1
// Generated by gtkmmproc -- DO NOT MODIFY!
4
#include <gtkmm/private/box_p.h>
11
* Copyright 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.
28
#include <gtk/gtkbox.h>
29
#include <gtk/gtkvbox.h>
30
#include <gtk/gtkhbox.h>
31
#include <glibmm/wrap.h>
39
Widget* Child::get_widget() const
41
return Glib::wrap(gobj()->widget);
44
void Child::set_options(PackOptions options, guint padding)
46
const bool expand = (options == PACK_EXPAND_PADDING || options == PACK_EXPAND_WIDGET);
47
const bool fill = (options == PACK_EXPAND_WIDGET);
49
set_options(expand, fill, padding);
52
void Child::set_options(bool expand, bool fill, guint padding)
54
gobj()->expand = expand;
56
gobj()->padding = padding;
59
void Child::set_pack(PackType pack)
65
/**************************************************************************/
68
typedef Box_Helpers::BoxList::iterator box_iterator;
70
box_iterator BoxList::insert(box_iterator position, const Element& e)
73
bool expand = (e.options_ == PACK_EXPAND_PADDING) || (e.options_ == PACK_EXPAND_WIDGET);
74
bool fill = (e.options_ == PACK_EXPAND_WIDGET);
76
if (e.pack_ == PACK_START)
77
gtk_box_pack_start(gparent(), (e.widget_? e.widget_->gobj() : 0),
78
(gboolean)expand, (gboolean)fill, e.padding_);
80
gtk_box_pack_end(gparent(), (e.widget_ ? e.widget_->gobj() : 0),
81
(gboolean)expand, (gboolean)fill, e.padding_);
92
void BoxList::reorder(box_iterator loc, box_iterator pos)
94
int position = g_list_position(glist(), pos.node_);
95
gtk_box_reorder_child(gparent(), loc->gobj()->widget, position);
98
} /* namespace Box_Helpers */
100
Box::BoxList& Box::children()
102
children_proxy_ = BoxList(gobj());
103
return children_proxy_;
106
const Box::BoxList& Box::children() const
108
children_proxy_ = BoxList(const_cast<GtkBox*>(gobj()));
109
return children_proxy_;
112
void Box::pack_start(Widget& child, PackOptions options, guint padding)
114
bool expand = (options == PACK_EXPAND_PADDING) || (options == PACK_EXPAND_WIDGET);
115
bool fill = (options == PACK_EXPAND_WIDGET);
117
gtk_box_pack_start(gobj(), child.gobj(), (gboolean)expand, (gboolean)fill, padding);
120
void Box::pack_end(Widget& child, PackOptions options, guint padding)
122
bool expand = (options == PACK_EXPAND_PADDING) || (options == PACK_EXPAND_WIDGET);
123
bool fill = (options == PACK_EXPAND_WIDGET);
125
gtk_box_pack_end(gobj(), child.gobj(), (gboolean)expand, (gboolean)fill, padding);
129
} /* namespace Gtk */
134
} // anonymous namespace
140
Gtk::Box* wrap(GtkBox* object, bool take_copy)
142
return dynamic_cast<Gtk::Box *> (Glib::wrap_auto ((GObject*)(object), take_copy));
145
} /* namespace Glib */
151
/* The *_Class implementation: */
153
const Glib::Class& Box_Class::init()
155
if(!gtype_) // create the GType if necessary
157
// Glib::Class has to know the class init function to clone custom types.
158
class_init_func_ = &Box_Class::class_init_function;
160
// This is actually just optimized away, apparently with no harm.
161
// Make sure that the parent type has been created.
162
//CppClassParent::CppObjectType::get_type();
164
// Create the wrapper type, with the same class/instance size as the base type.
165
register_derived_type(gtk_box_get_type());
167
// Add derived versions of interfaces, if the C type implements any interfaces:
173
void Box_Class::class_init_function(void* g_class, void* class_data)
175
BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
176
CppClassParent::class_init_function(klass, class_data);
181
Glib::ObjectBase* Box_Class::wrap_new(GObject* o)
183
return manage(new Box((GtkBox*)(o)));
188
/* The implementation: */
190
Box::Box(const Glib::ConstructParams& construct_params)
192
Gtk::Container(construct_params)
196
Box::Box(GtkBox* castitem)
198
Gtk::Container((GtkContainer*)(castitem))
207
Box::CppClassType Box::box_class_; // initialize static member
209
GType Box::get_type()
211
return box_class_.init().get_type();
214
GType Box::get_base_type()
216
return gtk_box_get_type();
220
namespace Box_Helpers
223
BoxList::iterator BoxList::find(const_reference w)
225
iterator i = begin();
226
for(i = begin(); i != end() && (i->get_widget()->gobj() != w.get_widget()->gobj()); i++);
230
BoxList::iterator BoxList::find(Widget& w)
233
for(i = begin(); i != end() && ((GtkWidget*)i->get_widget()->gobj() != w.gobj()); i++);
237
} /* namespace Box_Helpers */
240
namespace Box_Helpers
243
void BoxList::remove(const_reference child)
245
gtk_container_remove(GTK_CONTAINER(gparent_),
246
(GtkWidget*)(child.get_widget()->gobj()));
249
void BoxList::remove(Widget& widget)
251
gtk_container_remove(GTK_CONTAINER(gparent_), (GtkWidget*)(widget.gobj()));
254
BoxList::iterator BoxList::erase(iterator position)
256
//Check that it is a valid iterator, to a real item:
257
if ( !position.node_|| (position == end()) )
260
//Get an iterator the the next item, to return:
261
iterator next = position;
264
//Use GTK+ C function to remove it, by providing the GtkWidget*:
265
gtk_container_remove( GTK_CONTAINER(gparent_), (GtkWidget*)(position->get_widget()->gobj()) );
269
} /* namespace Box_Helpers */
272
namespace Box_Helpers
278
BoxList::BoxList(GtkBox* gparent)
279
: type_base((GObject*)gparent)
282
BoxList::BoxList(const BoxList& src)
287
BoxList& BoxList::operator=(const BoxList& src)
289
type_base::operator=(src);
293
GList*& BoxList::glist() const
295
return ((GtkBox*)gparent_)->children;
298
void BoxList::erase(iterator start, iterator stop)
300
type_base::erase(start, stop);
303
GtkBox* BoxList::gparent()
305
return (GtkBox*)type_base::gparent();
308
const GtkBox* BoxList::gparent() const
310
return (GtkBox*)type_base::gparent();
313
BoxList::reference BoxList::operator[](size_type l) const
315
return type_base::operator[](l);
318
} /* namespace Box_Helpers */
322
Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
323
Gtk::Container(Glib::ConstructParams(box_class_.init()))
327
void Box::pack_start(Widget& child, bool expand, bool fill, guint padding)
329
gtk_box_pack_start(gobj(), (child).gobj(), static_cast<int>(expand), static_cast<int>(fill), padding);
332
void Box::pack_end(Widget& child, bool expand, bool fill, guint padding)
334
gtk_box_pack_end(gobj(), (child).gobj(), static_cast<int>(expand), static_cast<int>(fill), padding);
337
void Box::set_homogeneous(bool homogeneous)
339
gtk_box_set_homogeneous(gobj(), static_cast<int>(homogeneous));
342
bool Box::get_homogeneous() const
344
return gtk_box_get_homogeneous(const_cast<GtkBox*>(gobj()));
347
void Box::set_spacing(int spacing)
349
gtk_box_set_spacing(gobj(), spacing);
352
int Box::get_spacing() const
354
return gtk_box_get_spacing(const_cast<GtkBox*>(gobj()));
357
void Box::reorder_child(Widget& child, int pos)
359
gtk_box_reorder_child(gobj(), (child).gobj(), pos);
363
Glib::PropertyProxy<int> Box::property_spacing()
365
return Glib::PropertyProxy<int>(this, "spacing");
368
Glib::PropertyProxy_ReadOnly<int> Box::property_spacing() const
370
return Glib::PropertyProxy_ReadOnly<int>(this, "spacing");
373
Glib::PropertyProxy<bool> Box::property_homogeneous()
375
return Glib::PropertyProxy<bool>(this, "homogeneous");
378
Glib::PropertyProxy_ReadOnly<bool> Box::property_homogeneous() const
380
return Glib::PropertyProxy_ReadOnly<bool>(this, "homogeneous");
390
Gtk::VBox* wrap(GtkVBox* object, bool take_copy)
392
return dynamic_cast<Gtk::VBox *> (Glib::wrap_auto ((GObject*)(object), take_copy));
395
} /* namespace Glib */
401
/* The *_Class implementation: */
403
const Glib::Class& VBox_Class::init()
405
if(!gtype_) // create the GType if necessary
407
// Glib::Class has to know the class init function to clone custom types.
408
class_init_func_ = &VBox_Class::class_init_function;
410
// This is actually just optimized away, apparently with no harm.
411
// Make sure that the parent type has been created.
412
//CppClassParent::CppObjectType::get_type();
414
// Create the wrapper type, with the same class/instance size as the base type.
415
register_derived_type(gtk_vbox_get_type());
417
// Add derived versions of interfaces, if the C type implements any interfaces:
423
void VBox_Class::class_init_function(void* g_class, void* class_data)
425
BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
426
CppClassParent::class_init_function(klass, class_data);
431
Glib::ObjectBase* VBox_Class::wrap_new(GObject* o)
433
return manage(new VBox((GtkVBox*)(o)));
438
/* The implementation: */
440
VBox::VBox(const Glib::ConstructParams& construct_params)
442
Gtk::Box(construct_params)
446
VBox::VBox(GtkVBox* castitem)
448
Gtk::Box((GtkBox*)(castitem))
457
VBox::CppClassType VBox::vbox_class_; // initialize static member
459
GType VBox::get_type()
461
return vbox_class_.init().get_type();
464
GType VBox::get_base_type()
466
return gtk_vbox_get_type();
469
VBox::VBox(bool homogeneous, int spacing)
471
Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
472
Gtk::Box(Glib::ConstructParams(vbox_class_.init(), "homogeneous", static_cast<int>(homogeneous), "spacing", spacing, (char*) 0))
483
Gtk::HBox* wrap(GtkHBox* object, bool take_copy)
485
return dynamic_cast<Gtk::HBox *> (Glib::wrap_auto ((GObject*)(object), take_copy));
488
} /* namespace Glib */
494
/* The *_Class implementation: */
496
const Glib::Class& HBox_Class::init()
498
if(!gtype_) // create the GType if necessary
500
// Glib::Class has to know the class init function to clone custom types.
501
class_init_func_ = &HBox_Class::class_init_function;
503
// This is actually just optimized away, apparently with no harm.
504
// Make sure that the parent type has been created.
505
//CppClassParent::CppObjectType::get_type();
507
// Create the wrapper type, with the same class/instance size as the base type.
508
register_derived_type(gtk_hbox_get_type());
510
// Add derived versions of interfaces, if the C type implements any interfaces:
516
void HBox_Class::class_init_function(void* g_class, void* class_data)
518
BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
519
CppClassParent::class_init_function(klass, class_data);
524
Glib::ObjectBase* HBox_Class::wrap_new(GObject* o)
526
return manage(new HBox((GtkHBox*)(o)));
531
/* The implementation: */
533
HBox::HBox(const Glib::ConstructParams& construct_params)
535
Gtk::Box(construct_params)
539
HBox::HBox(GtkHBox* castitem)
541
Gtk::Box((GtkBox*)(castitem))
550
HBox::CppClassType HBox::hbox_class_; // initialize static member
552
GType HBox::get_type()
554
return hbox_class_.init().get_type();
557
GType HBox::get_base_type()
559
return gtk_hbox_get_type();
562
HBox::HBox(bool homogeneous, int spacing)
564
Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
565
Gtk::Box(Glib::ConstructParams(hbox_class_.init(), "homogeneous", static_cast<int>(homogeneous), "spacing", spacing, (char*) 0))