1 // Generated by gtkmmproc -- DO NOT MODIFY!
4 #include <gtkmm/menutoolbutton.h>
5 #include <gtkmm/private/menutoolbutton_p.h>
12 * Copyright 2003 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 #include <gtk/gtkmenutoolbutton.h>
34 MenuToolButton::MenuToolButton(const Glib::ustring& label)
36 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
37 Gtk::ToolButton(Glib::ConstructParams(menutoolbutton_class_.init(), "label", label.c_str(), (char*) 0))
41 MenuToolButton::MenuToolButton(Widget& icon_widget, const Glib::ustring& label)
43 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
44 Gtk::ToolButton(Glib::ConstructParams(menutoolbutton_class_.init(), "icon_widget", (icon_widget).gobj(), "label", label.c_str(), (char*) 0))
55 static const Glib::SignalProxyInfo MenuToolButton_signal_show_menu_info =
58 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
59 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
63 } // anonymous namespace
69 Gtk::MenuToolButton* wrap(GtkMenuToolButton* object, bool take_copy)
71 return dynamic_cast<Gtk::MenuToolButton *> (Glib::wrap_auto ((GObject*)(object), take_copy));
74 } /* namespace Glib */
80 /* The *_Class implementation: */
82 const Glib::Class& MenuToolButton_Class::init()
84 if(!gtype_) // create the GType if necessary
86 // Glib::Class has to know the class init function to clone custom types.
87 class_init_func_ = &MenuToolButton_Class::class_init_function;
89 // This is actually just optimized away, apparently with no harm.
90 // Make sure that the parent type has been created.
91 //CppClassParent::CppObjectType::get_type();
93 // Create the wrapper type, with the same class/instance size as the base type.
94 register_derived_type(gtk_menu_tool_button_get_type());
96 // Add derived versions of interfaces, if the C type implements any interfaces:
102 void MenuToolButton_Class::class_init_function(void* g_class, void* class_data)
104 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
105 CppClassParent::class_init_function(klass, class_data);
107 #ifdef GLIBMM_VFUNCS_ENABLED
108 #endif //GLIBMM_VFUNCS_ENABLED
110 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
111 klass->show_menu = &show_menu_callback;
112 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
115 #ifdef GLIBMM_VFUNCS_ENABLED
116 #endif //GLIBMM_VFUNCS_ENABLED
118 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
119 void MenuToolButton_Class::show_menu_callback(GtkMenuToolButton* self)
121 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
122 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
124 // Non-gtkmmproc-generated custom classes implicitly call the default
125 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
126 // generated classes can use this optimisation, which avoids the unnecessary
127 // parameter conversions if there is no possibility of the virtual function
129 if(obj && obj->is_derived_())
131 #ifdef GLIBMM_EXCEPTIONS_ENABLED
132 try // Trap C++ exceptions which would normally be lost because this is a C callback.
134 #endif //GLIBMM_EXCEPTIONS_ENABLED
135 // Call the virtual member method, which derived classes might override.
137 #ifdef GLIBMM_EXCEPTIONS_ENABLED
141 Glib::exception_handlers_invoke();
143 #endif //GLIBMM_EXCEPTIONS_ENABLED
147 BaseClassType *const base = static_cast<BaseClassType*>(
148 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
151 // Call the original underlying C function:
152 if(base && base->show_menu)
153 (*base->show_menu)(self);
156 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
159 Glib::ObjectBase* MenuToolButton_Class::wrap_new(GObject* o)
161 return manage(new MenuToolButton((GtkMenuToolButton*)(o)));
166 /* The implementation: */
168 MenuToolButton::MenuToolButton(const Glib::ConstructParams& construct_params)
170 Gtk::ToolButton(construct_params)
174 MenuToolButton::MenuToolButton(GtkMenuToolButton* castitem)
176 Gtk::ToolButton((GtkToolButton*)(castitem))
180 MenuToolButton::~MenuToolButton()
185 MenuToolButton::CppClassType MenuToolButton::menutoolbutton_class_; // initialize static member
187 GType MenuToolButton::get_type()
189 return menutoolbutton_class_.init().get_type();
192 GType MenuToolButton::get_base_type()
194 return gtk_menu_tool_button_get_type();
198 MenuToolButton::MenuToolButton()
200 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
201 Gtk::ToolButton(Glib::ConstructParams(menutoolbutton_class_.init()))
205 MenuToolButton::MenuToolButton(const Gtk::StockID& stock_id)
207 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
208 Gtk::ToolButton(Glib::ConstructParams(menutoolbutton_class_.init(), "stock_id", (stock_id).get_c_str(), (char*) 0))
212 void MenuToolButton::set_menu(Menu& menu)
214 gtk_menu_tool_button_set_menu(gobj(), (menu).Gtk::Widget::gobj());
217 Menu* MenuToolButton::get_menu()
219 return Glib::wrap((GtkMenu*)(gtk_menu_tool_button_get_menu(gobj())));
222 const Menu* MenuToolButton::get_menu() const
224 return const_cast<MenuToolButton*>(this)->get_menu();
227 void MenuToolButton::set_arrow_tooltip(Tooltips& tooltips, const Glib::ustring& tip_text, const Glib::ustring& tip_private)
229 gtk_menu_tool_button_set_arrow_tooltip(gobj(), (tooltips).gobj(), tip_text.c_str(), tip_private.c_str());
233 Glib::SignalProxy0< void > MenuToolButton::signal_show_menu()
235 return Glib::SignalProxy0< void >(this, &MenuToolButton_signal_show_menu_info);
239 #ifdef GLIBMM_PROPERTIES_ENABLED
240 Glib::PropertyProxy<Menu*> MenuToolButton::property_menu()
242 return Glib::PropertyProxy<Menu*>(this, "menu");
244 #endif //GLIBMM_PROPERTIES_ENABLED
246 #ifdef GLIBMM_PROPERTIES_ENABLED
247 Glib::PropertyProxy_ReadOnly<Menu*> MenuToolButton::property_menu() const
249 return Glib::PropertyProxy_ReadOnly<Menu*>(this, "menu");
251 #endif //GLIBMM_PROPERTIES_ENABLED
254 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
255 void Gtk::MenuToolButton::on_show_menu()
257 BaseClassType *const base = static_cast<BaseClassType*>(
258 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
261 if(base && base->show_menu)
262 (*base->show_menu)(gobj());
264 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
266 #ifdef GLIBMM_VFUNCS_ENABLED
267 #endif //GLIBMM_VFUNCS_ENABLED