add new sigc++2 directory
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / menutoolbutton.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3
4 #include <gtkmm/menutoolbutton.h>
5 #include <gtkmm/private/menutoolbutton_p.h>
6
7 // -*- c++ -*-
8 /* $Id$ */
9
10 /* 
11  *
12  * Copyright 2003 The gtkmm Development Team
13  *
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.
18  *
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.
23  *
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.
27  */
28
29 #include <gtk/gtkmenutoolbutton.h>
30
31 namespace Gtk
32 {
33
34 MenuToolButton::MenuToolButton(const Glib::ustring& label)
35 :
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))
38 {
39 }
40
41 MenuToolButton::MenuToolButton(Widget& icon_widget, const Glib::ustring& label)
42 :
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))
45 {
46 }
47
48 } // namespace Gtk
49
50
51 namespace
52 {
53
54
55 static const Glib::SignalProxyInfo MenuToolButton_signal_show_menu_info =
56 {
57   "show_menu",
58   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
59   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
60 };
61
62
63 } // anonymous namespace
64
65
66 namespace Glib
67 {
68
69 Gtk::MenuToolButton* wrap(GtkMenuToolButton* object, bool take_copy)
70 {
71   return dynamic_cast<Gtk::MenuToolButton *> (Glib::wrap_auto ((GObject*)(object), take_copy));
72 }
73
74 } /* namespace Glib */
75
76 namespace Gtk
77 {
78
79
80 /* The *_Class implementation: */
81
82 const Glib::Class& MenuToolButton_Class::init()
83 {
84   if(!gtype_) // create the GType if necessary
85   {
86     // Glib::Class has to know the class init function to clone custom types.
87     class_init_func_ = &MenuToolButton_Class::class_init_function;
88
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();
92
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());
95
96     // Add derived versions of interfaces, if the C type implements any interfaces:
97   }
98
99   return *this;
100 }
101
102 void MenuToolButton_Class::class_init_function(void* g_class, void* class_data)
103 {
104   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
105   CppClassParent::class_init_function(klass, class_data);
106
107 #ifdef GLIBMM_VFUNCS_ENABLED
108 #endif //GLIBMM_VFUNCS_ENABLED
109
110 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
111   klass->show_menu = &show_menu_callback;
112 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
113 }
114
115 #ifdef GLIBMM_VFUNCS_ENABLED
116 #endif //GLIBMM_VFUNCS_ENABLED
117
118 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
119 void MenuToolButton_Class::show_menu_callback(GtkMenuToolButton* self)
120 {
121   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
122       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
123
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
128   // being overridden:
129   if(obj_base && obj_base->is_derived_())
130   {
131     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
132     if(obj) // This can be NULL during destruction.
133     {
134       #ifdef GLIBMM_EXCEPTIONS_ENABLED
135       try // Trap C++ exceptions which would normally be lost because this is a C callback.
136       {
137       #endif //GLIBMM_EXCEPTIONS_ENABLED
138         // Call the virtual member method, which derived classes might override.
139         obj->on_show_menu();
140         return;
141       #ifdef GLIBMM_EXCEPTIONS_ENABLED
142       }
143       catch(...)
144       {
145         Glib::exception_handlers_invoke();
146       }
147       #endif //GLIBMM_EXCEPTIONS_ENABLED
148     }
149   }
150   
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).
153     );
154
155   // Call the original underlying C function:
156   if(base && base->show_menu)
157     (*base->show_menu)(self);
158 }
159 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
160
161
162 Glib::ObjectBase* MenuToolButton_Class::wrap_new(GObject* o)
163 {
164   return manage(new MenuToolButton((GtkMenuToolButton*)(o)));
165
166 }
167
168
169 /* The implementation: */
170
171 MenuToolButton::MenuToolButton(const Glib::ConstructParams& construct_params)
172 :
173   Gtk::ToolButton(construct_params)
174 {
175   }
176
177 MenuToolButton::MenuToolButton(GtkMenuToolButton* castitem)
178 :
179   Gtk::ToolButton((GtkToolButton*)(castitem))
180 {
181   }
182
183 MenuToolButton::~MenuToolButton()
184 {
185   destroy_();
186 }
187
188 MenuToolButton::CppClassType MenuToolButton::menutoolbutton_class_; // initialize static member
189
190 GType MenuToolButton::get_type()
191 {
192   return menutoolbutton_class_.init().get_type();
193 }
194
195 GType MenuToolButton::get_base_type()
196 {
197   return gtk_menu_tool_button_get_type();
198 }
199
200
201 MenuToolButton::MenuToolButton()
202 :
203   // Mark this class as non-derived to allow C++ vfuncs to be skipped.
204   Glib::ObjectBase(0),
205   Gtk::ToolButton(Glib::ConstructParams(menutoolbutton_class_.init()))
206 {
207   }
208
209 MenuToolButton::MenuToolButton(const Gtk::StockID& stock_id)
210 :
211   // Mark this class as non-derived to allow C++ vfuncs to be skipped.
212   Glib::ObjectBase(0),
213   Gtk::ToolButton(Glib::ConstructParams(menutoolbutton_class_.init(), "stock_id", (stock_id).get_c_str(), static_cast<char*>(0)))
214 {
215   }
216
217 void MenuToolButton::set_menu(Menu& menu)
218 {
219 gtk_menu_tool_button_set_menu(gobj(), (menu).Gtk::Widget::gobj()); 
220 }
221
222 Menu* MenuToolButton::get_menu()
223 {
224   return Glib::wrap((GtkMenu*)(gtk_menu_tool_button_get_menu(gobj())));
225 }
226
227 const Menu* MenuToolButton::get_menu() const
228 {
229   return const_cast<MenuToolButton*>(this)->get_menu();
230 }
231
232 #ifndef GTKMM_DISABLE_DEPRECATED
233
234 void MenuToolButton::set_arrow_tooltip(Tooltips& tooltips, const Glib::ustring& tip_text, const Glib::ustring& tip_private)
235 {
236 gtk_menu_tool_button_set_arrow_tooltip(gobj(), (tooltips).gobj(), tip_text.c_str(), tip_private.c_str()); 
237 }
238
239 #endif // GTKMM_DISABLE_DEPRECATED
240
241 void MenuToolButton::set_arrow_tooltip_text(const Glib::ustring& text)
242 {
243 gtk_menu_tool_button_set_arrow_tooltip_text(gobj(), text.c_str()); 
244 }
245
246 void MenuToolButton::set_arrow_tooltip_markup(const Glib::ustring& markup)
247 {
248 gtk_menu_tool_button_set_arrow_tooltip_markup(gobj(), markup.c_str()); 
249 }
250
251
252 Glib::SignalProxy0< void > MenuToolButton::signal_show_menu()
253 {
254   return Glib::SignalProxy0< void >(this, &MenuToolButton_signal_show_menu_info);
255 }
256
257
258 #ifdef GLIBMM_PROPERTIES_ENABLED
259 Glib::PropertyProxy<Menu*> MenuToolButton::property_menu() 
260 {
261   return Glib::PropertyProxy<Menu*>(this, "menu");
262 }
263 #endif //GLIBMM_PROPERTIES_ENABLED
264
265 #ifdef GLIBMM_PROPERTIES_ENABLED
266 Glib::PropertyProxy_ReadOnly<Menu*> MenuToolButton::property_menu() const
267 {
268   return Glib::PropertyProxy_ReadOnly<Menu*>(this, "menu");
269 }
270 #endif //GLIBMM_PROPERTIES_ENABLED
271
272
273 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
274 void Gtk::MenuToolButton::on_show_menu()
275 {
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).
278   );
279
280   if(base && base->show_menu)
281     (*base->show_menu)(gobj());
282 }
283 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
284
285 #ifdef GLIBMM_VFUNCS_ENABLED
286 #endif //GLIBMM_VFUNCS_ENABLED
287
288
289 } // namespace Gtk
290
291