1 // Generated by gtkmmproc -- DO NOT MODIFY!
4 #include <gtkmm/item.h>
5 #include <gtkmm/private/item_p.h>
12 * Copyright 1998-2002 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/gtkitem.h>
36 static const Glib::SignalProxyInfo Item_signal_select_info =
39 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
40 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
44 static const Glib::SignalProxyInfo Item_signal_deselect_info =
47 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
48 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
52 static const Glib::SignalProxyInfo Item_signal_toggle_info =
55 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
56 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
60 } // anonymous namespace
66 Gtk::Item* wrap(GtkItem* object, bool take_copy)
68 return dynamic_cast<Gtk::Item *> (Glib::wrap_auto ((GObject*)(object), take_copy));
71 } /* namespace Glib */
77 /* The *_Class implementation: */
79 const Glib::Class& Item_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_ = &Item_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_item_get_type());
93 // Add derived versions of interfaces, if the C type implements any interfaces:
99 void Item_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 #ifdef GLIBMM_VFUNCS_ENABLED
105 #endif //GLIBMM_VFUNCS_ENABLED
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
114 #ifdef GLIBMM_VFUNCS_ENABLED
115 #endif //GLIBMM_VFUNCS_ENABLED
117 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
118 void Item_Class::select_callback(GtkItem* self)
120 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
121 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
128 if(obj_base && obj_base->is_derived_())
130 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
131 if(obj) // This can be NULL during destruction.
133 #ifdef GLIBMM_EXCEPTIONS_ENABLED
134 try // Trap C++ exceptions which would normally be lost because this is a C callback.
136 #endif //GLIBMM_EXCEPTIONS_ENABLED
137 // Call the virtual member method, which derived classes might override.
140 #ifdef GLIBMM_EXCEPTIONS_ENABLED
144 Glib::exception_handlers_invoke();
146 #endif //GLIBMM_EXCEPTIONS_ENABLED
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).
154 // Call the original underlying C function:
155 if(base && base->select)
156 (*base->select)(self);
158 void Item_Class::deselect_callback(GtkItem* self)
160 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
161 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
168 if(obj_base && obj_base->is_derived_())
170 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
171 if(obj) // This can be NULL during destruction.
173 #ifdef GLIBMM_EXCEPTIONS_ENABLED
174 try // Trap C++ exceptions which would normally be lost because this is a C callback.
176 #endif //GLIBMM_EXCEPTIONS_ENABLED
177 // Call the virtual member method, which derived classes might override.
180 #ifdef GLIBMM_EXCEPTIONS_ENABLED
184 Glib::exception_handlers_invoke();
186 #endif //GLIBMM_EXCEPTIONS_ENABLED
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).
194 // Call the original underlying C function:
195 if(base && base->deselect)
196 (*base->deselect)(self);
198 void Item_Class::toggle_callback(GtkItem* self)
200 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
201 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
208 if(obj_base && obj_base->is_derived_())
210 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
211 if(obj) // This can be NULL during destruction.
213 #ifdef GLIBMM_EXCEPTIONS_ENABLED
214 try // Trap C++ exceptions which would normally be lost because this is a C callback.
216 #endif //GLIBMM_EXCEPTIONS_ENABLED
217 // Call the virtual member method, which derived classes might override.
220 #ifdef GLIBMM_EXCEPTIONS_ENABLED
224 Glib::exception_handlers_invoke();
226 #endif //GLIBMM_EXCEPTIONS_ENABLED
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).
234 // Call the original underlying C function:
235 if(base && base->toggle)
236 (*base->toggle)(self);
238 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
241 Glib::ObjectBase* Item_Class::wrap_new(GObject* o)
243 return manage(new Item((GtkItem*)(o)));
248 /* The implementation: */
250 Item::Item(const Glib::ConstructParams& construct_params)
252 Gtk::Bin(construct_params)
256 Item::Item(GtkItem* castitem)
258 Gtk::Bin((GtkBin*)(castitem))
267 Item::CppClassType Item::item_class_; // initialize static member
269 GType Item::get_type()
271 return item_class_.init().get_type();
274 GType Item::get_base_type()
276 return gtk_item_get_type();
282 gtk_item_select(gobj());
285 void Item::deselect()
287 gtk_item_deselect(gobj());
292 gtk_item_toggle(gobj());
297 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
299 Gtk::Bin(Glib::ConstructParams(item_class_.init()))
304 Glib::SignalProxy0< void > Item::signal_select()
306 return Glib::SignalProxy0< void >(this, &Item_signal_select_info);
310 Glib::SignalProxy0< void > Item::signal_deselect()
312 return Glib::SignalProxy0< void >(this, &Item_signal_deselect_info);
316 Glib::SignalProxy0< void > Item::signal_toggle()
318 return Glib::SignalProxy0< void >(this, &Item_signal_toggle_info);
322 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
323 void Gtk::Item::on_select()
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).
329 if(base && base->select)
330 (*base->select)(gobj());
332 void Gtk::Item::on_deselect()
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).
338 if(base && base->deselect)
339 (*base->deselect)(gobj());
341 void Gtk::Item::on_toggle()
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).
347 if(base && base->toggle)
348 (*base->toggle)(gobj());
350 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
352 #ifdef GLIBMM_VFUNCS_ENABLED
353 #endif //GLIBMM_VFUNCS_ENABLED