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