Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / celleditable.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <gtkmm/celleditable.h>
4 #include <gtkmm/private/celleditable_p.h>
5
6 // -*- c++ -*-
7 /* $Id$ */
8
9 /* Copyright 1998-2002 The gtkmm Development Team
10  *
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.
15  *
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.
20  *
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.
24  */
25
26 #include <gtk/gtkcelleditable.h>
27
28
29 namespace
30 {
31
32 const Glib::SignalProxyInfo CellEditable_signal_editing_done_info =
33 {
34   "editing_done",
35   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
36   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
37 };
38
39
40 const Glib::SignalProxyInfo CellEditable_signal_remove_widget_info =
41 {
42   "remove_widget",
43   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
44   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
45 };
46
47 } // anonymous namespace
48
49
50 namespace Glib
51 {
52
53 Glib::RefPtr<Gtk::CellEditable> wrap(GtkCellEditable* object, bool take_copy)
54 {
55   return Glib::RefPtr<Gtk::CellEditable>( dynamic_cast<Gtk::CellEditable*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
56   //We use dynamic_cast<> in case of multiple inheritance.
57 }
58
59 } // namespace Glib
60
61
62 namespace Gtk
63 {
64
65
66 /* The *_Class implementation: */
67
68 const Glib::Interface_Class& CellEditable_Class::init()
69 {
70   if(!gtype_) // create the GType if necessary
71   {
72     // Glib::Interface_Class has to know the interface init function
73     // in order to add interfaces to implementing types.
74     class_init_func_ = &CellEditable_Class::iface_init_function;
75
76     // We can not derive from another interface, and it is not necessary anyway.
77     gtype_ = gtk_cell_editable_get_type();
78   }
79
80   return *this;
81 }
82
83 void CellEditable_Class::iface_init_function(void* g_iface, void*)
84 {
85   BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
86
87   //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
88   //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
89   g_assert(klass != 0); 
90
91   klass->start_editing = &start_editing_vfunc_callback;
92   klass->editing_done = &editing_done_callback;
93   klass->remove_widget = &remove_widget_callback;
94 }
95
96 void CellEditable_Class::start_editing_vfunc_callback(GtkCellEditable* self, GdkEvent* event)
97 {
98   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
99       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
100
101   // Non-gtkmmproc-generated custom classes implicitly call the default
102   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
103   // generated classes can use this optimisation, which avoids the unnecessary
104   // parameter conversions if there is no possibility of the virtual function
105   // being overridden:
106   if(obj && obj->is_derived_())
107   {
108     try // Trap C++ exceptions which would normally be lost because this is a C callback.
109     {
110       // Call the virtual member method, which derived classes might override.
111       obj->start_editing_vfunc(event);
112     }
113     catch(...)
114     {
115       Glib::exception_handlers_invoke();
116     }
117   }
118   else
119   {
120     BaseClassType *const base = static_cast<BaseClassType*>(
121         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
122 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
123 )    );
124
125     // Call the original underlying C function:
126     if(base && base->start_editing)
127       (*base->start_editing)(self, event);
128   }
129 }
130
131
132 void CellEditable_Class::editing_done_callback(GtkCellEditable* self)
133 {
134   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
135       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
136
137   // Non-gtkmmproc-generated custom classes implicitly call the default
138   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
139   // generated classes can use this optimisation, which avoids the unnecessary
140   // parameter conversions if there is no possibility of the virtual function
141   // being overridden:
142   if(obj && obj->is_derived_())
143   {
144     try // Trap C++ exceptions which would normally be lost because this is a C callback.
145     {
146       // Call the virtual member method, which derived classes might override.
147       obj->on_editing_done();
148     }
149     catch(...)
150     {
151       Glib::exception_handlers_invoke();
152     }
153   }
154   else
155   {
156     BaseClassType *const base = static_cast<BaseClassType*>(
157         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
158 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
159 )    );
160
161     // Call the original underlying C function:
162     if(base && base->editing_done)
163       (*base->editing_done)(self);
164   }
165 }
166
167 void CellEditable_Class::remove_widget_callback(GtkCellEditable* self)
168 {
169   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
170       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
171
172   // Non-gtkmmproc-generated custom classes implicitly call the default
173   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
174   // generated classes can use this optimisation, which avoids the unnecessary
175   // parameter conversions if there is no possibility of the virtual function
176   // being overridden:
177   if(obj && obj->is_derived_())
178   {
179     try // Trap C++ exceptions which would normally be lost because this is a C callback.
180     {
181       // Call the virtual member method, which derived classes might override.
182       obj->on_remove_widget();
183     }
184     catch(...)
185     {
186       Glib::exception_handlers_invoke();
187     }
188   }
189   else
190   {
191     BaseClassType *const base = static_cast<BaseClassType*>(
192         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
193 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
194 )    );
195
196     // Call the original underlying C function:
197     if(base && base->remove_widget)
198       (*base->remove_widget)(self);
199   }
200 }
201
202
203 Glib::ObjectBase* CellEditable_Class::wrap_new(GObject* object)
204 {
205   return new CellEditable((GtkCellEditable*)(object));
206 }
207
208
209 /* The implementation: */
210
211 CellEditable::CellEditable()
212 :
213   Glib::Interface(celleditable_class_.init())
214 {}
215
216 CellEditable::CellEditable(GtkCellEditable* castitem)
217 :
218   Glib::Interface((GObject*)(castitem))
219 {}
220
221 CellEditable::~CellEditable()
222 {}
223
224 // static
225 void CellEditable::add_interface(GType gtype_implementer)
226 {
227   celleditable_class_.init().add_interface(gtype_implementer);
228 }
229
230 CellEditable::CppClassType CellEditable::celleditable_class_; // initialize static member
231
232 GType CellEditable::get_type()
233 {
234   return celleditable_class_.init().get_type();
235 }
236
237 GType CellEditable::get_base_type()
238 {
239   return gtk_cell_editable_get_type();
240 }
241
242
243 void CellEditable::start_editing(GdkEvent* event)
244 {
245   gtk_cell_editable_start_editing(gobj(), event);
246 }
247
248 void CellEditable::editing_done()
249 {
250   gtk_cell_editable_editing_done(gobj());
251 }
252
253 void CellEditable::remove_widget()
254 {
255   gtk_cell_editable_remove_widget(gobj());
256 }
257
258
259 Glib::SignalProxy0< void > CellEditable::signal_editing_done()
260 {
261   return Glib::SignalProxy0< void >(this, &CellEditable_signal_editing_done_info);
262 }
263
264 Glib::SignalProxy0< void > CellEditable::signal_remove_widget()
265 {
266   return Glib::SignalProxy0< void >(this, &CellEditable_signal_remove_widget_info);
267 }
268
269
270 void Gtk::CellEditable::on_editing_done()
271 {
272   BaseClassType *const base = static_cast<BaseClassType*>(
273       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
274 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
275 )  );
276
277   if(base && base->editing_done)
278     (*base->editing_done)(gobj());
279 }
280
281 void Gtk::CellEditable::on_remove_widget()
282 {
283   BaseClassType *const base = static_cast<BaseClassType*>(
284       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
285 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
286 )  );
287
288   if(base && base->remove_widget)
289     (*base->remove_widget)(gobj());
290 }
291
292
293 void Gtk::CellEditable::start_editing_vfunc(GdkEvent* event) 
294 {
295   BaseClassType *const base = static_cast<BaseClassType*>(
296       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
297 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
298 )  );
299
300   if(base && base->start_editing)
301     (*base->start_editing)(gobj(),event);
302 }
303
304
305 } // namespace Gtk
306
307