2 // Generated by gtkmmproc -- DO NOT MODIFY!
11 /* Copyright (C) 1998-2002 The gtkmm Development Team
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Library General Public
15 * License as published by the Free Software Foundation; either
16 * version 2 of the License, or (at your option) any later version.
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Library General Public License for more details.
23 * You should have received a copy of the GNU Library General Public
24 * License along with this library; if not, write to the Free
25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 #include <gtkmm/container.h>
30 #include <glibmm/helperlist.h>
31 #include <gtk/gtkbox.h> /* For _GtkBoxChild */
34 #ifndef DOXYGEN_SHOULD_SKIP_THIS
35 typedef struct _GtkBox GtkBox;
36 typedef struct _GtkBoxClass GtkBoxClass;
37 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
41 { class Box_Class; } // namespace Gtk
42 #ifndef DOXYGEN_SHOULD_SKIP_THIS
43 typedef struct _GtkVBox GtkVBox;
44 typedef struct _GtkVBoxClass GtkVBoxClass;
45 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
49 { class VBox_Class; } // namespace Gtk
50 #ifndef DOXYGEN_SHOULD_SKIP_THIS
51 typedef struct _GtkHBox GtkHBox;
52 typedef struct _GtkHBoxClass GtkHBoxClass;
53 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
57 { class HBox_Class; } // namespace Gtk
61 /** Packing options for adding child widgets to a Box with pack_start() and pack_end().
66 PACK_SHRINK, /**< Space is contracted to the child widget size. */
67 PACK_EXPAND_PADDING, /**< Space is expanded, with extra space filled with padding. */
68 PACK_EXPAND_WIDGET /**< Space is expanded, with extra space filled by increasing the child widget size. */
76 //This may not have any data or virtual functions. See below.
77 class Child : protected _GtkBoxChild
80 Child& operator=(const Child&); //Not implemented.
81 Child(const Child&); //Not implemented.
84 /// Provides access to the underlying C GObject.
85 inline _GtkBoxChild* gobj() { return this; }
86 /// Provides access to the underlying C GObject.
87 inline const _GtkBoxChild* gobj() const { return this; }
89 Widget* get_widget() const;
91 inline guint16 get_padding() const { return (gobj()->padding); }
92 inline bool get_expand() const { return (gobj()->expand); }
93 inline bool get_fill() const { return (gobj()->fill); }
94 inline bool get_pack() const { return (gobj()->pack); }
96 void set_options(PackOptions options, guint padding = 0);
97 void set_options(bool expand, bool fill, guint padding = 0);
99 void set_pack(PackType pack);
102 inline GtkBox* parent()
103 { return (GtkBox*) (gobj()->widget->parent); }
107 #ifndef DOXYGEN_SHOULD_SKIP_THIS
108 friend class Dummy_; // silence the compiler (Child has only private ctors)
115 Element(Widget& widget,
116 PackOptions options = PACK_EXPAND_WIDGET,
118 PackType pack = PACK_START)
119 : widget_(&widget), options_(options),
120 padding_(padding), pack_(pack)
124 PackOptions options_;
129 typedef Element StartElem;
131 struct EndElem : public Element
133 EndElem(Widget& widget,
134 PackOptions options = PACK_EXPAND_WIDGET,
136 : Element (widget, options, padding, PACK_END)
141 class BoxList : public Glib::HelperList< Child, const Element, Glib::List_Iterator< Child > >
145 explicit BoxList(GtkBox* gparent);
146 BoxList(const BoxList& src);
147 virtual ~BoxList() {}
149 BoxList& operator=(const BoxList& src);
151 typedef Glib::HelperList< Child, const Element, Glib::List_Iterator< Child > > type_base;
154 const GtkBox* gparent() const;
156 virtual GList*& glist() const; // front of list
158 virtual void erase(iterator start, iterator stop);
159 virtual iterator erase(iterator); //Implented as custom or by LIST_CONTAINER_REMOVE
160 virtual void remove(const_reference); //Implented as custom or by LIST_CONTAINER_REMOVE
162 /// This is order n. (use at own risk)
163 reference operator[](size_type l) const;
166 iterator insert(iterator position, element_type& e); //custom-implemented.
168 template <class InputIterator>
169 inline void insert(iterator position, InputIterator first, InputIterator last)
171 for(;first != last; ++first)
172 position = insert(position, *first);
175 inline void push_front(element_type& e)
176 { insert(begin(), e); }
177 inline void push_back(element_type& e)
178 { insert(end(), e); }
181 //The standard iterator, instead of List_Cpp_Iterator,
182 //only works because Child is derived from _GtkBoxChild.
185 iterator find(const_reference c);
186 iterator find(Widget&);
189 virtual void remove(Widget& w); //Implented as custom or by LIST_CONTAINER_REMOVE
192 void reorder(iterator loc,iterator pos);
196 } /* namespace Box_Helpers */
199 /** A base class for box containers
201 * Abstract base class for horizontal and vertical boxes, which organize a
202 * variable number of widgets into a rectangular area. This is an abstract
203 * class and it defers choice of which way the widgets are packed to the screen
204 * to the derived classes. It provides a common interface for inserting
205 * widgets to a box indepenently of how it is shown in the screen.
207 * Gtk::Box uses a notion of packing. Packing refers to adding widgets with
208 * reference to a particular position in a Gtk::Container. There are two
209 * reference positions: the start and the end of the box. For a VBox, the start
210 * is defined as the top of the box and the end is defined as the bottom. For
211 * a HBox the start is defined as the left side and the end is defined as the
212 * right side. Use repeated calls to pack_start() to pack widgets into a
213 * Gtk::Box from start to end. Use pack_end() to add widgets from end to start.
214 * You may intersperse these calls and add widgets from both ends of the same
215 * Gtk::Box. The last widget added with pack_start() will be placed just before
216 * the last widget added with pack_end()
218 * Because Gtk::Box is a Gtk::Container, you may also use Gtk::Container::add()
219 * to insert widgets, and they will be packed as if with pack_start(). Use
220 * Gtk::Container::remove() to remove widgets.
222 * Use set_homogeneous() to specify whether or not all children of the Gtk::Box
223 * occupy the same amount of space. Use set_spacing() to determine the minimum
224 * space placed between all children in the Gtk::Box. Use reorder_child() to
225 * move a child widget to a different place in the box. Use
226 * set_child_packing() to reset the pack options and padding attributes of any
227 * Gtk::Box child. Use query_child_packing() to query these fields.
230 class Box : public Container
233 #ifndef DOXYGEN_SHOULD_SKIP_THIS
234 typedef Box CppObjectType;
235 typedef Box_Class CppClassType;
236 typedef GtkBox BaseObjectType;
237 typedef GtkBoxClass BaseClassType;
238 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
242 #ifndef DOXYGEN_SHOULD_SKIP_THIS
245 friend class Box_Class;
246 static CppClassType box_class_;
250 Box& operator=(const Box&);
253 explicit Box(const Glib::ConstructParams& construct_params);
254 explicit Box(GtkBox* castitem);
256 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
259 #ifndef DOXYGEN_SHOULD_SKIP_THIS
260 static GType get_type() G_GNUC_CONST;
261 static GType get_base_type() G_GNUC_CONST;
264 ///Provides access to the underlying C GtkObject.
265 GtkBox* gobj() { return reinterpret_cast<GtkBox*>(gobject_); }
267 ///Provides access to the underlying C GtkObject.
268 const GtkBox* gobj() const { return reinterpret_cast<GtkBox*>(gobject_); }
272 //C++ methods used to invoke GTK+ virtual functions:
273 #ifdef GLIBMM_VFUNCS_ENABLED
274 #endif //GLIBMM_VFUNCS_ENABLED
277 //GTK+ Virtual Functions (override these to change behaviour):
278 #ifdef GLIBMM_VFUNCS_ENABLED
279 #endif //GLIBMM_VFUNCS_ENABLED
281 //Default Signal Handlers::
282 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
283 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
290 typedef Box_Helpers::BoxList BoxList;
297 /** Left side insert a widget to a box.
298 * The expand argument to pack_start() or pack_end()
299 * controls whether the widgets are laid out in the box to fill in all
300 * the extra space in the box so the box is expanded to fill the area
301 * allocated to it (<tt>true</tt>). Or the box is shrunk to just fit the widgets
302 * (<tt>false</tt>). Setting @a expand to <tt>false</tt> will allow you to do right and left
303 * justifying of your widgets. Otherwise, they will all expand to fit in
304 * the box, and the same effect could be achieved by using only one of
305 * pack_start() or pack_end() functions.
307 * The @a fill argument to the pack_start()/pack_end() functions control whether the
308 * extra space is allocated to the objects themselves (<tt>true</tt>), or as extra
309 * padding in the box around these objects (<tt>false</tt>). It only has an effect
310 * if the @a expand argument is also <tt>true</tt>.
312 * The difference between spacing (set when the box is created)
313 * and padding (set when elements are packed) is, that spacing is added between
314 * objects, and padding is added on either side of an object.
315 * @param child The Gtk::Widget to be added to @a box .
316 * @param expand <tt>true</tt> if the new child is to be given extra space allocated to
317 * @a box . The extra space will be divided evenly between all children of
318 * @a box that use this option.
319 * @param fill <tt>true</tt> if space given to @a child by the @a expand option is
320 * actually allocated to @a child , rather than just padding it. This
321 * parameter has no effect if @a expand is set to <tt>false</tt>. A child is
322 * always allocated the full height of a Gtk::HBox and the full width
323 * of a Gtk::VBox. This option affects the other dimension.
324 * @param padding Extra space in pixels to put between this child and its
325 * neighbors, over and above the global amount specified by
326 * Gtk::Box:spacing property. If @a child is a widget at one of the
327 * reference ends of @a box , then @a padding pixels are also put between
328 * @a child and the reference edge of @a box .
330 void pack_start(Widget& child, bool expand, bool fill, guint padding = 0);
332 /** Left side insert a widget to a box.
333 * @param child A Widget to be added to box.
334 * @param options Controls how the widget expands to fill space, and how the space around them is used.
335 * @param padding Padding that is added on either side of the widget. This is different to spacing set when the box is created (or with set_spacing()) - spacing is added between objects, and padding is added on either side of an object.
337 void pack_start(Widget& child, PackOptions options = PACK_EXPAND_WIDGET, guint padding = 0);
340 /** Adds @a child to @a box , packed with reference to the end of @a box .
341 * The @a child is packed after (away from end of) any other child
342 * packed with reference to the end of @a box .
343 * @param child The Gtk::Widget to be added to @a box .
344 * @param expand <tt>true</tt> if the new child is to be given extra space allocated
345 * to @a box . The extra space will be divided evenly between all children
346 * of @a box that use this option.
347 * @param fill <tt>true</tt> if space given to @a child by the @a expand option is
348 * actually allocated to @a child , rather than just padding it. This
349 * parameter has no effect if @a expand is set to <tt>false</tt>. A child is
350 * always allocated the full height of a Gtk::HBox and the full width
351 * of a Gtk::VBox. This option affects the other dimension.
352 * @param padding Extra space in pixels to put between this child and its
353 * neighbors, over and above the global amount specified by
354 * Gtk::Box:spacing property. If @a child is a widget at one of the
355 * reference ends of @a box , then @a padding pixels are also put between
356 * @a child and the reference edge of @a box .
358 void pack_end(Widget& child, bool expand, bool fill, guint padding = 0);
360 /** Right side insert a widget to a box.
361 * @param child A Widget to be added to box.
362 * @param options Controls how the widget expands to fill space, and how the space around them is used.
363 * @param padding Padding that is added on either side of the widget. This is different to spacing set when the box is created (or with set_spacing()) - spacing is added between objects, and padding is added on either side of an object.
365 void pack_end(Widget& child, PackOptions options = PACK_EXPAND_WIDGET, guint padding = 0);
368 /** Sets the Gtk::Box:homogeneous property of @a box , controlling
369 * whether or not all children of @a box are given equal space
371 * @param homogeneous A boolean value, <tt>true</tt> to create equal allotments,
372 * <tt>false</tt> for variable allotments.
374 void set_homogeneous(bool homogeneous = true);
376 /** Return value: <tt>true</tt> if the box is homogeneous.
377 * @return <tt>true</tt> if the box is homogeneous.
379 bool get_homogeneous() const;
382 /** Sets the Gtk::Box:spacing property of @a box , which is the
383 * number of pixels to place between children of @a box .
384 * @param spacing The number of pixels to put between children.
386 void set_spacing(int spacing);
388 /** Gets the value set by set_spacing().
389 * @return Spacing between children.
391 int get_spacing() const;
394 /** Moves @a child to a new @a position in the list of @a box children.
395 * The list is the <structfield>children</structfield> field of
396 * Gtk::Box-struct, and contains both widgets packed Gtk::PACK_START
397 * as well as widgets packed Gtk::PACK_END, in the order that these
398 * widgets were added to @a box .
400 * A widget's position in the @a box children list determines where
401 * the widget is packed into @a box . A child widget at some position
402 * in the list will be packed just after all other widgets of the
403 * same packing type that appear earlier in the list.
404 * @param child The Gtk::Widget to move.
405 * @param position The new position for @a child in the list of children
406 * of @a box , starting from 0. If negative, indicates the end of
409 void reorder_child(Widget& child, int pos);
411 /* Get the child widgets.
412 * @result An STL-style container of pointers to the box's child widgets.
416 /* Get the child widgets.
417 * @result An STL-style container of pointers to the box's child widgets.
419 const BoxList& children() const;
421 #ifdef GLIBMM_PROPERTIES_ENABLED
422 /** The amount of space between children.
424 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
425 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
426 * the value of the property changes.
428 Glib::PropertyProxy<int> property_spacing() ;
429 #endif //#GLIBMM_PROPERTIES_ENABLED
431 #ifdef GLIBMM_PROPERTIES_ENABLED
432 /** The amount of space between children.
434 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
435 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
436 * the value of the property changes.
438 Glib::PropertyProxy_ReadOnly<int> property_spacing() const;
439 #endif //#GLIBMM_PROPERTIES_ENABLED
441 #ifdef GLIBMM_PROPERTIES_ENABLED
442 /** Whether the children should all be the same size.
444 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
445 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
446 * the value of the property changes.
448 Glib::PropertyProxy<bool> property_homogeneous() ;
449 #endif //#GLIBMM_PROPERTIES_ENABLED
451 #ifdef GLIBMM_PROPERTIES_ENABLED
452 /** Whether the children should all be the same size.
454 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
455 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
456 * the value of the property changes.
458 Glib::PropertyProxy_ReadOnly<bool> property_homogeneous() const;
459 #endif //#GLIBMM_PROPERTIES_ENABLED
463 #ifndef DOXYGEN_SHOULD_SKIP_THIS
464 mutable BoxList children_proxy_;
465 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
471 /** Vertical Box for laying widgets in a vertical row.
473 * You should create these objects, but it is more confortable to pass
474 * around pointers of Gtk::Box. All the methods that do anything are in
475 * class Gtk::Box and this allows you to later change the direction of the
476 * box, when there's no dependencies to HBox and VBox classes.
479 * @ingroup Containers
482 class VBox : public Box
485 #ifndef DOXYGEN_SHOULD_SKIP_THIS
486 typedef VBox CppObjectType;
487 typedef VBox_Class CppClassType;
488 typedef GtkVBox BaseObjectType;
489 typedef GtkVBoxClass BaseClassType;
490 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
494 #ifndef DOXYGEN_SHOULD_SKIP_THIS
497 friend class VBox_Class;
498 static CppClassType vbox_class_;
502 VBox& operator=(const VBox&);
505 explicit VBox(const Glib::ConstructParams& construct_params);
506 explicit VBox(GtkVBox* castitem);
508 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
511 #ifndef DOXYGEN_SHOULD_SKIP_THIS
512 static GType get_type() G_GNUC_CONST;
513 static GType get_base_type() G_GNUC_CONST;
516 ///Provides access to the underlying C GtkObject.
517 GtkVBox* gobj() { return reinterpret_cast<GtkVBox*>(gobject_); }
519 ///Provides access to the underlying C GtkObject.
520 const GtkVBox* gobj() const { return reinterpret_cast<GtkVBox*>(gobject_); }
524 //C++ methods used to invoke GTK+ virtual functions:
525 #ifdef GLIBMM_VFUNCS_ENABLED
526 #endif //GLIBMM_VFUNCS_ENABLED
529 //GTK+ Virtual Functions (override these to change behaviour):
530 #ifdef GLIBMM_VFUNCS_ENABLED
531 #endif //GLIBMM_VFUNCS_ENABLED
533 //Default Signal Handlers::
534 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
535 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
542 /** Creates a new vertical box.
543 * @param homogeneous Whether each widget in the VBox should have the same
544 * height. If set, a PACK_SHRINK argument to pack_start() or pack_end() is
546 * @param spacing Determines the space in pixels between child widgets.
548 explicit VBox(bool homogeneous = false, int spacing = 0);
553 /** Horizontal Box for laying widgets in a horizontal row.
555 * You should create these objects, but it is more confortable to pass
556 * around pointers of Gtk::Box. All the methods that do anything are in
557 * class Gtk::Box and this allows you to later change the direction of the
558 * box, when there's no dependencies to HBox and VBox classes.
560 * Use the Gtk::Box packing interface to determine the arrangement, spacing,
561 * width, and alignment of Gtk::HBox children.
563 * All children are allocated the same height.
566 * @ingroup Containers
569 class HBox : public Box
572 #ifndef DOXYGEN_SHOULD_SKIP_THIS
573 typedef HBox CppObjectType;
574 typedef HBox_Class CppClassType;
575 typedef GtkHBox BaseObjectType;
576 typedef GtkHBoxClass BaseClassType;
577 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
581 #ifndef DOXYGEN_SHOULD_SKIP_THIS
584 friend class HBox_Class;
585 static CppClassType hbox_class_;
589 HBox& operator=(const HBox&);
592 explicit HBox(const Glib::ConstructParams& construct_params);
593 explicit HBox(GtkHBox* castitem);
595 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
598 #ifndef DOXYGEN_SHOULD_SKIP_THIS
599 static GType get_type() G_GNUC_CONST;
600 static GType get_base_type() G_GNUC_CONST;
603 ///Provides access to the underlying C GtkObject.
604 GtkHBox* gobj() { return reinterpret_cast<GtkHBox*>(gobject_); }
606 ///Provides access to the underlying C GtkObject.
607 const GtkHBox* gobj() const { return reinterpret_cast<GtkHBox*>(gobject_); }
611 //C++ methods used to invoke GTK+ virtual functions:
612 #ifdef GLIBMM_VFUNCS_ENABLED
613 #endif //GLIBMM_VFUNCS_ENABLED
616 //GTK+ Virtual Functions (override these to change behaviour):
617 #ifdef GLIBMM_VFUNCS_ENABLED
618 #endif //GLIBMM_VFUNCS_ENABLED
620 //Default Signal Handlers::
621 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
622 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
629 /** Creates a new horizontal box.
630 * @param homogeneous Whether each widget in the HBox should have the same
631 * width. If set, a PACK_SHRINK argument to pack_start() or pack_end() is
633 * @param spacing Determines the space in pixels between child widgets.
635 explicit HBox(bool homogeneous = false, int spacing = 0);
645 /** A Glib::wrap() method for this object.
647 * @param object The C instance.
648 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
649 * @result A C++ instance that wraps this C instance.
653 Gtk::Box* wrap(GtkBox* object, bool take_copy = false);
659 /** A Glib::wrap() method for this object.
661 * @param object The C instance.
662 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
663 * @result A C++ instance that wraps this C instance.
667 Gtk::VBox* wrap(GtkVBox* object, bool take_copy = false);
673 /** A Glib::wrap() method for this object.
675 * @param object The C instance.
676 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
677 * @result A C++ instance that wraps this C instance.
681 Gtk::HBox* wrap(GtkHBox* object, bool take_copy = false);
685 #endif /* _GTKMM_BOX_H */