add new sigc++2 directory
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / celllayout.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3
4 #include <gtkmm/celllayout.h>
5 #include <gtkmm/private/celllayout_p.h>
6
7 // -*- c++ -*-
8 /* $Id$ */
9
10 /* Copyright 2003 The gtkmm Development Team
11  *
12  * This library is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Library General Public
14  * License as published by the Free Software Foundation; either
15  * version 2 of the License, or (at your option) any later version.
16  *
17  * This library is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * Library General Public License for more details.
21  *
22  * You should have received a copy of the GNU Library General Public
23  * License along with this library; if not, write to the Free
24  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25  */
26
27 #include <gtk/gtkcelllayout.h>
28
29
30 static void SignalProxy_CellData_gtk_callback(GtkCellLayout* /* cell_layout */, GtkCellRenderer* /* cell */, GtkTreeModel* tree_model, GtkTreeIter* iter, gpointer data)
31 {
32   Gtk::CellLayout::SlotCellData* the_slot = static_cast<Gtk::CellLayout::SlotCellData*>(data);
33
34   #ifdef GLIBMM_EXCEPTIONS_ENABLED
35   try
36   {
37   #endif //GLIBMM_EXCEPTIONS_ENABLED
38     //We ignore the cell, because that was given as an argument to the connecting method, so the caller should know which one it is already.
39     //And we ignore the tree_model because that can be obtained from the iter or from the CellLayout itself.
40     (*the_slot)(Gtk::TreeModel::const_iterator(tree_model, iter));
41   #ifdef GLIBMM_EXCEPTIONS_ENABLED
42   }
43   catch(...)
44   {
45     Glib::exception_handlers_invoke();
46   }
47   #endif //GLIBMM_EXCEPTIONS_ENABLED
48 }
49
50 static void SignalProxy_CellData_gtk_callback_destroy(void* data)
51 {
52   delete static_cast<Gtk::CellLayout::SlotCellData*>(data);
53 }
54
55 namespace Gtk
56 {
57
58 #ifdef GLIBMM_PROPERTIES_ENABLED
59 void CellLayout::add_attribute(const Glib::PropertyProxy_Base& property, const TreeModelColumnBase& column)
60 {
61   gtk_cell_layout_add_attribute(gobj(),
62       (GtkCellRenderer*) property.get_object()->gobj(), property.get_name(), column.index());
63 }
64 #endif //GLIBMM_PROPERTIES_ENABLED
65
66 void CellLayout::add_attribute(CellRenderer& cell, const Glib::ustring& attribute, const TreeModelColumnBase& column)
67 {
68   gtk_cell_layout_add_attribute(gobj(),
69       (GtkCellRenderer*) cell.gobj(), attribute.c_str(), column.index());
70 }
71
72 void CellLayout::set_cell_data_func(CellRenderer& cell, const SlotCellData& slot)
73 {
74   // Create a copy of the slot object.  A pointer to this will be passed
75   // through the callback's data parameter.  It will be deleted
76   // when SignalProxy_CellData_gtk_callback_destroy() is called.
77   SlotCellData* slot_copy = new SlotCellData(slot);
78
79   gtk_cell_layout_set_cell_data_func(gobj(), cell.gobj(),
80       &SignalProxy_CellData_gtk_callback, slot_copy,
81       &SignalProxy_CellData_gtk_callback_destroy);
82 }
83   
84
85 } //namespace Gtk
86
87
88 namespace
89 {
90 } // anonymous namespace
91
92
93 namespace Glib
94 {
95
96 Glib::RefPtr<Gtk::CellLayout> wrap(GtkCellLayout* object, bool take_copy)
97 {
98   return Glib::RefPtr<Gtk::CellLayout>( dynamic_cast<Gtk::CellLayout*> (Glib::wrap_auto_interface<Gtk::CellLayout> ((GObject*)(object), take_copy)) );
99   //We use dynamic_cast<> in case of multiple inheritance.
100 }
101
102 } // namespace Glib
103
104
105 namespace Gtk
106 {
107
108
109 /* The *_Class implementation: */
110
111 const Glib::Interface_Class& CellLayout_Class::init()
112 {
113   if(!gtype_) // create the GType if necessary
114   {
115     // Glib::Interface_Class has to know the interface init function
116     // in order to add interfaces to implementing types.
117     class_init_func_ = &CellLayout_Class::iface_init_function;
118
119     // We can not derive from another interface, and it is not necessary anyway.
120     gtype_ = gtk_cell_layout_get_type();
121   }
122
123   return *this;
124 }
125
126 void CellLayout_Class::iface_init_function(void* g_iface, void*)
127 {
128   BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
129
130   //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
131   //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
132   g_assert(klass != 0); 
133
134 #ifdef GLIBMM_VFUNCS_ENABLED
135   klass->pack_start = &pack_start_vfunc_callback;
136   klass->pack_end = &pack_end_vfunc_callback;
137   klass->clear = &clear_vfunc_callback;
138   klass->add_attribute = &add_attribute_vfunc_callback;
139   klass->clear_attributes = &clear_attributes_vfunc_callback;
140   klass->reorder = &reorder_vfunc_callback;
141 #endif //GLIBMM_VFUNCS_ENABLED
142
143 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
144 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
145 }
146
147 #ifdef GLIBMM_VFUNCS_ENABLED
148 void CellLayout_Class::pack_start_vfunc_callback(GtkCellLayout* self, GtkCellRenderer* cell, gboolean expand)
149 {
150   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
151       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
152
153   // Non-gtkmmproc-generated custom classes implicitly call the default
154   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
155   // generated classes can use this optimisation, which avoids the unnecessary
156   // parameter conversions if there is no possibility of the virtual function
157   // being overridden:
158   if(obj_base && obj_base->is_derived_())
159   {
160     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
161     if(obj) // This can be NULL during destruction.
162     {
163       #ifdef GLIBMM_EXCEPTIONS_ENABLED
164       try // Trap C++ exceptions which would normally be lost because this is a C callback.
165       {
166       #endif //GLIBMM_EXCEPTIONS_ENABLED
167         // Call the virtual member method, which derived classes might override.
168         obj->pack_start_vfunc(Glib::wrap(cell)
169 , expand
170 );
171         return;
172       #ifdef GLIBMM_EXCEPTIONS_ENABLED
173       }
174       catch(...)
175       {
176         Glib::exception_handlers_invoke();
177       }
178       #endif //GLIBMM_EXCEPTIONS_ENABLED
179     }
180   }
181   
182   BaseClassType *const base = static_cast<BaseClassType*>(
183       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
184 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
185 )  );
186
187   // Call the original underlying C function:
188   if(base && base->pack_start)
189     (*base->pack_start)(self, cell, expand);
190
191 }
192 void CellLayout_Class::pack_end_vfunc_callback(GtkCellLayout* self, GtkCellRenderer* cell, gboolean expand)
193 {
194   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
195       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
196
197   // Non-gtkmmproc-generated custom classes implicitly call the default
198   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
199   // generated classes can use this optimisation, which avoids the unnecessary
200   // parameter conversions if there is no possibility of the virtual function
201   // being overridden:
202   if(obj_base && obj_base->is_derived_())
203   {
204     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
205     if(obj) // This can be NULL during destruction.
206     {
207       #ifdef GLIBMM_EXCEPTIONS_ENABLED
208       try // Trap C++ exceptions which would normally be lost because this is a C callback.
209       {
210       #endif //GLIBMM_EXCEPTIONS_ENABLED
211         // Call the virtual member method, which derived classes might override.
212         obj->pack_end_vfunc(Glib::wrap(cell)
213 , expand
214 );
215         return;
216       #ifdef GLIBMM_EXCEPTIONS_ENABLED
217       }
218       catch(...)
219       {
220         Glib::exception_handlers_invoke();
221       }
222       #endif //GLIBMM_EXCEPTIONS_ENABLED
223     }
224   }
225   
226   BaseClassType *const base = static_cast<BaseClassType*>(
227       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
228 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
229 )  );
230
231   // Call the original underlying C function:
232   if(base && base->pack_end)
233     (*base->pack_end)(self, cell, expand);
234
235 }
236 void CellLayout_Class::clear_vfunc_callback(GtkCellLayout* self)
237 {
238   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
239       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
240
241   // Non-gtkmmproc-generated custom classes implicitly call the default
242   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
243   // generated classes can use this optimisation, which avoids the unnecessary
244   // parameter conversions if there is no possibility of the virtual function
245   // being overridden:
246   if(obj_base && obj_base->is_derived_())
247   {
248     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
249     if(obj) // This can be NULL during destruction.
250     {
251       #ifdef GLIBMM_EXCEPTIONS_ENABLED
252       try // Trap C++ exceptions which would normally be lost because this is a C callback.
253       {
254       #endif //GLIBMM_EXCEPTIONS_ENABLED
255         // Call the virtual member method, which derived classes might override.
256         obj->clear_vfunc();
257         return;
258       #ifdef GLIBMM_EXCEPTIONS_ENABLED
259       }
260       catch(...)
261       {
262         Glib::exception_handlers_invoke();
263       }
264       #endif //GLIBMM_EXCEPTIONS_ENABLED
265     }
266   }
267   
268   BaseClassType *const base = static_cast<BaseClassType*>(
269       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
270 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
271 )  );
272
273   // Call the original underlying C function:
274   if(base && base->clear)
275     (*base->clear)(self);
276
277 }
278 void CellLayout_Class::add_attribute_vfunc_callback(GtkCellLayout* self, GtkCellRenderer* cell, const gchar* attribute, gint column)
279 {
280   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
281       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
282
283   // Non-gtkmmproc-generated custom classes implicitly call the default
284   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
285   // generated classes can use this optimisation, which avoids the unnecessary
286   // parameter conversions if there is no possibility of the virtual function
287   // being overridden:
288   if(obj_base && obj_base->is_derived_())
289   {
290     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
291     if(obj) // This can be NULL during destruction.
292     {
293       #ifdef GLIBMM_EXCEPTIONS_ENABLED
294       try // Trap C++ exceptions which would normally be lost because this is a C callback.
295       {
296       #endif //GLIBMM_EXCEPTIONS_ENABLED
297         // Call the virtual member method, which derived classes might override.
298         obj->add_attribute_vfunc(Glib::wrap(cell)
299 , Glib::convert_const_gchar_ptr_to_ustring(attribute)
300 , column
301 );
302         return;
303       #ifdef GLIBMM_EXCEPTIONS_ENABLED
304       }
305       catch(...)
306       {
307         Glib::exception_handlers_invoke();
308       }
309       #endif //GLIBMM_EXCEPTIONS_ENABLED
310     }
311   }
312   
313   BaseClassType *const base = static_cast<BaseClassType*>(
314       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
315 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
316 )  );
317
318   // Call the original underlying C function:
319   if(base && base->add_attribute)
320     (*base->add_attribute)(self, cell, attribute, column);
321
322 }
323 void CellLayout_Class::clear_attributes_vfunc_callback(GtkCellLayout* self, GtkCellRenderer* cell)
324 {
325   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
326       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
327
328   // Non-gtkmmproc-generated custom classes implicitly call the default
329   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
330   // generated classes can use this optimisation, which avoids the unnecessary
331   // parameter conversions if there is no possibility of the virtual function
332   // being overridden:
333   if(obj_base && obj_base->is_derived_())
334   {
335     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
336     if(obj) // This can be NULL during destruction.
337     {
338       #ifdef GLIBMM_EXCEPTIONS_ENABLED
339       try // Trap C++ exceptions which would normally be lost because this is a C callback.
340       {
341       #endif //GLIBMM_EXCEPTIONS_ENABLED
342         // Call the virtual member method, which derived classes might override.
343         obj->clear_attributes_vfunc(Glib::wrap(cell)
344 );
345         return;
346       #ifdef GLIBMM_EXCEPTIONS_ENABLED
347       }
348       catch(...)
349       {
350         Glib::exception_handlers_invoke();
351       }
352       #endif //GLIBMM_EXCEPTIONS_ENABLED
353     }
354   }
355   
356   BaseClassType *const base = static_cast<BaseClassType*>(
357       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
358 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
359 )  );
360
361   // Call the original underlying C function:
362   if(base && base->clear_attributes)
363     (*base->clear_attributes)(self, cell);
364
365 }
366 void CellLayout_Class::reorder_vfunc_callback(GtkCellLayout* self, GtkCellRenderer* cell, gint position)
367 {
368   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
369       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
370
371   // Non-gtkmmproc-generated custom classes implicitly call the default
372   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
373   // generated classes can use this optimisation, which avoids the unnecessary
374   // parameter conversions if there is no possibility of the virtual function
375   // being overridden:
376   if(obj_base && obj_base->is_derived_())
377   {
378     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
379     if(obj) // This can be NULL during destruction.
380     {
381       #ifdef GLIBMM_EXCEPTIONS_ENABLED
382       try // Trap C++ exceptions which would normally be lost because this is a C callback.
383       {
384       #endif //GLIBMM_EXCEPTIONS_ENABLED
385         // Call the virtual member method, which derived classes might override.
386         obj->reorder_vfunc(Glib::wrap(cell)
387 , position
388 );
389         return;
390       #ifdef GLIBMM_EXCEPTIONS_ENABLED
391       }
392       catch(...)
393       {
394         Glib::exception_handlers_invoke();
395       }
396       #endif //GLIBMM_EXCEPTIONS_ENABLED
397     }
398   }
399   
400   BaseClassType *const base = static_cast<BaseClassType*>(
401       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
402 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
403 )  );
404
405   // Call the original underlying C function:
406   if(base && base->reorder)
407     (*base->reorder)(self, cell, position);
408
409 }
410 #endif //GLIBMM_VFUNCS_ENABLED
411
412 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
413 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
414
415
416 Glib::ObjectBase* CellLayout_Class::wrap_new(GObject* object)
417 {
418   return new CellLayout((GtkCellLayout*)(object));
419 }
420
421
422 /* The implementation: */
423
424 CellLayout::CellLayout()
425 :
426   Glib::Interface(celllayout_class_.init())
427 {}
428
429 CellLayout::CellLayout(GtkCellLayout* castitem)
430 :
431   Glib::Interface((GObject*)(castitem))
432 {}
433
434 CellLayout::~CellLayout()
435 {}
436
437 // static
438 void CellLayout::add_interface(GType gtype_implementer)
439 {
440   celllayout_class_.init().add_interface(gtype_implementer);
441 }
442
443 CellLayout::CppClassType CellLayout::celllayout_class_; // initialize static member
444
445 GType CellLayout::get_type()
446 {
447   return celllayout_class_.init().get_type();
448 }
449
450 GType CellLayout::get_base_type()
451 {
452   return gtk_cell_layout_get_type();
453 }
454
455
456 void CellLayout::pack_start(CellRenderer& cell, bool expand)
457 {
458 gtk_cell_layout_pack_start(gobj(), (cell).gobj(), static_cast<int>(expand)); 
459 }
460
461 void CellLayout::pack_end(CellRenderer& cell, bool expand)
462 {
463 gtk_cell_layout_pack_end(gobj(), (cell).gobj(), static_cast<int>(expand)); 
464 }
465
466 Glib::ListHandle<CellRenderer*> CellLayout::get_cells()
467 {
468   return Glib::ListHandle<CellRenderer*>(gtk_cell_layout_get_cells(gobj()), Glib::OWNERSHIP_SHALLOW);
469 }
470
471 Glib::ListHandle<const CellRenderer*> CellLayout::get_cells() const
472 {
473   return Glib::ListHandle<const CellRenderer*>(gtk_cell_layout_get_cells(const_cast<GtkCellLayout*>(gobj())), Glib::OWNERSHIP_SHALLOW);
474 }
475
476 void CellLayout::clear()
477 {
478 gtk_cell_layout_clear(gobj()); 
479 }
480
481 void CellLayout::add_attribute(CellRenderer& cell, const Glib::ustring& attribute, int column)
482 {
483 gtk_cell_layout_add_attribute(gobj(), (cell).gobj(), attribute.c_str(), column); 
484 }
485
486 void CellLayout::clear_attributes(CellRenderer& cell)
487 {
488 gtk_cell_layout_clear_attributes(gobj(), (cell).gobj()); 
489 }
490
491 void CellLayout::reorder(CellRenderer& cell, int position)
492 {
493 gtk_cell_layout_reorder(gobj(), (cell).gobj(), position); 
494 }
495
496
497 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
498 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
499
500 #ifdef GLIBMM_VFUNCS_ENABLED
501 void Gtk::CellLayout::pack_start_vfunc(CellRenderer* cell, bool expand) 
502 {
503   BaseClassType *const base = static_cast<BaseClassType*>(
504       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
505 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
506 )  );
507
508   if(base && base->pack_start)
509     (*base->pack_start)(gobj(),(GtkCellRenderer*)Glib::unwrap(cell),static_cast<int>(expand));
510 }
511 void Gtk::CellLayout::pack_end_vfunc(CellRenderer* cell, bool expand) 
512 {
513   BaseClassType *const base = static_cast<BaseClassType*>(
514       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
515 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
516 )  );
517
518   if(base && base->pack_end)
519     (*base->pack_end)(gobj(),(GtkCellRenderer*)Glib::unwrap(cell),static_cast<int>(expand));
520 }
521 void Gtk::CellLayout::clear_vfunc() 
522 {
523   BaseClassType *const base = static_cast<BaseClassType*>(
524       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
525 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
526 )  );
527
528   if(base && base->clear)
529     (*base->clear)(gobj());
530 }
531 void Gtk::CellLayout::add_attribute_vfunc(CellRenderer* cell, const Glib::ustring& attribute, int column) 
532 {
533   BaseClassType *const base = static_cast<BaseClassType*>(
534       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
535 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
536 )  );
537
538   if(base && base->add_attribute)
539     (*base->add_attribute)(gobj(),(GtkCellRenderer*)Glib::unwrap(cell),attribute.c_str(),column);
540 }
541 void Gtk::CellLayout::clear_attributes_vfunc(CellRenderer* cell) 
542 {
543   BaseClassType *const base = static_cast<BaseClassType*>(
544       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
545 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
546 )  );
547
548   if(base && base->clear_attributes)
549     (*base->clear_attributes)(gobj(),(GtkCellRenderer*)Glib::unwrap(cell));
550 }
551 void Gtk::CellLayout::reorder_vfunc(CellRenderer* cell, int position) 
552 {
553   BaseClassType *const base = static_cast<BaseClassType*>(
554       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
555 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
556 )  );
557
558   if(base && base->reorder)
559     (*base->reorder)(gobj(),(GtkCellRenderer*)Glib::unwrap(cell),position);
560 }
561 #endif //GLIBMM_VFUNCS_ENABLED
562
563
564 } // namespace Gtk
565
566