1 // Generated by gtkmmproc -- DO NOT MODIFY!
4 #include <gtkmm/toolbar.h>
5 #include <gtkmm/private/toolbar_p.h>
12 * Copyright 1998-2002 The gtkmm Development Team
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.
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.
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.
29 //Define this to make sure that we don't use any of the deprecated GtkToolbar API.
30 //Normally we just deprecate it in gtkmm too,
31 //but the GtkToolbar compatibility system is particularly unpleasant, so we just removed it in gtkmm 2.4. murrayc.
32 //In future, this GTK_DISABLE_DEPRECATED might be inappropriate because it might cover extra GTK+ API. Just remove it then.
34 #define GTK_DISABLE_DEPRECATED
37 #include <gtkmm/button.h>
38 #include <gtkmm/togglebutton.h>
39 #include <gtkmm/radiobutton.h>
40 #include <gtkmm/tooltips.h>
41 //#include <gtkmm/image.h>
42 #include <gtkmm/label.h>
43 #include <gtk/gtklabel.h>
44 #include <gtk/gtktoolbar.h>
49 void Toolbar::insert(ToolButton& item, int pos, const sigc::slot<void>& clicked_slot)
51 item.signal_clicked().connect(clicked_slot);
52 gtk_toolbar_insert(gobj(), (GtkToolItem*)((item).gobj()), pos);
55 void Toolbar::insert(ToggleToolButton& item, int pos, const sigc::slot<void>& toggled_slot)
57 item.signal_toggled().connect(toggled_slot);
58 gtk_toolbar_insert(gobj(), (GtkToolItem*)((item).gobj()), pos);
61 void Toolbar::append(ToolItem& item)
63 gtk_toolbar_insert(gobj(), (item).gobj(), -1 /* See GTK+ docs */);
66 void Toolbar::append(ToolButton& item, const sigc::slot<void>& clicked_slot)
68 item.signal_clicked().connect(clicked_slot);
69 gtk_toolbar_insert(gobj(), (GtkToolItem*)((item).gobj()), -1 /* See GTK+ docs */);
72 void Toolbar::append(ToggleToolButton& item, const sigc::slot<void>& toggled_slot)
74 item.signal_toggled().connect(toggled_slot);
75 gtk_toolbar_insert(gobj(), (GtkToolItem*)((item).gobj()), -1 /* See GTK+ docs */);
78 void Toolbar::prepend(ToolItem& item)
80 gtk_toolbar_insert(gobj(), (item).gobj(), 0 /* See GTK+ docs */);
83 void Toolbar::prepend(ToolButton& item, const sigc::slot<void>& clicked_slot)
85 item.signal_clicked().connect(clicked_slot);
86 gtk_toolbar_insert(gobj(), (GtkToolItem*)((item).gobj()), 0 /* See GTK+ docs */);
89 void Toolbar::prepend(ToggleToolButton& item, const sigc::slot<void>& toggled_slot)
91 item.signal_toggled().connect(toggled_slot);
92 gtk_toolbar_insert(gobj(), (GtkToolItem*)((item).gobj()), 0 /* See GTK+ docs */);
95 void Toolbar::unset_drop_highlight_item()
98 gtk_toolbar_set_drop_highlight_item(gobj(), 0, 0);
101 #ifndef GTKMM_DISABLE_DEPRECATED
102 Tooltips* Toolbar::get_tooltips_object() const
104 //Note that the _tooltips field is deprecated and broken since GTK+ 2.12:
105 return Glib::wrap((GtkTooltips*)gobj()->_tooltips);
107 #endif //GTKMM_DISABLE_DEPRECATED
116 static void Toolbar_signal_orientation_changed_callback(GtkToolbar* self, GtkOrientation p0,void* data)
119 typedef sigc::slot< void,Orientation > SlotType;
121 // Do not try to call a signal on a disassociated wrapper.
122 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
124 #ifdef GLIBMM_EXCEPTIONS_ENABLED
127 #endif //GLIBMM_EXCEPTIONS_ENABLED
128 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
129 (*static_cast<SlotType*>(slot))(((Orientation)(p0))
131 #ifdef GLIBMM_EXCEPTIONS_ENABLED
135 Glib::exception_handlers_invoke();
137 #endif //GLIBMM_EXCEPTIONS_ENABLED
141 static const Glib::SignalProxyInfo Toolbar_signal_orientation_changed_info =
143 "orientation_changed",
144 (GCallback) &Toolbar_signal_orientation_changed_callback,
145 (GCallback) &Toolbar_signal_orientation_changed_callback
149 static void Toolbar_signal_toolbar_style_changed_callback(GtkToolbar* self, GtkToolbarStyle p0,void* data)
152 typedef sigc::slot< void,ToolbarStyle > SlotType;
154 // Do not try to call a signal on a disassociated wrapper.
155 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
157 #ifdef GLIBMM_EXCEPTIONS_ENABLED
160 #endif //GLIBMM_EXCEPTIONS_ENABLED
161 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
162 (*static_cast<SlotType*>(slot))(((ToolbarStyle)(p0))
164 #ifdef GLIBMM_EXCEPTIONS_ENABLED
168 Glib::exception_handlers_invoke();
170 #endif //GLIBMM_EXCEPTIONS_ENABLED
174 static const Glib::SignalProxyInfo Toolbar_signal_toolbar_style_changed_info =
177 (GCallback) &Toolbar_signal_toolbar_style_changed_callback,
178 (GCallback) &Toolbar_signal_toolbar_style_changed_callback
182 static gboolean Toolbar_signal_popup_context_menu_callback(GtkToolbar* self, gint p0,gint p1,gint p2,void* data)
185 typedef sigc::slot< bool,int,int,int > SlotType;
187 // Do not try to call a signal on a disassociated wrapper.
188 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
190 #ifdef GLIBMM_EXCEPTIONS_ENABLED
193 #endif //GLIBMM_EXCEPTIONS_ENABLED
194 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
195 return static_cast<int>((*static_cast<SlotType*>(slot))(p0
199 #ifdef GLIBMM_EXCEPTIONS_ENABLED
203 Glib::exception_handlers_invoke();
205 #endif //GLIBMM_EXCEPTIONS_ENABLED
208 typedef gboolean RType;
212 static gboolean Toolbar_signal_popup_context_menu_notify_callback(GtkToolbar* self, gint p0,gint p1,gint p2, void* data)
215 typedef sigc::slot< void,int,int,int > SlotType;
217 // Do not try to call a signal on a disassociated wrapper.
218 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
220 #ifdef GLIBMM_EXCEPTIONS_ENABLED
223 #endif //GLIBMM_EXCEPTIONS_ENABLED
224 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
225 (*static_cast<SlotType*>(slot))(p0
229 #ifdef GLIBMM_EXCEPTIONS_ENABLED
233 Glib::exception_handlers_invoke();
235 #endif //GLIBMM_EXCEPTIONS_ENABLED
238 typedef gboolean RType;
242 static const Glib::SignalProxyInfo Toolbar_signal_popup_context_menu_info =
244 "popup_context_menu",
245 (GCallback) &Toolbar_signal_popup_context_menu_callback,
246 (GCallback) &Toolbar_signal_popup_context_menu_notify_callback
250 } // anonymous namespace
256 Gtk::Toolbar* wrap(GtkToolbar* object, bool take_copy)
258 return dynamic_cast<Gtk::Toolbar *> (Glib::wrap_auto ((GObject*)(object), take_copy));
261 } /* namespace Glib */
267 /* The *_Class implementation: */
269 const Glib::Class& Toolbar_Class::init()
271 if(!gtype_) // create the GType if necessary
273 // Glib::Class has to know the class init function to clone custom types.
274 class_init_func_ = &Toolbar_Class::class_init_function;
276 // This is actually just optimized away, apparently with no harm.
277 // Make sure that the parent type has been created.
278 //CppClassParent::CppObjectType::get_type();
280 // Create the wrapper type, with the same class/instance size as the base type.
281 register_derived_type(gtk_toolbar_get_type());
283 // Add derived versions of interfaces, if the C type implements any interfaces:
289 void Toolbar_Class::class_init_function(void* g_class, void* class_data)
291 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
292 CppClassParent::class_init_function(klass, class_data);
294 #ifdef GLIBMM_VFUNCS_ENABLED
295 #endif //GLIBMM_VFUNCS_ENABLED
297 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
298 klass->orientation_changed = &orientation_changed_callback;
299 klass->style_changed = &style_changed_callback;
300 klass->popup_context_menu = &popup_context_menu_callback;
301 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
304 #ifdef GLIBMM_VFUNCS_ENABLED
305 #endif //GLIBMM_VFUNCS_ENABLED
307 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
308 void Toolbar_Class::orientation_changed_callback(GtkToolbar* self, GtkOrientation p0)
310 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
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_base && obj_base->is_derived_())
320 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
321 if(obj) // This can be NULL during destruction.
323 #ifdef GLIBMM_EXCEPTIONS_ENABLED
324 try // Trap C++ exceptions which would normally be lost because this is a C callback.
326 #endif //GLIBMM_EXCEPTIONS_ENABLED
327 // Call the virtual member method, which derived classes might override.
328 obj->on_orientation_changed(((Orientation)(p0))
331 #ifdef GLIBMM_EXCEPTIONS_ENABLED
335 Glib::exception_handlers_invoke();
337 #endif //GLIBMM_EXCEPTIONS_ENABLED
341 BaseClassType *const base = static_cast<BaseClassType*>(
342 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
345 // Call the original underlying C function:
346 if(base && base->orientation_changed)
347 (*base->orientation_changed)(self, p0);
349 void Toolbar_Class::style_changed_callback(GtkToolbar* self, GtkToolbarStyle p0)
351 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
352 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
354 // Non-gtkmmproc-generated custom classes implicitly call the default
355 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
356 // generated classes can use this optimisation, which avoids the unnecessary
357 // parameter conversions if there is no possibility of the virtual function
359 if(obj_base && obj_base->is_derived_())
361 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
362 if(obj) // This can be NULL during destruction.
364 #ifdef GLIBMM_EXCEPTIONS_ENABLED
365 try // Trap C++ exceptions which would normally be lost because this is a C callback.
367 #endif //GLIBMM_EXCEPTIONS_ENABLED
368 // Call the virtual member method, which derived classes might override.
369 obj->on_toolbar_style_changed(((ToolbarStyle)(p0))
372 #ifdef GLIBMM_EXCEPTIONS_ENABLED
376 Glib::exception_handlers_invoke();
378 #endif //GLIBMM_EXCEPTIONS_ENABLED
382 BaseClassType *const base = static_cast<BaseClassType*>(
383 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
386 // Call the original underlying C function:
387 if(base && base->style_changed)
388 (*base->style_changed)(self, p0);
390 gboolean Toolbar_Class::popup_context_menu_callback(GtkToolbar* self, gint p0, gint p1, gint p2)
392 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
393 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
395 // Non-gtkmmproc-generated custom classes implicitly call the default
396 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
397 // generated classes can use this optimisation, which avoids the unnecessary
398 // parameter conversions if there is no possibility of the virtual function
400 if(obj_base && obj_base->is_derived_())
402 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
403 if(obj) // This can be NULL during destruction.
405 #ifdef GLIBMM_EXCEPTIONS_ENABLED
406 try // Trap C++ exceptions which would normally be lost because this is a C callback.
408 #endif //GLIBMM_EXCEPTIONS_ENABLED
409 // Call the virtual member method, which derived classes might override.
410 return static_cast<int>(obj->on_popup_context_menu(p0
414 #ifdef GLIBMM_EXCEPTIONS_ENABLED
418 Glib::exception_handlers_invoke();
420 #endif //GLIBMM_EXCEPTIONS_ENABLED
424 BaseClassType *const base = static_cast<BaseClassType*>(
425 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
428 // Call the original underlying C function:
429 if(base && base->popup_context_menu)
430 return (*base->popup_context_menu)(self, p0, p1, p2);
432 typedef gboolean RType;
435 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
438 Glib::ObjectBase* Toolbar_Class::wrap_new(GObject* o)
440 return manage(new Toolbar((GtkToolbar*)(o)));
445 /* The implementation: */
447 Toolbar::Toolbar(const Glib::ConstructParams& construct_params)
449 Gtk::Container(construct_params)
453 Toolbar::Toolbar(GtkToolbar* castitem)
455 Gtk::Container((GtkContainer*)(castitem))
464 Toolbar::CppClassType Toolbar::toolbar_class_; // initialize static member
466 GType Toolbar::get_type()
468 return toolbar_class_.init().get_type();
471 GType Toolbar::get_base_type()
473 return gtk_toolbar_get_type();
479 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
481 Gtk::Container(Glib::ConstructParams(toolbar_class_.init()))
485 void Toolbar::insert(ToolItem& item, int pos)
487 gtk_toolbar_insert(gobj(), (item).gobj(), pos);
490 int Toolbar::get_item_index(const ToolItem& item) const
492 return gtk_toolbar_get_item_index(const_cast<GtkToolbar*>(gobj()), const_cast<GtkToolItem*>((item).gobj()));
495 int Toolbar::get_n_items() const
497 return gtk_toolbar_get_n_items(const_cast<GtkToolbar*>(gobj()));
500 ToolItem* Toolbar::get_nth_item(int n)
502 return Glib::wrap(gtk_toolbar_get_nth_item(gobj(), n));
505 const ToolItem* Toolbar::get_nth_item(int n) const
507 return const_cast<Toolbar*>(this)->get_nth_item(n);
510 bool Toolbar::get_show_arrow() const
512 return gtk_toolbar_get_show_arrow(const_cast<GtkToolbar*>(gobj()));
515 void Toolbar::set_show_arrow(bool show_arrow)
517 gtk_toolbar_set_show_arrow(gobj(), static_cast<int>(show_arrow));
520 void Toolbar::set_orientation(Orientation orientation)
522 gtk_toolbar_set_orientation(gobj(), ((GtkOrientation)(orientation)));
525 Orientation Toolbar::get_orientation() const
527 return ((Orientation)(gtk_toolbar_get_orientation(const_cast<GtkToolbar*>(gobj()))));
530 void Toolbar::set_toolbar_style(ToolbarStyle style)
532 gtk_toolbar_set_style(gobj(), ((GtkToolbarStyle)(style)));
535 ToolbarStyle Toolbar::get_toolbar_style() const
537 return ((ToolbarStyle)(gtk_toolbar_get_style(const_cast<GtkToolbar*>(gobj()))));
540 void Toolbar::set_tooltips(bool enable)
542 #ifndef GTK_NEW_TOOLTIP_API
543 gtk_toolbar_set_tooltips(gobj(), static_cast<int>(enable));
547 bool Toolbar::get_tooltips() const
549 #ifndef GTK_NEW_TOOLTIP_API
550 return gtk_toolbar_get_tooltips(const_cast<GtkToolbar*>(gobj()));
554 void Toolbar::unset_toolbar_style()
556 gtk_toolbar_unset_style(gobj());
559 void Toolbar::set_icon_size(IconSize icon_size)
561 gtk_toolbar_set_icon_size(gobj(), static_cast<GtkIconSize>(int(icon_size)));
564 void Toolbar::unset_icon_size()
566 gtk_toolbar_unset_icon_size(gobj());
569 IconSize Toolbar::get_icon_size() const
571 return IconSize(static_cast<int>(gtk_toolbar_get_icon_size(const_cast<GtkToolbar*>(gobj()))));
574 ReliefStyle Toolbar::get_relief_style() const
576 return ((ReliefStyle)(gtk_toolbar_get_relief_style(const_cast<GtkToolbar*>(gobj()))));
579 int Toolbar::get_drop_index(int x, int y) const
581 return gtk_toolbar_get_drop_index(const_cast<GtkToolbar*>(gobj()), x, y);
584 void Toolbar::set_drop_highlight_item(ToolItem& tool_item, int index)
586 gtk_toolbar_set_drop_highlight_item(gobj(), (tool_item).gobj(), index);
590 Glib::SignalProxy1< void,Orientation > Toolbar::signal_orientation_changed()
592 return Glib::SignalProxy1< void,Orientation >(this, &Toolbar_signal_orientation_changed_info);
596 Glib::SignalProxy1< void,ToolbarStyle > Toolbar::signal_toolbar_style_changed()
598 return Glib::SignalProxy1< void,ToolbarStyle >(this, &Toolbar_signal_toolbar_style_changed_info);
602 Glib::SignalProxy3< bool,int,int,int > Toolbar::signal_popup_context_menu()
604 return Glib::SignalProxy3< bool,int,int,int >(this, &Toolbar_signal_popup_context_menu_info);
608 #ifdef GLIBMM_PROPERTIES_ENABLED
609 Glib::PropertyProxy<Orientation> Toolbar::property_orientation()
611 return Glib::PropertyProxy<Orientation>(this, "orientation");
613 #endif //GLIBMM_PROPERTIES_ENABLED
615 #ifdef GLIBMM_PROPERTIES_ENABLED
616 Glib::PropertyProxy_ReadOnly<Orientation> Toolbar::property_orientation() const
618 return Glib::PropertyProxy_ReadOnly<Orientation>(this, "orientation");
620 #endif //GLIBMM_PROPERTIES_ENABLED
622 #ifdef GLIBMM_PROPERTIES_ENABLED
623 Glib::PropertyProxy<ToolbarStyle> Toolbar::property_toolbar_style()
625 return Glib::PropertyProxy<ToolbarStyle>(this, "toolbar-style");
627 #endif //GLIBMM_PROPERTIES_ENABLED
629 #ifdef GLIBMM_PROPERTIES_ENABLED
630 Glib::PropertyProxy_ReadOnly<ToolbarStyle> Toolbar::property_toolbar_style() const
632 return Glib::PropertyProxy_ReadOnly<ToolbarStyle>(this, "toolbar-style");
634 #endif //GLIBMM_PROPERTIES_ENABLED
636 #ifdef GLIBMM_PROPERTIES_ENABLED
637 Glib::PropertyProxy<bool> Toolbar::property_show_arrow()
639 return Glib::PropertyProxy<bool>(this, "show-arrow");
641 #endif //GLIBMM_PROPERTIES_ENABLED
643 #ifdef GLIBMM_PROPERTIES_ENABLED
644 Glib::PropertyProxy_ReadOnly<bool> Toolbar::property_show_arrow() const
646 return Glib::PropertyProxy_ReadOnly<bool>(this, "show-arrow");
648 #endif //GLIBMM_PROPERTIES_ENABLED
651 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
652 void Gtk::Toolbar::on_orientation_changed(Orientation orientation)
654 BaseClassType *const base = static_cast<BaseClassType*>(
655 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
658 if(base && base->orientation_changed)
659 (*base->orientation_changed)(gobj(),((GtkOrientation)(orientation)));
661 void Gtk::Toolbar::on_toolbar_style_changed(ToolbarStyle style)
663 BaseClassType *const base = static_cast<BaseClassType*>(
664 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
667 if(base && base->style_changed)
668 (*base->style_changed)(gobj(),((GtkToolbarStyle)(style)));
670 bool Gtk::Toolbar::on_popup_context_menu(int x, int y, int button_number)
672 BaseClassType *const base = static_cast<BaseClassType*>(
673 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
676 if(base && base->popup_context_menu)
677 return (*base->popup_context_menu)(gobj(),x,y,button_number);
682 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
684 #ifdef GLIBMM_VFUNCS_ENABLED
685 #endif //GLIBMM_VFUNCS_ENABLED