/src/wrappers/gtk/library/gtk_container.e

http://github.com/tybor/Liberty · Specman e · 486 lines · 86 code · 128 blank · 272 comment · 2 complexity · 4af2f0e60056f37b06c4871a02ac7ef2 MD5 · raw file

  1. indexing
  2. description: "GtkContainer -- Base class for widgets which contain other widgets"
  3. copyright: "[
  4. Copyright (C) 2006 eiffel-libraries team, GTK+ team
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public License
  7. as published by the Free Software Foundation; either version 2.1 of
  8. the License, or (at your option) any later version.
  9. This library is distributed in the hope that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  16. 02110-1301 USA
  17. ]"
  18. -- TODO: add long description from GTK docs
  19. deferred class GTK_CONTAINER
  20. inherit GTK_WIDGET
  21. -- Implemented Interfaces: GtkContainer implements
  22. -- AtkImplementorIface.
  23. insert GTK_CONTAINER_EXTERNALS
  24. feature
  25. add (a_widget: GTK_WIDGET) is
  26. -- Adds widget to container. Typically used for simple
  27. -- containers such as GtkWindow, GtkFrame, or GtkButton; for
  28. -- more complicated layout containers such as GtkBox or
  29. -- GtkTable, this function will pick default packing
  30. -- parameters that may not be correct. So consider functions
  31. -- such as gtk_box_pack_start() and gtk_table_attach() as an
  32. -- alternative to gtk_container_add() in those cases. A
  33. -- widget may be added to only one container at a time; you
  34. -- can't place the same widget inside two different
  35. -- containers.
  36. require valid_widget: a_widget /= Void
  37. do
  38. gtk_container_add (handle, a_widget.handle)
  39. end
  40. remove (a_widget: GTK_WIDGET) is
  41. -- Removes widget from container. widget must be inside
  42. -- container. Note that container will own a reference to
  43. -- widget, and that this may be the last reference held; so
  44. -- removing a widget from its container can destroy that
  45. -- widget. If you want to use widget again, you need to add a
  46. -- reference to it while it's not inside a container, using
  47. -- g_object_ref(). If you don't want to use widget again it's
  48. -- usually more efficient to simply destroy it directly using
  49. -- gtk_widget_destroy() since this will remove it from the
  50. -- container and help break any circular reference count
  51. -- cycles.
  52. require
  53. valid_widget: a_widget /= Void
  54. widget_contained: True -- TODO: has (a_widget)
  55. do
  56. gtk_container_remove (handle, a_widget.handle)
  57. end
  58. -- TODO: (since it's variadic) gtk_container_add_with_properties ()
  59. -- void gtk_container_add_with_properties (GtkContainer *container,
  60. -- GtkWidget *widget, const gchar *first_prop_name, ...);
  61. -- Adds widget to container, setting child properties at the same
  62. -- time. See gtk_container_add() and gtk_container_child_set() for
  63. -- more details.
  64. -- container : a GtkContainer
  65. -- widget : a widget to be placed inside container
  66. -- first_prop_name : the name of the first child property to set
  67. -- ... : a NULL-terminated list of property names and values, starting with first_prop_name.
  68. resize_mode: INTEGER is
  69. -- the resize mode for the container. See set_resize_mode.
  70. do
  71. Result:= gtk_container_get_resize_mode (handle)
  72. end
  73. is_resize_parent: BOOLEAN is
  74. -- Is resize request passed to the parent?
  75. do
  76. Result := (resize_mode = gtk_resize_parent)
  77. end
  78. is_resize_queue: BOOLEAN is
  79. -- Is resizes on this widget queued?
  80. do
  81. Result := (resize_mode = gtk_resize_queue)
  82. end
  83. set_resize_mode (a_mode: INTEGER) is
  84. -- Sets the resize mode for the container. The resize mode
  85. -- of a container determines whether a resize request will be
  86. -- passed to the container's parent or queued for later
  87. -- execution.
  88. require valid_mode: is_valid_gtk_resize_mode (a_mode)
  89. do
  90. gtk_container_set_resize_mode (handle, a_mode)
  91. end
  92. check_resize is
  93. -- TODO: undocumented in GTK+ documentation
  94. do
  95. gtk_container_check_resize (handle)
  96. end
  97. set_border_width (a_width: INTEGER) is
  98. require
  99. a_width.in_range(0, 65535)
  100. do
  101. gtk_container_set_border_width (handle, a_width)
  102. ensure
  103. border_width = a_width
  104. end
  105. border_width: INTEGER is
  106. do
  107. Result := gtk_container_get_border_width (handle)
  108. end
  109. -- TODO: wrap gtk_container_foreach ()
  110. -- void gtk_container_foreach (GtkContainer *container, GtkCallback
  111. -- callback, gpointer callback_data);
  112. -- Invokes callback on each non-internal child of container. See
  113. -- gtk_container_forall() for details on what constitutes an
  114. -- "internal" child. Most applications should use
  115. -- gtk_container_foreach(), rather than gtk_container_forall().
  116. -- container : a GtkContainer
  117. -- callback : a callback
  118. -- callback_data : callback user data
  119. children: G_LIST [GTK_WIDGET] is
  120. -- container's non-internal children. See `forall' for
  121. -- details on what constitutes an "internal" child.
  122. local ptr: POINTER
  123. do
  124. ptr:=gtk_container_get_children(handle)
  125. create {G_OBJECT_LIST[GTK_WIDGET]} Result.from_external_pointer (ptr)
  126. ensure result_not_void: Result/=Void
  127. end
  128. set_reallocate_redraws is
  129. -- Sets the reallocate_redraws flag of the container to the
  130. -- given value. Containers requesting reallocation redraws
  131. -- get automatically redrawn if any of their children changed
  132. -- allocation.
  133. do
  134. gtk_container_set_reallocate_redraws (handle,1)
  135. end
  136. unset_reallocate_redraws is
  137. -- Opposite of `set_reallocate_redraws'
  138. do
  139. gtk_container_set_reallocate_redraws (handle,0)
  140. end
  141. set_focus_child (a_child: GTK_WIDGET) is
  142. do
  143. gtk_container_set_focus_child (handle,a_child.handle)
  144. end
  145. -- gtk_container_get_focus_vadjustment ()
  146. -- GtkAdjustment* gtk_container_get_focus_vadjustment
  147. -- (GtkContainer *container);
  148. -- Retrieves the vertical focus adjustment for the container. See gtk_container_set_focus_vadjustment().
  149. -- container : a GtkContainer
  150. -- Returns : the vertical focus adjustment, or NULL if none has been set.
  151. -- gtk_container_set_focus_vadjustment ()
  152. -- void gtk_container_set_focus_vadjustment
  153. -- (GtkContainer *container,
  154. -- GtkAdjustment *adjustment);
  155. -- 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.
  156. -- The adjustments have to be in pixel units and in the same coordinate system as the allocation for immediate children of the container.
  157. -- container : a GtkContainer
  158. -- adjustment : an adjustment which should be adjusted when the focus is moved among the descendents of container
  159. -- gtk_container_get_focus_hadjustment ()
  160. -- GtkAdjustment* gtk_container_get_focus_hadjustment
  161. -- (GtkContainer *container);
  162. -- Retrieves the horizontal focus adjustment for the container. See gtk_container_set_focus_hadjustment().
  163. -- container : a GtkContainer
  164. -- Returns : the horizontal focus adjustment, or NULL if none has been set.
  165. -- gtk_container_set_focus_hadjustment ()
  166. -- void gtk_container_set_focus_hadjustment
  167. -- (GtkContainer *container,
  168. -- GtkAdjustment *adjustment);
  169. -- 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.
  170. -- The adjustments have to be in pixel units and in the same coordinate system as the allocation for immediate children of the container.
  171. -- container : a GtkContainer
  172. -- adjustment : an adjustment which should be adjusted when the focus is moved among the descendents of container
  173. -- gtk_container_resize_children ()
  174. -- void gtk_container_resize_children (GtkContainer *container);
  175. -- container :
  176. -- gtk_container_child_type ()
  177. -- GType gtk_container_child_type (GtkContainer *container);
  178. -- Returns the type of the children supported by the container.
  179. -- Note that this may return G_TYPE_NONE to indicate that no more children can be added, e.g. for a GtkPaned which already has two children.
  180. -- container : a GtkContainer.
  181. -- Returns : a GType.
  182. -- Made external calls till here, the rest is TODO: Paolo 2005-12-31
  183. -- gtk_container_child_get ()
  184. -- void gtk_container_child_get (GtkContainer *container,
  185. -- GtkWidget *child,
  186. -- const gchar *first_prop_name,
  187. -- ...);
  188. -- Gets the values of one or more child properties for child and container.
  189. -- container : a GtkContainer
  190. -- child : a widget which is a child of container
  191. -- first_prop_name : the name of the first property to get
  192. -- ... : a NULL-terminated list of property names and GValue*, starting with first_prop_name.
  193. -- gtk_container_child_set ()
  194. -- void gtk_container_child_set (GtkContainer *container,
  195. -- GtkWidget *child,
  196. -- const gchar *first_prop_name,
  197. -- ...);
  198. -- Sets one or more child properties for child and container.
  199. -- container : a GtkContainer
  200. -- child : a widget which is a child of container
  201. -- first_prop_name : the name of the first property to set
  202. -- ... : a NULL-terminated list of property names and values, starting with first_prop_name.
  203. -- gtk_container_child_get_property ()
  204. -- void gtk_container_child_get_property
  205. -- (GtkContainer *container,
  206. -- GtkWidget *child,
  207. -- const gchar *property_name,
  208. -- GValue *value);
  209. -- Gets the value of a child property for child and container.
  210. -- container : a GtkContainer
  211. -- child : a widget which is a child of container
  212. -- property_name : the name of the property to get
  213. -- value : a location to return the value
  214. -- gtk_container_child_set_property ()
  215. -- void gtk_container_child_set_property
  216. -- (GtkContainer *container,
  217. -- GtkWidget *child,
  218. -- const gchar *property_name,
  219. -- const GValue *value);
  220. -- Sets a child property for child and container.
  221. -- container : a GtkContainer
  222. -- child : a widget which is a child of container
  223. -- property_name : the name of the property to set
  224. -- value : the value to set the property to
  225. -- gtk_container_child_get_valist ()
  226. -- void gtk_container_child_get_valist (GtkContainer *container,
  227. -- GtkWidget *child,
  228. -- const gchar *first_property_name,
  229. -- va_list var_args);
  230. -- Gets the values of one or more child properties for child and container.
  231. -- container : a GtkContainer
  232. -- child : a widget which is a child of container
  233. -- first_property_name : the name of the first property to get
  234. -- var_args : a NULL-terminated list of property names and GValue*, starting with first_prop_name.
  235. -- gtk_container_child_set_valist ()
  236. -- void gtk_container_child_set_valist (GtkContainer *container,
  237. -- GtkWidget *child,
  238. -- const gchar *first_property_name,
  239. -- va_list var_args);
  240. -- Sets one or more child properties for child and container.
  241. -- container : a GtkContainer
  242. -- child : a widget which is a child of container
  243. -- first_property_name : the name of the first property to set
  244. -- var_args : a NULL-terminated list of property names and values, starting with first_prop_name.
  245. -- gtk_container_forall ()
  246. -- void gtk_container_forall (GtkContainer *container,
  247. -- GtkCallback callback,
  248. -- gpointer callback_data);
  249. -- 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().
  250. -- container : a GtkContainer
  251. -- callback : a callback
  252. -- callback_data : callback user data
  253. -- gtk_container_get_border_width ()
  254. -- guint gtk_container_get_border_width (GtkContainer *container);
  255. -- Retrieves the border width of the container. See gtk_container_set_border_width().
  256. -- container : a GtkContainer
  257. -- Returns : the current border width
  258. -- gtk_container_set_border_width ()
  259. -- void gtk_container_set_border_width (GtkContainer *container,
  260. -- guint border_width);
  261. -- Sets the border width of the container.
  262. -- 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 GtkWindow; 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 GtkAlignment widget, call gtk_widget_set_usize() to give it a size, and place it on the side of the container as a spacer.
  263. -- container : a GtkContainer
  264. -- border_width : amount of blank space to leave outside the container. Valid values are in the range 0-65535 pixels.
  265. -- gtk_container_propagate_expose ()
  266. -- void gtk_container_propagate_expose (GtkContainer *container,
  267. -- GtkWidget *child,
  268. -- GdkEventExpose *event);
  269. -- When a container receives an expose event, it must send synthetic expose events to all children that don't have their own GdkWindows. This function provides a convenient way of doing this. A container, when it receives an expose event, calls gtk_container_propagate_expose() once for each child, passing in the event the container received.
  270. -- gtk_container_propagate_expose() takes care of deciding whether an expose event needs to be sent to the child, intersecting the event's area with the child area, and sending the event.
  271. -- In most cases, a container can simply either simply inherit the ::expose implementation from GtkContainer, or, do some drawing and then chain to the ::expose implementation from GtkContainer.
  272. -- container : a GtkContainer
  273. -- child : a child of container
  274. -- event : a expose event sent to container
  275. -- gtk_container_get_focus_chain ()
  276. -- gboolean gtk_container_get_focus_chain (GtkContainer *container,
  277. -- GList **focusable_widgets);
  278. -- Retrieves the focus chain of the container, if one has been set explicitly. If no focus chain has been explicitly set, GTK+ computes the focus chain based on the positions of the children. In that case, GTK+ stores NULL in focusable_widgets and returns FALSE.
  279. -- container : a GtkContainer
  280. -- focusable_widgets : location to store the focus chain of the container, or NULL. You should free this list using g_list_free() when you are done with it, however no additional reference count is added to the individual widgets in the focus chain.
  281. -- Returns : TRUE if the focus chain of the container has been set explicitly.
  282. -- gtk_container_set_focus_chain ()
  283. -- void gtk_container_set_focus_chain (GtkContainer *container,
  284. -- GList *focusable_widgets);
  285. -- Sets a focus chain, overriding the one computed automatically by GTK+.
  286. -- 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.
  287. -- container : a GtkContainer.
  288. -- focusable_widgets : the new focus chain.
  289. -- gtk_container_unset_focus_chain ()
  290. -- void gtk_container_unset_focus_chain (GtkContainer *container);
  291. -- Removes a focus chain explicitly set with gtk_container_set_focus_chain().
  292. -- container : a GtkContainer.
  293. -- gtk_container_class_find_child_property ()
  294. -- GParamSpec* gtk_container_class_find_child_property
  295. -- (GObjectClass *cclass,
  296. -- const gchar *property_name);
  297. -- Finds a child property of a container class by name.
  298. -- cclass : a GtkContainerClass
  299. -- property_name : the name of the child property to find
  300. -- Returns : the GParamSpec of the child property or NULL if class has no child property with that name.
  301. -- gtk_container_class_install_child_property ()
  302. -- void gtk_container_class_install_child_property
  303. -- (GtkContainerClass *cclass,
  304. -- guint property_id,
  305. -- GParamSpec *pspec);
  306. -- Installs a child property on a container class.
  307. -- cclass : a GtkContainerClass
  308. -- property_id : the id for the property
  309. -- pspec : the GParamSpec for the property
  310. -- gtk_container_class_list_child_properties ()
  311. -- GParamSpec** gtk_container_class_list_child_properties
  312. -- (GObjectClass *cclass,
  313. -- guint *n_properties);
  314. -- Returns all child properties of a container class.
  315. -- cclass : a GtkContainerClass
  316. -- n_properties : location to return the number of child properties found
  317. -- Returns : a newly allocated array of GParamSpec*. The array must be freed with g_free().
  318. -- Property Details
  319. -- The "border-width" property
  320. -- "border-width" guint : Read / Write
  321. -- The width of the empty border outside the containers children.
  322. -- Allowed values: <= G_MAXINT
  323. -- Default value: 0
  324. -- The "child" property
  325. -- "child" GtkWidget : Write
  326. -- Can be used to add a new child to the container.
  327. -- The "resize-mode" property
  328. -- "resize-mode" GtkResizeMode : Read / Write
  329. -- Specify how resize events are handled.
  330. -- Default value: GTK_RESIZE_PARENT
  331. -- Signal Details
  332. -- The "add" signal
  333. -- void user_function (GtkContainer *container,
  334. -- GtkWidget *widget,
  335. -- gpointer user_data) : Run first
  336. -- container : the object which received the signal.
  337. -- widget :
  338. -- user_data : user data set when the signal handler was connected.
  339. -- The "check-resize" signal
  340. -- void user_function (GtkContainer *container,
  341. -- gpointer user_data) : Run last
  342. -- container : the object which received the signal.
  343. -- user_data : user data set when the signal handler was connected.
  344. -- The "remove" signal
  345. -- void user_function (GtkContainer *container,
  346. -- GtkWidget *widget,
  347. -- gpointer user_data) : Run first
  348. -- container : the object which received the signal.
  349. -- widget :
  350. -- user_data : user data set when the signal handler was connected.
  351. -- The "set-focus-child" signal
  352. -- void user_function (GtkContainer *container,
  353. -- GtkWidget *widget,
  354. -- gpointer user_data) : Run first
  355. -- container : the object which received the signal.
  356. -- widget :
  357. -- user_data : user data set when the signal handler was connected.
  358. end