Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / toolbar.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <gtkmm/toolbar.h>
4 #include <gtkmm/private/toolbar_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 //Define this to make sure that we don't use any of the deprecated GtkToolbar API.
29 //Normally we just deprecate it in gtkmm too,
30 //but the GtkToolbar compatibility system is particularly unpleasant, so we just removed it in gtkmm 2.4. murrayc.
31 //In future, this GTK_DISABLE_DEPRECATED might be inappropriate because it might cover extra GTK+ API. Just remove it then.
32
33 #define GTK_DISABLE_DEPRECATED
34
35 #include <glib.h>
36 #include <gtkmm/button.h>
37 #include <gtkmm/togglebutton.h>
38 #include <gtkmm/radiobutton.h>
39 #include <gtkmm/tooltips.h>
40 //#include <gtkmm/image.h>
41 #include <gtkmm/label.h>
42 #include <gtk/gtklabel.h>
43 #include <gtk/gtktoolbar.h>
44
45 namespace Gtk
46 {
47
48 void Toolbar::insert(ToolButton& item, int pos, const sigc::slot<void>& clicked_slot)
49 {
50   item.signal_clicked().connect(clicked_slot);
51   gtk_toolbar_insert(gobj(), (GtkToolItem*)((item).gobj()), pos);
52 }
53
54 void Toolbar::insert(ToggleToolButton& item, int pos, const sigc::slot<void>& toggled_slot)
55 {
56   item.signal_toggled().connect(toggled_slot);
57   gtk_toolbar_insert(gobj(), (GtkToolItem*)((item).gobj()), pos);
58 }
59
60 void Toolbar::append(ToolItem& item)
61 {
62   gtk_toolbar_insert(gobj(), (item).gobj(), -1 /* See GTK+ docs */);
63 }
64
65 void Toolbar::append(ToolButton& item, const sigc::slot<void>& clicked_slot)
66 {
67   item.signal_clicked().connect(clicked_slot);
68   gtk_toolbar_insert(gobj(), (GtkToolItem*)((item).gobj()), -1 /* See GTK+ docs */);
69 }
70
71 void Toolbar::append(ToggleToolButton& item, const sigc::slot<void>& toggled_slot)
72 {
73   item.signal_toggled().connect(toggled_slot);
74   gtk_toolbar_insert(gobj(), (GtkToolItem*)((item).gobj()), -1 /* See GTK+ docs */);
75 }
76
77 void Toolbar::prepend(ToolItem& item)
78 {
79   gtk_toolbar_insert(gobj(), (item).gobj(), 0 /* See GTK+ docs */);
80 }
81
82 void Toolbar::prepend(ToolButton& item, const sigc::slot<void>& clicked_slot)
83 {
84   item.signal_clicked().connect(clicked_slot);
85   gtk_toolbar_insert(gobj(), (GtkToolItem*)((item).gobj()), 0 /* See GTK+ docs */);
86 }
87
88 void Toolbar::prepend(ToggleToolButton& item, const sigc::slot<void>& toggled_slot)
89 {
90   item.signal_toggled().connect(toggled_slot);
91   gtk_toolbar_insert(gobj(), (GtkToolItem*)((item).gobj()), 0 /* See GTK+ docs */);
92 }
93
94 void Toolbar::unset_drop_highlight_item()
95 {
96   //See GTK+ docs.
97   gtk_toolbar_set_drop_highlight_item(gobj(), 0, 0);
98 }
99
100 } // namespace Gtk
101
102
103 namespace
104 {
105
106 void Toolbar_signal_orientation_changed_callback(GtkToolbar* self, GtkOrientation p0,void* data)
107 {
108   using namespace Gtk;
109   typedef sigc::slot< void,Orientation > SlotType;
110
111   // Do not try to call a signal on a disassociated wrapper.
112   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
113   {
114     try
115     {
116       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
117         (*static_cast<SlotType*>(slot))(((Orientation)(p0))
118 );
119     }
120     catch(...)
121     {
122       Glib::exception_handlers_invoke();
123     }
124   }
125 }
126
127 const Glib::SignalProxyInfo Toolbar_signal_orientation_changed_info =
128 {
129   "orientation_changed",
130   (GCallback) &Toolbar_signal_orientation_changed_callback,
131   (GCallback) &Toolbar_signal_orientation_changed_callback
132 };
133
134
135 void Toolbar_signal_toolbar_style_changed_callback(GtkToolbar* self, GtkToolbarStyle p0,void* data)
136 {
137   using namespace Gtk;
138   typedef sigc::slot< void,ToolbarStyle > SlotType;
139
140   // Do not try to call a signal on a disassociated wrapper.
141   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
142   {
143     try
144     {
145       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
146         (*static_cast<SlotType*>(slot))(((ToolbarStyle)(p0))
147 );
148     }
149     catch(...)
150     {
151       Glib::exception_handlers_invoke();
152     }
153   }
154 }
155
156 const Glib::SignalProxyInfo Toolbar_signal_toolbar_style_changed_info =
157 {
158   "style_changed",
159   (GCallback) &Toolbar_signal_toolbar_style_changed_callback,
160   (GCallback) &Toolbar_signal_toolbar_style_changed_callback
161 };
162
163
164 gboolean Toolbar_signal_popup_context_menu_callback(GtkToolbar* self, gint p0,gint p1,gint p2,void* data)
165 {
166   using namespace Gtk;
167   typedef sigc::slot< bool,int,int,int > SlotType;
168
169   // Do not try to call a signal on a disassociated wrapper.
170   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
171   {
172     try
173     {
174       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
175         return static_cast<int>((*static_cast<SlotType*>(slot))(p0
176 , p1
177 , p2
178 ));
179     }
180     catch(...)
181     {
182       Glib::exception_handlers_invoke();
183     }
184   }
185
186   typedef gboolean RType;
187   return RType();
188 }
189
190 gboolean Toolbar_signal_popup_context_menu_notify_callback(GtkToolbar* self, gint p0,gint p1,gint p2, void* data)
191 {
192   using namespace Gtk;
193   typedef sigc::slot< void,int,int,int > SlotType;
194
195   // Do not try to call a signal on a disassociated wrapper.
196   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
197   {
198     try
199     {
200       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
201         (*static_cast<SlotType*>(slot))(p0
202 , p1
203 , p2
204 );
205     }
206     catch(...)
207     {
208       Glib::exception_handlers_invoke();
209     }
210   }
211
212   typedef gboolean RType;
213   return RType();
214 }
215
216 const Glib::SignalProxyInfo Toolbar_signal_popup_context_menu_info =
217 {
218   "popup_context_menu",
219   (GCallback) &Toolbar_signal_popup_context_menu_callback,
220   (GCallback) &Toolbar_signal_popup_context_menu_notify_callback
221 };
222
223 } // anonymous namespace
224
225
226 namespace Glib
227 {
228
229 Gtk::Toolbar* wrap(GtkToolbar* object, bool take_copy)
230 {
231   return dynamic_cast<Gtk::Toolbar *> (Glib::wrap_auto ((GObject*)(object), take_copy));
232 }
233
234 } /* namespace Glib */
235
236 namespace Gtk
237 {
238
239
240 /* The *_Class implementation: */
241
242 const Glib::Class& Toolbar_Class::init()
243 {
244   if(!gtype_) // create the GType if necessary
245   {
246     // Glib::Class has to know the class init function to clone custom types.
247     class_init_func_ = &Toolbar_Class::class_init_function;
248
249     // This is actually just optimized away, apparently with no harm.
250     // Make sure that the parent type has been created.
251     //CppClassParent::CppObjectType::get_type();
252
253     // Create the wrapper type, with the same class/instance size as the base type.
254     register_derived_type(gtk_toolbar_get_type());
255
256     // Add derived versions of interfaces, if the C type implements any interfaces:
257   }
258
259   return *this;
260 }
261
262 void Toolbar_Class::class_init_function(void* g_class, void* class_data)
263 {
264   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
265   CppClassParent::class_init_function(klass, class_data);
266
267   klass->orientation_changed = &orientation_changed_callback;
268   klass->style_changed = &style_changed_callback;
269   klass->popup_context_menu = &popup_context_menu_callback;
270 }
271
272
273 void Toolbar_Class::orientation_changed_callback(GtkToolbar* self, GtkOrientation p0)
274 {
275   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
276       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
277
278   // Non-gtkmmproc-generated custom classes implicitly call the default
279   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
280   // generated classes can use this optimisation, which avoids the unnecessary
281   // parameter conversions if there is no possibility of the virtual function
282   // being overridden:
283   if(obj && obj->is_derived_())
284   {
285     try // Trap C++ exceptions which would normally be lost because this is a C callback.
286     {
287       // Call the virtual member method, which derived classes might override.
288       obj->on_orientation_changed(((Orientation)(p0))
289 );
290     }
291     catch(...)
292     {
293       Glib::exception_handlers_invoke();
294     }
295   }
296   else
297   {
298     BaseClassType *const base = static_cast<BaseClassType*>(
299         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
300     );
301
302     // Call the original underlying C function:
303     if(base && base->orientation_changed)
304       (*base->orientation_changed)(self, p0);
305   }
306 }
307
308 void Toolbar_Class::style_changed_callback(GtkToolbar* self, GtkToolbarStyle p0)
309 {
310   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
311       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
312
313   // Non-gtkmmproc-generated custom classes implicitly call the default
314   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
315   // generated classes can use this optimisation, which avoids the unnecessary
316   // parameter conversions if there is no possibility of the virtual function
317   // being overridden:
318   if(obj && obj->is_derived_())
319   {
320     try // Trap C++ exceptions which would normally be lost because this is a C callback.
321     {
322       // Call the virtual member method, which derived classes might override.
323       obj->on_toolbar_style_changed(((ToolbarStyle)(p0))
324 );
325     }
326     catch(...)
327     {
328       Glib::exception_handlers_invoke();
329     }
330   }
331   else
332   {
333     BaseClassType *const base = static_cast<BaseClassType*>(
334         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
335     );
336
337     // Call the original underlying C function:
338     if(base && base->style_changed)
339       (*base->style_changed)(self, p0);
340   }
341 }
342
343 gboolean Toolbar_Class::popup_context_menu_callback(GtkToolbar* self, gint p0, gint p1, gint p2)
344 {
345   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
346       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
347
348   // Non-gtkmmproc-generated custom classes implicitly call the default
349   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
350   // generated classes can use this optimisation, which avoids the unnecessary
351   // parameter conversions if there is no possibility of the virtual function
352   // being overridden:
353   if(obj && obj->is_derived_())
354   {
355     try // Trap C++ exceptions which would normally be lost because this is a C callback.
356     {
357       // Call the virtual member method, which derived classes might override.
358       return static_cast<int>(obj->on_popup_context_menu(p0
359 , p1
360 , p2
361 ));
362     }
363     catch(...)
364     {
365       Glib::exception_handlers_invoke();
366     }
367   }
368   else
369   {
370     BaseClassType *const base = static_cast<BaseClassType*>(
371         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
372     );
373
374     // Call the original underlying C function:
375     if(base && base->popup_context_menu)
376       return (*base->popup_context_menu)(self, p0, p1, p2);
377   }
378
379   typedef gboolean RType;
380   return RType();
381 }
382
383
384 Glib::ObjectBase* Toolbar_Class::wrap_new(GObject* o)
385 {
386   return manage(new Toolbar((GtkToolbar*)(o)));
387
388 }
389
390
391 /* The implementation: */
392
393 Toolbar::Toolbar(const Glib::ConstructParams& construct_params)
394 :
395   Gtk::Container(construct_params)
396 {
397   }
398
399 Toolbar::Toolbar(GtkToolbar* castitem)
400 :
401   Gtk::Container((GtkContainer*)(castitem))
402 {
403   }
404
405 Toolbar::~Toolbar()
406 {
407   destroy_();
408 }
409
410 Toolbar::CppClassType Toolbar::toolbar_class_; // initialize static member
411
412 GType Toolbar::get_type()
413 {
414   return toolbar_class_.init().get_type();
415 }
416
417 GType Toolbar::get_base_type()
418 {
419   return gtk_toolbar_get_type();
420 }
421
422
423 Toolbar::Toolbar()
424 :
425   Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
426   Gtk::Container(Glib::ConstructParams(toolbar_class_.init()))
427 {
428   }
429
430 void Toolbar::insert(ToolItem& item, int pos)
431 {
432   gtk_toolbar_insert(gobj(), (item).gobj(), pos);
433 }
434
435 int Toolbar::get_item_index(const ToolItem& item) const
436 {
437   return gtk_toolbar_get_item_index(const_cast<GtkToolbar*>(gobj()), const_cast<GtkToolItem*>((item).gobj()));
438 }
439
440 int Toolbar::get_n_items() const
441 {
442   return gtk_toolbar_get_n_items(const_cast<GtkToolbar*>(gobj()));
443 }
444
445 ToolItem* Toolbar::get_nth_item(int n)
446 {
447   return Glib::wrap(gtk_toolbar_get_nth_item(gobj(), n));
448 }
449
450 const ToolItem* Toolbar::get_nth_item(int n) const
451 {
452   return Glib::wrap(gtk_toolbar_get_nth_item(const_cast<GtkToolbar*>(gobj()), n));
453 }
454
455 bool Toolbar::get_show_arrow() const
456 {
457   return gtk_toolbar_get_show_arrow(const_cast<GtkToolbar*>(gobj()));
458 }
459
460 void Toolbar::set_show_arrow(bool show_arrow)
461 {
462   gtk_toolbar_set_show_arrow(gobj(), static_cast<int>(show_arrow));
463 }
464
465 void Toolbar::set_orientation(Orientation orientation)
466 {
467   gtk_toolbar_set_orientation(gobj(), ((GtkOrientation)(orientation)));
468 }
469
470 Orientation Toolbar::get_orientation() const
471 {
472   return ((Orientation)(gtk_toolbar_get_orientation(const_cast<GtkToolbar*>(gobj()))));
473 }
474
475 void Toolbar::set_toolbar_style(ToolbarStyle style)
476 {
477   gtk_toolbar_set_style(gobj(), ((GtkToolbarStyle)(style)));
478 }
479
480 ToolbarStyle Toolbar::get_toolbar_style() const
481 {
482   return ((ToolbarStyle)(gtk_toolbar_get_style(const_cast<GtkToolbar*>(gobj()))));
483 }
484
485 void Toolbar::set_tooltips(bool enable)
486 {
487   gtk_toolbar_set_tooltips(gobj(), static_cast<int>(enable));
488 }
489
490 bool Toolbar::get_tooltips() const
491 {
492   return gtk_toolbar_get_tooltips(const_cast<GtkToolbar*>(gobj()));
493 }
494
495 void Toolbar::unset_toolbar_style()
496 {
497   gtk_toolbar_unset_style(gobj());
498 }
499
500 IconSize Toolbar::get_icon_size() const
501 {
502   return IconSize(static_cast<int>(gtk_toolbar_get_icon_size(const_cast<GtkToolbar*>(gobj()))));
503 }
504
505 ReliefStyle Toolbar::get_relief_style() const
506 {
507   return ((ReliefStyle)(gtk_toolbar_get_relief_style(const_cast<GtkToolbar*>(gobj()))));
508 }
509
510 int Toolbar::get_drop_index(int x, int y) const
511 {
512   return gtk_toolbar_get_drop_index(const_cast<GtkToolbar*>(gobj()), x, y);
513 }
514
515 void Toolbar::set_drop_highlight_item(ToolItem& tool_item, int index)
516 {
517   gtk_toolbar_set_drop_highlight_item(gobj(), (tool_item).gobj(), index);
518 }
519
520 Tooltips* Toolbar::get_tooltips_object() const
521 {
522   return Glib::wrap(gobj()->tooltips);
523 }
524
525
526 Glib::SignalProxy1< void,Orientation > Toolbar::signal_orientation_changed()
527 {
528   return Glib::SignalProxy1< void,Orientation >(this, &Toolbar_signal_orientation_changed_info);
529 }
530
531 Glib::SignalProxy1< void,ToolbarStyle > Toolbar::signal_toolbar_style_changed()
532 {
533   return Glib::SignalProxy1< void,ToolbarStyle >(this, &Toolbar_signal_toolbar_style_changed_info);
534 }
535
536 Glib::SignalProxy3< bool,int,int,int > Toolbar::signal_popup_context_menu()
537 {
538   return Glib::SignalProxy3< bool,int,int,int >(this, &Toolbar_signal_popup_context_menu_info);
539 }
540
541
542 Glib::PropertyProxy<Orientation> Toolbar::property_orientation() 
543 {
544   return Glib::PropertyProxy<Orientation>(this, "orientation");
545 }
546
547 Glib::PropertyProxy_ReadOnly<Orientation> Toolbar::property_orientation() const
548 {
549   return Glib::PropertyProxy_ReadOnly<Orientation>(this, "orientation");
550 }
551
552 Glib::PropertyProxy<ToolbarStyle> Toolbar::property_toolbar_style() 
553 {
554   return Glib::PropertyProxy<ToolbarStyle>(this, "toolbar-style");
555 }
556
557 Glib::PropertyProxy_ReadOnly<ToolbarStyle> Toolbar::property_toolbar_style() const
558 {
559   return Glib::PropertyProxy_ReadOnly<ToolbarStyle>(this, "toolbar-style");
560 }
561
562 Glib::PropertyProxy<bool> Toolbar::property_show_arrow() 
563 {
564   return Glib::PropertyProxy<bool>(this, "show-arrow");
565 }
566
567 Glib::PropertyProxy_ReadOnly<bool> Toolbar::property_show_arrow() const
568 {
569   return Glib::PropertyProxy_ReadOnly<bool>(this, "show-arrow");
570 }
571
572
573 void Gtk::Toolbar::on_orientation_changed(Orientation orientation)
574 {
575   BaseClassType *const base = static_cast<BaseClassType*>(
576       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
577   );
578
579   if(base && base->orientation_changed)
580     (*base->orientation_changed)(gobj(),((GtkOrientation)(orientation)));
581 }
582
583 void Gtk::Toolbar::on_toolbar_style_changed(ToolbarStyle style)
584 {
585   BaseClassType *const base = static_cast<BaseClassType*>(
586       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
587   );
588
589   if(base && base->style_changed)
590     (*base->style_changed)(gobj(),((GtkToolbarStyle)(style)));
591 }
592
593 bool Gtk::Toolbar::on_popup_context_menu(int x, int y, int button_number)
594 {
595   BaseClassType *const base = static_cast<BaseClassType*>(
596       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
597   );
598
599   if(base && base->popup_context_menu)
600     return (*base->popup_context_menu)(gobj(),x,y,button_number);
601
602   typedef bool RType;
603   return RType();
604 }
605
606
607 } // namespace Gtk
608
609