1 // Generated by gtkmmproc -- DO NOT MODIFY!
5 #include <gtkmm/private/box_p.h>
12 * Copyright 1998-2002 The gtkmm Development Team
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Library General Public
16 * License as published by the Free Software Foundation; either
17 * version 2 of the License, or (at your option) any later version.
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Library General Public License for more details.
24 * You should have received a copy of the GNU Library General Public
25 * License along with this library; if not, write to the Free
26 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 #include <gtk/gtkbox.h>
30 #include <gtk/gtkvbox.h>
31 #include <gtk/gtkhbox.h>
32 #include <glibmm/wrap.h>
40 Widget* Child::get_widget() const
42 return Glib::wrap(gobj()->widget);
45 void Child::set_options(PackOptions options, guint padding)
47 const bool expand = (options == PACK_EXPAND_PADDING || options == PACK_EXPAND_WIDGET);
48 const bool fill = (options == PACK_EXPAND_WIDGET);
50 set_options(expand, fill, padding);
53 void Child::set_options(bool expand, bool fill, guint padding)
55 gobj()->expand = expand;
57 gobj()->padding = padding;
60 void Child::set_pack(PackType pack)
66 /**************************************************************************/
69 typedef Box_Helpers::BoxList::iterator box_iterator;
71 box_iterator BoxList::insert(box_iterator position, const Element& e)
74 bool expand = (e.options_ == PACK_EXPAND_PADDING) || (e.options_ == PACK_EXPAND_WIDGET);
75 bool fill = (e.options_ == PACK_EXPAND_WIDGET);
77 if (e.pack_ == PACK_START)
78 gtk_box_pack_start(gparent(), (e.widget_? e.widget_->gobj() : 0),
79 (gboolean)expand, (gboolean)fill, e.padding_);
81 gtk_box_pack_end(gparent(), (e.widget_ ? e.widget_->gobj() : 0),
82 (gboolean)expand, (gboolean)fill, e.padding_);
93 void BoxList::reorder(box_iterator loc, box_iterator pos)
95 int position = g_list_position(glist(), pos.node_);
96 gtk_box_reorder_child(gparent(), loc->gobj()->widget, position);
99 } /* namespace Box_Helpers */
101 Box::BoxList& Box::children()
103 children_proxy_ = BoxList(gobj());
104 return children_proxy_;
107 const Box::BoxList& Box::children() const
109 children_proxy_ = BoxList(const_cast<GtkBox*>(gobj()));
110 return children_proxy_;
113 void Box::pack_start(Widget& child, PackOptions options, guint padding)
115 bool expand = (options == PACK_EXPAND_PADDING) || (options == PACK_EXPAND_WIDGET);
116 bool fill = (options == PACK_EXPAND_WIDGET);
118 gtk_box_pack_start(gobj(), child.gobj(), (gboolean)expand, (gboolean)fill, padding);
121 void Box::pack_end(Widget& child, PackOptions options, guint padding)
123 bool expand = (options == PACK_EXPAND_PADDING) || (options == PACK_EXPAND_WIDGET);
124 bool fill = (options == PACK_EXPAND_WIDGET);
126 gtk_box_pack_end(gobj(), child.gobj(), (gboolean)expand, (gboolean)fill, padding);
130 } /* namespace Gtk */
135 } // anonymous namespace
141 Gtk::Box* wrap(GtkBox* object, bool take_copy)
143 return dynamic_cast<Gtk::Box *> (Glib::wrap_auto ((GObject*)(object), take_copy));
146 } /* namespace Glib */
152 /* The *_Class implementation: */
154 const Glib::Class& Box_Class::init()
156 if(!gtype_) // create the GType if necessary
158 // Glib::Class has to know the class init function to clone custom types.
159 class_init_func_ = &Box_Class::class_init_function;
161 // This is actually just optimized away, apparently with no harm.
162 // Make sure that the parent type has been created.
163 //CppClassParent::CppObjectType::get_type();
165 // Create the wrapper type, with the same class/instance size as the base type.
166 register_derived_type(gtk_box_get_type());
168 // Add derived versions of interfaces, if the C type implements any interfaces:
174 void Box_Class::class_init_function(void* g_class, void* class_data)
176 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
177 CppClassParent::class_init_function(klass, class_data);
179 #ifdef GLIBMM_VFUNCS_ENABLED
180 #endif //GLIBMM_VFUNCS_ENABLED
182 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
183 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
186 #ifdef GLIBMM_VFUNCS_ENABLED
187 #endif //GLIBMM_VFUNCS_ENABLED
189 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
190 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
193 Glib::ObjectBase* Box_Class::wrap_new(GObject* o)
195 return manage(new Box((GtkBox*)(o)));
200 /* The implementation: */
202 Box::Box(const Glib::ConstructParams& construct_params)
204 Gtk::Container(construct_params)
208 Box::Box(GtkBox* castitem)
210 Gtk::Container((GtkContainer*)(castitem))
219 Box::CppClassType Box::box_class_; // initialize static member
221 GType Box::get_type()
223 return box_class_.init().get_type();
226 GType Box::get_base_type()
228 return gtk_box_get_type();
232 namespace Box_Helpers
235 BoxList::iterator BoxList::find(const_reference w)
237 iterator i = begin();
238 for(i = begin(); i != end() && (i->get_widget()->gobj() != w.get_widget()->gobj()); i++);
242 BoxList::iterator BoxList::find(Widget& w)
245 for(i = begin(); i != end() && ((GtkWidget*)i->get_widget()->gobj() != w.gobj()); i++);
249 } /* namespace Box_Helpers */
252 namespace Box_Helpers
255 void BoxList::remove(const_reference child)
257 gtk_container_remove(GTK_CONTAINER(gparent_),
258 (GtkWidget*)(child.get_widget()->gobj()));
261 void BoxList::remove(Widget& widget)
263 gtk_container_remove(GTK_CONTAINER(gparent_), (GtkWidget*)(widget.gobj()));
266 BoxList::iterator BoxList::erase(iterator position)
268 //Check that it is a valid iterator, to a real item:
269 if ( !position.node_|| (position == end()) )
272 //Get an iterator the the next item, to return:
273 iterator next = position;
276 //Use GTK+ C function to remove it, by providing the GtkWidget*:
277 gtk_container_remove( GTK_CONTAINER(gparent_), (GtkWidget*)(position->get_widget()->gobj()) );
281 } /* namespace Box_Helpers */
284 namespace Box_Helpers
290 BoxList::BoxList(GtkBox* gparent)
291 : type_base((GObject*)gparent)
294 BoxList::BoxList(const BoxList& src)
299 BoxList& BoxList::operator=(const BoxList& src)
301 type_base::operator=(src);
305 GList*& BoxList::glist() const
307 return ((GtkBox*)gparent_)->children;
310 void BoxList::erase(iterator start, iterator stop)
312 type_base::erase(start, stop);
315 GtkBox* BoxList::gparent()
317 return (GtkBox*)type_base::gparent();
320 const GtkBox* BoxList::gparent() const
322 return (GtkBox*)type_base::gparent();
325 BoxList::reference BoxList::operator[](size_type l) const
327 return type_base::operator[](l);
330 } /* namespace Box_Helpers */
334 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
336 Gtk::Container(Glib::ConstructParams(box_class_.init()))
340 void Box::pack_start(Widget& child, bool expand, bool fill, guint padding)
342 gtk_box_pack_start(gobj(), (child).gobj(), static_cast<int>(expand), static_cast<int>(fill), padding);
345 void Box::pack_end(Widget& child, bool expand, bool fill, guint padding)
347 gtk_box_pack_end(gobj(), (child).gobj(), static_cast<int>(expand), static_cast<int>(fill), padding);
350 void Box::set_homogeneous(bool homogeneous)
352 gtk_box_set_homogeneous(gobj(), static_cast<int>(homogeneous));
355 bool Box::get_homogeneous() const
357 return gtk_box_get_homogeneous(const_cast<GtkBox*>(gobj()));
360 void Box::set_spacing(int spacing)
362 gtk_box_set_spacing(gobj(), spacing);
365 int Box::get_spacing() const
367 return gtk_box_get_spacing(const_cast<GtkBox*>(gobj()));
370 void Box::reorder_child(Widget& child, int pos)
372 gtk_box_reorder_child(gobj(), (child).gobj(), pos);
376 #ifdef GLIBMM_PROPERTIES_ENABLED
377 Glib::PropertyProxy<int> Box::property_spacing()
379 return Glib::PropertyProxy<int>(this, "spacing");
381 #endif //GLIBMM_PROPERTIES_ENABLED
383 #ifdef GLIBMM_PROPERTIES_ENABLED
384 Glib::PropertyProxy_ReadOnly<int> Box::property_spacing() const
386 return Glib::PropertyProxy_ReadOnly<int>(this, "spacing");
388 #endif //GLIBMM_PROPERTIES_ENABLED
390 #ifdef GLIBMM_PROPERTIES_ENABLED
391 Glib::PropertyProxy<bool> Box::property_homogeneous()
393 return Glib::PropertyProxy<bool>(this, "homogeneous");
395 #endif //GLIBMM_PROPERTIES_ENABLED
397 #ifdef GLIBMM_PROPERTIES_ENABLED
398 Glib::PropertyProxy_ReadOnly<bool> Box::property_homogeneous() const
400 return Glib::PropertyProxy_ReadOnly<bool>(this, "homogeneous");
402 #endif //GLIBMM_PROPERTIES_ENABLED
405 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
406 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
408 #ifdef GLIBMM_VFUNCS_ENABLED
409 #endif //GLIBMM_VFUNCS_ENABLED
418 Gtk::VBox* wrap(GtkVBox* object, bool take_copy)
420 return dynamic_cast<Gtk::VBox *> (Glib::wrap_auto ((GObject*)(object), take_copy));
423 } /* namespace Glib */
429 /* The *_Class implementation: */
431 const Glib::Class& VBox_Class::init()
433 if(!gtype_) // create the GType if necessary
435 // Glib::Class has to know the class init function to clone custom types.
436 class_init_func_ = &VBox_Class::class_init_function;
438 // This is actually just optimized away, apparently with no harm.
439 // Make sure that the parent type has been created.
440 //CppClassParent::CppObjectType::get_type();
442 // Create the wrapper type, with the same class/instance size as the base type.
443 register_derived_type(gtk_vbox_get_type());
445 // Add derived versions of interfaces, if the C type implements any interfaces:
451 void VBox_Class::class_init_function(void* g_class, void* class_data)
453 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
454 CppClassParent::class_init_function(klass, class_data);
456 #ifdef GLIBMM_VFUNCS_ENABLED
457 #endif //GLIBMM_VFUNCS_ENABLED
459 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
460 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
463 #ifdef GLIBMM_VFUNCS_ENABLED
464 #endif //GLIBMM_VFUNCS_ENABLED
466 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
467 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
470 Glib::ObjectBase* VBox_Class::wrap_new(GObject* o)
472 return manage(new VBox((GtkVBox*)(o)));
477 /* The implementation: */
479 VBox::VBox(const Glib::ConstructParams& construct_params)
481 Gtk::Box(construct_params)
485 VBox::VBox(GtkVBox* castitem)
487 Gtk::Box((GtkBox*)(castitem))
496 VBox::CppClassType VBox::vbox_class_; // initialize static member
498 GType VBox::get_type()
500 return vbox_class_.init().get_type();
503 GType VBox::get_base_type()
505 return gtk_vbox_get_type();
508 VBox::VBox(bool homogeneous, int spacing)
510 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
512 Gtk::Box(Glib::ConstructParams(vbox_class_.init(), "homogeneous", static_cast<int>(homogeneous), "spacing", spacing, static_cast<char*>(0)))
517 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
518 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
520 #ifdef GLIBMM_VFUNCS_ENABLED
521 #endif //GLIBMM_VFUNCS_ENABLED
530 Gtk::HBox* wrap(GtkHBox* object, bool take_copy)
532 return dynamic_cast<Gtk::HBox *> (Glib::wrap_auto ((GObject*)(object), take_copy));
535 } /* namespace Glib */
541 /* The *_Class implementation: */
543 const Glib::Class& HBox_Class::init()
545 if(!gtype_) // create the GType if necessary
547 // Glib::Class has to know the class init function to clone custom types.
548 class_init_func_ = &HBox_Class::class_init_function;
550 // This is actually just optimized away, apparently with no harm.
551 // Make sure that the parent type has been created.
552 //CppClassParent::CppObjectType::get_type();
554 // Create the wrapper type, with the same class/instance size as the base type.
555 register_derived_type(gtk_hbox_get_type());
557 // Add derived versions of interfaces, if the C type implements any interfaces:
563 void HBox_Class::class_init_function(void* g_class, void* class_data)
565 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
566 CppClassParent::class_init_function(klass, class_data);
568 #ifdef GLIBMM_VFUNCS_ENABLED
569 #endif //GLIBMM_VFUNCS_ENABLED
571 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
572 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
575 #ifdef GLIBMM_VFUNCS_ENABLED
576 #endif //GLIBMM_VFUNCS_ENABLED
578 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
579 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
582 Glib::ObjectBase* HBox_Class::wrap_new(GObject* o)
584 return manage(new HBox((GtkHBox*)(o)));
589 /* The implementation: */
591 HBox::HBox(const Glib::ConstructParams& construct_params)
593 Gtk::Box(construct_params)
597 HBox::HBox(GtkHBox* castitem)
599 Gtk::Box((GtkBox*)(castitem))
608 HBox::CppClassType HBox::hbox_class_; // initialize static member
610 GType HBox::get_type()
612 return hbox_class_.init().get_type();
615 GType HBox::get_base_type()
617 return gtk_hbox_get_type();
620 HBox::HBox(bool homogeneous, int spacing)
622 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
624 Gtk::Box(Glib::ConstructParams(hbox_class_.init(), "homogeneous", static_cast<int>(homogeneous), "spacing", spacing, static_cast<char*>(0)))
629 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
630 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
632 #ifdef GLIBMM_VFUNCS_ENABLED
633 #endif //GLIBMM_VFUNCS_ENABLED