{-# LINE 2 "./Graphics/UI/Gtk/Abstract/Container.chs" #-}
module Graphics.UI.Gtk.Abstract.Container (
Container,
ContainerClass,
castToContainer, gTypeContainer,
toContainer,
ContainerForeachCB,
ResizeMode(..),
containerAdd,
containerRemove,
containerForeach,
containerForall,
containerGetChildren,
containerSetFocusChild,
containerSetFocusChain,
containerGetFocusChain,
containerUnsetFocusChain,
containerSetFocusVAdjustment,
containerGetFocusVAdjustment,
containerSetFocusHAdjustment,
containerGetFocusHAdjustment,
containerResizeChildren,
containerSetBorderWidth,
containerGetBorderWidth,
containerGetResizeMode,
containerSetResizeMode,
containerResizeMode,
containerBorderWidth,
containerChild,
containerFocusHAdjustment,
containerFocusVAdjustment,
add,
checkResize,
remove,
setFocusChild,
onAdd,
afterAdd,
onCheckResize,
afterCheckResize,
onRemove,
afterRemove,
onSetFocusChild,
afterSetFocusChild,
) where
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
{-# LINE 205 "./Graphics/UI/Gtk/Abstract/Container.chs" #-}
import Graphics.UI.Gtk.Signals
{-# LINE 206 "./Graphics/UI/Gtk/Abstract/Container.chs" #-}
import System.Glib.GList (fromGList, withGList)
import Graphics.UI.Gtk.General.Enums (ResizeMode(..))
{-# LINE 210 "./Graphics/UI/Gtk/Abstract/Container.chs" #-}
containerAdd :: (ContainerClass self, WidgetClass widget) => self
-> widget
-> IO ()
containerAdd self widget =
(\(Container arg1) (Widget arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_container_add argPtr1 argPtr2)
{-# LINE 227 "./Graphics/UI/Gtk/Abstract/Container.chs" #-}
(toContainer self)
(toWidget widget)
containerRemove :: (ContainerClass self, WidgetClass widget) => self
-> widget
-> IO ()
containerRemove self widget =
(\(Container arg1) (Widget arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_container_remove argPtr1 argPtr2)
{-# LINE 237 "./Graphics/UI/Gtk/Abstract/Container.chs" #-}
(toContainer self)
(toWidget widget)
containerForeach :: ContainerClass self => self
-> ContainerForeachCB
-> IO ()
containerForeach self fun = do
fPtr <- mkContainerForeachFunc (\wPtr _ -> do
w <- makeNewObject mkWidget (return wPtr)
fun w)
(\(Container arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->gtk_container_foreach argPtr1 arg2 arg3)
{-# LINE 253 "./Graphics/UI/Gtk/Abstract/Container.chs" #-}
(toContainer self)
fPtr
nullPtr
freeHaskellFunPtr fPtr
type ContainerForeachCB = Widget -> IO ()
type Callback = FunPtr (((Ptr Widget) -> ((Ptr ()) -> (IO ()))))
{-# LINE 261 "./Graphics/UI/Gtk/Abstract/Container.chs" #-}
foreign import ccall "wrapper" mkContainerForeachFunc ::
(Ptr Widget -> Ptr () -> IO ()) -> IO Callback
containerForall :: ContainerClass self => self
-> ContainerForeachCB
-> IO ()
containerForall self fun = do
fPtr <- mkContainerForeachFunc (\wPtr _ -> do
w <- makeNewObject mkWidget (return wPtr)
fun w)
(\(Container arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->gtk_container_forall argPtr1 arg2 arg3)
{-# LINE 279 "./Graphics/UI/Gtk/Abstract/Container.chs" #-}
(toContainer self)
fPtr
nullPtr
freeHaskellFunPtr fPtr
containerGetChildren :: ContainerClass self => self
-> IO [Widget]
containerGetChildren self = do
glist <- (\(Container arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_container_get_children argPtr1) (toContainer self)
widgetPtrs <- fromGList glist
mapM (makeNewObject mkWidget . return) widgetPtrs
containerSetFocusChild :: (ContainerClass self, WidgetClass child) => self
-> child
-> IO ()
containerSetFocusChild self child =
(\(Container arg1) (Widget arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_container_set_focus_child argPtr1 argPtr2)
{-# LINE 301 "./Graphics/UI/Gtk/Abstract/Container.chs" #-}
(toContainer self)
(toWidget child)
containerSetFocusChain :: ContainerClass self => self
-> [Widget]
-> IO ()
containerSetFocusChain self chain =
withForeignPtrs (map unWidget chain) $ \wPtrs ->
withGList wPtrs $ \glist ->
(\(Container arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_container_set_focus_chain argPtr1 arg2)
{-# LINE 319 "./Graphics/UI/Gtk/Abstract/Container.chs" #-}
(toContainer self)
glist
containerGetFocusChain :: ContainerClass self => self
-> IO (Maybe [Widget])
containerGetFocusChain self =
alloca $ \glistPtr -> do
(\(Container arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_container_get_focus_chain argPtr1 arg2)
{-# LINE 332 "./Graphics/UI/Gtk/Abstract/Container.chs" #-}
(toContainer self)
glistPtr
if glistPtr == nullPtr then return Nothing else liftM Just $ do
glist <- peek glistPtr
widgetPtrs <- fromGList glist
mapM (makeNewObject mkWidget . return) widgetPtrs
containerUnsetFocusChain :: ContainerClass self => self -> IO ()
containerUnsetFocusChain self =
(\(Container arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_container_unset_focus_chain argPtr1)
{-# LINE 344 "./Graphics/UI/Gtk/Abstract/Container.chs" #-}
(toContainer self)
containerSetFocusVAdjustment :: ContainerClass self => self
-> Adjustment
-> IO ()
containerSetFocusVAdjustment self adjustment =
(\(Container arg1) (Adjustment arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_container_set_focus_vadjustment argPtr1 argPtr2)
{-# LINE 361 "./Graphics/UI/Gtk/Abstract/Container.chs" #-}
(toContainer self)
adjustment
containerGetFocusVAdjustment :: ContainerClass self => self
-> IO (Maybe Adjustment)
containerGetFocusVAdjustment self =
maybeNull (makeNewObject mkAdjustment) $
(\(Container arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_container_get_focus_vadjustment argPtr1)
{-# LINE 373 "./Graphics/UI/Gtk/Abstract/Container.chs" #-}
(toContainer self)
containerSetFocusHAdjustment :: ContainerClass self => self
-> Adjustment
-> IO ()
containerSetFocusHAdjustment self adjustment =
(\(Container arg1) (Adjustment arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_container_set_focus_hadjustment argPtr1 argPtr2)
{-# LINE 390 "./Graphics/UI/Gtk/Abstract/Container.chs" #-}
(toContainer self)
adjustment
containerGetFocusHAdjustment :: ContainerClass self => self
-> IO (Maybe Adjustment)
containerGetFocusHAdjustment self =
maybeNull (makeNewObject mkAdjustment) $
(\(Container arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_container_get_focus_hadjustment argPtr1)
{-# LINE 402 "./Graphics/UI/Gtk/Abstract/Container.chs" #-}
(toContainer self)
containerResizeChildren :: ContainerClass self => self -> IO ()
containerResizeChildren self =
(\(Container arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_container_resize_children argPtr1)
{-# LINE 409 "./Graphics/UI/Gtk/Abstract/Container.chs" #-}
(toContainer self)
containerSetBorderWidth :: ContainerClass self => self
-> Int
-> IO ()
containerSetBorderWidth self borderWidth =
(\(Container arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_container_set_border_width argPtr1 arg2)
{-# LINE 427 "./Graphics/UI/Gtk/Abstract/Container.chs" #-}
(toContainer self)
(fromIntegral borderWidth)
containerGetBorderWidth :: ContainerClass self => self
-> IO Int
containerGetBorderWidth self =
liftM fromIntegral $
(\(Container arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_container_get_border_width argPtr1)
{-# LINE 438 "./Graphics/UI/Gtk/Abstract/Container.chs" #-}
(toContainer self)
containerGetResizeMode :: ContainerClass self => self
-> IO ResizeMode
containerGetResizeMode self =
liftM (toEnum . fromIntegral) $
(\(Container arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_container_get_resize_mode argPtr1)
{-# LINE 447 "./Graphics/UI/Gtk/Abstract/Container.chs" #-}
(toContainer self)
containerSetResizeMode :: ContainerClass self => self
-> ResizeMode
-> IO ()
containerSetResizeMode self resizeMode =
(\(Container arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_container_set_resize_mode argPtr1 arg2)
{-# LINE 460 "./Graphics/UI/Gtk/Abstract/Container.chs" #-}
(toContainer self)
((fromIntegral . fromEnum) resizeMode)
containerResizeMode :: ContainerClass self => Attr self ResizeMode
containerResizeMode = newAttr
containerGetResizeMode
containerSetResizeMode
containerBorderWidth :: ContainerClass self => Attr self Int
containerBorderWidth = newAttr
containerGetBorderWidth
containerSetBorderWidth
containerChild :: (ContainerClass self, WidgetClass widget) => WriteAttr self widget
containerChild = writeAttrFromObjectProperty "child"
gtk_widget_get_type
{-# LINE 491 "./Graphics/UI/Gtk/Abstract/Container.chs" #-}
containerFocusHAdjustment :: ContainerClass self => ReadWriteAttr self (Maybe Adjustment) Adjustment
containerFocusHAdjustment = newAttr
containerGetFocusHAdjustment
containerSetFocusHAdjustment
containerFocusVAdjustment :: ContainerClass self => ReadWriteAttr self (Maybe Adjustment) Adjustment
containerFocusVAdjustment = newAttr
containerGetFocusVAdjustment
containerSetFocusVAdjustment
add :: ContainerClass self => Signal self (Widget -> IO ())
add = Signal (connect_OBJECT__NONE "add")
remove :: ContainerClass self => Signal self (Widget -> IO ())
remove = Signal (connect_OBJECT__NONE "remove")
checkResize :: ContainerClass self => Signal self (IO ())
checkResize = Signal (connect_NONE__NONE "check-resize")
setFocusChild :: ContainerClass self => Signal self (Maybe Widget -> IO ())
setFocusChild = Signal (connect_MOBJECT__NONE "set-focus-child")
onAdd :: ContainerClass self => self
-> (Widget -> IO ())
-> IO (ConnectId self)
onAdd = connect_OBJECT__NONE "add" False
{-# DEPRECATED onAdd "instead of 'onAdd obj' use 'on obj add'" #-}
afterAdd :: ContainerClass self => self
-> (Widget -> IO ())
-> IO (ConnectId self)
afterAdd = connect_OBJECT__NONE "add" True
{-# DEPRECATED afterAdd "instead of 'afterAdd obj' use 'after obj add'" #-}
onRemove :: ContainerClass self => self
-> (Widget -> IO ())
-> IO (ConnectId self)
onRemove = connect_OBJECT__NONE "remove" False
{-# DEPRECATED onRemove "instead of 'onRemove obj' use 'on obj remove'" #-}
afterRemove :: ContainerClass self => self
-> (Widget -> IO ())
-> IO (ConnectId self)
afterRemove = connect_OBJECT__NONE "remove" True
{-# DEPRECATED afterRemove "instead of 'afterRemove obj' use 'after obj remove'" #-}
onCheckResize :: ContainerClass self => self
-> IO ()
-> IO (ConnectId self)
onCheckResize = connect_NONE__NONE "check_resize" False
{-# DEPRECATED onCheckResize "instead of 'onCheckResize obj' use 'on obj checkResize'" #-}
afterCheckResize :: ContainerClass self => self
-> IO ()
-> IO (ConnectId self)
afterCheckResize = connect_NONE__NONE "check_resize" True
{-# DEPRECATED afterCheckResize "instead of 'afterCheckResize obj' use 'after obj checkResize'" #-}
onSetFocusChild :: ContainerClass self => self
-> (Maybe Widget -> IO ())
-> IO (ConnectId self)
onSetFocusChild = connect_MOBJECT__NONE "set-focus-child" False
{-# DEPRECATED onSetFocusChild "instead of 'onSetFocusChild obj' use 'on obj setFocusChild'" #-}
afterSetFocusChild :: ContainerClass self => self
-> (Maybe Widget -> IO ())
-> IO (ConnectId self)
afterSetFocusChild = connect_MOBJECT__NONE "set-focus-child" True
{-# DEPRECATED afterSetFocusChild "instead of 'afterSetFocusChild obj' use 'after obj setFocusChild'" #-}
foreign import ccall safe "gtk_container_add"
gtk_container_add :: ((Ptr Container) -> ((Ptr Widget) -> (IO ())))
foreign import ccall safe "gtk_container_remove"
gtk_container_remove :: ((Ptr Container) -> ((Ptr Widget) -> (IO ())))
foreign import ccall safe "gtk_container_foreach"
gtk_container_foreach :: ((Ptr Container) -> ((FunPtr ((Ptr Widget) -> ((Ptr ()) -> (IO ())))) -> ((Ptr ()) -> (IO ()))))
foreign import ccall safe "gtk_container_forall"
gtk_container_forall :: ((Ptr Container) -> ((FunPtr ((Ptr Widget) -> ((Ptr ()) -> (IO ())))) -> ((Ptr ()) -> (IO ()))))
foreign import ccall safe "gtk_container_get_children"
gtk_container_get_children :: ((Ptr Container) -> (IO (Ptr ())))
foreign import ccall safe "gtk_container_set_focus_child"
gtk_container_set_focus_child :: ((Ptr Container) -> ((Ptr Widget) -> (IO ())))
foreign import ccall safe "gtk_container_set_focus_chain"
gtk_container_set_focus_chain :: ((Ptr Container) -> ((Ptr ()) -> (IO ())))
foreign import ccall safe "gtk_container_get_focus_chain"
gtk_container_get_focus_chain :: ((Ptr Container) -> ((Ptr (Ptr ())) -> (IO CInt)))
foreign import ccall safe "gtk_container_unset_focus_chain"
gtk_container_unset_focus_chain :: ((Ptr Container) -> (IO ()))
foreign import ccall safe "gtk_container_set_focus_vadjustment"
gtk_container_set_focus_vadjustment :: ((Ptr Container) -> ((Ptr Adjustment) -> (IO ())))
foreign import ccall unsafe "gtk_container_get_focus_vadjustment"
gtk_container_get_focus_vadjustment :: ((Ptr Container) -> (IO (Ptr Adjustment)))
foreign import ccall safe "gtk_container_set_focus_hadjustment"
gtk_container_set_focus_hadjustment :: ((Ptr Container) -> ((Ptr Adjustment) -> (IO ())))
foreign import ccall unsafe "gtk_container_get_focus_hadjustment"
gtk_container_get_focus_hadjustment :: ((Ptr Container) -> (IO (Ptr Adjustment)))
foreign import ccall safe "gtk_container_resize_children"
gtk_container_resize_children :: ((Ptr Container) -> (IO ()))
foreign import ccall safe "gtk_container_set_border_width"
gtk_container_set_border_width :: ((Ptr Container) -> (CUInt -> (IO ())))
foreign import ccall unsafe "gtk_container_get_border_width"
gtk_container_get_border_width :: ((Ptr Container) -> (IO CUInt))
foreign import ccall safe "gtk_container_get_resize_mode"
gtk_container_get_resize_mode :: ((Ptr Container) -> (IO CInt))
foreign import ccall safe "gtk_container_set_resize_mode"
gtk_container_set_resize_mode :: ((Ptr Container) -> (CInt -> (IO ())))
foreign import ccall unsafe "gtk_widget_get_type"
gtk_widget_get_type :: CULong