module Graphics.UI.Gtk.Layout.Layout (
Layout,
LayoutClass,
castToLayout, gTypeLayout,
toLayout,
layoutNew,
layoutPut,
layoutMove,
layoutSetSize,
layoutGetSize,
layoutGetHAdjustment,
layoutGetVAdjustment,
layoutSetHAdjustment,
layoutSetVAdjustment,
layoutGetDrawWindow,
layoutHAdjustment,
layoutVAdjustment,
layoutWidth,
layoutHeight,
layoutChildX,
layoutChildY,
onSetScrollAdjustments,
afterSetScrollAdjustments,
) where
import Data.Maybe (fromMaybe)
import Control.Monad (liftM)
import System.Glib.FFI
import System.Glib.Attributes
import System.Glib.Properties
import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
import Graphics.UI.Gtk.Types
import Graphics.UI.Gtk.Signals
import Graphics.UI.Gtk.Abstract.ContainerChildProperties
layoutNew ::
Maybe Adjustment
-> Maybe Adjustment
-> IO Layout
layoutNew hadjustment vadjustment =
makeNewObject mkLayout $
liftM (castPtr :: Ptr Widget -> Ptr Layout) $
(\(Adjustment arg1) (Adjustment arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_layout_new argPtr1 argPtr2)
(fromMaybe (Adjustment nullForeignPtr) hadjustment)
(fromMaybe (Adjustment nullForeignPtr) vadjustment)
layoutPut :: (LayoutClass self, WidgetClass childWidget) => self
-> childWidget
-> Int
-> Int
-> IO ()
layoutPut self childWidget x y =
(\(Layout arg1) (Widget arg2) arg3 arg4 -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_layout_put argPtr1 argPtr2 arg3 arg4)
(toLayout self)
(toWidget childWidget)
(fromIntegral x)
(fromIntegral y)
layoutMove :: (LayoutClass self, WidgetClass childWidget) => self
-> childWidget
-> Int
-> Int
-> IO ()
layoutMove self childWidget x y =
(\(Layout arg1) (Widget arg2) arg3 arg4 -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_layout_move argPtr1 argPtr2 arg3 arg4)
(toLayout self)
(toWidget childWidget)
(fromIntegral x)
(fromIntegral y)
layoutSetSize :: LayoutClass self => self
-> Int
-> Int
-> IO ()
layoutSetSize self width height =
(\(Layout arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->gtk_layout_set_size argPtr1 arg2 arg3)
(toLayout self)
(fromIntegral width)
(fromIntegral height)
layoutGetSize :: LayoutClass self => self
-> IO (Int, Int)
layoutGetSize self =
alloca $ \widthPtr ->
alloca $ \heightPtr -> do
(\(Layout arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->gtk_layout_get_size argPtr1 arg2 arg3)
(toLayout self)
widthPtr
heightPtr
width <-peek widthPtr
height <- peek heightPtr
return (fromIntegral width, fromIntegral height)
layoutGetHAdjustment :: LayoutClass self => self
-> IO Adjustment
layoutGetHAdjustment self =
makeNewObject mkAdjustment $
(\(Layout arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_layout_get_hadjustment argPtr1)
(toLayout self)
layoutGetVAdjustment :: LayoutClass self => self
-> IO Adjustment
layoutGetVAdjustment self =
makeNewObject mkAdjustment $
(\(Layout arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_layout_get_vadjustment argPtr1)
(toLayout self)
layoutSetHAdjustment :: LayoutClass self => self
-> Adjustment
-> IO ()
layoutSetHAdjustment self adjustment =
(\(Layout arg1) (Adjustment arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_layout_set_hadjustment argPtr1 argPtr2)
(toLayout self)
adjustment
layoutSetVAdjustment :: LayoutClass self => self
-> Adjustment
-> IO ()
layoutSetVAdjustment self adjustment =
(\(Layout arg1) (Adjustment arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_layout_set_vadjustment argPtr1 argPtr2)
(toLayout self)
adjustment
layoutGetDrawWindow :: Layout -> IO DrawWindow
layoutGetDrawWindow lay = makeNewGObject mkDrawWindow $
(\(Layout arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_layout_get_bin_window argPtr1)
(toLayout lay)
layoutHAdjustment :: LayoutClass self => Attr self Adjustment
layoutHAdjustment = newAttr
layoutGetHAdjustment
layoutSetHAdjustment
layoutVAdjustment :: LayoutClass self => Attr self Adjustment
layoutVAdjustment = newAttr
layoutGetVAdjustment
layoutSetVAdjustment
layoutWidth :: LayoutClass self => Attr self Int
layoutWidth = newAttrFromUIntProperty "width"
layoutHeight :: LayoutClass self => Attr self Int
layoutHeight = newAttrFromUIntProperty "height"
layoutChildX :: (LayoutClass self, WidgetClass child) => child -> Attr self Int
layoutChildX = newAttrFromContainerChildIntProperty "x"
layoutChildY :: (LayoutClass self, WidgetClass child) => child -> Attr self Int
layoutChildY = newAttrFromContainerChildIntProperty "y"
onSetScrollAdjustments, afterSetScrollAdjustments :: LayoutClass self => self
-> (Adjustment -> Adjustment -> IO ())
-> IO (ConnectId self)
onSetScrollAdjustments = connect_OBJECT_OBJECT__NONE "set-scroll-adjustments" False
afterSetScrollAdjustments = connect_OBJECT_OBJECT__NONE "set-scroll-adjustments" True
foreign import ccall unsafe "gtk_layout_new"
gtk_layout_new :: ((Ptr Adjustment) -> ((Ptr Adjustment) -> (IO (Ptr Widget))))
foreign import ccall safe "gtk_layout_put"
gtk_layout_put :: ((Ptr Layout) -> ((Ptr Widget) -> (CInt -> (CInt -> (IO ())))))
foreign import ccall safe "gtk_layout_move"
gtk_layout_move :: ((Ptr Layout) -> ((Ptr Widget) -> (CInt -> (CInt -> (IO ())))))
foreign import ccall safe "gtk_layout_set_size"
gtk_layout_set_size :: ((Ptr Layout) -> (CUInt -> (CUInt -> (IO ()))))
foreign import ccall unsafe "gtk_layout_get_size"
gtk_layout_get_size :: ((Ptr Layout) -> ((Ptr CUInt) -> ((Ptr CUInt) -> (IO ()))))
foreign import ccall unsafe "gtk_layout_get_hadjustment"
gtk_layout_get_hadjustment :: ((Ptr Layout) -> (IO (Ptr Adjustment)))
foreign import ccall unsafe "gtk_layout_get_vadjustment"
gtk_layout_get_vadjustment :: ((Ptr Layout) -> (IO (Ptr Adjustment)))
foreign import ccall safe "gtk_layout_set_hadjustment"
gtk_layout_set_hadjustment :: ((Ptr Layout) -> ((Ptr Adjustment) -> (IO ())))
foreign import ccall safe "gtk_layout_set_vadjustment"
gtk_layout_set_vadjustment :: ((Ptr Layout) -> ((Ptr Adjustment) -> (IO ())))
foreign import ccall safe "gtk_layout_get_bin_window"
gtk_layout_get_bin_window :: ((Ptr Layout) -> (IO (Ptr DrawWindow)))