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 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
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_base && obj_base->is_derived_())
131 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
132 if(obj) // This can be NULL during destruction.
134 #ifdef GLIBMM_EXCEPTIONS_ENABLED
135 try // Trap C++ exceptions which would normally be lost because this is a C callback.
137 #endif //GLIBMM_EXCEPTIONS_ENABLED
138 // Call the virtual member method, which derived classes might override.
141 #ifdef GLIBMM_EXCEPTIONS_ENABLED
145 Glib::exception_handlers_invoke();
147 #endif //GLIBMM_EXCEPTIONS_ENABLED
151 BaseClassType *const base = static_cast<BaseClassType*>(
152 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
155 // Call the original underlying C function:
156 if(base && base->show_menu)
157 (*base->show_menu)(self);
159 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
162 Glib::ObjectBase* MenuToolButton_Class::wrap_new(GObject* o)
164 return manage(new MenuToolButton((GtkMenuToolButton*)(o)));
169 /* The implementation: */
171 MenuToolButton::MenuToolButton(const Glib::ConstructParams& construct_params)
173 Gtk::ToolButton(construct_params)
177 MenuToolButton::MenuToolButton(GtkMenuToolButton* castitem)
179 Gtk::ToolButton((GtkToolButton*)(castitem))
183 MenuToolButton::~MenuToolButton()
188 MenuToolButton::CppClassType MenuToolButton::menutoolbutton_class_; // initialize static member
190 GType MenuToolButton::get_type()
192 return menutoolbutton_class_.init().get_type();
195 GType MenuToolButton::get_base_type()
197 return gtk_menu_tool_button_get_type();
201 MenuToolButton::MenuToolButton()
203 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
205 Gtk::ToolButton(Glib::ConstructParams(menutoolbutton_class_.init()))
209 MenuToolButton::MenuToolButton(const Gtk::StockID& stock_id)
211 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
213 Gtk::ToolButton(Glib::ConstructParams(menutoolbutton_class_.init(), "stock_id", (stock_id).get_c_str(), static_cast<char*>(0)))
217 void MenuToolButton::set_menu(Menu& menu)
219 gtk_menu_tool_button_set_menu(gobj(), (menu).Gtk::Widget::gobj());
222 Menu* MenuToolButton::get_menu()
224 return Glib::wrap((GtkMenu*)(gtk_menu_tool_button_get_menu(gobj())));
227 const Menu* MenuToolButton::get_menu() const
229 return const_cast<MenuToolButton*>(this)->get_menu();
232 #ifndef GTKMM_DISABLE_DEPRECATED
234 void MenuToolButton::set_arrow_tooltip(Tooltips& tooltips, const Glib::ustring& tip_text, const Glib::ustring& tip_private)
236 gtk_menu_tool_button_set_arrow_tooltip(gobj(), (tooltips).gobj(), tip_text.c_str(), tip_private.c_str());
239 #endif // GTKMM_DISABLE_DEPRECATED
241 void MenuToolButton::set_arrow_tooltip_text(const Glib::ustring& text)
243 gtk_menu_tool_button_set_arrow_tooltip_text(gobj(), text.c_str());
246 void MenuToolButton::set_arrow_tooltip_markup(const Glib::ustring& markup)
248 gtk_menu_tool_button_set_arrow_tooltip_markup(gobj(), markup.c_str());
252 Glib::SignalProxy0< void > MenuToolButton::signal_show_menu()
254 return Glib::SignalProxy0< void >(this, &MenuToolButton_signal_show_menu_info);
258 #ifdef GLIBMM_PROPERTIES_ENABLED
259 Glib::PropertyProxy<Menu*> MenuToolButton::property_menu()
261 return Glib::PropertyProxy<Menu*>(this, "menu");
263 #endif //GLIBMM_PROPERTIES_ENABLED
265 #ifdef GLIBMM_PROPERTIES_ENABLED
266 Glib::PropertyProxy_ReadOnly<Menu*> MenuToolButton::property_menu() const
268 return Glib::PropertyProxy_ReadOnly<Menu*>(this, "menu");
270 #endif //GLIBMM_PROPERTIES_ENABLED
273 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
274 void Gtk::MenuToolButton::on_show_menu()
276 BaseClassType *const base = static_cast<BaseClassType*>(
277 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
280 if(base && base->show_menu)
281 (*base->show_menu)(gobj());
283 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
285 #ifdef GLIBMM_VFUNCS_ENABLED
286 #endif //GLIBMM_VFUNCS_ENABLED