1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <gtkmm/socket.h>
4 #include <gtkmm/private/socket_p.h>
9 /* Copyright 1998-2002 The gtkmm Development Team
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
21 * You should have received a copy of the GNU Library General Public
22 * License along with this library; if not, write to the Free
23 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #include <gtk/gtksocket.h>
32 const Glib::SignalProxyInfo Socket_signal_plug_added_info =
35 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
36 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
40 gboolean Socket_signal_plug_removed_callback(GtkSocket* self, void* data)
43 typedef sigc::slot< bool > SlotType;
45 // Do not try to call a signal on a disassociated wrapper.
46 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
50 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
51 return static_cast<int>((*static_cast<SlotType*>(slot))());
55 Glib::exception_handlers_invoke();
59 typedef gboolean RType;
63 gboolean Socket_signal_plug_removed_notify_callback(GtkSocket* self, void* data)
66 typedef sigc::slot< void > SlotType;
68 // Do not try to call a signal on a disassociated wrapper.
69 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
73 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
74 (*static_cast<SlotType*>(slot))();
78 Glib::exception_handlers_invoke();
82 typedef gboolean RType;
86 const Glib::SignalProxyInfo Socket_signal_plug_removed_info =
89 (GCallback) &Socket_signal_plug_removed_callback,
90 (GCallback) &Socket_signal_plug_removed_notify_callback
93 } // anonymous namespace
99 Gtk::Socket* wrap(GtkSocket* object, bool take_copy)
101 return dynamic_cast<Gtk::Socket *> (Glib::wrap_auto ((GObject*)(object), take_copy));
104 } /* namespace Glib */
110 /* The *_Class implementation: */
112 const Glib::Class& Socket_Class::init()
114 if(!gtype_) // create the GType if necessary
116 // Glib::Class has to know the class init function to clone custom types.
117 class_init_func_ = &Socket_Class::class_init_function;
119 // This is actually just optimized away, apparently with no harm.
120 // Make sure that the parent type has been created.
121 //CppClassParent::CppObjectType::get_type();
123 // Create the wrapper type, with the same class/instance size as the base type.
124 register_derived_type(gtk_socket_get_type());
126 // Add derived versions of interfaces, if the C type implements any interfaces:
132 void Socket_Class::class_init_function(void* g_class, void* class_data)
134 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
135 CppClassParent::class_init_function(klass, class_data);
137 klass->plug_added = &plug_added_callback;
138 klass->plug_removed = &plug_removed_callback;
142 void Socket_Class::plug_added_callback(GtkSocket* self)
144 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
145 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
147 // Non-gtkmmproc-generated custom classes implicitly call the default
148 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
149 // generated classes can use this optimisation, which avoids the unnecessary
150 // parameter conversions if there is no possibility of the virtual function
152 if(obj && obj->is_derived_())
154 try // Trap C++ exceptions which would normally be lost because this is a C callback.
156 // Call the virtual member method, which derived classes might override.
157 obj->on_plug_added();
161 Glib::exception_handlers_invoke();
166 BaseClassType *const base = static_cast<BaseClassType*>(
167 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
170 // Call the original underlying C function:
171 if(base && base->plug_added)
172 (*base->plug_added)(self);
176 gboolean Socket_Class::plug_removed_callback(GtkSocket* self)
178 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
179 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
181 // Non-gtkmmproc-generated custom classes implicitly call the default
182 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
183 // generated classes can use this optimisation, which avoids the unnecessary
184 // parameter conversions if there is no possibility of the virtual function
186 if(obj && obj->is_derived_())
188 try // Trap C++ exceptions which would normally be lost because this is a C callback.
190 // Call the virtual member method, which derived classes might override.
191 return static_cast<int>(obj->on_plug_removed());
195 Glib::exception_handlers_invoke();
200 BaseClassType *const base = static_cast<BaseClassType*>(
201 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
204 // Call the original underlying C function:
205 if(base && base->plug_removed)
206 return (*base->plug_removed)(self);
209 typedef gboolean RType;
214 Glib::ObjectBase* Socket_Class::wrap_new(GObject* o)
216 return manage(new Socket((GtkSocket*)(o)));
221 /* The implementation: */
223 Socket::Socket(const Glib::ConstructParams& construct_params)
225 Gtk::Container(construct_params)
229 Socket::Socket(GtkSocket* castitem)
231 Gtk::Container((GtkContainer*)(castitem))
240 Socket::CppClassType Socket::socket_class_; // initialize static member
242 GType Socket::get_type()
244 return socket_class_.init().get_type();
247 GType Socket::get_base_type()
249 return gtk_socket_get_type();
255 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
256 Gtk::Container(Glib::ConstructParams(socket_class_.init()))
260 void Socket::add_id(Gdk::NativeWindow window_id)
262 gtk_socket_add_id(gobj(), (GdkNativeWindow)(window_id));
265 Gdk::NativeWindow Socket::get_id() const
267 return (Gdk::NativeWindow)(gtk_socket_get_id(const_cast<GtkSocket*>(gobj())));
271 Glib::SignalProxy0< void > Socket::signal_plug_added()
273 return Glib::SignalProxy0< void >(this, &Socket_signal_plug_added_info);
276 Glib::SignalProxy0< bool > Socket::signal_plug_removed()
278 return Glib::SignalProxy0< bool >(this, &Socket_signal_plug_removed_info);
282 void Gtk::Socket::on_plug_added()
284 BaseClassType *const base = static_cast<BaseClassType*>(
285 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
288 if(base && base->plug_added)
289 (*base->plug_added)(gobj());
292 bool Gtk::Socket::on_plug_removed()
294 BaseClassType *const base = static_cast<BaseClassType*>(
295 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
298 if(base && base->plug_removed)
299 return (*base->plug_removed)(gobj());