add new sigc++2 directory
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / item.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3
4 #include <gtkmm/item.h>
5 #include <gtkmm/private/item_p.h>
6
7 // -*- c++ -*-
8 /* $Id$ */
9
10 /* 
11  *
12  * Copyright 1998-2002 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/gtkitem.h>
30
31
32 namespace
33 {
34
35
36 static const Glib::SignalProxyInfo Item_signal_select_info =
37 {
38   "select",
39   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
40   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
41 };
42
43
44 static const Glib::SignalProxyInfo Item_signal_deselect_info =
45 {
46   "deselect",
47   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
48   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
49 };
50
51
52 static const Glib::SignalProxyInfo Item_signal_toggle_info =
53 {
54   "toggle",
55   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
56   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
57 };
58
59
60 } // anonymous namespace
61
62
63 namespace Glib
64 {
65
66 Gtk::Item* wrap(GtkItem* object, bool take_copy)
67 {
68   return dynamic_cast<Gtk::Item *> (Glib::wrap_auto ((GObject*)(object), take_copy));
69 }
70
71 } /* namespace Glib */
72
73 namespace Gtk
74 {
75
76
77 /* The *_Class implementation: */
78
79 const Glib::Class& Item_Class::init()
80 {
81   if(!gtype_) // create the GType if necessary
82   {
83     // Glib::Class has to know the class init function to clone custom types.
84     class_init_func_ = &Item_Class::class_init_function;
85
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();
89
90     // Create the wrapper type, with the same class/instance size as the base type.
91     register_derived_type(gtk_item_get_type());
92
93     // Add derived versions of interfaces, if the C type implements any interfaces:
94   }
95
96   return *this;
97 }
98
99 void Item_Class::class_init_function(void* g_class, void* class_data)
100 {
101   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
102   CppClassParent::class_init_function(klass, class_data);
103
104 #ifdef GLIBMM_VFUNCS_ENABLED
105 #endif //GLIBMM_VFUNCS_ENABLED
106
107 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
108   klass->select = &select_callback;
109   klass->deselect = &deselect_callback;
110   klass->toggle = &toggle_callback;
111 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
112 }
113
114 #ifdef GLIBMM_VFUNCS_ENABLED
115 #endif //GLIBMM_VFUNCS_ENABLED
116
117 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
118 void Item_Class::select_callback(GtkItem* self)
119 {
120   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
121       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
122
123   // Non-gtkmmproc-generated custom classes implicitly call the default
124   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
125   // generated classes can use this optimisation, which avoids the unnecessary
126   // parameter conversions if there is no possibility of the virtual function
127   // being overridden:
128   if(obj_base && obj_base->is_derived_())
129   {
130     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
131     if(obj) // This can be NULL during destruction.
132     {
133       #ifdef GLIBMM_EXCEPTIONS_ENABLED
134       try // Trap C++ exceptions which would normally be lost because this is a C callback.
135       {
136       #endif //GLIBMM_EXCEPTIONS_ENABLED
137         // Call the virtual member method, which derived classes might override.
138         obj->on_select();
139         return;
140       #ifdef GLIBMM_EXCEPTIONS_ENABLED
141       }
142       catch(...)
143       {
144         Glib::exception_handlers_invoke();
145       }
146       #endif //GLIBMM_EXCEPTIONS_ENABLED
147     }
148   }
149   
150   BaseClassType *const base = static_cast<BaseClassType*>(
151         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
152     );
153
154   // Call the original underlying C function:
155   if(base && base->select)
156     (*base->select)(self);
157 }
158 void Item_Class::deselect_callback(GtkItem* self)
159 {
160   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
161       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
162
163   // Non-gtkmmproc-generated custom classes implicitly call the default
164   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
165   // generated classes can use this optimisation, which avoids the unnecessary
166   // parameter conversions if there is no possibility of the virtual function
167   // being overridden:
168   if(obj_base && obj_base->is_derived_())
169   {
170     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
171     if(obj) // This can be NULL during destruction.
172     {
173       #ifdef GLIBMM_EXCEPTIONS_ENABLED
174       try // Trap C++ exceptions which would normally be lost because this is a C callback.
175       {
176       #endif //GLIBMM_EXCEPTIONS_ENABLED
177         // Call the virtual member method, which derived classes might override.
178         obj->on_deselect();
179         return;
180       #ifdef GLIBMM_EXCEPTIONS_ENABLED
181       }
182       catch(...)
183       {
184         Glib::exception_handlers_invoke();
185       }
186       #endif //GLIBMM_EXCEPTIONS_ENABLED
187     }
188   }
189   
190   BaseClassType *const base = static_cast<BaseClassType*>(
191         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
192     );
193
194   // Call the original underlying C function:
195   if(base && base->deselect)
196     (*base->deselect)(self);
197 }
198 void Item_Class::toggle_callback(GtkItem* self)
199 {
200   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
201       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
202
203   // Non-gtkmmproc-generated custom classes implicitly call the default
204   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
205   // generated classes can use this optimisation, which avoids the unnecessary
206   // parameter conversions if there is no possibility of the virtual function
207   // being overridden:
208   if(obj_base && obj_base->is_derived_())
209   {
210     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
211     if(obj) // This can be NULL during destruction.
212     {
213       #ifdef GLIBMM_EXCEPTIONS_ENABLED
214       try // Trap C++ exceptions which would normally be lost because this is a C callback.
215       {
216       #endif //GLIBMM_EXCEPTIONS_ENABLED
217         // Call the virtual member method, which derived classes might override.
218         obj->on_toggle();
219         return;
220       #ifdef GLIBMM_EXCEPTIONS_ENABLED
221       }
222       catch(...)
223       {
224         Glib::exception_handlers_invoke();
225       }
226       #endif //GLIBMM_EXCEPTIONS_ENABLED
227     }
228   }
229   
230   BaseClassType *const base = static_cast<BaseClassType*>(
231         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
232     );
233
234   // Call the original underlying C function:
235   if(base && base->toggle)
236     (*base->toggle)(self);
237 }
238 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
239
240
241 Glib::ObjectBase* Item_Class::wrap_new(GObject* o)
242 {
243   return manage(new Item((GtkItem*)(o)));
244
245 }
246
247
248 /* The implementation: */
249
250 Item::Item(const Glib::ConstructParams& construct_params)
251 :
252   Gtk::Bin(construct_params)
253 {
254   }
255
256 Item::Item(GtkItem* castitem)
257 :
258   Gtk::Bin((GtkBin*)(castitem))
259 {
260   }
261
262 Item::~Item()
263 {
264   destroy_();
265 }
266
267 Item::CppClassType Item::item_class_; // initialize static member
268
269 GType Item::get_type()
270 {
271   return item_class_.init().get_type();
272 }
273
274 GType Item::get_base_type()
275 {
276   return gtk_item_get_type();
277 }
278
279
280 void Item::select()
281 {
282 gtk_item_select(gobj()); 
283 }
284
285 void Item::deselect()
286 {
287 gtk_item_deselect(gobj()); 
288 }
289
290 void Item::toggle()
291 {
292 gtk_item_toggle(gobj()); 
293 }
294
295 Item::Item()
296 :
297   // Mark this class as non-derived to allow C++ vfuncs to be skipped.
298   Glib::ObjectBase(0),
299   Gtk::Bin(Glib::ConstructParams(item_class_.init()))
300 {
301   }
302
303
304 Glib::SignalProxy0< void > Item::signal_select()
305 {
306   return Glib::SignalProxy0< void >(this, &Item_signal_select_info);
307 }
308
309
310 Glib::SignalProxy0< void > Item::signal_deselect()
311 {
312   return Glib::SignalProxy0< void >(this, &Item_signal_deselect_info);
313 }
314
315
316 Glib::SignalProxy0< void > Item::signal_toggle()
317 {
318   return Glib::SignalProxy0< void >(this, &Item_signal_toggle_info);
319 }
320
321
322 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
323 void Gtk::Item::on_select()
324 {
325   BaseClassType *const base = static_cast<BaseClassType*>(
326       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
327   );
328
329   if(base && base->select)
330     (*base->select)(gobj());
331 }
332 void Gtk::Item::on_deselect()
333 {
334   BaseClassType *const base = static_cast<BaseClassType*>(
335       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
336   );
337
338   if(base && base->deselect)
339     (*base->deselect)(gobj());
340 }
341 void Gtk::Item::on_toggle()
342 {
343   BaseClassType *const base = static_cast<BaseClassType*>(
344       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
345   );
346
347   if(base && base->toggle)
348     (*base->toggle)(gobj());
349 }
350 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
351
352 #ifdef GLIBMM_VFUNCS_ENABLED
353 #endif //GLIBMM_VFUNCS_ENABLED
354
355
356 } // namespace Gtk
357
358