module Graphics.UI.Gtk.Ornaments.Frame (
Frame,
FrameClass,
castToFrame, gTypeFrame,
toFrame,
frameNew,
frameSetLabel,
frameGetLabel,
frameSetLabelWidget,
frameGetLabelWidget,
frameSetLabelAlign,
frameGetLabelAlign,
ShadowType(..),
frameSetShadowType,
frameGetShadowType,
frameLabel,
frameLabelXAlign,
frameLabelYAlign,
frameShadowType,
frameLabelWidget,
) 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 (ShadowType(..))
frameNew :: IO Frame
frameNew =
makeNewObject mkFrame $
liftM (castPtr :: Ptr Widget -> Ptr Frame) $
gtk_frame_new
nullPtr
frameSetLabel :: FrameClass self => self
-> String
-> IO ()
frameSetLabel self label =
withUTFString label $ \labelPtr ->
(\(Frame arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_frame_set_label argPtr1 arg2)
(toFrame self)
labelPtr
frameSetLabelWidget :: (FrameClass self, WidgetClass labelWidget) => self
-> labelWidget
-> IO ()
frameSetLabelWidget self labelWidget =
(\(Frame arg1) (Widget arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_frame_set_label_widget argPtr1 argPtr2)
(toFrame self)
(toWidget labelWidget)
frameGetLabelWidget :: FrameClass self => self
-> IO (Maybe Widget)
frameGetLabelWidget self =
maybeNull (makeNewObject mkWidget) $
(\(Frame arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_frame_get_label_widget argPtr1)
(toFrame self)
frameSetLabelAlign :: FrameClass self => self
-> Float
-> Float
-> IO ()
frameSetLabelAlign self xalign yalign =
(\(Frame arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->gtk_frame_set_label_align argPtr1 arg2 arg3)
(toFrame self)
(realToFrac xalign)
(realToFrac yalign)
frameGetLabelAlign :: FrameClass self => self
-> IO (Float, Float)
frameGetLabelAlign self =
alloca $ \xalignPtr ->
alloca $ \yalignPtr -> do
(\(Frame arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->gtk_frame_get_label_align argPtr1 arg2 arg3)
(toFrame self)
xalignPtr
yalignPtr
xalign <- peek xalignPtr
yalign <- peek yalignPtr
return (realToFrac xalign, realToFrac yalign)
frameSetShadowType :: FrameClass self => self -> ShadowType -> IO ()
frameSetShadowType self type_ =
(\(Frame arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_frame_set_shadow_type argPtr1 arg2)
(toFrame self)
((fromIntegral . fromEnum) type_)
frameGetShadowType :: FrameClass self => self -> IO ShadowType
frameGetShadowType self =
liftM (toEnum . fromIntegral) $
(\(Frame arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_frame_get_shadow_type argPtr1)
(toFrame self)
frameGetLabel :: FrameClass self => self
-> IO String
frameGetLabel self =
throwIfNull "frameGetLabel: the title of the frame was not a Label widget."
((\(Frame arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_frame_get_label argPtr1)
(toFrame self))
>>= peekUTFString
frameLabel :: FrameClass self => Attr self String
frameLabel = newAttr
frameGetLabel
frameSetLabel
frameLabelXAlign :: FrameClass self => Attr self Float
frameLabelXAlign = newAttrFromFloatProperty "label-xalign"
frameLabelYAlign :: FrameClass self => Attr self Float
frameLabelYAlign = newAttrFromFloatProperty "label-yalign"
frameShadowType :: FrameClass self => Attr self ShadowType
frameShadowType = newAttr
frameGetShadowType
frameSetShadowType
frameLabelWidget :: (FrameClass self, WidgetClass labelWidget) => ReadWriteAttr self (Maybe Widget) labelWidget
frameLabelWidget = newAttr
frameGetLabelWidget
frameSetLabelWidget
foreign import ccall unsafe "gtk_frame_new"
gtk_frame_new :: ((Ptr CChar) -> (IO (Ptr Widget)))
foreign import ccall safe "gtk_frame_set_label"
gtk_frame_set_label :: ((Ptr Frame) -> ((Ptr CChar) -> (IO ())))
foreign import ccall safe "gtk_frame_set_label_widget"
gtk_frame_set_label_widget :: ((Ptr Frame) -> ((Ptr Widget) -> (IO ())))
foreign import ccall safe "gtk_frame_get_label_widget"
gtk_frame_get_label_widget :: ((Ptr Frame) -> (IO (Ptr Widget)))
foreign import ccall safe "gtk_frame_set_label_align"
gtk_frame_set_label_align :: ((Ptr Frame) -> (CFloat -> (CFloat -> (IO ()))))
foreign import ccall unsafe "gtk_frame_get_label_align"
gtk_frame_get_label_align :: ((Ptr Frame) -> ((Ptr CFloat) -> ((Ptr CFloat) -> (IO ()))))
foreign import ccall safe "gtk_frame_set_shadow_type"
gtk_frame_set_shadow_type :: ((Ptr Frame) -> (CInt -> (IO ())))
foreign import ccall unsafe "gtk_frame_get_shadow_type"
gtk_frame_get_shadow_type :: ((Ptr Frame) -> (IO CInt))
foreign import ccall unsafe "gtk_frame_get_label"
gtk_frame_get_label :: ((Ptr Frame) -> (IO (Ptr CChar)))