Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / box.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <gtkmm/box.h>
4 #include <gtkmm/private/box_p.h>
5
6 // -*- c++ -*-
7 /* $Id$ */
8
9 /* 
10  *
11  * Copyright 1998-2002 The gtkmm Development Team
12  *
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.
17  *
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.
22  *
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.
26  */
27
28 #include <gtk/gtkbox.h>
29 #include <gtk/gtkvbox.h>
30 #include <gtk/gtkhbox.h>
31 #include <glibmm/wrap.h>
32
33 namespace Gtk
34 {
35
36 namespace Box_Helpers
37 {
38
39 Widget* Child::get_widget() const
40
41   return Glib::wrap(gobj()->widget);
42 }
43
44 void Child::set_options(PackOptions options, guint padding)
45 {
46   const bool expand = (options == PACK_EXPAND_PADDING || options == PACK_EXPAND_WIDGET);
47   const bool fill   = (options == PACK_EXPAND_WIDGET);
48
49   set_options(expand, fill, padding);
50 }
51
52 void Child::set_options(bool expand, bool fill, guint padding)
53 {
54   gobj()->expand  = expand;
55   gobj()->fill    = fill;
56   gobj()->padding = padding;
57 }
58
59 void Child::set_pack(PackType pack)
60 {
61   gobj()->pack = pack;
62 }
63
64
65 /**************************************************************************/
66
67
68 typedef Box_Helpers::BoxList::iterator box_iterator;
69
70 box_iterator BoxList::insert(box_iterator position, const Element& e)
71 {
72   iterator i;
73   bool expand = (e.options_ == PACK_EXPAND_PADDING) || (e.options_ == PACK_EXPAND_WIDGET);
74   bool fill = (e.options_ == PACK_EXPAND_WIDGET);
75
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_);
79   else
80     gtk_box_pack_end(gparent(), (e.widget_ ? e.widget_->gobj() : 0),
81                        (gboolean)expand, (gboolean)fill, e.padding_);
82
83   i = --end();
84
85   if (position!=end())
86     reorder(i, position);
87
88   return i;
89 }
90
91 // Non-standard
92 void BoxList::reorder(box_iterator loc, box_iterator pos)
93 {
94   int position = g_list_position(glist(), pos.node_);
95   gtk_box_reorder_child(gparent(), loc->gobj()->widget, position);
96 }
97
98 } /* namespace Box_Helpers */
99
100 Box::BoxList& Box::children()
101 {
102   children_proxy_ = BoxList(gobj());
103   return children_proxy_;
104 }
105
106 const Box::BoxList& Box::children() const
107 {
108   children_proxy_ = BoxList(const_cast<GtkBox*>(gobj()));
109   return children_proxy_;
110 }
111
112 void Box::pack_start(Widget& child, PackOptions options, guint padding)
113 {
114   bool expand = (options == PACK_EXPAND_PADDING) || (options == PACK_EXPAND_WIDGET);
115   bool fill = (options == PACK_EXPAND_WIDGET);
116
117   gtk_box_pack_start(gobj(), child.gobj(), (gboolean)expand, (gboolean)fill, padding);
118 }
119
120 void Box::pack_end(Widget& child, PackOptions options, guint padding)
121 {
122   bool expand = (options == PACK_EXPAND_PADDING) || (options == PACK_EXPAND_WIDGET);
123   bool fill = (options == PACK_EXPAND_WIDGET);
124
125   gtk_box_pack_end(gobj(), child.gobj(), (gboolean)expand, (gboolean)fill, padding);
126 }
127
128
129 } /* namespace Gtk */
130
131
132 namespace
133 {
134 } // anonymous namespace
135
136
137 namespace Glib
138 {
139
140 Gtk::Box* wrap(GtkBox* object, bool take_copy)
141 {
142   return dynamic_cast<Gtk::Box *> (Glib::wrap_auto ((GObject*)(object), take_copy));
143 }
144
145 } /* namespace Glib */
146
147 namespace Gtk
148 {
149
150
151 /* The *_Class implementation: */
152
153 const Glib::Class& Box_Class::init()
154 {
155   if(!gtype_) // create the GType if necessary
156   {
157     // Glib::Class has to know the class init function to clone custom types.
158     class_init_func_ = &Box_Class::class_init_function;
159
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();
163
164     // Create the wrapper type, with the same class/instance size as the base type.
165     register_derived_type(gtk_box_get_type());
166
167     // Add derived versions of interfaces, if the C type implements any interfaces:
168   }
169
170   return *this;
171 }
172
173 void Box_Class::class_init_function(void* g_class, void* class_data)
174 {
175   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
176   CppClassParent::class_init_function(klass, class_data);
177
178 }
179
180
181 Glib::ObjectBase* Box_Class::wrap_new(GObject* o)
182 {
183   return manage(new Box((GtkBox*)(o)));
184
185 }
186
187
188 /* The implementation: */
189
190 Box::Box(const Glib::ConstructParams& construct_params)
191 :
192   Gtk::Container(construct_params)
193 {
194   }
195
196 Box::Box(GtkBox* castitem)
197 :
198   Gtk::Container((GtkContainer*)(castitem))
199 {
200   }
201
202 Box::~Box()
203 {
204   destroy_();
205 }
206
207 Box::CppClassType Box::box_class_; // initialize static member
208
209 GType Box::get_type()
210 {
211   return box_class_.init().get_type();
212 }
213
214 GType Box::get_base_type()
215 {
216   return gtk_box_get_type();
217 }
218
219
220 namespace Box_Helpers
221 {
222
223 BoxList::iterator BoxList::find(const_reference w)
224 {
225   iterator i = begin();
226   for(i = begin(); i != end() && (i->get_widget()->gobj() != w.get_widget()->gobj()); i++);
227   return i;
228 }
229
230 BoxList::iterator BoxList::find(Widget& w)
231 {
232   iterator i;
233   for(i = begin(); i != end() && ((GtkWidget*)i->get_widget()->gobj() != w.gobj()); i++);
234   return i;
235 }
236
237 } /* namespace Box_Helpers */
238
239
240 namespace Box_Helpers
241 {
242
243 void BoxList::remove(const_reference child)
244 {
245   gtk_container_remove(GTK_CONTAINER(gparent_),
246                        (GtkWidget*)(child.get_widget()->gobj()));
247 }
248
249 void BoxList::remove(Widget& widget)
250 {
251   gtk_container_remove(GTK_CONTAINER(gparent_), (GtkWidget*)(widget.gobj()));
252 }
253
254 BoxList::iterator BoxList::erase(iterator position)
255 {
256   //Check that it is a valid iterator, to a real item:
257   if ( !position.node_|| (position == end()) )
258     return end();
259
260   //Get an iterator the the next item, to return:
261   iterator next = position;
262   next++;
263
264   //Use GTK+ C function to remove it, by providing the GtkWidget*:
265   gtk_container_remove( GTK_CONTAINER(gparent_), (GtkWidget*)(position->get_widget()->gobj()) );
266   return next;
267 }
268
269 } /* namespace Box_Helpers */
270
271
272 namespace Box_Helpers
273 {
274
275 BoxList::BoxList()
276 {}
277
278 BoxList::BoxList(GtkBox* gparent)
279 : type_base((GObject*)gparent)
280 {}
281
282 BoxList::BoxList(const BoxList& src)
283 :
284   type_base(src)
285 {}
286
287 BoxList& BoxList::operator=(const BoxList& src)
288 {
289   type_base::operator=(src);
290   return *this;
291 }
292
293 GList*& BoxList::glist() const
294 {
295   return ((GtkBox*)gparent_)->children;
296 }
297
298 void BoxList::erase(iterator start, iterator stop)
299 {
300   type_base::erase(start, stop);
301 }
302
303 GtkBox* BoxList::gparent()
304 {
305   return (GtkBox*)type_base::gparent();
306 }
307
308 const GtkBox* BoxList::gparent() const
309 {
310   return (GtkBox*)type_base::gparent();
311 }
312
313 BoxList::reference BoxList::operator[](size_type l) const
314 {
315   return type_base::operator[](l);
316 }
317
318 } /* namespace Box_Helpers */
319
320 Box::Box()
321 :
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()))
324 {
325   }
326
327 void Box::pack_start(Widget& child, bool expand, bool fill, guint padding)
328 {
329   gtk_box_pack_start(gobj(), (child).gobj(), static_cast<int>(expand), static_cast<int>(fill), padding);
330 }
331
332 void Box::pack_end(Widget& child, bool expand, bool fill, guint padding)
333 {
334   gtk_box_pack_end(gobj(), (child).gobj(), static_cast<int>(expand), static_cast<int>(fill), padding);
335 }
336
337 void Box::set_homogeneous(bool homogeneous)
338 {
339   gtk_box_set_homogeneous(gobj(), static_cast<int>(homogeneous));
340 }
341
342 bool Box::get_homogeneous() const
343 {
344   return gtk_box_get_homogeneous(const_cast<GtkBox*>(gobj()));
345 }
346
347 void Box::set_spacing(int spacing)
348 {
349   gtk_box_set_spacing(gobj(), spacing);
350 }
351
352 int Box::get_spacing() const
353 {
354   return gtk_box_get_spacing(const_cast<GtkBox*>(gobj()));
355 }
356
357 void Box::reorder_child(Widget& child, int pos)
358 {
359   gtk_box_reorder_child(gobj(), (child).gobj(), pos);
360 }
361
362
363 Glib::PropertyProxy<int> Box::property_spacing() 
364 {
365   return Glib::PropertyProxy<int>(this, "spacing");
366 }
367
368 Glib::PropertyProxy_ReadOnly<int> Box::property_spacing() const
369 {
370   return Glib::PropertyProxy_ReadOnly<int>(this, "spacing");
371 }
372
373 Glib::PropertyProxy<bool> Box::property_homogeneous() 
374 {
375   return Glib::PropertyProxy<bool>(this, "homogeneous");
376 }
377
378 Glib::PropertyProxy_ReadOnly<bool> Box::property_homogeneous() const
379 {
380   return Glib::PropertyProxy_ReadOnly<bool>(this, "homogeneous");
381 }
382
383
384 } // namespace Gtk
385
386
387 namespace Glib
388 {
389
390 Gtk::VBox* wrap(GtkVBox* object, bool take_copy)
391 {
392   return dynamic_cast<Gtk::VBox *> (Glib::wrap_auto ((GObject*)(object), take_copy));
393 }
394
395 } /* namespace Glib */
396
397 namespace Gtk
398 {
399
400
401 /* The *_Class implementation: */
402
403 const Glib::Class& VBox_Class::init()
404 {
405   if(!gtype_) // create the GType if necessary
406   {
407     // Glib::Class has to know the class init function to clone custom types.
408     class_init_func_ = &VBox_Class::class_init_function;
409
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();
413
414     // Create the wrapper type, with the same class/instance size as the base type.
415     register_derived_type(gtk_vbox_get_type());
416
417     // Add derived versions of interfaces, if the C type implements any interfaces:
418   }
419
420   return *this;
421 }
422
423 void VBox_Class::class_init_function(void* g_class, void* class_data)
424 {
425   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
426   CppClassParent::class_init_function(klass, class_data);
427
428 }
429
430
431 Glib::ObjectBase* VBox_Class::wrap_new(GObject* o)
432 {
433   return manage(new VBox((GtkVBox*)(o)));
434
435 }
436
437
438 /* The implementation: */
439
440 VBox::VBox(const Glib::ConstructParams& construct_params)
441 :
442   Gtk::Box(construct_params)
443 {
444   }
445
446 VBox::VBox(GtkVBox* castitem)
447 :
448   Gtk::Box((GtkBox*)(castitem))
449 {
450   }
451
452 VBox::~VBox()
453 {
454   destroy_();
455 }
456
457 VBox::CppClassType VBox::vbox_class_; // initialize static member
458
459 GType VBox::get_type()
460 {
461   return vbox_class_.init().get_type();
462 }
463
464 GType VBox::get_base_type()
465 {
466   return gtk_vbox_get_type();
467 }
468
469 VBox::VBox(bool homogeneous, int spacing)
470 :
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))
473 {
474   }
475
476
477 } // namespace Gtk
478
479
480 namespace Glib
481 {
482
483 Gtk::HBox* wrap(GtkHBox* object, bool take_copy)
484 {
485   return dynamic_cast<Gtk::HBox *> (Glib::wrap_auto ((GObject*)(object), take_copy));
486 }
487
488 } /* namespace Glib */
489
490 namespace Gtk
491 {
492
493
494 /* The *_Class implementation: */
495
496 const Glib::Class& HBox_Class::init()
497 {
498   if(!gtype_) // create the GType if necessary
499   {
500     // Glib::Class has to know the class init function to clone custom types.
501     class_init_func_ = &HBox_Class::class_init_function;
502
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();
506
507     // Create the wrapper type, with the same class/instance size as the base type.
508     register_derived_type(gtk_hbox_get_type());
509
510     // Add derived versions of interfaces, if the C type implements any interfaces:
511   }
512
513   return *this;
514 }
515
516 void HBox_Class::class_init_function(void* g_class, void* class_data)
517 {
518   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
519   CppClassParent::class_init_function(klass, class_data);
520
521 }
522
523
524 Glib::ObjectBase* HBox_Class::wrap_new(GObject* o)
525 {
526   return manage(new HBox((GtkHBox*)(o)));
527
528 }
529
530
531 /* The implementation: */
532
533 HBox::HBox(const Glib::ConstructParams& construct_params)
534 :
535   Gtk::Box(construct_params)
536 {
537   }
538
539 HBox::HBox(GtkHBox* castitem)
540 :
541   Gtk::Box((GtkBox*)(castitem))
542 {
543   }
544
545 HBox::~HBox()
546 {
547   destroy_();
548 }
549
550 HBox::CppClassType HBox::hbox_class_; // initialize static member
551
552 GType HBox::get_type()
553 {
554   return hbox_class_.init().get_type();
555 }
556
557 GType HBox::get_base_type()
558 {
559   return gtk_hbox_get_type();
560 }
561
562 HBox::HBox(bool homogeneous, int spacing)
563 :
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))
566 {
567   }
568
569
570 } // namespace Gtk
571
572