{-# LINE 2 "./Graphics/UI/Gtk/Ornaments/Frame.chs" #-}
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
{-# LINE 84 "./Graphics/UI/Gtk/Ornaments/Frame.chs" #-}
import Graphics.UI.Gtk.General.Enums (ShadowType(..))
{-# LINE 87 "./Graphics/UI/Gtk/Ornaments/Frame.chs" #-}
frameNew :: IO Frame
frameNew :: IO Frame
frameNew =
(ForeignPtr Frame -> Frame, FinalizerPtr Frame)
-> IO (Ptr Frame) -> IO Frame
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewObject (ForeignPtr Frame -> Frame, FinalizerPtr Frame)
forall {a}. (ForeignPtr Frame -> Frame, FinalizerPtr a)
mkFrame (IO (Ptr Frame) -> IO Frame) -> IO (Ptr Frame) -> IO Frame
forall a b. (a -> b) -> a -> b
$
(Ptr Widget -> Ptr Frame) -> IO (Ptr Widget) -> IO (Ptr Frame)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Ptr Widget -> Ptr Frame
forall a b. Ptr a -> Ptr b
castPtr :: Ptr Widget -> Ptr Frame) (IO (Ptr Widget) -> IO (Ptr Frame))
-> IO (Ptr Widget) -> IO (Ptr Frame)
forall a b. (a -> b) -> a -> b
$
Ptr CChar -> IO (Ptr Widget)
gtk_frame_new
{-# LINE 100 "./Graphics/UI/Gtk/Ornaments/Frame.chs" #-}
nullPtr
frameSetLabel :: (FrameClass self, GlibString string) => self
-> string
-> IO ()
frameSetLabel :: forall self string.
(FrameClass self, GlibString string) =>
self -> string -> IO ()
frameSetLabel self
self string
label =
string -> (Ptr CChar -> IO ()) -> IO ()
forall a. string -> (Ptr CChar -> IO a) -> IO a
forall s a. GlibString s => s -> (Ptr CChar -> IO a) -> IO a
withUTFString string
label ((Ptr CChar -> IO ()) -> IO ()) -> (Ptr CChar -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr CChar
labelPtr ->
(\(Frame ForeignPtr Frame
arg1) Ptr CChar
arg2 -> ForeignPtr Frame -> (Ptr Frame -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Frame
arg1 ((Ptr Frame -> IO ()) -> IO ()) -> (Ptr Frame -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Frame
argPtr1 ->Ptr Frame -> Ptr CChar -> IO ()
gtk_frame_set_label Ptr Frame
argPtr1 Ptr CChar
arg2)
{-# LINE 113 "./Graphics/UI/Gtk/Ornaments/Frame.chs" #-}
(toFrame self)
Ptr CChar
labelPtr
frameSetLabelWidget :: (FrameClass self, WidgetClass labelWidget) => self
-> labelWidget
-> IO ()
frameSetLabelWidget :: forall self labelWidget.
(FrameClass self, WidgetClass labelWidget) =>
self -> labelWidget -> IO ()
frameSetLabelWidget self
self labelWidget
labelWidget =
(\(Frame ForeignPtr Frame
arg1) (Widget ForeignPtr Widget
arg2) -> ForeignPtr Frame -> (Ptr Frame -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Frame
arg1 ((Ptr Frame -> IO ()) -> IO ()) -> (Ptr Frame -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Frame
argPtr1 ->ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg2 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr2 ->Ptr Frame -> Ptr Widget -> IO ()
gtk_frame_set_label_widget Ptr Frame
argPtr1 Ptr Widget
argPtr2)
{-# LINE 124 "./Graphics/UI/Gtk/Ornaments/Frame.chs" #-}
(toFrame self)
(labelWidget -> Widget
forall o. WidgetClass o => o -> Widget
toWidget labelWidget
labelWidget)
frameGetLabelWidget :: FrameClass self => self
-> IO (Maybe Widget)
frameGetLabelWidget :: forall self. FrameClass self => self -> IO (Maybe Widget)
frameGetLabelWidget self
self =
(IO (Ptr Widget) -> IO Widget)
-> IO (Ptr Widget) -> IO (Maybe Widget)
forall a. (IO (Ptr a) -> IO a) -> IO (Ptr a) -> IO (Maybe a)
maybeNull ((ForeignPtr Widget -> Widget, FinalizerPtr Widget)
-> IO (Ptr Widget) -> IO Widget
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewObject (ForeignPtr Widget -> Widget, FinalizerPtr Widget)
forall {a}. (ForeignPtr Widget -> Widget, FinalizerPtr a)
mkWidget) (IO (Ptr Widget) -> IO (Maybe Widget))
-> IO (Ptr Widget) -> IO (Maybe Widget)
forall a b. (a -> b) -> a -> b
$
(\(Frame ForeignPtr Frame
arg1) -> ForeignPtr Frame
-> (Ptr Frame -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Frame
arg1 ((Ptr Frame -> IO (Ptr Widget)) -> IO (Ptr Widget))
-> (Ptr Frame -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a b. (a -> b) -> a -> b
$ \Ptr Frame
argPtr1 ->Ptr Frame -> IO (Ptr Widget)
gtk_frame_get_label_widget Ptr Frame
argPtr1)
{-# LINE 135 "./Graphics/UI/Gtk/Ornaments/Frame.chs" #-}
(toFrame self)
frameSetLabelAlign :: FrameClass self => self
-> Float
-> Float
-> IO ()
frameSetLabelAlign :: forall self. FrameClass self => self -> Float -> Float -> IO ()
frameSetLabelAlign self
self Float
xalign Float
yalign =
(\(Frame ForeignPtr Frame
arg1) CFloat
arg2 CFloat
arg3 -> ForeignPtr Frame -> (Ptr Frame -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Frame
arg1 ((Ptr Frame -> IO ()) -> IO ()) -> (Ptr Frame -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Frame
argPtr1 ->Ptr Frame -> CFloat -> CFloat -> IO ()
gtk_frame_set_label_align Ptr Frame
argPtr1 CFloat
arg2 CFloat
arg3)
{-# LINE 149 "./Graphics/UI/Gtk/Ornaments/Frame.chs" #-}
(toFrame self)
(Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
xalign)
(Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
yalign)
frameGetLabelAlign :: FrameClass self => self
-> IO (Float, Float)
frameGetLabelAlign :: forall self. FrameClass self => self -> IO (Float, Float)
frameGetLabelAlign self
self =
(Ptr CFloat -> IO (Float, Float)) -> IO (Float, Float)
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CFloat -> IO (Float, Float)) -> IO (Float, Float))
-> (Ptr CFloat -> IO (Float, Float)) -> IO (Float, Float)
forall a b. (a -> b) -> a -> b
$ \Ptr CFloat
xalignPtr ->
(Ptr CFloat -> IO (Float, Float)) -> IO (Float, Float)
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CFloat -> IO (Float, Float)) -> IO (Float, Float))
-> (Ptr CFloat -> IO (Float, Float)) -> IO (Float, Float)
forall a b. (a -> b) -> a -> b
$ \Ptr CFloat
yalignPtr -> do
(\(Frame ForeignPtr Frame
arg1) Ptr CFloat
arg2 Ptr CFloat
arg3 -> ForeignPtr Frame -> (Ptr Frame -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Frame
arg1 ((Ptr Frame -> IO ()) -> IO ()) -> (Ptr Frame -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Frame
argPtr1 ->Ptr Frame -> Ptr CFloat -> Ptr CFloat -> IO ()
gtk_frame_get_label_align Ptr Frame
argPtr1 Ptr CFloat
arg2 Ptr CFloat
arg3)
{-# LINE 162 "./Graphics/UI/Gtk/Ornaments/Frame.chs" #-}
(toFrame self)
Ptr CFloat
xalignPtr
Ptr CFloat
yalignPtr
CFloat
xalign <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
xalignPtr
CFloat
yalign <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
yalignPtr
(Float, Float) -> IO (Float, Float)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
xalign, CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
yalign)
frameSetShadowType :: FrameClass self => self -> ShadowType -> IO ()
frameSetShadowType :: forall self. FrameClass self => self -> ShadowType -> IO ()
frameSetShadowType self
self ShadowType
type_ =
(\(Frame ForeignPtr Frame
arg1) CInt
arg2 -> ForeignPtr Frame -> (Ptr Frame -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Frame
arg1 ((Ptr Frame -> IO ()) -> IO ()) -> (Ptr Frame -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Frame
argPtr1 ->Ptr Frame -> CInt -> IO ()
gtk_frame_set_shadow_type Ptr Frame
argPtr1 CInt
arg2)
{-# LINE 174 "./Graphics/UI/Gtk/Ornaments/Frame.chs" #-}
(toFrame self)
((Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (ShadowType -> Int) -> ShadowType -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShadowType -> Int
forall a. Enum a => a -> Int
fromEnum) ShadowType
type_)
frameGetShadowType :: FrameClass self => self -> IO ShadowType
frameGetShadowType :: forall self. FrameClass self => self -> IO ShadowType
frameGetShadowType self
self =
(CInt -> ShadowType) -> IO CInt -> IO ShadowType
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Int -> ShadowType
forall a. Enum a => Int -> a
toEnum (Int -> ShadowType) -> (CInt -> Int) -> CInt -> ShadowType
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) (IO CInt -> IO ShadowType) -> IO CInt -> IO ShadowType
forall a b. (a -> b) -> a -> b
$
(\(Frame ForeignPtr Frame
arg1) -> ForeignPtr Frame -> (Ptr Frame -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Frame
arg1 ((Ptr Frame -> IO CInt) -> IO CInt)
-> (Ptr Frame -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Frame
argPtr1 ->Ptr Frame -> IO CInt
gtk_frame_get_shadow_type Ptr Frame
argPtr1)
{-# LINE 183 "./Graphics/UI/Gtk/Ornaments/Frame.chs" #-}
(toFrame self)
frameGetLabel :: (FrameClass self, GlibString string) => self
-> IO string
frameGetLabel :: forall self string.
(FrameClass self, GlibString string) =>
self -> IO string
frameGetLabel self
self =
String -> IO (Ptr CChar) -> IO (Ptr CChar)
forall a. String -> IO (Ptr a) -> IO (Ptr a)
throwIfNull String
"frameGetLabel: the title of the frame was not a Label widget."
((\(Frame ForeignPtr Frame
arg1) -> ForeignPtr Frame -> (Ptr Frame -> IO (Ptr CChar)) -> IO (Ptr CChar)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Frame
arg1 ((Ptr Frame -> IO (Ptr CChar)) -> IO (Ptr CChar))
-> (Ptr Frame -> IO (Ptr CChar)) -> IO (Ptr CChar)
forall a b. (a -> b) -> a -> b
$ \Ptr Frame
argPtr1 ->Ptr Frame -> IO (Ptr CChar)
gtk_frame_get_label Ptr Frame
argPtr1)
{-# LINE 195 "./Graphics/UI/Gtk/Ornaments/Frame.chs" #-}
(toFrame self))
IO (Ptr CChar) -> (Ptr CChar -> IO string) -> IO string
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr CChar -> IO string
forall s. GlibString s => Ptr CChar -> IO s
peekUTFString
frameLabel :: (FrameClass self, GlibString string) => Attr self string
frameLabel :: forall self string.
(FrameClass self, GlibString string) =>
Attr self string
frameLabel = (self -> IO string)
-> (self -> string -> IO ()) -> ReadWriteAttr self string string
forall o a b.
(o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
newAttr
self -> IO string
forall self string.
(FrameClass self, GlibString string) =>
self -> IO string
frameGetLabel
self -> string -> IO ()
forall self string.
(FrameClass self, GlibString string) =>
self -> string -> IO ()
frameSetLabel
frameLabelXAlign :: FrameClass self => Attr self Float
frameLabelXAlign :: forall self. FrameClass self => Attr self Float
frameLabelXAlign = String -> Attr self Float
forall gobj. GObjectClass gobj => String -> Attr gobj Float
newAttrFromFloatProperty String
"label-xalign"
frameLabelYAlign :: FrameClass self => Attr self Float
frameLabelYAlign :: forall self. FrameClass self => Attr self Float
frameLabelYAlign = String -> Attr self Float
forall gobj. GObjectClass gobj => String -> Attr gobj Float
newAttrFromFloatProperty String
"label-yalign"
frameShadowType :: FrameClass self => Attr self ShadowType
frameShadowType :: forall self. FrameClass self => Attr self ShadowType
frameShadowType = (self -> IO ShadowType)
-> (self -> ShadowType -> IO ())
-> ReadWriteAttr self ShadowType ShadowType
forall o a b.
(o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
newAttr
self -> IO ShadowType
forall self. FrameClass self => self -> IO ShadowType
frameGetShadowType
self -> ShadowType -> IO ()
forall self. FrameClass self => self -> ShadowType -> IO ()
frameSetShadowType
frameLabelWidget :: (FrameClass self, WidgetClass labelWidget) => ReadWriteAttr self (Maybe Widget) labelWidget
frameLabelWidget :: forall self labelWidget.
(FrameClass self, WidgetClass labelWidget) =>
ReadWriteAttr self (Maybe Widget) labelWidget
frameLabelWidget = (self -> IO (Maybe Widget))
-> (self -> labelWidget -> IO ())
-> ReadWriteAttr self (Maybe Widget) labelWidget
forall o a b.
(o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
newAttr
self -> IO (Maybe Widget)
forall self. FrameClass self => self -> IO (Maybe Widget)
frameGetLabelWidget
self -> labelWidget -> IO ()
forall self labelWidget.
(FrameClass self, WidgetClass labelWidget) =>
self -> labelWidget -> IO ()
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)))