1. ------------------------------------------------------------------------------ 
  2. --                                                                          -- 
  3. --      Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet       -- 
  4. --                     Copyright (C) 2000-2014, AdaCore                     -- 
  5. --                                                                          -- 
  6. -- This library is free software;  you can redistribute it and/or modify it -- 
  7. -- under terms of the  GNU General Public License  as published by the Free -- 
  8. -- Software  Foundation;  either version 3,  or (at your  option) any later -- 
  9. -- version. This library is distributed in the hope that it will be useful, -- 
  10. -- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- -- 
  11. -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.                            -- 
  12. --                                                                          -- 
  13. -- As a special exception under Section 7 of GPL version 3, you are granted -- 
  14. -- additional permissions described in the GCC Runtime Library Exception,   -- 
  15. -- version 3.1, as published by the Free Software Foundation.               -- 
  16. --                                                                          -- 
  17. -- You should have received a copy of the GNU General Public License and    -- 
  18. -- a copy of the GCC Runtime Library Exception along with this program;     -- 
  19. -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    -- 
  20. -- <http://www.gnu.org/licenses/>.                                          -- 
  21. --                                                                          -- 
  22. ------------------------------------------------------------------------------ 
  23.  
  24. --  <description> 
  25. --  A GTK+ user interface is constructed by nesting widgets inside widgets. 
  26. --  Container widgets are the inner nodes in the resulting tree of widgets: 
  27. --  they contain other widgets. So, for example, you might have a 
  28. --  Gtk.Window.Gtk_Window containing a Gtk.Frame.Gtk_Frame containing a 
  29. --  Gtk.Label.Gtk_Label. If you wanted an image instead of a textual label 
  30. --  inside the frame, you might replace the Gtk.Label.Gtk_Label widget with a 
  31. --  Gtk.Image.Gtk_Image widget. 
  32. -- 
  33. --  There are two major kinds of container widgets in GTK+. Both are 
  34. --  subclasses of the abstract GtkContainer base class. 
  35. -- 
  36. --  The first type of container widget has a single child widget and derives 
  37. --  from Gtk.Bin.Gtk_Bin. These containers are *decorators*, which add some 
  38. --  kind of functionality to the child. For example, a Gtk.Button.Gtk_Button 
  39. --  makes its child into a clickable button; a Gtk.Frame.Gtk_Frame draws a 
  40. --  frame around its child and a Gtk.Window.Gtk_Window places its child widget 
  41. --  inside a top-level window. 
  42. -- 
  43. --  The second type of container can have more than one child; its purpose is 
  44. --  to manage *layout*. This means that these containers assign sizes and 
  45. --  positions to their children. For example, a Gtk.Box.Gtk_Hbox arranges its 
  46. --  children in a horizontal row, and a Gtk.Grid.Gtk_Grid arranges the widgets 
  47. --  it contains in a two-dimensional grid. 
  48. -- 
  49. --  == Height for width geometry management == 
  50. -- 
  51. --  GTK+ uses a height-for-width (and width-for-height) geometry management 
  52. --  system. Height-for-width means that a widget can change how much vertical 
  53. --  space it needs, depending on the amount of horizontal space that it is 
  54. --  given (and similar for width-for-height). 
  55. -- 
  56. --  There are some things to keep in mind when implementing container widgets 
  57. --  that make use of GTK+'s height for width geometry management system. First, 
  58. --  it's important to note that a container must prioritize one of its 
  59. --  dimensions, that is to say that a widget or container can only have a 
  60. --  Gtk.Enums.Gtk_Size_Request_Mode that is Gtk.Enums.Height_For_Width or 
  61. --  Gtk.Enums.Width_For_Height. However, every widget and container must be 
  62. --  able to respond to the APIs for both dimensions, i.e. even if a widget has 
  63. --  a request mode that is height-for-width, it is possible that its parent 
  64. --  will request its sizes using the width-for-height APIs. 
  65. -- 
  66. --  To ensure that everything works properly, here are some guidelines to 
  67. --  follow when implementing height-for-width (or width-for-height) containers. 
  68. -- 
  69. --  Each request mode involves 2 virtual methods. Height-for-width apis run 
  70. --  through Gtk.Widget.Get_Preferred_Width and then through 
  71. --  Gtk.Widget.Get_Preferred_Height_For_Width. When handling requests in the 
  72. --  opposite Gtk.Enums.Gtk_Size_Request_Mode it is important that every widget 
  73. --  request at least enough space to display all of its content at all times. 
  74. -- 
  75. --  When Gtk.Widget.Get_Preferred_Height is called on a container that is 
  76. --  height-for-width, the container must return the height for its minimum 
  77. --  width. This is easily achieved by simply calling the reverse apis 
  78. --  implemented for itself as follows: 
  79. -- 
  80. --    static void 
  81. --    foo_container_get_preferred_height (GtkWidget *widget, gint *min_height, gint *nat_height) 
  82. --    { 
  83. --       if (i_am_in_height_for_width_mode) 
  84. --       { 
  85. --          gint min_width; 
  86. --          GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, &min_width, NULL); 
  87. --          GTK_WIDGET_GET_CLASS (widget)->get_preferred_height_for_width (widget, min_width, 
  88. --             min_height, nat_height); 
  89. --       } 
  90. --    else 
  91. --       { 
  92. --          ... many containers support both request modes, execute the real width-for-height 
  93. --          request here by returning the collective heights of all widgets that are 
  94. --          stacked vertically (or whatever is appropriate for this container) ... 
  95. --       } 
  96. --    } 
  97. -- 
  98. --  Similarly, when Gtk.Widget.Get_Preferred_Width_For_Height is called for a 
  99. --  container or widget that is height-for-width, it then only needs to return 
  100. --  the base minimum width like so: 
  101. -- 
  102. --    static void 
  103. --    foo_container_get_preferred_width_for_height (GtkWidget *widget, gint for_height, 
  104. --       gint *min_width, gint *nat_width) 
  105. --    { 
  106. --       if (i_am_in_height_for_width_mode) 
  107. --       { 
  108. --          GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, min_width, nat_width); 
  109. --       } 
  110. --    else 
  111. --       { 
  112. --          ... execute the real width-for-height request here based on the required width 
  113. --          of the children collectively if the container were to be allocated the said height ... 
  114. --       } 
  115. --    } 
  116. -- 
  117. --  Height for width requests are generally implemented in terms of a virtual 
  118. --  allocation of widgets in the input orientation. Assuming an 
  119. --  height-for-width request mode, a container would implement the 
  120. --  <function>get_preferred_height_for_width</function> virtual function by 
  121. --  first calling Gtk.Widget.Get_Preferred_Width for each of its children. 
  122. -- 
  123. --  For each potential group of children that are lined up horizontally, the 
  124. --  values returned by Gtk.Widget.Get_Preferred_Width should be collected in an 
  125. --  array of Gtk_Requested_Size structures. Any child spacing should be removed 
  126. --  from the input For_Width and then the collective size should be allocated 
  127. --  using the gtk_distribute_natural_allocation convenience function. 
  128. -- 
  129. --  The container will then move on to request the preferred height for each 
  130. --  child by using Gtk.Widget.Get_Preferred_Height_For_Width and using the 
  131. --  sizes stored in the Gtk_Requested_Size array. 
  132. -- 
  133. --  To allocate a height-for-width container, it's again important to consider 
  134. --  that a container must prioritize one dimension over the other. So if a 
  135. --  container is a height-for-width container it must first allocate all 
  136. --  widgets horizontally using a Gtk_Requested_Size array and 
  137. --  gtk_distribute_natural_allocation and then add any extra space (if and 
  138. --  where appropriate) for the widget to expand. 
  139. -- 
  140. --  After adding all the expand space, the container assumes it was allocated 
  141. --  sufficient height to fit all of its content. At this time, the container 
  142. --  must use the total horizontal sizes of each widget to request the 
  143. --  height-for-width of each of its children and store the requests in a 
  144. --  Gtk_Requested_Size array for any widgets that stack vertically (for tabular 
  145. --  containers this can be generalized into the heights and widths of rows and 
  146. --  columns). The vertical space must then again be distributed using 
  147. --  gtk_distribute_natural_allocation while this time considering the allocated 
  148. --  height of the widget minus any vertical spacing that the container adds. 
  149. --  Then vertical expand space should be added where appropriate and available 
  150. --  and the container should go on to actually allocating the child widgets. 
  151. -- 
  152. --  See <link linkend="geometry-management">GtkWidget's geometry management 
  153. --  section</link> to learn more about implementing height-for-width geometry 
  154. --  management for widgets. 
  155. -- 
  156. --  == Child properties == 
  157. -- 
  158. --  GtkContainer introduces *child properties*. These are object properties 
  159. --  that are not specific to either the container or the contained widget, but 
  160. --  rather to their relation. Typical examples of child properties are the 
  161. --  position or pack-type of a widget which is contained in a Gtk.Box.Gtk_Box. 
  162. -- 
  163. --  Use gtk_container_class_install_child_property to install child properties 
  164. --  for a container class and gtk_container_class_find_child_property or 
  165. --  gtk_container_class_list_child_properties to get information about existing 
  166. --  child properties. 
  167. -- 
  168. --  To set the value of a child property, use 
  169. --  Gtk.Container.Child_Set_Property, gtk_container_child_set or 
  170. --  gtk_container_child_set_valist. To obtain the value of a child property, 
  171. --  use Gtk.Container.Child_Get_Property, gtk_container_child_get or 
  172. --  gtk_container_child_get_valist. To emit notification about child property 
  173. --  changes, use Gtk.Widget.Child_Notify. 
  174. -- 
  175. --  == GtkContainer as GtkBuildable == 
  176. -- 
  177. --  The GtkContainer implementation of the GtkBuildable interface supports a 
  178. --  <packing> element for children, which can contain multiple <property> 
  179. --  elements that specify child properties for the child. 
  180. -- 
  181. --  == Child properties in UI definitions == 
  182. -- 
  183. --    <object class="GtkVBox"> 
  184. --    <child> 
  185. --    <object class="GtkLabel"/> 
  186. --    <packing> 
  187. --    <property name="pack-type">start</property> 
  188. --    </packing> 
  189. --    </child> 
  190. --    </object> 
  191. --  Since 2.16, child properties can also be marked as translatable using the 
  192. --  same "translatable", "comments" and "context" attributes that are used for 
  193. --  regular properties. 
  194. -- 
  195. -- 
  196. --  </description> 
  197. pragma Ada_2005; 
  198.  
  199. pragma Warnings (Off, "*is already use-visible*"); 
  200. with Cairo;           use Cairo; 
  201. with Glib;            use Glib; 
  202. with Glib.Object;     use Glib.Object; 
  203. with Glib.Properties; use Glib.Properties; 
  204. with Glib.Types;      use Glib.Types; 
  205. with Glib.Values;     use Glib.Values; 
  206. with Gtk.Adjustment;  use Gtk.Adjustment; 
  207. with Gtk.Buildable;   use Gtk.Buildable; 
  208. with Gtk.Enums;       use Gtk.Enums; 
  209. with Gtk.Widget;      use Gtk.Widget; 
  210.  
  211. package Gtk.Container is 
  212.  
  213.    type Gtk_Container_Record is new Gtk_Widget_Record with null record; 
  214.    type Gtk_Container is access all Gtk_Container_Record'Class; 
  215.  
  216.    --------------- 
  217.    -- Callbacks -- 
  218.    --------------- 
  219.  
  220.    type Gtk_Callback is access procedure 
  221.      (Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class); 
  222.    --  The type of the callback functions used for e.g. iterating over the 
  223.    --  children of a container, see gtk_container_foreach. 
  224.    --  "widget": the widget to operate on 
  225.  
  226.    ------------------ 
  227.    -- Constructors -- 
  228.    ------------------ 
  229.  
  230.    function Get_Type return Glib.GType; 
  231.    pragma Import (C, Get_Type, "gtk_container_get_type"); 
  232.  
  233.    ------------- 
  234.    -- Methods -- 
  235.    ------------- 
  236.  
  237.    procedure Add 
  238.       (Container : not null access Gtk_Container_Record; 
  239.        Widget    : not null access Gtk.Widget.Gtk_Widget_Record'Class); 
  240.    --  Adds Widget to Container. Typically used for simple containers such as 
  241.    --  Gtk.Window.Gtk_Window, Gtk.Frame.Gtk_Frame, or Gtk.Button.Gtk_Button; 
  242.    --  for more complicated layout containers such as Gtk.Box.Gtk_Box or 
  243.    --  Gtk.Grid.Gtk_Grid, this function will pick default packing parameters 
  244.    --  that may not be correct. So consider functions such as 
  245.    --  Gtk.Box.Pack_Start and Gtk.Grid.Attach as an alternative to 
  246.    --  Gtk.Container.Add in those cases. A widget may be added to only one 
  247.    --  container at a time; you can't place the same widget inside two 
  248.    --  different containers. 
  249.    --  "widget": a widget to be placed inside Container 
  250.  
  251.    procedure Check_Resize (Container : not null access Gtk_Container_Record); 
  252.  
  253.    procedure Child_Get_Property 
  254.       (Container     : not null access Gtk_Container_Record; 
  255.        Child         : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  256.        Property_Name : UTF8_String; 
  257.        Value         : in out Glib.Values.GValue); 
  258.    --  Gets the value of a child property for Child and Container. 
  259.    --  "child": a widget which is a child of Container 
  260.    --  "property_name": the name of the property to get 
  261.    --  "value": a location to return the value 
  262.  
  263.    procedure Child_Set_Property 
  264.       (Container     : not null access Gtk_Container_Record; 
  265.        Child         : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  266.        Property_Name : UTF8_String; 
  267.        Value         : Glib.Values.GValue); 
  268.    --  Sets a child property for Child and Container. 
  269.    --  "child": a widget which is a child of Container 
  270.    --  "property_name": the name of the property to set 
  271.    --  "value": the value to set the property to 
  272.  
  273.    procedure Child_Notify 
  274.       (Container      : not null access Gtk_Container_Record; 
  275.        Child          : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  276.        Child_Property : UTF8_String); 
  277.    --  Emits a Gtk.Widget.Gtk_Widget::child-notify signal for the <link 
  278.    --  linkend="child-properties">child property</link> Child_Property on 
  279.    --  widget. 
  280.    --  This is an analogue of g_object_notify for child properties. 
  281.    --  Also see Gtk.Widget.Child_Notify. 
  282.    --  Since: gtk+ 3.2 
  283.    --  "child": the child widget 
  284.    --  "child_property": the name of a child property installed on the class 
  285.    --  of Container 
  286.  
  287.    function Child_Type 
  288.       (Container : not null access Gtk_Container_Record) return GType; 
  289.    --  Returns the type of the children supported by the container. 
  290.    --  Note that this may return G_TYPE_NONE to indicate that no more children 
  291.    --  can be added, e.g. for a Gtk.Paned.Gtk_Paned which already has two 
  292.    --  children. 
  293.  
  294.    procedure Forall 
  295.       (Container : not null access Gtk_Container_Record; 
  296.        Callback  : Gtk_Callback); 
  297.    --  Invokes Callback on each child of Container, including children that 
  298.    --  are considered "internal" (implementation details of the container). 
  299.    --  "Internal" children generally weren't added by the user of the 
  300.    --  container, but were added by the container implementation itself. Most 
  301.    --  applications should use Gtk.Container.Foreach, rather than 
  302.    --  Gtk.Container.Forall. 
  303.    --  "callback": a callback 
  304.  
  305.    generic 
  306.       type User_Data_Type (<>) is private; 
  307.       with procedure Destroy (Data : in out User_Data_Type) is null; 
  308.    package Forall_User_Data is 
  309.  
  310.       type Gtk_Callback is access procedure 
  311.         (Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  312.          Data   : User_Data_Type); 
  313.       --  The type of the callback functions used for e.g. iterating over the 
  314.       --  children of a container, see gtk_container_foreach. 
  315.       --  "widget": the widget to operate on 
  316.       --  "data": user-supplied data 
  317.  
  318.       procedure Forall 
  319.          (Container     : not null access Gtk.Container.Gtk_Container_Record'Class; 
  320.           Callback      : Gtk_Callback; 
  321.           Callback_Data : User_Data_Type); 
  322.       --  Invokes Callback on each child of Container, including children that 
  323.       --  are considered "internal" (implementation details of the container). 
  324.       --  "Internal" children generally weren't added by the user of the 
  325.       --  container, but were added by the container implementation itself. 
  326.       --  Most applications should use Gtk.Container.Foreach, rather than 
  327.       --  Gtk.Container.Forall. 
  328.       --  "callback": a callback 
  329.       --  "callback_data": callback user data 
  330.  
  331.    end Forall_User_Data; 
  332.  
  333.    procedure Foreach 
  334.       (Container : not null access Gtk_Container_Record; 
  335.        Callback  : Gtk_Callback); 
  336.    --  Invokes Callback on each non-internal child of Container. See 
  337.    --  Gtk.Container.Forall for details on what constitutes an "internal" 
  338.    --  child. Most applications should use Gtk.Container.Foreach, rather than 
  339.    --  Gtk.Container.Forall. 
  340.    --  "callback": a callback 
  341.  
  342.    generic 
  343.       type User_Data_Type (<>) is private; 
  344.       with procedure Destroy (Data : in out User_Data_Type) is null; 
  345.    package Foreach_User_Data is 
  346.  
  347.       type Gtk_Callback is access procedure 
  348.         (Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  349.          Data   : User_Data_Type); 
  350.       --  The type of the callback functions used for e.g. iterating over the 
  351.       --  children of a container, see Gtk.Container.Foreach. 
  352.       --  "widget": the widget to operate on 
  353.       --  "data": user-supplied data 
  354.  
  355.       procedure Foreach 
  356.          (Container     : not null access Gtk.Container.Gtk_Container_Record'Class; 
  357.           Callback      : Gtk_Callback; 
  358.           Callback_Data : User_Data_Type); 
  359.       --  Invokes Callback on each non-internal child of Container. See 
  360.       --  Gtk.Container.Forall for details on what constitutes an "internal" 
  361.       --  child. Most applications should use Gtk.Container.Foreach, rather 
  362.       --  than Gtk.Container.Forall. 
  363.       --  "callback": a callback 
  364.       --  "callback_data": callback user data 
  365.  
  366.    end Foreach_User_Data; 
  367.  
  368.    function Get_Border_Width 
  369.       (Container : not null access Gtk_Container_Record) return Guint; 
  370.    --  Retrieves the border width of the container. See 
  371.    --  Gtk.Container.Set_Border_Width. 
  372.  
  373.    procedure Set_Border_Width 
  374.       (Container    : not null access Gtk_Container_Record; 
  375.        Border_Width : Guint); 
  376.    --  Sets the border width of the container. 
  377.    --  The border width of a container is the amount of space to leave around 
  378.    --  the outside of the container. The only exception to this is 
  379.    --  Gtk.Window.Gtk_Window; because toplevel windows can't leave space 
  380.    --  outside, they leave the space inside. The border is added on all sides 
  381.    --  of the container. To add space to only one side, one approach is to 
  382.    --  create a Gtk.Alignment.Gtk_Alignment widget, call 
  383.    --  Gtk.Widget.Set_Size_Request to give it a size, and place it on the side 
  384.    --  of the container as a spacer. 
  385.    --  "border_width": amount of blank space to leave *outside* the container. 
  386.    --  Valid values are in the range 0-65535 pixels. 
  387.  
  388.    function Get_Children 
  389.       (Container : not null access Gtk_Container_Record) 
  390.        return Gtk.Widget.Widget_List.Glist; 
  391.    --  Returns the container's non-internal children. See Gtk.Container.Forall 
  392.    --  for details on what constitutes an "internal" child. 
  393.  
  394.    function Get_Focus_Child 
  395.       (Container : not null access Gtk_Container_Record) 
  396.        return Gtk.Widget.Gtk_Widget; 
  397.    --  Returns the current focus child widget inside Container. This is not 
  398.    --  the currently focused widget. That can be obtained by calling 
  399.    --  Gtk.Window.Get_Focus. 
  400.    --  Since: gtk+ 2.14 
  401.  
  402.    procedure Set_Focus_Child 
  403.       (Container : not null access Gtk_Container_Record; 
  404.        Child     : access Gtk.Widget.Gtk_Widget_Record'Class); 
  405.    --  Sets, or unsets if Child is null, the focused child of Container. 
  406.    --  This function emits the GtkContainer::set_focus_child signal of 
  407.    --  Container. Implementations of Gtk.Container.Gtk_Container can override 
  408.    --  the default behaviour by overriding the class closure of this signal. 
  409.    --  This is function is mostly meant to be used by widgets. Applications 
  410.    --  can use Gtk.Widget.Grab_Focus to manualy set the focus to a specific 
  411.    --  widget. 
  412.    --  "child": a Gtk.Widget.Gtk_Widget, or null 
  413.  
  414.    function Get_Focus_Hadjustment 
  415.       (Container : not null access Gtk_Container_Record) 
  416.        return Gtk.Adjustment.Gtk_Adjustment; 
  417.    --  Retrieves the horizontal focus adjustment for the container. See 
  418.    --  gtk_container_set_focus_hadjustment (). 
  419.  
  420.    procedure Set_Focus_Hadjustment 
  421.       (Container  : not null access Gtk_Container_Record; 
  422.        Adjustment : not null access Gtk.Adjustment.Gtk_Adjustment_Record'Class); 
  423.    --  Hooks up an adjustment to focus handling in a container, so when a 
  424.    --  child of the container is focused, the adjustment is scrolled to show 
  425.    --  that widget. This function sets the horizontal alignment. See 
  426.    --  Gtk.Scrolled_Window.Get_Hadjustment for a typical way of obtaining the 
  427.    --  adjustment and Gtk.Container.Set_Focus_Vadjustment for setting the 
  428.    --  vertical adjustment. 
  429.    --  The adjustments have to be in pixel units and in the same coordinate 
  430.    --  system as the allocation for immediate children of the container. 
  431.    --  "adjustment": an adjustment which should be adjusted when the focus is 
  432.    --  moved among the descendents of Container 
  433.  
  434.    function Get_Focus_Vadjustment 
  435.       (Container : not null access Gtk_Container_Record) 
  436.        return Gtk.Adjustment.Gtk_Adjustment; 
  437.    --  Retrieves the vertical focus adjustment for the container. See 
  438.    --  Gtk.Container.Set_Focus_Vadjustment. 
  439.  
  440.    procedure Set_Focus_Vadjustment 
  441.       (Container  : not null access Gtk_Container_Record; 
  442.        Adjustment : not null access Gtk.Adjustment.Gtk_Adjustment_Record'Class); 
  443.    --  Hooks up an adjustment to focus handling in a container, so when a 
  444.    --  child of the container is focused, the adjustment is scrolled to show 
  445.    --  that widget. This function sets the vertical alignment. See 
  446.    --  Gtk.Scrolled_Window.Get_Vadjustment for a typical way of obtaining the 
  447.    --  adjustment and Gtk.Container.Set_Focus_Hadjustment for setting the 
  448.    --  horizontal adjustment. 
  449.    --  The adjustments have to be in pixel units and in the same coordinate 
  450.    --  system as the allocation for immediate children of the container. 
  451.    --  "adjustment": an adjustment which should be adjusted when the focus is 
  452.    --  moved among the descendents of Container 
  453.  
  454.    function Get_Path_For_Child 
  455.       (Container : not null access Gtk_Container_Record; 
  456.        Child     : not null access Gtk.Widget.Gtk_Widget_Record'Class) 
  457.        return Gtk.Widget.Gtk_Widget_Path; 
  458.    --  Returns a newly created widget path representing all the widget 
  459.    --  hierarchy from the toplevel down to and including Child. 
  460.    --  "child": a child of Container 
  461.  
  462.    function Get_Resize_Mode 
  463.       (Container : not null access Gtk_Container_Record) 
  464.        return Gtk.Enums.Gtk_Resize_Mode; 
  465.    --  Returns the resize mode for the container. See 
  466.    --  gtk_container_set_resize_mode (). 
  467.  
  468.    procedure Set_Resize_Mode 
  469.       (Container   : not null access Gtk_Container_Record; 
  470.        Resize_Mode : Gtk.Enums.Gtk_Resize_Mode); 
  471.    --  Sets the resize mode for the container. 
  472.    --  The resize mode of a container determines whether a resize request will 
  473.    --  be passed to the container's parent, queued for later execution or 
  474.    --  executed immediately. 
  475.    --  "resize_mode": the new resize mode 
  476.  
  477.    procedure Propagate_Draw 
  478.       (Container : not null access Gtk_Container_Record; 
  479.        Child     : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  480.        Cr        : Cairo.Cairo_Context); 
  481.    --  When a container receives a call to the draw function, it must send 
  482.    --  synthetic Gtk.Widget.Gtk_Widget::draw calls to all children that don't 
  483.    --  have their own Gdk_Windows. This function provides a convenient way of 
  484.    --  doing this. A container, when it receives a call to its 
  485.    --  Gtk.Widget.Gtk_Widget::draw function, calls Gtk.Container.Propagate_Draw 
  486.    --  once for each child, passing in the Cr the container received. 
  487.    --  Gtk.Container.Propagate_Draw takes care of translating the origin of 
  488.    --  Cr, and deciding whether the draw needs to be sent to the child. It is a 
  489.    --  convenient and optimized way of getting the same effect as calling 
  490.    --  Gtk.Widget.Draw on the child directly. 
  491.    --  In most cases, a container can simply either inherit the 
  492.    --  Gtk.Widget.Gtk_Widget::draw implementation from 
  493.    --  Gtk.Container.Gtk_Container, or do some drawing and then chain to the 
  494.    --  ::draw implementation from Gtk.Container.Gtk_Container. 
  495.    --  "child": a child of Container 
  496.    --  "cr": Cairo context as passed to the container. If you want to use Cr 
  497.    --  in container's draw function, consider using cairo_save and 
  498.    --  cairo_restore before calling this function. 
  499.  
  500.    procedure Remove 
  501.       (Container : not null access Gtk_Container_Record; 
  502.        Widget    : not null access Gtk.Widget.Gtk_Widget_Record'Class); 
  503.    --  Removes Widget from Container. Widget must be inside Container. Note 
  504.    --  that Container will own a reference to Widget, and that this may be the 
  505.    --  last reference held; so removing a widget from its container can destroy 
  506.    --  that widget. If you want to use Widget again, you need to add a 
  507.    --  reference to it while it's not inside a container, using g_object_ref. 
  508.    --  If you don't want to use Widget again it's usually more efficient to 
  509.    --  simply destroy it directly using Gtk.Widget.Destroy since this will 
  510.    --  remove it from the container and help break any circular reference count 
  511.    --  cycles. 
  512.    --  "widget": a current child of Container 
  513.  
  514.    procedure Resize_Children 
  515.       (Container : not null access Gtk_Container_Record); 
  516.  
  517.    procedure Set_Focus_Chain 
  518.       (Container         : not null access Gtk_Container_Record; 
  519.        Focusable_Widgets : Gtk.Widget.Widget_List.Glist); 
  520.    --  Sets a focus chain, overriding the one computed automatically by GTK+. 
  521.    --  In principle each widget in the chain should be a descendant of the 
  522.    --  container, but this is not enforced by this method, since it's allowed 
  523.    --  to set the focus chain before you pack the widgets, or have a widget in 
  524.    --  the chain that isn't always packed. The necessary checks are done when 
  525.    --  the focus chain is actually traversed. 
  526.    --  "focusable_widgets": the new focus chain 
  527.  
  528.    procedure Set_Reallocate_Redraws 
  529.       (Container     : not null access Gtk_Container_Record; 
  530.        Needs_Redraws : Boolean); 
  531.    --  Sets the Reallocate_Redraws flag of the container to the given value. 
  532.    --  Containers requesting reallocation redraws get automatically redrawn if 
  533.    --  any of their children changed allocation. 
  534.    --  "needs_redraws": the new value for the container's Reallocate_Redraws 
  535.    --  flag 
  536.  
  537.    procedure Unset_Focus_Chain 
  538.       (Container : not null access Gtk_Container_Record); 
  539.    --  Removes a focus chain explicitly set with 
  540.    --  Gtk.Container.Set_Focus_Chain. 
  541.  
  542.    ---------------- 
  543.    -- Properties -- 
  544.    ---------------- 
  545.    --  The following properties are defined for this widget. See 
  546.    --  Glib.Properties for more information on properties) 
  547.  
  548.    Border_Width_Property : constant Glib.Properties.Property_Uint; 
  549.  
  550.    Child_Property : constant Glib.Properties.Property_Object; 
  551.    --  Type: Gtk.Widget.Gtk_Widget 
  552.    --  Flags: write 
  553.  
  554.    Resize_Mode_Property : constant Gtk.Enums.Property_Gtk_Resize_Mode; 
  555.  
  556.    ------------- 
  557.    -- Signals -- 
  558.    ------------- 
  559.  
  560.    type Cb_Gtk_Container_Gtk_Widget_Void is not null access procedure 
  561.      (Self   : access Gtk_Container_Record'Class; 
  562.       Object : not null access Gtk.Widget.Gtk_Widget_Record'Class); 
  563.  
  564.    type Cb_GObject_Gtk_Widget_Void is not null access procedure 
  565.      (Self   : access Glib.Object.GObject_Record'Class; 
  566.       Object : not null access Gtk.Widget.Gtk_Widget_Record'Class); 
  567.  
  568.    Signal_Add : constant Glib.Signal_Name := "add"; 
  569.    procedure On_Add 
  570.       (Self  : not null access Gtk_Container_Record; 
  571.        Call  : Cb_Gtk_Container_Gtk_Widget_Void; 
  572.        After : Boolean := False); 
  573.    procedure On_Add 
  574.       (Self  : not null access Gtk_Container_Record; 
  575.        Call  : Cb_GObject_Gtk_Widget_Void; 
  576.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  577.        After : Boolean := False); 
  578.  
  579.    type Cb_Gtk_Container_Void is not null access procedure (Self : access Gtk_Container_Record'Class); 
  580.  
  581.    type Cb_GObject_Void is not null access procedure 
  582.      (Self : access Glib.Object.GObject_Record'Class); 
  583.  
  584.    Signal_Check_Resize : constant Glib.Signal_Name := "check-resize"; 
  585.    procedure On_Check_Resize 
  586.       (Self  : not null access Gtk_Container_Record; 
  587.        Call  : Cb_Gtk_Container_Void; 
  588.        After : Boolean := False); 
  589.    procedure On_Check_Resize 
  590.       (Self  : not null access Gtk_Container_Record; 
  591.        Call  : Cb_GObject_Void; 
  592.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  593.        After : Boolean := False); 
  594.  
  595.    Signal_Remove : constant Glib.Signal_Name := "remove"; 
  596.    procedure On_Remove 
  597.       (Self  : not null access Gtk_Container_Record; 
  598.        Call  : Cb_Gtk_Container_Gtk_Widget_Void; 
  599.        After : Boolean := False); 
  600.    procedure On_Remove 
  601.       (Self  : not null access Gtk_Container_Record; 
  602.        Call  : Cb_GObject_Gtk_Widget_Void; 
  603.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  604.        After : Boolean := False); 
  605.  
  606.    Signal_Set_Focus_Child : constant Glib.Signal_Name := "set-focus-child"; 
  607.    procedure On_Set_Focus_Child 
  608.       (Self  : not null access Gtk_Container_Record; 
  609.        Call  : Cb_Gtk_Container_Gtk_Widget_Void; 
  610.        After : Boolean := False); 
  611.    procedure On_Set_Focus_Child 
  612.       (Self  : not null access Gtk_Container_Record; 
  613.        Call  : Cb_GObject_Gtk_Widget_Void; 
  614.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  615.        After : Boolean := False); 
  616.  
  617.    ---------------- 
  618.    -- Interfaces -- 
  619.    ---------------- 
  620.    --  This class implements several interfaces. See Glib.Types 
  621.    -- 
  622.    --  - "Buildable" 
  623.  
  624.    package Implements_Gtk_Buildable is new Glib.Types.Implements 
  625.      (Gtk.Buildable.Gtk_Buildable, Gtk_Container_Record, Gtk_Container); 
  626.    function "+" 
  627.      (Widget : access Gtk_Container_Record'Class) 
  628.    return Gtk.Buildable.Gtk_Buildable 
  629.    renames Implements_Gtk_Buildable.To_Interface; 
  630.    function "-" 
  631.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  632.    return Gtk_Container 
  633.    renames Implements_Gtk_Buildable.To_Object; 
  634.  
  635. private 
  636.    Resize_Mode_Property : constant Gtk.Enums.Property_Gtk_Resize_Mode := 
  637.      Gtk.Enums.Build ("resize-mode"); 
  638.    Child_Property : constant Glib.Properties.Property_Object := 
  639.      Glib.Properties.Build ("child"); 
  640.    Border_Width_Property : constant Glib.Properties.Property_Uint := 
  641.      Glib.Properties.Build ("border-width"); 
  642. end Gtk.Container;