Index

Package: Container

Description

package Gtk.Container is

A GTK+ user interface is constructed by nesting widgets inside widgets.

Container widgets are the inner nodes in the resulting tree of widgets: they contain other widgets. So, for example, you might have a Gtk.Window.Gtk_Window containing a Gtk.Frame.Gtk_Frame containing a Gtk.Label.Gtk_Label. If you wanted an image instead of a textual label inside the frame, you might replace the Gtk.Label.Gtk_Label widget with a Gtk.Image.Gtk_Image widget.

There are two major kinds of container widgets in GTK+. Both are subclasses of the abstract GtkContainer base class.

The first type of container widget has a single child widget and derives from Gtk.Bin.Gtk_Bin. These containers are *decorators*, which add some kind of functionality to the child. For example, a Gtk.Button.Gtk_Button makes its child into a clickable button; a Gtk.Frame.Gtk_Frame draws a frame around its child and a Gtk.Window.Gtk_Window places its child widget inside a top-level window.

The second type of container can have more than one child; its purpose is to manage *layout*. This means that these containers assign sizes and positions to their children. For example, a Gtk.Box.Gtk_Hbox arranges its children in a horizontal row, and a Gtk.Grid.Gtk_Grid arranges the widgets it contains in a two-dimensional grid. == Height for width geometry management == GTK+ uses a height-for-width (and width-for-height) geometry management system. Height-for-width means that a widget can change how much vertical space it needs, depending on the amount of horizontal space that it is given (and similar for width-for-height).

There are some things to keep in mind when implementing container widgets that make use of GTK+'s height for width geometry management system. First, it's important to note that a container must prioritize one of its dimensions, that is to say that a widget or container can only have a Gtk.Enums.Gtk_Size_Request_Mode that is Gtk.Enums.Height_For_Width or Gtk.Enums.Width_For_Height. However, every widget and container must be able to respond to the APIs for both dimensions, i.e. even if a widget has a request mode that is height-for-width, it is possible that its parent will request its sizes using the width-for-height APIs.

To ensure that everything works properly, here are some guidelines to follow when implementing height-for-width (or width-for-height) containers.

Each request mode involves 2 virtual methods. Height-for-width apis run through Gtk.Widget.Get_Preferred_Width and then through Gtk.Widget.Get_Preferred_Height_For_Width. When handling requests in the opposite Gtk.Enums.Gtk_Size_Request_Mode it is important that every widget request at least enough space to display all of its content at all times.

When Gtk.Widget.Get_Preferred_Height is called on a container that is height-for-width, the container must return the height for its minimum width. This is easily achieved by simply calling the reverse apis implemented for itself as follows: static void foo_container_get_preferred_height (GtkWidget *widget, gint *min_height, gint *nat_height) { if (i_am_in_height_for_width_mode) { gint min_width; GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, &min_width, NULL); GTK_WIDGET_GET_CLASS (widget)->get_preferred_height_for_width (widget, min_width, min_height, nat_height); } else { ... many containers support both request modes, execute the real width-for-height request here by returning the collective heights of all widgets that are stacked vertically (or whatever is appropriate for this container) ... } } Similarly, when Gtk.Widget.Get_Preferred_Width_For_Height is called for a container or widget that is height-for-width, it then only needs to return the base minimum width like so: static void foo_container_get_preferred_width_for_height (GtkWidget *widget, gint for_height, gint *min_width, gint *nat_width) { if (i_am_in_height_for_width_mode) { GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, min_width, nat_width); } else { ... execute the real width-for-height request here based on the required width of the children collectively if the container were to be allocated the said height ... } } Height for width requests are generally implemented in terms of a virtual allocation of widgets in the input orientation. Assuming an height-for-width request mode, a container would implement the <function>get_preferred_height_for_width</function> virtual function by first calling Gtk.Widget.Get_Preferred_Width for each of its children.

For each potential group of children that are lined up horizontally, the values returned by Gtk.Widget.Get_Preferred_Width should be collected in an array of Gtk_Requested_Size structures. Any child spacing should be removed from the input For_Width and then the collective size should be allocated using the gtk_distribute_natural_allocation convenience function.

The container will then move on to request the preferred height for each child by using Gtk.Widget.Get_Preferred_Height_For_Width and using the sizes stored in the Gtk_Requested_Size array.

To allocate a height-for-width container, it's again important to consider that a container must prioritize one dimension over the other. So if a container is a height-for-width container it must first allocate all widgets horizontally using a Gtk_Requested_Size array and gtk_distribute_natural_allocation and then add any extra space (if and where appropriate) for the widget to expand.

After adding all the expand space, the container assumes it was allocated sufficient height to fit all of its content. At this time, the container must use the total horizontal sizes of each widget to request the height-for-width of each of its children and store the requests in a Gtk_Requested_Size array for any widgets that stack vertically (for tabular containers this can be generalized into the heights and widths of rows and columns). The vertical space must then again be distributed using gtk_distribute_natural_allocation while this time considering the allocated height of the widget minus any vertical spacing that the container adds.

Then vertical expand space should be added where appropriate and available and the container should go on to actually allocating the child widgets.

See <link linkend="geometry-management">GtkWidget's geometry management section</link> to learn more about implementing height-for-width geometry management for widgets. == Child properties == GtkContainer introduces *child properties*. These are object properties that are not specific to either the container or the contained widget, but rather to their relation. Typical examples of child properties are the position or pack-type of a widget which is contained in a Gtk.Box.Gtk_Box.

Use gtk_container_class_install_child_property to install child properties for a container class and gtk_container_class_find_child_property or gtk_container_class_list_child_properties to get information about existing child properties.

To set the value of a child property, use Gtk.Container.Child_Set_Property, gtk_container_child_set or gtk_container_child_set_valist. To obtain the value of a child property, use Gtk.Container.Child_Get_Property, gtk_container_child_get or gtk_container_child_get_valist. To emit notification about child property changes, use Gtk.Widget.Child_Notify. == GtkContainer as GtkBuildable == The GtkContainer implementation of the GtkBuildable interface supports a <packing> element for children, which can contain multiple <property> elements that specify child properties for the child. == Child properties in UI definitions == <object class="GtkVBox"> <child> <object class="GtkLabel"/> <packing> <property name="pack-type">start</property> </packing> </child> </object> Since 2.16, child properties can also be marked as translatable using the same "translatable", "comments" and "context" attributes that are used for regular properties.

Packages

Forall_User_Data (generic)

Foreach_User_Data (generic)

Implements_Gtk_Buildable (new Glib.Types.Implements)

Classes

Gtk_Container_Record

type Gtk_Container_Record is new Gtk_Widget_Record with null record;

Ancestors:

Immediate Children:

Primitive operations:

Check_Resize
Child_Get_Property
Child_Notify
Child_Set_Property
Get_Border_Width
Get_Children
Get_Focus_Child
Get_Focus_Hadjustment
Get_Focus_Vadjustment
Get_Path_For_Child
Get_Resize_Mode
Glib.Object.Deallocate (Inherited)
Glib.Object.Get_Type (Inherited)
Glib.Object.Notify (Inherited)
Glib.Object.Ref (Inherited)
Glib.Object.Ref_Sink (Inherited)
Glib.Object.Unref (Inherited)
Gtk.Widget.Activate (Inherited)
Gtk.Widget.Add_Accelerator (Inherited)
Gtk.Widget.Add_Device_Events (Inherited)
Gtk.Widget.Add_Events (Inherited)
Gtk.Widget.Add_Mnemonic_Label (Inherited)
Gtk.Widget.Add_Tick_Callback (Inherited)
Gtk.Widget.Can_Activate_Accel (Inherited)
Gtk.Widget.Child_Focus (Inherited)
Gtk.Widget.Child_Notify (Inherited)
Gtk.Widget.Compute_Expand (Inherited)
Gtk.Widget.Create_Pango_Context (Inherited)
Gtk.Widget.Create_Pango_Layout (Inherited)
Gtk.Widget.Destroy (Inherited)
Gtk.Widget.Destroyed (Inherited)
Gtk.Widget.Device_Is_Shadowed (Inherited)
Gtk.Widget.Drag_Check_Threshold (Inherited)
Gtk.Widget.Drag_Dest_Add_Image_Targets (Inherited)
Gtk.Widget.Drag_Dest_Add_Text_Targets (Inherited)
Gtk.Widget.Drag_Dest_Add_Uri_Targets (Inherited)
Gtk.Widget.Drag_Dest_Get_Track_Motion (Inherited)
Gtk.Widget.Drag_Dest_Set_Proxy (Inherited)
Gtk.Widget.Drag_Dest_Set_Track_Motion (Inherited)
Gtk.Widget.Drag_Dest_Unset (Inherited)
Gtk.Widget.Drag_Get_Data (Inherited)
Gtk.Widget.Drag_Highlight (Inherited)
Gtk.Widget.Drag_Source_Add_Image_Targets (Inherited)
Gtk.Widget.Drag_Source_Add_Uri_Targets (Inherited)
Gtk.Widget.Drag_Source_Set_Icon_Pixbuf (Inherited)
Gtk.Widget.Drag_Source_Unset (Inherited)
Gtk.Widget.Drag_Unhighlight (Inherited)
Gtk.Widget.Draw (Inherited)
Gtk.Widget.Ensure_Style (Inherited)
Gtk.Widget.Error_Bell (Inherited)
Gtk.Widget.Event (Inherited)
Gtk.Widget.Freeze_Child_Notify (Inherited)
Gtk.Widget.Get_Allocated_Height (Inherited)
Gtk.Widget.Get_Allocated_Width (Inherited)
Gtk.Widget.Get_Allocation (Inherited)
Gtk.Widget.Get_Ancestor (Inherited)
Gtk.Widget.Get_App_Paintable (Inherited)
Gtk.Widget.Get_Can_Default (Inherited)
Gtk.Widget.Get_Can_Focus (Inherited)
Gtk.Widget.Get_Child_Requisition (Inherited)
Gtk.Widget.Get_Child_Visible (Inherited)
Gtk.Widget.Get_Composite_Name (Inherited)
Gtk.Widget.Get_Device_Enabled (Inherited)
Gtk.Widget.Get_Device_Events (Inherited)
Gtk.Widget.Get_Direction (Inherited)
Gtk.Widget.Get_Display (Inherited)
Gtk.Widget.Get_Double_Buffered (Inherited)
Gtk.Widget.Get_Events (Inherited)
Gtk.Widget.Get_Frame_Clock (Inherited)
Gtk.Widget.Get_Halign (Inherited)
Gtk.Widget.Get_Has_Tooltip (Inherited)
Gtk.Widget.Get_Has_Window (Inherited)
Gtk.Widget.Get_Hexpand (Inherited)
Gtk.Widget.Get_Hexpand_Set (Inherited)
Gtk.Widget.Get_Mapped (Inherited)
Gtk.Widget.Get_Margin_Bottom (Inherited)
Gtk.Widget.Get_Margin_Left (Inherited)
Gtk.Widget.Get_Margin_Right (Inherited)
Gtk.Widget.Get_Margin_Top (Inherited)
Gtk.Widget.Get_Modifier_Mask (Inherited)
Gtk.Widget.Get_Name (Inherited)
Gtk.Widget.Get_No_Show_All (Inherited)
Gtk.Widget.Get_Opacity (Inherited)
Gtk.Widget.Get_Pango_Context (Inherited)
Gtk.Widget.Get_Parent (Inherited)
Gtk.Widget.Get_Parent_Window (Inherited)
Gtk.Widget.Get_Path (Inherited)
Gtk.Widget.Get_Pointer (Inherited)
Gtk.Widget.Get_Preferred_Height (Inherited)
Gtk.Widget.Get_Preferred_Height_For_Width (Inherited)
Gtk.Widget.Get_Preferred_Size (Inherited)
Gtk.Widget.Get_Preferred_Width (Inherited)
Gtk.Widget.Get_Preferred_Width_For_Height (Inherited)
Gtk.Widget.Get_Realized (Inherited)
Gtk.Widget.Get_Receives_Default (Inherited)
Gtk.Widget.Get_Request_Mode (Inherited)
Gtk.Widget.Get_Requisition (Inherited)
Gtk.Widget.Get_Root_Window (Inherited)
Gtk.Widget.Get_Screen (Inherited)
Gtk.Widget.Get_Sensitive (Inherited)
Gtk.Widget.Get_Size_Request (Inherited)
Gtk.Widget.Get_State (Inherited)
Gtk.Widget.Get_State_Flags (Inherited)
Gtk.Widget.Get_Style (Inherited)
Gtk.Widget.Get_Support_Multidevice (Inherited)
Gtk.Widget.Get_Tooltip_Markup (Inherited)
Gtk.Widget.Get_Tooltip_Text (Inherited)
Gtk.Widget.Get_Tooltip_Window (Inherited)
Gtk.Widget.Get_Toplevel (Inherited)
Gtk.Widget.Get_Valign (Inherited)
Gtk.Widget.Get_Vexpand (Inherited)
Gtk.Widget.Get_Vexpand_Set (Inherited)
Gtk.Widget.Get_Visible (Inherited)
Gtk.Widget.Get_Visual (Inherited)
Gtk.Widget.Get_Window (Inherited)
Gtk.Widget.Grab_Add (Inherited)
Gtk.Widget.Grab_Default (Inherited)
Gtk.Widget.Grab_Focus (Inherited)
Gtk.Widget.Grab_Remove (Inherited)
Gtk.Widget.Has_Default (Inherited)
Gtk.Widget.Has_Focus (Inherited)
Gtk.Widget.Has_Grab (Inherited)
Gtk.Widget.Has_Rc_Style (Inherited)
Gtk.Widget.Has_Screen (Inherited)
Gtk.Widget.Has_Visible_Focus (Inherited)
Gtk.Widget.Hide (Inherited)
Gtk.Widget.Hide_On_Delete (Inherited)
Gtk.Widget.In_Destruction (Inherited)
Gtk.Widget.Input_Shape_Combine_Region (Inherited)
Gtk.Widget.Intersect (Inherited)
Gtk.Widget.Is_Ancestor (Inherited)
Gtk.Widget.Is_Composited (Inherited)
Gtk.Widget.Is_Drawable (Inherited)
Gtk.Widget.Is_Focus (Inherited)
Gtk.Widget.Is_Sensitive (Inherited)
Gtk.Widget.Is_Toplevel (Inherited)
Gtk.Widget.Is_Visible (Inherited)
Gtk.Widget.Keynav_Failed (Inherited)
Gtk.Widget.List_Mnemonic_Labels (Inherited)
Gtk.Widget.Map (Inherited)
Gtk.Widget.Mnemonic_Activate (Inherited)
Gtk.Widget.Modify_Base (Inherited)
Gtk.Widget.Modify_Bg (Inherited)
Gtk.Widget.Modify_Cursor (Inherited)
Gtk.Widget.Modify_Fg (Inherited)
Gtk.Widget.Modify_Font (Inherited)
Gtk.Widget.Modify_Text (Inherited)
Gtk.Widget.On_Accel_Closures_Changed (Inherited)
Gtk.Widget.On_Accel_Closures_Changed (Inherited)
Gtk.Widget.On_Button_Press_Event (Inherited)
Gtk.Widget.On_Button_Press_Event (Inherited)
Gtk.Widget.On_Button_Release_Event (Inherited)
Gtk.Widget.On_Button_Release_Event (Inherited)
Gtk.Widget.On_Can_Activate_Accel (Inherited)
Gtk.Widget.On_Can_Activate_Accel (Inherited)
Gtk.Widget.On_Child_Notify (Inherited)
Gtk.Widget.On_Child_Notify (Inherited)
Gtk.Widget.On_Composited_Changed (Inherited)
Gtk.Widget.On_Composited_Changed (Inherited)
Gtk.Widget.On_Configure_Event (Inherited)
Gtk.Widget.On_Configure_Event (Inherited)
Gtk.Widget.On_Damage_Event (Inherited)
Gtk.Widget.On_Damage_Event (Inherited)
Gtk.Widget.On_Delete_Event (Inherited)
Gtk.Widget.On_Delete_Event (Inherited)
Gtk.Widget.On_Destroy (Inherited)
Gtk.Widget.On_Destroy (Inherited)
Gtk.Widget.On_Destroy_Event (Inherited)
Gtk.Widget.On_Destroy_Event (Inherited)
Gtk.Widget.On_Direction_Changed (Inherited)
Gtk.Widget.On_Direction_Changed (Inherited)
Gtk.Widget.On_Drag_Begin (Inherited)
Gtk.Widget.On_Drag_Begin (Inherited)
Gtk.Widget.On_Drag_Data_Delete (Inherited)
Gtk.Widget.On_Drag_Data_Delete (Inherited)
Gtk.Widget.On_Drag_Data_Get (Inherited)
Gtk.Widget.On_Drag_Data_Get (Inherited)
Gtk.Widget.On_Drag_Data_Received (Inherited)
Gtk.Widget.On_Drag_Data_Received (Inherited)
Gtk.Widget.On_Drag_Drop (Inherited)
Gtk.Widget.On_Drag_Drop (Inherited)
Gtk.Widget.On_Drag_End (Inherited)
Gtk.Widget.On_Drag_End (Inherited)
Gtk.Widget.On_Drag_Failed (Inherited)
Gtk.Widget.On_Drag_Failed (Inherited)
Gtk.Widget.On_Drag_Leave (Inherited)
Gtk.Widget.On_Drag_Leave (Inherited)
Gtk.Widget.On_Drag_Motion (Inherited)
Gtk.Widget.On_Drag_Motion (Inherited)
Gtk.Widget.On_Draw (Inherited)
Gtk.Widget.On_Draw (Inherited)
Gtk.Widget.On_Enter_Notify_Event (Inherited)
Gtk.Widget.On_Enter_Notify_Event (Inherited)
Gtk.Widget.On_Event (Inherited)
Gtk.Widget.On_Event (Inherited)
Gtk.Widget.On_Event_After (Inherited)
Gtk.Widget.On_Event_After (Inherited)
Gtk.Widget.On_Focus (Inherited)
Gtk.Widget.On_Focus (Inherited)
Gtk.Widget.On_Focus_In_Event (Inherited)
Gtk.Widget.On_Focus_In_Event (Inherited)
Gtk.Widget.On_Focus_Out_Event (Inherited)
Gtk.Widget.On_Focus_Out_Event (Inherited)
Gtk.Widget.On_Grab_Broken_Event (Inherited)
Gtk.Widget.On_Grab_Broken_Event (Inherited)
Gtk.Widget.On_Grab_Focus (Inherited)
Gtk.Widget.On_Grab_Focus (Inherited)
Gtk.Widget.On_Grab_Notify (Inherited)
Gtk.Widget.On_Grab_Notify (Inherited)
Gtk.Widget.On_Hide (Inherited)
Gtk.Widget.On_Hide (Inherited)
Gtk.Widget.On_Hierarchy_Changed (Inherited)
Gtk.Widget.On_Hierarchy_Changed (Inherited)
Gtk.Widget.On_Key_Press_Event (Inherited)
Gtk.Widget.On_Key_Press_Event (Inherited)
Gtk.Widget.On_Key_Release_Event (Inherited)
Gtk.Widget.On_Key_Release_Event (Inherited)
Gtk.Widget.On_Keynav_Failed (Inherited)
Gtk.Widget.On_Keynav_Failed (Inherited)
Gtk.Widget.On_Leave_Notify_Event (Inherited)
Gtk.Widget.On_Leave_Notify_Event (Inherited)
Gtk.Widget.On_Map (Inherited)
Gtk.Widget.On_Map (Inherited)
Gtk.Widget.On_Map_Event (Inherited)
Gtk.Widget.On_Map_Event (Inherited)
Gtk.Widget.On_Mnemonic_Activate (Inherited)
Gtk.Widget.On_Mnemonic_Activate (Inherited)
Gtk.Widget.On_Motion_Notify_Event (Inherited)
Gtk.Widget.On_Motion_Notify_Event (Inherited)
Gtk.Widget.On_Move_Focus (Inherited)
Gtk.Widget.On_Move_Focus (Inherited)
Gtk.Widget.On_Parent_Set (Inherited)
Gtk.Widget.On_Parent_Set (Inherited)
Gtk.Widget.On_Popup_Menu (Inherited)
Gtk.Widget.On_Popup_Menu (Inherited)
Gtk.Widget.On_Property_Notify_Event (Inherited)
Gtk.Widget.On_Property_Notify_Event (Inherited)
Gtk.Widget.On_Proximity_In_Event (Inherited)
Gtk.Widget.On_Proximity_In_Event (Inherited)
Gtk.Widget.On_Proximity_Out_Event (Inherited)
Gtk.Widget.On_Proximity_Out_Event (Inherited)
Gtk.Widget.On_Query_Tooltip (Inherited)
Gtk.Widget.On_Query_Tooltip (Inherited)
Gtk.Widget.On_Realize (Inherited)
Gtk.Widget.On_Realize (Inherited)
Gtk.Widget.On_Screen_Changed (Inherited)
Gtk.Widget.On_Screen_Changed (Inherited)
Gtk.Widget.On_Scroll_Event (Inherited)
Gtk.Widget.On_Scroll_Event (Inherited)
Gtk.Widget.On_Selection_Clear_Event (Inherited)
Gtk.Widget.On_Selection_Clear_Event (Inherited)
Gtk.Widget.On_Selection_Get (Inherited)
Gtk.Widget.On_Selection_Get (Inherited)
Gtk.Widget.On_Selection_Notify_Event (Inherited)
Gtk.Widget.On_Selection_Notify_Event (Inherited)
Gtk.Widget.On_Selection_Received (Inherited)
Gtk.Widget.On_Selection_Received (Inherited)
Gtk.Widget.On_Selection_Request_Event (Inherited)
Gtk.Widget.On_Selection_Request_Event (Inherited)
Gtk.Widget.On_Show (Inherited)
Gtk.Widget.On_Show (Inherited)
Gtk.Widget.On_Show_Help (Inherited)
Gtk.Widget.On_Show_Help (Inherited)
Gtk.Widget.On_Size_Allocate (Inherited)
Gtk.Widget.On_Size_Allocate (Inherited)
Gtk.Widget.On_State_Changed (Inherited)
Gtk.Widget.On_State_Changed (Inherited)
Gtk.Widget.On_State_Flags_Changed (Inherited)
Gtk.Widget.On_State_Flags_Changed (Inherited)
Gtk.Widget.On_Style_Set (Inherited)
Gtk.Widget.On_Style_Set (Inherited)
Gtk.Widget.On_Style_Updated (Inherited)
Gtk.Widget.On_Style_Updated (Inherited)
Gtk.Widget.On_Touch_Event (Inherited)
Gtk.Widget.On_Touch_Event (Inherited)
Gtk.Widget.On_Unmap (Inherited)
Gtk.Widget.On_Unmap (Inherited)
Gtk.Widget.On_Unmap_Event (Inherited)
Gtk.Widget.On_Unmap_Event (Inherited)
Gtk.Widget.On_Unrealize (Inherited)
Gtk.Widget.On_Unrealize (Inherited)
Gtk.Widget.On_Visibility_Notify_Event (Inherited)
Gtk.Widget.On_Visibility_Notify_Event (Inherited)
Gtk.Widget.On_Window_State_Event (Inherited)
Gtk.Widget.On_Window_State_Event (Inherited)
Gtk.Widget.Override_Background_Color (Inherited)
Gtk.Widget.Override_Color (Inherited)
Gtk.Widget.Override_Cursor (Inherited)
Gtk.Widget.Override_Font (Inherited)
Gtk.Widget.Override_Symbolic_Color (Inherited)
Gtk.Widget.Queue_Compute_Expand (Inherited)
Gtk.Widget.Queue_Draw (Inherited)
Gtk.Widget.Queue_Draw_Area (Inherited)
Gtk.Widget.Queue_Draw_Region (Inherited)
Gtk.Widget.Queue_Resize (Inherited)
Gtk.Widget.Queue_Resize_No_Redraw (Inherited)
Gtk.Widget.Realize (Inherited)
Gtk.Widget.Region_Intersect (Inherited)
Gtk.Widget.Register_Window (Inherited)
Gtk.Widget.Remove_Accelerator (Inherited)
Gtk.Widget.Remove_Mnemonic_Label (Inherited)
Gtk.Widget.Remove_Tick_Callback (Inherited)
Gtk.Widget.Render_Icon (Inherited)
Gtk.Widget.Render_Icon_Pixbuf (Inherited)
Gtk.Widget.Reparent (Inherited)
Gtk.Widget.Reset_Rc_Styles (Inherited)
Gtk.Widget.Reset_Style (Inherited)
Gtk.Widget.Send_Expose (Inherited)
Gtk.Widget.Send_Focus_Change (Inherited)
Gtk.Widget.Set_Accel_Path (Inherited)
Gtk.Widget.Set_Allocation (Inherited)
Gtk.Widget.Set_App_Paintable (Inherited)
Gtk.Widget.Set_Can_Default (Inherited)
Gtk.Widget.Set_Can_Focus (Inherited)
Gtk.Widget.Set_Child_Visible (Inherited)
Gtk.Widget.Set_Composite_Name (Inherited)
Gtk.Widget.Set_Device_Enabled (Inherited)
Gtk.Widget.Set_Device_Events (Inherited)
Gtk.Widget.Set_Direction (Inherited)
Gtk.Widget.Set_Double_Buffered (Inherited)
Gtk.Widget.Set_Events (Inherited)
Gtk.Widget.Set_Halign (Inherited)
Gtk.Widget.Set_Has_Tooltip (Inherited)
Gtk.Widget.Set_Has_Window (Inherited)
Gtk.Widget.Set_Hexpand (Inherited)
Gtk.Widget.Set_Hexpand_Set (Inherited)
Gtk.Widget.Set_Mapped (Inherited)
Gtk.Widget.Set_Margin_Bottom (Inherited)
Gtk.Widget.Set_Margin_Left (Inherited)
Gtk.Widget.Set_Margin_Right (Inherited)
Gtk.Widget.Set_Margin_Top (Inherited)
Gtk.Widget.Set_Name (Inherited)
Gtk.Widget.Set_No_Show_All (Inherited)
Gtk.Widget.Set_Opacity (Inherited)
Gtk.Widget.Set_Parent (Inherited)
Gtk.Widget.Set_Parent_Window (Inherited)
Gtk.Widget.Set_Realized (Inherited)
Gtk.Widget.Set_Receives_Default (Inherited)
Gtk.Widget.Set_Redraw_On_Allocate (Inherited)
Gtk.Widget.Set_Sensitive (Inherited)
Gtk.Widget.Set_Size_Request (Inherited)
Gtk.Widget.Set_State (Inherited)
Gtk.Widget.Set_State_Flags (Inherited)
Gtk.Widget.Set_Style (Inherited)
Gtk.Widget.Set_Support_Multidevice (Inherited)
Gtk.Widget.Set_Tooltip_Markup (Inherited)
Gtk.Widget.Set_Tooltip_Text (Inherited)
Gtk.Widget.Set_Tooltip_Window (Inherited)
Gtk.Widget.Set_Valign (Inherited)
Gtk.Widget.Set_Vexpand (Inherited)
Gtk.Widget.Set_Vexpand_Set (Inherited)
Gtk.Widget.Set_Visible (Inherited)
Gtk.Widget.Set_Visual (Inherited)
Gtk.Widget.Set_Window (Inherited)
Gtk.Widget.Shape_Combine_Region (Inherited)
Gtk.Widget.Show (Inherited)
Gtk.Widget.Show_All (Inherited)
Gtk.Widget.Show_Now (Inherited)
Gtk.Widget.Size_Allocate (Inherited)
Gtk.Widget.Size_Request (Inherited)
Gtk.Widget.Style_Attach (Inherited)
Gtk.Widget.Style_Get_Property (Inherited)
Gtk.Widget.Thaw_Child_Notify (Inherited)
Gtk.Widget.Translate_Coordinates (Inherited)
Gtk.Widget.Trigger_Tooltip_Query (Inherited)
Gtk.Widget.Unmap (Inherited)
Gtk.Widget.Unparent (Inherited)
Gtk.Widget.Unrealize (Inherited)
Gtk.Widget.Unregister_Window (Inherited)
Gtk.Widget.Unset_State_Flags (Inherited)
On_Check_Resize
On_Check_Resize
On_Set_Focus_Child
On_Set_Focus_Child
Propagate_Draw
Resize_Children
Set_Border_Width
Set_Focus_Chain
Set_Focus_Child
Set_Focus_Hadjustment
Set_Focus_Vadjustment
Set_Reallocate_Redraws
Set_Resize_Mode
Unset_Focus_Chain

Types

Gtk_Container

type Gtk_Container is access all Gtk_Container_Record'Class;

Gtk_Callback

type Gtk_Callback is access procedure
     (Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class);
The type of the callback functions used for e.g. iterating over the children of a container, see gtk_container_foreach. "widget": the widget to operate on

Cb_Gtk_Container_Gtk_Widget_Void

type Cb_Gtk_Container_Gtk_Widget_Void is not null access procedure
     (Self   : access Gtk_Container_Record'Class;
      Object : not null access Gtk.Widget.Gtk_Widget_Record'Class);

Cb_GObject_Gtk_Widget_Void

type Cb_GObject_Gtk_Widget_Void is not null access procedure
     (Self   : access Glib.Object.GObject_Record'Class;
      Object : not null access Gtk.Widget.Gtk_Widget_Record'Class);

Cb_Gtk_Container_Void

type Cb_Gtk_Container_Void is not null access procedure (Self : access Gtk_Container_Record'Class);

Cb_GObject_Void

type Cb_GObject_Void is not null access procedure
     (Self : access Glib.Object.GObject_Record'Class);

Constants & Global variables

Border_Width_Property (Glib.Properties.Property_Uint)

Border_Width_Property : constant Glib.Properties.Property_Uint;

Signal_Add (Glib.Signal_Name)

Signal_Add : constant Glib.Signal_Name := "add";

Signal_Check_Resize (Glib.Signal_Name)

Signal_Check_Resize : constant Glib.Signal_Name := "check-resize";

Signal_Remove (Glib.Signal_Name)

Signal_Remove : constant Glib.Signal_Name := "remove";

Signal_Set_Focus_Child (Glib.Signal_Name)

Signal_Set_Focus_Child : constant Glib.Signal_Name := "set-focus-child";

Subprograms & Entries

Get_Type

function Get_Type return Glib.GType;

Add

procedure Add 
(Container: not null access Gtk_Container_Record;
Widget: not null access Gtk.Widget.Gtk_Widget_Record'Class);
Adds Widget to Container. Typically used for simple containers such as Gtk.Window.Gtk_Window, Gtk.Frame.Gtk_Frame, or Gtk.Button.Gtk_Button; for more complicated layout containers such as Gtk.Box.Gtk_Box or Gtk.Grid.Gtk_Grid, this function will pick default packing parameters that may not be correct. So consider functions such as Gtk.Box.Pack_Start and Gtk.Grid.Attach as an alternative to Gtk.Container.Add in those cases. A widget may be added to only one container at a time; you can't place the same widget inside two different containers. "widget": a widget to be placed inside Container

Check_Resize

procedure Check_Resize 
(Container: not null access Gtk_Container_Record);

Child_Get_Property

procedure Child_Get_Property 
(Container: not null access Gtk_Container_Record;
Child: not null access Gtk.Widget.Gtk_Widget_Record'Class;
Property_Name: UTF8_String;
Value: in out Glib.Values.GValue);
Gets the value of a child property for Child and Container. "child": a widget which is a child of Container "property_name": the name of the property to get "value": a location to return the value

Child_Set_Property

procedure Child_Set_Property 
(Container: not null access Gtk_Container_Record;
Child: not null access Gtk.Widget.Gtk_Widget_Record'Class;
Property_Name: UTF8_String;
Value: Glib.Values.GValue);
Sets a child property for Child and Container. "child": a widget which is a child of Container "property_name": the name of the property to set "value": the value to set the property to

Child_Notify

procedure Child_Notify 
(Container: not null access Gtk_Container_Record;
Child: not null access Gtk.Widget.Gtk_Widget_Record'Class;
Child_Property: UTF8_String);
Emits a Gtk.Widget.Gtk_Widget::child-notify signal for the <link linkend="child-properties">child property</link> Child_Property on widget. This is an analogue of g_object_notify for child properties. Also see Gtk.Widget.Child_Notify. Since: gtk+ 3.2 "child": the child widget "child_property": the name of a child property installed on the class of Container

Child_Type

function Child_Type 
(Container: not null access Gtk_Container_Record) return GType;
Returns the type of the children supported by the container. Note that this may return G_TYPE_NONE to indicate that no more children can be added, e.g. for a Gtk.Paned.Gtk_Paned which already has two children.

Forall

procedure Forall 
(Container: not null access Gtk_Container_Record;
Callback: Gtk_Callback);
Invokes Callback on each child of Container, including children that are considered "internal" (implementation details of the container). "Internal" children generally weren't added by the user of the container, but were added by the container implementation itself. Most applications should use Gtk.Container.Foreach, rather than Gtk.Container.Forall. "callback": a callback

Foreach

procedure Foreach 
(Container: not null access Gtk_Container_Record;
Callback: Gtk_Callback);
Invokes Callback on each non-internal child of Container. See Gtk.Container.Forall for details on what constitutes an "internal" child. Most applications should use Gtk.Container.Foreach, rather than Gtk.Container.Forall. "callback": a callback

Get_Border_Width

function Get_Border_Width 
(Container: not null access Gtk_Container_Record) return Guint;
Retrieves the border width of the container. See Gtk.Container.Set_Border_Width.

Set_Border_Width

procedure Set_Border_Width 
(Container: not null access Gtk_Container_Record;
Border_Width: Guint);
Sets the border width of the container. The border width of a container is the amount of space to leave around the outside of the container. The only exception to this is Gtk.Window.Gtk_Window; because toplevel windows can't leave space outside, they leave the space inside. The border is added on all sides of the container. To add space to only one side, one approach is to create a Gtk.Alignment.Gtk_Alignment widget, call Gtk.Widget.Set_Size_Request to give it a size, and place it on the side of the container as a spacer. "border_width": amount of blank space to leave *outside* the container. Valid values are in the range 0-65535 pixels.

Get_Children

function Get_Children 
(Container: not null access Gtk_Container_Record) return Gtk.Widget.Widget_List.Glist;
Returns the container's non-internal children. See Gtk.Container.Forall for details on what constitutes an "internal" child.

Get_Focus_Child

function Get_Focus_Child 
(Container: not null access Gtk_Container_Record) return Gtk.Widget.Gtk_Widget;
Returns the current focus child widget inside Container. This is not the currently focused widget. That can be obtained by calling Gtk.Window.Get_Focus. Since: gtk+ 2.14

Set_Focus_Child

procedure Set_Focus_Child 
(Container: not null access Gtk_Container_Record;
Child: access Gtk.Widget.Gtk_Widget_Record'Class);
Sets, or unsets if Child is null, the focused child of Container. This function emits the GtkContainer::set_focus_child signal of Container. Implementations of Gtk.Container.Gtk_Container can override the default behaviour by overriding the class closure of this signal. This is function is mostly meant to be used by widgets. Applications can use Gtk.Widget.Grab_Focus to manualy set the focus to a specific widget. "child": a Gtk.Widget.Gtk_Widget, or null

Get_Focus_Hadjustment

function Get_Focus_Hadjustment 
(Container: not null access Gtk_Container_Record) return Gtk.Adjustment.Gtk_Adjustment;
Retrieves the horizontal focus adjustment for the container. See gtk_container_set_focus_hadjustment ().

Set_Focus_Hadjustment

procedure Set_Focus_Hadjustment 
(Container: not null access Gtk_Container_Record;
Adjustment: not null access Gtk.Adjustment.Gtk_Adjustment_Record'Class);
Hooks up an adjustment to focus handling in a container, so when a child of the container is focused, the adjustment is scrolled to show that widget. This function sets the horizontal alignment. See Gtk.Scrolled_Window.Get_Hadjustment for a typical way of obtaining the adjustment and Gtk.Container.Set_Focus_Vadjustment for setting the vertical adjustment. The adjustments have to be in pixel units and in the same coordinate system as the allocation for immediate children of the container. "adjustment": an adjustment which should be adjusted when the focus is moved among the descendents of Container

Get_Focus_Vadjustment

function Get_Focus_Vadjustment 
(Container: not null access Gtk_Container_Record) return Gtk.Adjustment.Gtk_Adjustment;
Retrieves the vertical focus adjustment for the container. See Gtk.Container.Set_Focus_Vadjustment.

Set_Focus_Vadjustment

procedure Set_Focus_Vadjustment 
(Container: not null access Gtk_Container_Record;
Adjustment: not null access Gtk.Adjustment.Gtk_Adjustment_Record'Class);
Hooks up an adjustment to focus handling in a container, so when a child of the container is focused, the adjustment is scrolled to show that widget. This function sets the vertical alignment. See Gtk.Scrolled_Window.Get_Vadjustment for a typical way of obtaining the adjustment and Gtk.Container.Set_Focus_Hadjustment for setting the horizontal adjustment. The adjustments have to be in pixel units and in the same coordinate system as the allocation for immediate children of the container. "adjustment": an adjustment which should be adjusted when the focus is moved among the descendents of Container

Get_Path_For_Child

function Get_Path_For_Child 
(Container: not null access Gtk_Container_Record;
Child: not null access Gtk.Widget.Gtk_Widget_Record'Class) return Gtk.Widget.Gtk_Widget_Path;
Returns a newly created widget path representing all the widget hierarchy from the toplevel down to and including Child. "child": a child of Container

Get_Resize_Mode

function Get_Resize_Mode 
(Container: not null access Gtk_Container_Record) return Gtk.Enums.Gtk_Resize_Mode;
Returns the resize mode for the container. See gtk_container_set_resize_mode ().

Set_Resize_Mode

procedure Set_Resize_Mode 
(Container: not null access Gtk_Container_Record;
Resize_Mode: Gtk.Enums.Gtk_Resize_Mode);
Sets the resize mode for the container. The resize mode of a container determines whether a resize request will be passed to the container's parent, queued for later execution or executed immediately. "resize_mode": the new resize mode

Propagate_Draw

procedure Propagate_Draw 
(Container: not null access Gtk_Container_Record;
Child: not null access Gtk.Widget.Gtk_Widget_Record'Class;
Cr: Cairo.Cairo_Context);
When a container receives a call to the draw function, it must send synthetic Gtk.Widget.Gtk_Widget::draw calls to all children that don't have their own Gdk_Windows. This function provides a convenient way of doing this. A container, when it receives a call to its Gtk.Widget.Gtk_Widget::draw function, calls Gtk.Container.Propagate_Draw once for each child, passing in the Cr the container received. Gtk.Container.Propagate_Draw takes care of translating the origin of Cr, and deciding whether the draw needs to be sent to the child. It is a convenient and optimized way of getting the same effect as calling Gtk.Widget.Draw on the child directly. In most cases, a container can simply either inherit the Gtk.Widget.Gtk_Widget::draw implementation from Gtk.Container.Gtk_Container, or do some drawing and then chain to the ::draw implementation from Gtk.Container.Gtk_Container. "child": a child of Container "cr": Cairo context as passed to the container. If you want to use Cr in container's draw function, consider using cairo_save and cairo_restore before calling this function.

Remove

procedure Remove 
(Container: not null access Gtk_Container_Record;
Widget: not null access Gtk.Widget.Gtk_Widget_Record'Class);
Removes Widget from Container. Widget must be inside Container. Note that Container will own a reference to Widget, and that this may be the last reference held; so removing a widget from its container can destroy that widget. If you want to use Widget again, you need to add a reference to it while it's not inside a container, using g_object_ref. If you don't want to use Widget again it's usually more efficient to simply destroy it directly using Gtk.Widget.Destroy since this will remove it from the container and help break any circular reference count cycles. "widget": a current child of Container

Resize_Children

procedure Resize_Children 
(Container: not null access Gtk_Container_Record);

Set_Focus_Chain

procedure Set_Focus_Chain 
(Container: not null access Gtk_Container_Record;
Focusable_Widgets: Gtk.Widget.Widget_List.Glist);
Sets a focus chain, overriding the one computed automatically by GTK+. In principle each widget in the chain should be a descendant of the container, but this is not enforced by this method, since it's allowed to set the focus chain before you pack the widgets, or have a widget in the chain that isn't always packed. The necessary checks are done when the focus chain is actually traversed. "focusable_widgets": the new focus chain

Set_Reallocate_Redraws

procedure Set_Reallocate_Redraws 
(Container: not null access Gtk_Container_Record;
Needs_Redraws: Boolean);
Sets the Reallocate_Redraws flag of the container to the given value. Containers requesting reallocation redraws get automatically redrawn if any of their children changed allocation. "needs_redraws": the new value for the container's Reallocate_Redraws flag

Unset_Focus_Chain

procedure Unset_Focus_Chain 
(Container: not null access Gtk_Container_Record);
Removes a focus chain explicitly set with Gtk.Container.Set_Focus_Chain.

On_Add

procedure On_Add 
(Self: not null access Gtk_Container_Record;
Call: Cb_Gtk_Container_Gtk_Widget_Void;
After: Boolean := False);

On_Add

procedure On_Add 
(Self: not null access Gtk_Container_Record;
Call: Cb_GObject_Gtk_Widget_Void;
Slot: not null access Glib.Object.GObject_Record'Class;
After: Boolean := False);

On_Check_Resize

procedure On_Check_Resize 
(Self: not null access Gtk_Container_Record;
Call: Cb_Gtk_Container_Void;
After: Boolean := False);

On_Check_Resize

procedure On_Check_Resize 
(Self: not null access Gtk_Container_Record;
Call: Cb_GObject_Void;
Slot: not null access Glib.Object.GObject_Record'Class;
After: Boolean := False);

On_Remove

procedure On_Remove 
(Self: not null access Gtk_Container_Record;
Call: Cb_Gtk_Container_Gtk_Widget_Void;
After: Boolean := False);

On_Remove

procedure On_Remove 
(Self: not null access Gtk_Container_Record;
Call: Cb_GObject_Gtk_Widget_Void;
Slot: not null access Glib.Object.GObject_Record'Class;
After: Boolean := False);

On_Set_Focus_Child

procedure On_Set_Focus_Child 
(Self: not null access Gtk_Container_Record;
Call: Cb_Gtk_Container_Gtk_Widget_Void;
After: Boolean := False);

On_Set_Focus_Child

procedure On_Set_Focus_Child 
(Self: not null access Gtk_Container_Record;
Call: Cb_GObject_Gtk_Widget_Void;
Slot: not null access Glib.Object.GObject_Record'Class;
After: Boolean := False);