1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <gtkmm/toolbar.h>
4 #include <gtkmm/private/toolbar_p.h>
11 * Copyright 1998-2002 The gtkmm Development Team
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.
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.
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.
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.
33 #define GTK_DISABLE_DEPRECATED
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>
48 void Toolbar::insert(ToolButton& item, int pos, const sigc::slot<void>& clicked_slot)
50 item.signal_clicked().connect(clicked_slot);
51 gtk_toolbar_insert(gobj(), (GtkToolItem*)((item).gobj()), pos);
54 void Toolbar::insert(ToggleToolButton& item, int pos, const sigc::slot<void>& toggled_slot)
56 item.signal_toggled().connect(toggled_slot);
57 gtk_toolbar_insert(gobj(), (GtkToolItem*)((item).gobj()), pos);
60 void Toolbar::append(ToolItem& item)
62 gtk_toolbar_insert(gobj(), (item).gobj(), -1 /* See GTK+ docs */);
65 void Toolbar::append(ToolButton& item, const sigc::slot<void>& clicked_slot)
67 item.signal_clicked().connect(clicked_slot);
68 gtk_toolbar_insert(gobj(), (GtkToolItem*)((item).gobj()), -1 /* See GTK+ docs */);
71 void Toolbar::append(ToggleToolButton& item, const sigc::slot<void>& toggled_slot)
73 item.signal_toggled().connect(toggled_slot);
74 gtk_toolbar_insert(gobj(), (GtkToolItem*)((item).gobj()), -1 /* See GTK+ docs */);
77 void Toolbar::prepend(ToolItem& item)
79 gtk_toolbar_insert(gobj(), (item).gobj(), 0 /* See GTK+ docs */);
82 void Toolbar::prepend(ToolButton& item, const sigc::slot<void>& clicked_slot)
84 item.signal_clicked().connect(clicked_slot);
85 gtk_toolbar_insert(gobj(), (GtkToolItem*)((item).gobj()), 0 /* See GTK+ docs */);
88 void Toolbar::prepend(ToggleToolButton& item, const sigc::slot<void>& toggled_slot)
90 item.signal_toggled().connect(toggled_slot);
91 gtk_toolbar_insert(gobj(), (GtkToolItem*)((item).gobj()), 0 /* See GTK+ docs */);
94 void Toolbar::unset_drop_highlight_item()
97 gtk_toolbar_set_drop_highlight_item(gobj(), 0, 0);
106 void Toolbar_signal_orientation_changed_callback(GtkToolbar* self, GtkOrientation p0,void* data)
109 typedef sigc::slot< void,Orientation > SlotType;
111 // Do not try to call a signal on a disassociated wrapper.
112 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
116 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
117 (*static_cast<SlotType*>(slot))(((Orientation)(p0))
122 Glib::exception_handlers_invoke();
127 const Glib::SignalProxyInfo Toolbar_signal_orientation_changed_info =
129 "orientation_changed",
130 (GCallback) &Toolbar_signal_orientation_changed_callback,
131 (GCallback) &Toolbar_signal_orientation_changed_callback
135 void Toolbar_signal_toolbar_style_changed_callback(GtkToolbar* self, GtkToolbarStyle p0,void* data)
138 typedef sigc::slot< void,ToolbarStyle > SlotType;
140 // Do not try to call a signal on a disassociated wrapper.
141 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
145 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
146 (*static_cast<SlotType*>(slot))(((ToolbarStyle)(p0))
151 Glib::exception_handlers_invoke();
156 const Glib::SignalProxyInfo Toolbar_signal_toolbar_style_changed_info =
159 (GCallback) &Toolbar_signal_toolbar_style_changed_callback,
160 (GCallback) &Toolbar_signal_toolbar_style_changed_callback
164 gboolean Toolbar_signal_popup_context_menu_callback(GtkToolbar* self, gint p0,gint p1,gint p2,void* data)
167 typedef sigc::slot< bool,int,int,int > SlotType;
169 // Do not try to call a signal on a disassociated wrapper.
170 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
174 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
175 return static_cast<int>((*static_cast<SlotType*>(slot))(p0
182 Glib::exception_handlers_invoke();
186 typedef gboolean RType;
190 gboolean Toolbar_signal_popup_context_menu_notify_callback(GtkToolbar* self, gint p0,gint p1,gint p2, void* data)
193 typedef sigc::slot< void,int,int,int > SlotType;
195 // Do not try to call a signal on a disassociated wrapper.
196 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
200 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
201 (*static_cast<SlotType*>(slot))(p0
208 Glib::exception_handlers_invoke();
212 typedef gboolean RType;
216 const Glib::SignalProxyInfo Toolbar_signal_popup_context_menu_info =
218 "popup_context_menu",
219 (GCallback) &Toolbar_signal_popup_context_menu_callback,
220 (GCallback) &Toolbar_signal_popup_context_menu_notify_callback
223 } // anonymous namespace
229 Gtk::Toolbar* wrap(GtkToolbar* object, bool take_copy)
231 return dynamic_cast<Gtk::Toolbar *> (Glib::wrap_auto ((GObject*)(object), take_copy));
234 } /* namespace Glib */
240 /* The *_Class implementation: */
242 const Glib::Class& Toolbar_Class::init()
244 if(!gtype_) // create the GType if necessary
246 // Glib::Class has to know the class init function to clone custom types.
247 class_init_func_ = &Toolbar_Class::class_init_function;
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();
253 // Create the wrapper type, with the same class/instance size as the base type.
254 register_derived_type(gtk_toolbar_get_type());
256 // Add derived versions of interfaces, if the C type implements any interfaces:
262 void Toolbar_Class::class_init_function(void* g_class, void* class_data)
264 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
265 CppClassParent::class_init_function(klass, class_data);
267 klass->orientation_changed = &orientation_changed_callback;
268 klass->style_changed = &style_changed_callback;
269 klass->popup_context_menu = &popup_context_menu_callback;
273 void Toolbar_Class::orientation_changed_callback(GtkToolbar* self, GtkOrientation p0)
275 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
276 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
283 if(obj && obj->is_derived_())
285 try // Trap C++ exceptions which would normally be lost because this is a C callback.
287 // Call the virtual member method, which derived classes might override.
288 obj->on_orientation_changed(((Orientation)(p0))
293 Glib::exception_handlers_invoke();
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).
302 // Call the original underlying C function:
303 if(base && base->orientation_changed)
304 (*base->orientation_changed)(self, p0);
308 void Toolbar_Class::style_changed_callback(GtkToolbar* self, GtkToolbarStyle p0)
310 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
311 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
318 if(obj && obj->is_derived_())
320 try // Trap C++ exceptions which would normally be lost because this is a C callback.
322 // Call the virtual member method, which derived classes might override.
323 obj->on_toolbar_style_changed(((ToolbarStyle)(p0))
328 Glib::exception_handlers_invoke();
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).
337 // Call the original underlying C function:
338 if(base && base->style_changed)
339 (*base->style_changed)(self, p0);
343 gboolean Toolbar_Class::popup_context_menu_callback(GtkToolbar* self, gint p0, gint p1, gint p2)
345 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
346 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
353 if(obj && obj->is_derived_())
355 try // Trap C++ exceptions which would normally be lost because this is a C callback.
357 // Call the virtual member method, which derived classes might override.
358 return static_cast<int>(obj->on_popup_context_menu(p0
365 Glib::exception_handlers_invoke();
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).
374 // Call the original underlying C function:
375 if(base && base->popup_context_menu)
376 return (*base->popup_context_menu)(self, p0, p1, p2);
379 typedef gboolean RType;
384 Glib::ObjectBase* Toolbar_Class::wrap_new(GObject* o)
386 return manage(new Toolbar((GtkToolbar*)(o)));
391 /* The implementation: */
393 Toolbar::Toolbar(const Glib::ConstructParams& construct_params)
395 Gtk::Container(construct_params)
399 Toolbar::Toolbar(GtkToolbar* castitem)
401 Gtk::Container((GtkContainer*)(castitem))
410 Toolbar::CppClassType Toolbar::toolbar_class_; // initialize static member
412 GType Toolbar::get_type()
414 return toolbar_class_.init().get_type();
417 GType Toolbar::get_base_type()
419 return gtk_toolbar_get_type();
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()))
430 void Toolbar::insert(ToolItem& item, int pos)
432 gtk_toolbar_insert(gobj(), (item).gobj(), pos);
435 int Toolbar::get_item_index(const ToolItem& item) const
437 return gtk_toolbar_get_item_index(const_cast<GtkToolbar*>(gobj()), const_cast<GtkToolItem*>((item).gobj()));
440 int Toolbar::get_n_items() const
442 return gtk_toolbar_get_n_items(const_cast<GtkToolbar*>(gobj()));
445 ToolItem* Toolbar::get_nth_item(int n)
447 return Glib::wrap(gtk_toolbar_get_nth_item(gobj(), n));
450 const ToolItem* Toolbar::get_nth_item(int n) const
452 return Glib::wrap(gtk_toolbar_get_nth_item(const_cast<GtkToolbar*>(gobj()), n));
455 bool Toolbar::get_show_arrow() const
457 return gtk_toolbar_get_show_arrow(const_cast<GtkToolbar*>(gobj()));
460 void Toolbar::set_show_arrow(bool show_arrow)
462 gtk_toolbar_set_show_arrow(gobj(), static_cast<int>(show_arrow));
465 void Toolbar::set_orientation(Orientation orientation)
467 gtk_toolbar_set_orientation(gobj(), ((GtkOrientation)(orientation)));
470 Orientation Toolbar::get_orientation() const
472 return ((Orientation)(gtk_toolbar_get_orientation(const_cast<GtkToolbar*>(gobj()))));
475 void Toolbar::set_toolbar_style(ToolbarStyle style)
477 gtk_toolbar_set_style(gobj(), ((GtkToolbarStyle)(style)));
480 ToolbarStyle Toolbar::get_toolbar_style() const
482 return ((ToolbarStyle)(gtk_toolbar_get_style(const_cast<GtkToolbar*>(gobj()))));
485 void Toolbar::set_tooltips(bool enable)
487 gtk_toolbar_set_tooltips(gobj(), static_cast<int>(enable));
490 bool Toolbar::get_tooltips() const
492 return gtk_toolbar_get_tooltips(const_cast<GtkToolbar*>(gobj()));
495 void Toolbar::unset_toolbar_style()
497 gtk_toolbar_unset_style(gobj());
500 IconSize Toolbar::get_icon_size() const
502 return IconSize(static_cast<int>(gtk_toolbar_get_icon_size(const_cast<GtkToolbar*>(gobj()))));
505 ReliefStyle Toolbar::get_relief_style() const
507 return ((ReliefStyle)(gtk_toolbar_get_relief_style(const_cast<GtkToolbar*>(gobj()))));
510 int Toolbar::get_drop_index(int x, int y) const
512 return gtk_toolbar_get_drop_index(const_cast<GtkToolbar*>(gobj()), x, y);
515 void Toolbar::set_drop_highlight_item(ToolItem& tool_item, int index)
517 gtk_toolbar_set_drop_highlight_item(gobj(), (tool_item).gobj(), index);
520 Tooltips* Toolbar::get_tooltips_object() const
522 return Glib::wrap(gobj()->tooltips);
526 Glib::SignalProxy1< void,Orientation > Toolbar::signal_orientation_changed()
528 return Glib::SignalProxy1< void,Orientation >(this, &Toolbar_signal_orientation_changed_info);
531 Glib::SignalProxy1< void,ToolbarStyle > Toolbar::signal_toolbar_style_changed()
533 return Glib::SignalProxy1< void,ToolbarStyle >(this, &Toolbar_signal_toolbar_style_changed_info);
536 Glib::SignalProxy3< bool,int,int,int > Toolbar::signal_popup_context_menu()
538 return Glib::SignalProxy3< bool,int,int,int >(this, &Toolbar_signal_popup_context_menu_info);
542 Glib::PropertyProxy<Orientation> Toolbar::property_orientation()
544 return Glib::PropertyProxy<Orientation>(this, "orientation");
547 Glib::PropertyProxy_ReadOnly<Orientation> Toolbar::property_orientation() const
549 return Glib::PropertyProxy_ReadOnly<Orientation>(this, "orientation");
552 Glib::PropertyProxy<ToolbarStyle> Toolbar::property_toolbar_style()
554 return Glib::PropertyProxy<ToolbarStyle>(this, "toolbar-style");
557 Glib::PropertyProxy_ReadOnly<ToolbarStyle> Toolbar::property_toolbar_style() const
559 return Glib::PropertyProxy_ReadOnly<ToolbarStyle>(this, "toolbar-style");
562 Glib::PropertyProxy<bool> Toolbar::property_show_arrow()
564 return Glib::PropertyProxy<bool>(this, "show-arrow");
567 Glib::PropertyProxy_ReadOnly<bool> Toolbar::property_show_arrow() const
569 return Glib::PropertyProxy_ReadOnly<bool>(this, "show-arrow");
573 void Gtk::Toolbar::on_orientation_changed(Orientation orientation)
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).
579 if(base && base->orientation_changed)
580 (*base->orientation_changed)(gobj(),((GtkOrientation)(orientation)));
583 void Gtk::Toolbar::on_toolbar_style_changed(ToolbarStyle style)
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).
589 if(base && base->style_changed)
590 (*base->style_changed)(gobj(),((GtkToolbarStyle)(style)));
593 bool Gtk::Toolbar::on_popup_context_menu(int x, int y, int button_number)
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).
599 if(base && base->popup_context_menu)
600 return (*base->popup_context_menu)(gobj(),x,y,button_number);