module Graphics.UI.Gtk.Display.LevelBar (
LevelBar,
LevelBarClass,
castToLevelBar, gTypeLevelBar,
toLevelBar,
levelBarNew,
levelBarSetMode,
levelBarGetMode,
levelBarAddOffsetValue,
levelBarRemoveOffsetValue,
levelBarGetOffsetValue,
levelBarInverted,
levelBarMaxValue,
levelBarMinValue,
levelBarValue,
levelBarMode
) 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 (LevelBarMode(..))
levelBarNew :: IO LevelBar
levelBarNew =
makeNewObject mkLevelBar $
liftM (castPtr :: Ptr Widget -> Ptr LevelBar) $
gtk_level_bar_new
levelBarSetMode :: LevelBarClass self => self -> LevelBarMode -> IO ()
levelBarSetMode self mode =
(\(LevelBar arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_level_bar_set_mode argPtr1 arg2) (toLevelBar self) ((fromIntegral . fromEnum) mode)
levelBarGetMode :: LevelBarClass self => self -> IO LevelBarMode
levelBarGetMode self =
liftM (toEnum . fromIntegral) $
(\(LevelBar arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_level_bar_get_mode argPtr1)
(toLevelBar self)
levelBarAddOffsetValue :: (LevelBarClass self, GlibString string) => self
-> string
-> Double
-> IO ()
levelBarAddOffsetValue self name value =
withUTFString name $ \namePtr ->
(\(LevelBar arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->gtk_level_bar_add_offset_value argPtr1 arg2 arg3)
(toLevelBar self)
namePtr
(realToFrac value)
levelBarRemoveOffsetValue :: (LevelBarClass self, GlibString string) => self
-> string
-> IO ()
levelBarRemoveOffsetValue self name =
withUTFString name $ \namePtr ->
(\(LevelBar arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_level_bar_remove_offset_value argPtr1 arg2)
(toLevelBar self)
namePtr
levelBarGetOffsetValue :: (LevelBarClass self, GlibString string) => self
-> string
-> IO Double
levelBarGetOffsetValue self name =
alloca $ \dPtr ->
withUTFString name $ \namePtr -> do
(\(LevelBar arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->gtk_level_bar_get_offset_value argPtr1 arg2 arg3)
(toLevelBar self) namePtr dPtr
liftM realToFrac $ peek dPtr
levelBarInverted :: LevelBarClass self => Attr self Bool
levelBarInverted = newAttrFromBoolProperty "inverted"
levelBarValue :: LevelBarClass self => Attr self Double
levelBarValue = newAttrFromDoubleProperty "value"
levelBarMinValue :: LevelBarClass self => Attr self Double
levelBarMinValue = newAttrFromDoubleProperty "min-value"
levelBarMaxValue :: LevelBarClass self => Attr self Double
levelBarMaxValue = newAttrFromDoubleProperty "max-value"
levelBarMode :: LevelBarClass self => Attr self LevelBarMode
levelBarMode = newAttr levelBarGetMode levelBarSetMode
foreign import ccall unsafe "gtk_level_bar_new"
gtk_level_bar_new :: (IO (Ptr Widget))
foreign import ccall safe "gtk_level_bar_set_mode"
gtk_level_bar_set_mode :: ((Ptr LevelBar) -> (CInt -> (IO ())))
foreign import ccall safe "gtk_level_bar_get_mode"
gtk_level_bar_get_mode :: ((Ptr LevelBar) -> (IO CInt))
foreign import ccall unsafe "gtk_level_bar_add_offset_value"
gtk_level_bar_add_offset_value :: ((Ptr LevelBar) -> ((Ptr CChar) -> (CDouble -> (IO ()))))
foreign import ccall unsafe "gtk_level_bar_remove_offset_value"
gtk_level_bar_remove_offset_value :: ((Ptr LevelBar) -> ((Ptr CChar) -> (IO ())))
foreign import ccall unsafe "gtk_level_bar_get_offset_value"
gtk_level_bar_get_offset_value :: ((Ptr LevelBar) -> ((Ptr CChar) -> ((Ptr CDouble) -> (IO CInt))))