moved 2.1-staging to trunk @ rev 1765
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / toolitem.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3
4 #include <gtkmm/toolitem.h>
5 #include <gtkmm/private/toolitem_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/gtktoolitem.h>
30
31 namespace Gtk
32 {
33
34
35 } // namespace Gtk
36
37
38 namespace
39 {
40
41
42 static gboolean ToolItem_signal_create_menu_proxy_callback(GtkToolItem* self, void* data)
43 {
44   using namespace Gtk;
45   typedef sigc::slot< bool > SlotType;
46
47   // Do not try to call a signal on a disassociated wrapper.
48   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
49   {
50     #ifdef GLIBMM_EXCEPTIONS_ENABLED
51     try
52     {
53     #endif //GLIBMM_EXCEPTIONS_ENABLED
54       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
55         return static_cast<int>((*static_cast<SlotType*>(slot))());
56     #ifdef GLIBMM_EXCEPTIONS_ENABLED
57     }
58     catch(...)
59     {
60       Glib::exception_handlers_invoke();
61     }
62     #endif //GLIBMM_EXCEPTIONS_ENABLED
63   }
64
65   typedef gboolean RType;
66   return RType();
67 }
68
69 static gboolean ToolItem_signal_create_menu_proxy_notify_callback(GtkToolItem* self,  void* data)
70 {
71   using namespace Gtk;
72   typedef sigc::slot< void > SlotType;
73
74   // Do not try to call a signal on a disassociated wrapper.
75   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
76   {
77     #ifdef GLIBMM_EXCEPTIONS_ENABLED
78     try
79     {
80     #endif //GLIBMM_EXCEPTIONS_ENABLED
81       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
82         (*static_cast<SlotType*>(slot))();
83     #ifdef GLIBMM_EXCEPTIONS_ENABLED
84     }
85     catch(...)
86     {
87       Glib::exception_handlers_invoke();
88     }
89     #endif //GLIBMM_EXCEPTIONS_ENABLED
90   }
91
92   typedef gboolean RType;
93   return RType();
94 }
95
96 static const Glib::SignalProxyInfo ToolItem_signal_create_menu_proxy_info =
97 {
98   "create_menu_proxy",
99   (GCallback) &ToolItem_signal_create_menu_proxy_callback,
100   (GCallback) &ToolItem_signal_create_menu_proxy_notify_callback
101 };
102
103
104 static const Glib::SignalProxyInfo ToolItem_signal_toolbar_reconfigured_info =
105 {
106   "toolbar_reconfigured",
107   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
108   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
109 };
110
111
112 static gboolean ToolItem_signal_set_tooltip_callback(GtkToolItem* self, GtkTooltips* p0,const gchar* p1,const gchar* p2,void* data)
113 {
114   using namespace Gtk;
115   typedef sigc::slot< bool,Tooltips*,const Glib::ustring&,const Glib::ustring& > SlotType;
116
117   // Do not try to call a signal on a disassociated wrapper.
118   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
119   {
120     #ifdef GLIBMM_EXCEPTIONS_ENABLED
121     try
122     {
123     #endif //GLIBMM_EXCEPTIONS_ENABLED
124       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
125         return static_cast<int>((*static_cast<SlotType*>(slot))(Glib::wrap(p0)
126 , Glib::convert_const_gchar_ptr_to_ustring(p1)
127 , Glib::convert_const_gchar_ptr_to_ustring(p2)
128 ));
129     #ifdef GLIBMM_EXCEPTIONS_ENABLED
130     }
131     catch(...)
132     {
133       Glib::exception_handlers_invoke();
134     }
135     #endif //GLIBMM_EXCEPTIONS_ENABLED
136   }
137
138   typedef gboolean RType;
139   return RType();
140 }
141
142 static gboolean ToolItem_signal_set_tooltip_notify_callback(GtkToolItem* self, GtkTooltips* p0,const gchar* p1,const gchar* p2, void* data)
143 {
144   using namespace Gtk;
145   typedef sigc::slot< void,Tooltips*,const Glib::ustring&,const Glib::ustring& > SlotType;
146
147   // Do not try to call a signal on a disassociated wrapper.
148   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
149   {
150     #ifdef GLIBMM_EXCEPTIONS_ENABLED
151     try
152     {
153     #endif //GLIBMM_EXCEPTIONS_ENABLED
154       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
155         (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
156 , Glib::convert_const_gchar_ptr_to_ustring(p1)
157 , Glib::convert_const_gchar_ptr_to_ustring(p2)
158 );
159     #ifdef GLIBMM_EXCEPTIONS_ENABLED
160     }
161     catch(...)
162     {
163       Glib::exception_handlers_invoke();
164     }
165     #endif //GLIBMM_EXCEPTIONS_ENABLED
166   }
167
168   typedef gboolean RType;
169   return RType();
170 }
171
172 static const Glib::SignalProxyInfo ToolItem_signal_set_tooltip_info =
173 {
174   "set_tooltip",
175   (GCallback) &ToolItem_signal_set_tooltip_callback,
176   (GCallback) &ToolItem_signal_set_tooltip_notify_callback
177 };
178
179
180 } // anonymous namespace
181
182
183 namespace Glib
184 {
185
186 Gtk::ToolItem* wrap(GtkToolItem* object, bool take_copy)
187 {
188   return dynamic_cast<Gtk::ToolItem *> (Glib::wrap_auto ((GObject*)(object), take_copy));
189 }
190
191 } /* namespace Glib */
192
193 namespace Gtk
194 {
195
196
197 /* The *_Class implementation: */
198
199 const Glib::Class& ToolItem_Class::init()
200 {
201   if(!gtype_) // create the GType if necessary
202   {
203     // Glib::Class has to know the class init function to clone custom types.
204     class_init_func_ = &ToolItem_Class::class_init_function;
205
206     // This is actually just optimized away, apparently with no harm.
207     // Make sure that the parent type has been created.
208     //CppClassParent::CppObjectType::get_type();
209
210     // Create the wrapper type, with the same class/instance size as the base type.
211     register_derived_type(gtk_tool_item_get_type());
212
213     // Add derived versions of interfaces, if the C type implements any interfaces:
214   }
215
216   return *this;
217 }
218
219 void ToolItem_Class::class_init_function(void* g_class, void* class_data)
220 {
221   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
222   CppClassParent::class_init_function(klass, class_data);
223
224 #ifdef GLIBMM_VFUNCS_ENABLED
225 #endif //GLIBMM_VFUNCS_ENABLED
226
227 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
228   klass->create_menu_proxy = &create_menu_proxy_callback;
229   klass->toolbar_reconfigured = &toolbar_reconfigured_callback;
230 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
231 }
232
233 #ifdef GLIBMM_VFUNCS_ENABLED
234 #endif //GLIBMM_VFUNCS_ENABLED
235
236 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
237 gboolean ToolItem_Class::create_menu_proxy_callback(GtkToolItem* self)
238 {
239   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
240       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
241
242   // Non-gtkmmproc-generated custom classes implicitly call the default
243   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
244   // generated classes can use this optimisation, which avoids the unnecessary
245   // parameter conversions if there is no possibility of the virtual function
246   // being overridden:
247   if(obj && obj->is_derived_())
248   {
249     #ifdef GLIBMM_EXCEPTIONS_ENABLED
250     try // Trap C++ exceptions which would normally be lost because this is a C callback.
251     {
252     #endif //GLIBMM_EXCEPTIONS_ENABLED
253       // Call the virtual member method, which derived classes might override.
254       return static_cast<int>(obj->on_create_menu_proxy());
255     #ifdef GLIBMM_EXCEPTIONS_ENABLED
256     }
257     catch(...)
258     {
259       Glib::exception_handlers_invoke();
260     }
261     #endif //GLIBMM_EXCEPTIONS_ENABLED
262   }
263   else
264   {
265     BaseClassType *const base = static_cast<BaseClassType*>(
266         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
267     );
268
269     // Call the original underlying C function:
270     if(base && base->create_menu_proxy)
271       return (*base->create_menu_proxy)(self);
272   }
273
274   typedef gboolean RType;
275   return RType();
276 }
277 void ToolItem_Class::toolbar_reconfigured_callback(GtkToolItem* self)
278 {
279   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
280       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
281
282   // Non-gtkmmproc-generated custom classes implicitly call the default
283   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
284   // generated classes can use this optimisation, which avoids the unnecessary
285   // parameter conversions if there is no possibility of the virtual function
286   // being overridden:
287   if(obj && obj->is_derived_())
288   {
289     #ifdef GLIBMM_EXCEPTIONS_ENABLED
290     try // Trap C++ exceptions which would normally be lost because this is a C callback.
291     {
292     #endif //GLIBMM_EXCEPTIONS_ENABLED
293       // Call the virtual member method, which derived classes might override.
294       obj->on_toolbar_reconfigured();
295     #ifdef GLIBMM_EXCEPTIONS_ENABLED
296     }
297     catch(...)
298     {
299       Glib::exception_handlers_invoke();
300     }
301     #endif //GLIBMM_EXCEPTIONS_ENABLED
302   }
303   else
304   {
305     BaseClassType *const base = static_cast<BaseClassType*>(
306         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
307     );
308
309     // Call the original underlying C function:
310     if(base && base->toolbar_reconfigured)
311       (*base->toolbar_reconfigured)(self);
312   }
313 }
314 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
315
316
317 Glib::ObjectBase* ToolItem_Class::wrap_new(GObject* o)
318 {
319   return manage(new ToolItem((GtkToolItem*)(o)));
320
321 }
322
323
324 /* The implementation: */
325
326 ToolItem::ToolItem(const Glib::ConstructParams& construct_params)
327 :
328   Gtk::Bin(construct_params)
329 {
330   }
331
332 ToolItem::ToolItem(GtkToolItem* castitem)
333 :
334   Gtk::Bin((GtkBin*)(castitem))
335 {
336   }
337
338 ToolItem::~ToolItem()
339 {
340   destroy_();
341 }
342
343 ToolItem::CppClassType ToolItem::toolitem_class_; // initialize static member
344
345 GType ToolItem::get_type()
346 {
347   return toolitem_class_.init().get_type();
348 }
349
350 GType ToolItem::get_base_type()
351 {
352   return gtk_tool_item_get_type();
353 }
354
355
356 ToolItem::ToolItem()
357 :
358   Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
359   Gtk::Bin(Glib::ConstructParams(toolitem_class_.init()))
360 {
361   }
362
363 void ToolItem::set_homogeneous(bool homogeneous)
364 {
365 gtk_tool_item_set_homogeneous(gobj(), static_cast<int>(homogeneous)); 
366 }
367
368 bool ToolItem::get_homogeneous() const
369 {
370   return gtk_tool_item_get_homogeneous(const_cast<GtkToolItem*>(gobj()));
371 }
372
373 void ToolItem::set_expand(bool expand)
374 {
375 gtk_tool_item_set_expand(gobj(), static_cast<int>(expand)); 
376 }
377
378 bool ToolItem::get_expand() const
379 {
380   return gtk_tool_item_get_expand(const_cast<GtkToolItem*>(gobj()));
381 }
382
383 void ToolItem::set_tooltip(Tooltips& tooltips, const Glib::ustring& tip_text, const Glib::ustring& tip_private)
384 {
385 gtk_tool_item_set_tooltip(gobj(), (tooltips).gobj(), tip_text.c_str(), tip_private.c_str()); 
386 }
387
388 void ToolItem::set_use_drag_window(bool use_drag_window)
389 {
390 gtk_tool_item_set_use_drag_window(gobj(), static_cast<int>(use_drag_window)); 
391 }
392
393 bool ToolItem::get_use_drag_window() const
394 {
395   return gtk_tool_item_get_use_drag_window(const_cast<GtkToolItem*>(gobj()));
396 }
397
398 void ToolItem::set_visible_horizontal(bool visible_horizontal)
399 {
400 gtk_tool_item_set_visible_horizontal(gobj(), static_cast<int>(visible_horizontal)); 
401 }
402
403 bool ToolItem::get_visible_horizontal() const
404 {
405   return gtk_tool_item_get_visible_horizontal(const_cast<GtkToolItem*>(gobj()));
406 }
407
408 void ToolItem::set_visible_vertical(bool visible_vertical)
409 {
410 gtk_tool_item_set_visible_vertical(gobj(), static_cast<int>(visible_vertical)); 
411 }
412
413 bool ToolItem::get_visible_vertical() const
414 {
415   return gtk_tool_item_get_visible_vertical(const_cast<GtkToolItem*>(gobj()));
416 }
417
418 bool ToolItem::get_is_important() const
419 {
420   return gtk_tool_item_get_is_important(const_cast<GtkToolItem*>(gobj()));
421 }
422
423 void ToolItem::set_is_important(bool is_important)
424 {
425 gtk_tool_item_set_is_important(gobj(), static_cast<int>(is_important)); 
426 }
427
428 IconSize ToolItem::get_icon_size() const
429 {
430   return IconSize(static_cast<int>(gtk_tool_item_get_icon_size(const_cast<GtkToolItem*>(gobj()))));
431 }
432
433 Orientation ToolItem::get_orientation() const
434 {
435   return ((Orientation)(gtk_tool_item_get_orientation(const_cast<GtkToolItem*>(gobj()))));
436 }
437
438 ToolbarStyle ToolItem::get_toolbar_style() const
439 {
440   return ((ToolbarStyle)(gtk_tool_item_get_toolbar_style(const_cast<GtkToolItem*>(gobj()))));
441 }
442
443 ReliefStyle ToolItem::get_relief_style() const
444 {
445   return ((ReliefStyle)(gtk_tool_item_get_relief_style(const_cast<GtkToolItem*>(gobj()))));
446 }
447
448 Widget* ToolItem::retrieve_proxy_menu_item()
449 {
450   return Glib::wrap(gtk_tool_item_retrieve_proxy_menu_item(gobj()));
451 }
452
453 const Widget* ToolItem::retrieve_proxy_menu_item() const
454 {
455   return const_cast<ToolItem*>(this)->retrieve_proxy_menu_item();
456 }
457
458 Widget* ToolItem::get_proxy_menu_item(const Glib::ustring& menu_item_id)
459 {
460   return Glib::wrap(gtk_tool_item_get_proxy_menu_item(gobj(), menu_item_id.c_str()));
461 }
462
463 const Widget* ToolItem::get_proxy_menu_item(const Glib::ustring& menu_item_id) const
464 {
465   return const_cast<ToolItem*>(this)->get_proxy_menu_item(menu_item_id);
466 }
467
468 void ToolItem::set_proxy_menu_item(const Glib::ustring& menu_item_id, Widget& menu_item)
469 {
470 gtk_tool_item_set_proxy_menu_item(gobj(), menu_item_id.c_str(), (menu_item).gobj()); 
471 }
472
473 void ToolItem::rebuild_menu()
474 {
475 gtk_tool_item_rebuild_menu(gobj()); 
476 }
477
478
479 Glib::SignalProxy0< bool > ToolItem::signal_create_menu_proxy()
480 {
481   return Glib::SignalProxy0< bool >(this, &ToolItem_signal_create_menu_proxy_info);
482 }
483
484
485 Glib::SignalProxy0< void > ToolItem::signal_toolbar_reconfigured()
486 {
487   return Glib::SignalProxy0< void >(this, &ToolItem_signal_toolbar_reconfigured_info);
488 }
489
490
491 Glib::SignalProxy3< bool,Tooltips*,const Glib::ustring&,const Glib::ustring& > ToolItem::signal_set_tooltip()
492 {
493   return Glib::SignalProxy3< bool,Tooltips*,const Glib::ustring&,const Glib::ustring& >(this, &ToolItem_signal_set_tooltip_info);
494 }
495
496
497 #ifdef GLIBMM_PROPERTIES_ENABLED
498 Glib::PropertyProxy<bool> ToolItem::property_visible_horizontal() 
499 {
500   return Glib::PropertyProxy<bool>(this, "visible-horizontal");
501 }
502 #endif //GLIBMM_PROPERTIES_ENABLED
503
504 #ifdef GLIBMM_PROPERTIES_ENABLED
505 Glib::PropertyProxy_ReadOnly<bool> ToolItem::property_visible_horizontal() const
506 {
507   return Glib::PropertyProxy_ReadOnly<bool>(this, "visible-horizontal");
508 }
509 #endif //GLIBMM_PROPERTIES_ENABLED
510
511 #ifdef GLIBMM_PROPERTIES_ENABLED
512 Glib::PropertyProxy<bool> ToolItem::property_visible_vertical() 
513 {
514   return Glib::PropertyProxy<bool>(this, "visible-vertical");
515 }
516 #endif //GLIBMM_PROPERTIES_ENABLED
517
518 #ifdef GLIBMM_PROPERTIES_ENABLED
519 Glib::PropertyProxy_ReadOnly<bool> ToolItem::property_visible_vertical() const
520 {
521   return Glib::PropertyProxy_ReadOnly<bool>(this, "visible-vertical");
522 }
523 #endif //GLIBMM_PROPERTIES_ENABLED
524
525 #ifdef GLIBMM_PROPERTIES_ENABLED
526 Glib::PropertyProxy<bool> ToolItem::property_is_important() 
527 {
528   return Glib::PropertyProxy<bool>(this, "is-important");
529 }
530 #endif //GLIBMM_PROPERTIES_ENABLED
531
532 #ifdef GLIBMM_PROPERTIES_ENABLED
533 Glib::PropertyProxy_ReadOnly<bool> ToolItem::property_is_important() const
534 {
535   return Glib::PropertyProxy_ReadOnly<bool>(this, "is-important");
536 }
537 #endif //GLIBMM_PROPERTIES_ENABLED
538
539
540 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
541 bool Gtk::ToolItem::on_create_menu_proxy()
542 {
543   BaseClassType *const base = static_cast<BaseClassType*>(
544       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
545   );
546
547   if(base && base->create_menu_proxy)
548     return (*base->create_menu_proxy)(gobj());
549
550   typedef bool RType;
551   return RType();
552 }
553 void Gtk::ToolItem::on_toolbar_reconfigured()
554 {
555   BaseClassType *const base = static_cast<BaseClassType*>(
556       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
557   );
558
559   if(base && base->toolbar_reconfigured)
560     (*base->toolbar_reconfigured)(gobj());
561 }
562 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
563
564 #ifdef GLIBMM_VFUNCS_ENABLED
565 #endif //GLIBMM_VFUNCS_ENABLED
566
567
568 } // namespace Gtk
569
570