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