| Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte | 
|---|---|
| License | LGPL-2.1 | 
| Maintainer | Iñaki García Etxebarria | 
| Safe Haskell | Safe-Inferred | 
| Language | Haskell2010 | 
GI.Gtk.Objects.LayoutManager
Description
Layout managers are delegate classes that handle the preferred size and the allocation of a container widget.
You typically subclass LayoutManager if you want to implement a
 layout policy for the children of a widget, or if you want to determine
 the size of a widget depending on its contents.
Each Widget can only have a LayoutManager instance associated to it
 at any given time; it is possible, though, to replace the layout manager
 instance using widgetSetLayoutManager.
Layout properties
A layout manager can expose properties for controlling the layout of
 each child, by creating an object type derived from LayoutChild
 and installing the properties on it as normal GObject properties.
Each LayoutChild instance storing the layout properties for a
 specific child is created through the layoutManagerGetLayoutChild
 method; a LayoutManager controls the creation of its LayoutChild
 instances by overriding the GtkLayoutManagerClass.create_layout_child()
 virtual function. The typical implementation should look like:
C code
static GtkLayoutChild *
create_layout_child (GtkLayoutManager *manager,
                     GtkWidget        *container,
                     GtkWidget        *child)
{
  return g_object_new (your_layout_child_get_type (),
                       "layout-manager", manager,
                       "child-widget", child,
                       NULL);
}The LayoutChild:layout-manager and LayoutChild:child-widget properties
 on the newly created LayoutChild instance are mandatory. The
 LayoutManager will cache the newly created LayoutChild instance until
 the widget is removed from its parent, or the parent removes the layout
 manager.
Each LayoutManager instance creating a LayoutChild should use
 layoutManagerGetLayoutChild every time it needs to query the
 layout properties; each LayoutChild instance should call
 layoutManagerLayoutChanged every time a property is updated, in
 order to queue a new size measuring and allocation.
Synopsis
- newtype LayoutManager = LayoutManager (ManagedPtr LayoutManager)
- class (GObject o, IsDescendantOf LayoutManager o) => IsLayoutManager o
- toLayoutManager :: (MonadIO m, IsLayoutManager o) => o -> m LayoutManager
- layoutManagerAllocate :: (HasCallStack, MonadIO m, IsLayoutManager a, IsWidget b) => a -> b -> Int32 -> Int32 -> Int32 -> m ()
- layoutManagerGetLayoutChild :: (HasCallStack, MonadIO m, IsLayoutManager a, IsWidget b) => a -> b -> m LayoutChild
- layoutManagerGetRequestMode :: (HasCallStack, MonadIO m, IsLayoutManager a) => a -> m SizeRequestMode
- layoutManagerGetWidget :: (HasCallStack, MonadIO m, IsLayoutManager a) => a -> m (Maybe Widget)
- layoutManagerLayoutChanged :: (HasCallStack, MonadIO m, IsLayoutManager a) => a -> m ()
- layoutManagerMeasure :: (HasCallStack, MonadIO m, IsLayoutManager a, IsWidget b) => a -> b -> Orientation -> Int32 -> m (Int32, Int32, Int32, Int32)
Exported types
newtype LayoutManager Source #
Memory-managed wrapper type.
Constructors
| LayoutManager (ManagedPtr LayoutManager) | 
Instances
| Eq LayoutManager Source # | |
| Defined in GI.Gtk.Objects.LayoutManager Methods (==) :: LayoutManager -> LayoutManager -> Bool # (/=) :: LayoutManager -> LayoutManager -> Bool # | |
| GObject LayoutManager Source # | |
| Defined in GI.Gtk.Objects.LayoutManager | |
| ManagedPtrNewtype LayoutManager Source # | |
| Defined in GI.Gtk.Objects.LayoutManager Methods toManagedPtr :: LayoutManager -> ManagedPtr LayoutManager | |
| TypedObject LayoutManager Source # | |
| Defined in GI.Gtk.Objects.LayoutManager | |
| HasParentTypes LayoutManager Source # | |
| Defined in GI.Gtk.Objects.LayoutManager | |
| IsGValue (Maybe LayoutManager) Source # | Convert  | 
| Defined in GI.Gtk.Objects.LayoutManager Methods gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe LayoutManager -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe LayoutManager) | |
| type ParentTypes LayoutManager Source # | |
| Defined in GI.Gtk.Objects.LayoutManager | |
class (GObject o, IsDescendantOf LayoutManager o) => IsLayoutManager o Source #
Type class for types which can be safely cast to LayoutManager, for instance with toLayoutManager.
Instances
| (GObject o, IsDescendantOf LayoutManager o) => IsLayoutManager o Source # | |
| Defined in GI.Gtk.Objects.LayoutManager | |
toLayoutManager :: (MonadIO m, IsLayoutManager o) => o -> m LayoutManager Source #
Cast to LayoutManager, for types for which this is known to be safe. For general casts, use castTo.
Methods
Click to display all available methods, including inherited ones
Methods
allocate, bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, layoutChanged, measure, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getData, getLayoutChild, getProperty, getQdata, getRequestMode, getWidget.
Setters
allocate
layoutManagerAllocate Source #
Arguments
| :: (HasCallStack, MonadIO m, IsLayoutManager a, IsWidget b) | |
| => a | 
 | 
| -> b | 
 | 
| -> Int32 | 
 | 
| -> Int32 | 
 | 
| -> Int32 | 
 | 
| -> m () | 
This function assigns the given width, height, and baseline to
 a widget, and computes the position and sizes of the children of
 the widget using the layout management policy of manager.
getLayoutChild
layoutManagerGetLayoutChild Source #
Arguments
| :: (HasCallStack, MonadIO m, IsLayoutManager a, IsWidget b) | |
| => a | 
 | 
| -> b | 
 | 
| -> m LayoutChild | Returns: a  | 
Retrieves a LayoutChild instance for the LayoutManager, creating
 one if necessary.
The child widget must be a child of the widget using manager.
The LayoutChild instance is owned by the LayoutManager, and is
 guaranteed to exist as long as child is a child of the Widget using
 the given LayoutManager.
getRequestMode
layoutManagerGetRequestMode Source #
Arguments
| :: (HasCallStack, MonadIO m, IsLayoutManager a) | |
| => a | 
 | 
| -> m SizeRequestMode | Returns: a  | 
Retrieves the request mode of manager.
getWidget
layoutManagerGetWidget Source #
Arguments
| :: (HasCallStack, MonadIO m, IsLayoutManager a) | |
| => a | 
 | 
| -> m (Maybe Widget) | Returns: a  | 
Retrieves the Widget using the given LayoutManager.
layoutChanged
layoutManagerLayoutChanged Source #
Arguments
| :: (HasCallStack, MonadIO m, IsLayoutManager a) | |
| => a | 
 | 
| -> m () | 
Queues a resize on the Widget using manager, if any.
This function should be called by subclasses of LayoutManager in
 response to changes to their layout management policies.
measure
Arguments
| :: (HasCallStack, MonadIO m, IsLayoutManager a, IsWidget b) | |
| => a | 
 | 
| -> b | 
 | 
| -> Orientation | 
 | 
| -> Int32 | 
 | 
| -> m (Int32, Int32, Int32, Int32) | 
Measures the size of the widget using manager, for the
 given orientation and size.
See [GtkWidget's geometry management section][geometry-management] for more details.