module Graphics.UI.Gtk.Display.ProgressBar (
ProgressBar,
ProgressBarClass,
castToProgressBar, gTypeProgressBar,
toProgressBar,
progressBarNew,
progressBarPulse,
progressBarSetText,
progressBarSetFraction,
progressBarSetPulseStep,
progressBarGetFraction,
progressBarGetPulseStep,
progressBarGetText,
ProgressBarOrientation(..),
progressBarSetOrientation,
progressBarGetOrientation,
progressBarSetEllipsize,
progressBarGetEllipsize,
progressBarOrientation,
progressBarDiscreteBlocks,
progressBarFraction,
progressBarPulseStep,
progressBarText,
progressBarEllipsize,
) where
import Control.Monad (liftM)
import System.Glib.FFI
import System.Glib.UTFString
import System.Glib.Attributes
import System.Glib.Properties
import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
import Graphics.UI.Gtk.Types
import Graphics.UI.Gtk.General.Enums (ProgressBarOrientation(..))
import Graphics.Rendering.Pango.Enums (EllipsizeMode(..))
progressBarNew :: IO ProgressBar
progressBarNew =
makeNewObject mkProgressBar $
liftM (castPtr :: Ptr Widget -> Ptr ProgressBar) $
gtk_progress_bar_new
progressBarPulse :: ProgressBarClass self => self -> IO ()
progressBarPulse self =
(\(ProgressBar arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_progress_bar_pulse argPtr1)
(toProgressBar self)
progressBarSetText :: (ProgressBarClass self, GlibString string) => self -> string -> IO ()
progressBarSetText self text =
withUTFString text $ \textPtr ->
(\(ProgressBar arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_progress_bar_set_text argPtr1 arg2)
(toProgressBar self)
textPtr
progressBarSetFraction :: ProgressBarClass self => self
-> Double
-> IO ()
progressBarSetFraction self fraction =
(\(ProgressBar arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_progress_bar_set_fraction argPtr1 arg2)
(toProgressBar self)
(realToFrac fraction)
progressBarSetPulseStep :: ProgressBarClass self => self
-> Double
-> IO ()
progressBarSetPulseStep self fraction =
(\(ProgressBar arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_progress_bar_set_pulse_step argPtr1 arg2)
(toProgressBar self)
(realToFrac fraction)
progressBarGetFraction :: ProgressBarClass self => self
-> IO Double
progressBarGetFraction self =
liftM realToFrac $
(\(ProgressBar arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_progress_bar_get_fraction argPtr1)
(toProgressBar self)
progressBarGetPulseStep :: ProgressBarClass self => self
-> IO Double
progressBarGetPulseStep self =
liftM realToFrac $
(\(ProgressBar arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_progress_bar_get_pulse_step argPtr1)
(toProgressBar self)
progressBarGetText :: (ProgressBarClass self, GlibString string) => self
-> IO (Maybe string)
progressBarGetText self =
(\(ProgressBar arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_progress_bar_get_text argPtr1)
(toProgressBar self)
>>= maybePeek peekUTFString
progressBarSetOrientation :: ProgressBarClass self => self -> ProgressBarOrientation -> IO ()
progressBarSetOrientation self orientation =
(\(ProgressBar arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_progress_bar_set_orientation argPtr1 arg2)
(toProgressBar self)
((fromIntegral . fromEnum) orientation)
progressBarGetOrientation :: ProgressBarClass self => self -> IO ProgressBarOrientation
progressBarGetOrientation self =
liftM (toEnum . fromIntegral) $
(\(ProgressBar arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_progress_bar_get_orientation argPtr1)
(toProgressBar self)
progressBarSetEllipsize :: ProgressBarClass self => self -> EllipsizeMode -> IO ()
progressBarSetEllipsize self mode =
(\(ProgressBar arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_progress_bar_set_ellipsize argPtr1 arg2)
(toProgressBar self)
((fromIntegral . fromEnum) mode)
progressBarGetEllipsize :: ProgressBarClass self => self -> IO EllipsizeMode
progressBarGetEllipsize self =
liftM (toEnum . fromIntegral) $
(\(ProgressBar arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_progress_bar_get_ellipsize argPtr1)
(toProgressBar self)
progressBarOrientation :: ProgressBarClass self => Attr self ProgressBarOrientation
progressBarOrientation = newAttr
progressBarGetOrientation
progressBarSetOrientation
progressBarDiscreteBlocks :: ProgressBarClass self => Attr self Int
progressBarDiscreteBlocks = newAttrFromUIntProperty "discrete-blocks"
progressBarFraction :: ProgressBarClass self => Attr self Double
progressBarFraction = newAttr
progressBarGetFraction
progressBarSetFraction
progressBarPulseStep :: ProgressBarClass self => Attr self Double
progressBarPulseStep = newAttr
progressBarGetPulseStep
progressBarSetPulseStep
progressBarText :: (ProgressBarClass self, GlibString string) => ReadWriteAttr self (Maybe string) string
progressBarText = newAttr
progressBarGetText
progressBarSetText
progressBarEllipsize :: ProgressBarClass self => Attr self EllipsizeMode
progressBarEllipsize = newAttr
progressBarGetEllipsize
progressBarSetEllipsize
foreign import ccall unsafe "gtk_progress_bar_new"
gtk_progress_bar_new :: (IO (Ptr Widget))
foreign import ccall unsafe "gtk_progress_bar_pulse"
gtk_progress_bar_pulse :: ((Ptr ProgressBar) -> (IO ()))
foreign import ccall unsafe "gtk_progress_bar_set_text"
gtk_progress_bar_set_text :: ((Ptr ProgressBar) -> ((Ptr CChar) -> (IO ())))
foreign import ccall unsafe "gtk_progress_bar_set_fraction"
gtk_progress_bar_set_fraction :: ((Ptr ProgressBar) -> (CDouble -> (IO ())))
foreign import ccall unsafe "gtk_progress_bar_set_pulse_step"
gtk_progress_bar_set_pulse_step :: ((Ptr ProgressBar) -> (CDouble -> (IO ())))
foreign import ccall unsafe "gtk_progress_bar_get_fraction"
gtk_progress_bar_get_fraction :: ((Ptr ProgressBar) -> (IO CDouble))
foreign import ccall unsafe "gtk_progress_bar_get_pulse_step"
gtk_progress_bar_get_pulse_step :: ((Ptr ProgressBar) -> (IO CDouble))
foreign import ccall unsafe "gtk_progress_bar_get_text"
gtk_progress_bar_get_text :: ((Ptr ProgressBar) -> (IO (Ptr CChar)))
foreign import ccall safe "gtk_progress_bar_set_orientation"
gtk_progress_bar_set_orientation :: ((Ptr ProgressBar) -> (CInt -> (IO ())))
foreign import ccall unsafe "gtk_progress_bar_get_orientation"
gtk_progress_bar_get_orientation :: ((Ptr ProgressBar) -> (IO CInt))
foreign import ccall safe "gtk_progress_bar_set_ellipsize"
gtk_progress_bar_set_ellipsize :: ((Ptr ProgressBar) -> (CInt -> (IO ())))
foreign import ccall safe "gtk_progress_bar_get_ellipsize"
gtk_progress_bar_get_ellipsize :: ((Ptr ProgressBar) -> (IO CInt))