1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <gtkmm/menutoolbutton.h>
4 #include <gtkmm/private/menutoolbutton_p.h>
11 * Copyright 2003 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 #include <gtk/gtkmenutoolbutton.h>
33 MenuToolButton::MenuToolButton(const Glib::ustring& label)
35 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
36 Gtk::ToolButton(Glib::ConstructParams(menutoolbutton_class_.init(), "label", label.c_str(), (char*) 0))
40 MenuToolButton::MenuToolButton(Widget& icon_widget, const Glib::ustring& label)
42 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
43 Gtk::ToolButton(Glib::ConstructParams(menutoolbutton_class_.init(), "icon_widget", (icon_widget).gobj(), "label", label.c_str(), (char*) 0))
53 const Glib::SignalProxyInfo MenuToolButton_signal_show_menu_info =
56 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
57 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
60 } // anonymous namespace
66 Gtk::MenuToolButton* wrap(GtkMenuToolButton* object, bool take_copy)
68 return dynamic_cast<Gtk::MenuToolButton *> (Glib::wrap_auto ((GObject*)(object), take_copy));
71 } /* namespace Glib */
77 /* The *_Class implementation: */
79 const Glib::Class& MenuToolButton_Class::init()
81 if(!gtype_) // create the GType if necessary
83 // Glib::Class has to know the class init function to clone custom types.
84 class_init_func_ = &MenuToolButton_Class::class_init_function;
86 // This is actually just optimized away, apparently with no harm.
87 // Make sure that the parent type has been created.
88 //CppClassParent::CppObjectType::get_type();
90 // Create the wrapper type, with the same class/instance size as the base type.
91 register_derived_type(gtk_menu_tool_button_get_type());
93 // Add derived versions of interfaces, if the C type implements any interfaces:
99 void MenuToolButton_Class::class_init_function(void* g_class, void* class_data)
101 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
102 CppClassParent::class_init_function(klass, class_data);
104 klass->show_menu = &show_menu_callback;
108 void MenuToolButton_Class::show_menu_callback(GtkMenuToolButton* self)
110 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
111 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
113 // Non-gtkmmproc-generated custom classes implicitly call the default
114 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
115 // generated classes can use this optimisation, which avoids the unnecessary
116 // parameter conversions if there is no possibility of the virtual function
118 if(obj && obj->is_derived_())
120 try // Trap C++ exceptions which would normally be lost because this is a C callback.
122 // Call the virtual member method, which derived classes might override.
127 Glib::exception_handlers_invoke();
132 BaseClassType *const base = static_cast<BaseClassType*>(
133 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
136 // Call the original underlying C function:
137 if(base && base->show_menu)
138 (*base->show_menu)(self);
143 Glib::ObjectBase* MenuToolButton_Class::wrap_new(GObject* o)
145 return manage(new MenuToolButton((GtkMenuToolButton*)(o)));
150 /* The implementation: */
152 MenuToolButton::MenuToolButton(const Glib::ConstructParams& construct_params)
154 Gtk::ToolButton(construct_params)
158 MenuToolButton::MenuToolButton(GtkMenuToolButton* castitem)
160 Gtk::ToolButton((GtkToolButton*)(castitem))
164 MenuToolButton::~MenuToolButton()
169 MenuToolButton::CppClassType MenuToolButton::menutoolbutton_class_; // initialize static member
171 GType MenuToolButton::get_type()
173 return menutoolbutton_class_.init().get_type();
176 GType MenuToolButton::get_base_type()
178 return gtk_menu_tool_button_get_type();
182 MenuToolButton::MenuToolButton()
184 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
185 Gtk::ToolButton(Glib::ConstructParams(menutoolbutton_class_.init()))
189 MenuToolButton::MenuToolButton(const Gtk::StockID& stock_id)
191 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
192 Gtk::ToolButton(Glib::ConstructParams(menutoolbutton_class_.init(), "stock_id", (stock_id).get_c_str(), (char*) 0))
196 void MenuToolButton::set_menu(Menu& menu)
198 gtk_menu_tool_button_set_menu(gobj(), (menu).Gtk::Widget::gobj());
201 Menu* MenuToolButton::get_menu()
203 return Glib::wrap((GtkMenu*)(gtk_menu_tool_button_get_menu(gobj())));
206 const Menu* MenuToolButton::get_menu() const
208 return Glib::wrap((GtkMenu*)(gtk_menu_tool_button_get_menu(const_cast<GtkMenuToolButton*>(gobj()))));
211 void MenuToolButton::set_arrow_tooltip(Tooltips& tooltips, const Glib::ustring& tip_text, const Glib::ustring& tip_private)
213 gtk_menu_tool_button_set_arrow_tooltip(gobj(), (tooltips).gobj(), tip_text.c_str(), tip_private.c_str());
217 Glib::SignalProxy0< void > MenuToolButton::signal_show_menu()
219 return Glib::SignalProxy0< void >(this, &MenuToolButton_signal_show_menu_info);
223 Glib::PropertyProxy<Menu*> MenuToolButton::property_menu()
225 return Glib::PropertyProxy<Menu*>(this, "menu");
228 Glib::PropertyProxy_ReadOnly<Menu*> MenuToolButton::property_menu() const
230 return Glib::PropertyProxy_ReadOnly<Menu*>(this, "menu");
234 void Gtk::MenuToolButton::on_show_menu()
236 BaseClassType *const base = static_cast<BaseClassType*>(
237 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
240 if(base && base->show_menu)
241 (*base->show_menu)(gobj());