1 // Generated by gtkmmproc -- DO NOT MODIFY!
4 #include <gtkmm/celllayout.h>
5 #include <gtkmm/private/celllayout_p.h>
10 /* Copyright 2003 The gtkmm Development Team
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.
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.
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.
27 #include <gtk/gtkcelllayout.h>
30 static void SignalProxy_CellData_gtk_callback(GtkCellLayout* /* cell_layout */, GtkCellRenderer* /* cell */, GtkTreeModel* tree_model, GtkTreeIter* iter, gpointer data)
32 Gtk::CellLayout::SlotCellData* the_slot = static_cast<Gtk::CellLayout::SlotCellData*>(data);
34 #ifdef GLIBMM_EXCEPTIONS_ENABLED
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
45 Glib::exception_handlers_invoke();
47 #endif //GLIBMM_EXCEPTIONS_ENABLED
50 static void SignalProxy_CellData_gtk_callback_destroy(void* data)
52 delete static_cast<Gtk::CellLayout::SlotCellData*>(data);
58 #ifdef GLIBMM_PROPERTIES_ENABLED
59 void CellLayout::add_attribute(const Glib::PropertyProxy_Base& property, const TreeModelColumnBase& column)
61 gtk_cell_layout_add_attribute(gobj(),
62 (GtkCellRenderer*) property.get_object()->gobj(), property.get_name(), column.index());
64 #endif //GLIBMM_PROPERTIES_ENABLED
66 void CellLayout::add_attribute(CellRenderer& cell, const Glib::ustring& attribute, const TreeModelColumnBase& column)
68 gtk_cell_layout_add_attribute(gobj(),
69 (GtkCellRenderer*) cell.gobj(), attribute.c_str(), column.index());
72 void CellLayout::set_cell_data_func(CellRenderer& cell, const SlotCellData& slot)
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);
79 gtk_cell_layout_set_cell_data_func(gobj(), cell.gobj(),
80 &SignalProxy_CellData_gtk_callback, slot_copy,
81 &SignalProxy_CellData_gtk_callback_destroy);
90 } // anonymous namespace
96 Glib::RefPtr<Gtk::CellLayout> wrap(GtkCellLayout* object, bool take_copy)
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.
109 /* The *_Class implementation: */
111 const Glib::Interface_Class& CellLayout_Class::init()
113 if(!gtype_) // create the GType if necessary
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;
119 // We can not derive from another interface, and it is not necessary anyway.
120 gtype_ = gtk_cell_layout_get_type();
126 void CellLayout_Class::iface_init_function(void* g_iface, void*)
128 BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
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);
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
143 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
144 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
147 #ifdef GLIBMM_VFUNCS_ENABLED
148 void CellLayout_Class::pack_start_vfunc_callback(GtkCellLayout* self, GtkCellRenderer* cell, gboolean expand)
150 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
151 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
158 if(obj_base && obj_base->is_derived_())
160 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
161 if(obj) // This can be NULL during destruction.
163 #ifdef GLIBMM_EXCEPTIONS_ENABLED
164 try // Trap C++ exceptions which would normally be lost because this is a C callback.
166 #endif //GLIBMM_EXCEPTIONS_ENABLED
167 // Call the virtual member method, which derived classes might override.
168 obj->pack_start_vfunc(Glib::wrap(cell)
172 #ifdef GLIBMM_EXCEPTIONS_ENABLED
176 Glib::exception_handlers_invoke();
178 #endif //GLIBMM_EXCEPTIONS_ENABLED
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.
187 // Call the original underlying C function:
188 if(base && base->pack_start)
189 (*base->pack_start)(self, cell, expand);
192 void CellLayout_Class::pack_end_vfunc_callback(GtkCellLayout* self, GtkCellRenderer* cell, gboolean expand)
194 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
195 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
202 if(obj_base && obj_base->is_derived_())
204 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
205 if(obj) // This can be NULL during destruction.
207 #ifdef GLIBMM_EXCEPTIONS_ENABLED
208 try // Trap C++ exceptions which would normally be lost because this is a C callback.
210 #endif //GLIBMM_EXCEPTIONS_ENABLED
211 // Call the virtual member method, which derived classes might override.
212 obj->pack_end_vfunc(Glib::wrap(cell)
216 #ifdef GLIBMM_EXCEPTIONS_ENABLED
220 Glib::exception_handlers_invoke();
222 #endif //GLIBMM_EXCEPTIONS_ENABLED
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.
231 // Call the original underlying C function:
232 if(base && base->pack_end)
233 (*base->pack_end)(self, cell, expand);
236 void CellLayout_Class::clear_vfunc_callback(GtkCellLayout* self)
238 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
239 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
246 if(obj_base && obj_base->is_derived_())
248 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
249 if(obj) // This can be NULL during destruction.
251 #ifdef GLIBMM_EXCEPTIONS_ENABLED
252 try // Trap C++ exceptions which would normally be lost because this is a C callback.
254 #endif //GLIBMM_EXCEPTIONS_ENABLED
255 // Call the virtual member method, which derived classes might override.
258 #ifdef GLIBMM_EXCEPTIONS_ENABLED
262 Glib::exception_handlers_invoke();
264 #endif //GLIBMM_EXCEPTIONS_ENABLED
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.
273 // Call the original underlying C function:
274 if(base && base->clear)
275 (*base->clear)(self);
278 void CellLayout_Class::add_attribute_vfunc_callback(GtkCellLayout* self, GtkCellRenderer* cell, const gchar* attribute, gint column)
280 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
281 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
288 if(obj_base && obj_base->is_derived_())
290 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
291 if(obj) // This can be NULL during destruction.
293 #ifdef GLIBMM_EXCEPTIONS_ENABLED
294 try // Trap C++ exceptions which would normally be lost because this is a C callback.
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)
303 #ifdef GLIBMM_EXCEPTIONS_ENABLED
307 Glib::exception_handlers_invoke();
309 #endif //GLIBMM_EXCEPTIONS_ENABLED
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.
318 // Call the original underlying C function:
319 if(base && base->add_attribute)
320 (*base->add_attribute)(self, cell, attribute, column);
323 void CellLayout_Class::clear_attributes_vfunc_callback(GtkCellLayout* self, GtkCellRenderer* cell)
325 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
326 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
333 if(obj_base && obj_base->is_derived_())
335 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
336 if(obj) // This can be NULL during destruction.
338 #ifdef GLIBMM_EXCEPTIONS_ENABLED
339 try // Trap C++ exceptions which would normally be lost because this is a C callback.
341 #endif //GLIBMM_EXCEPTIONS_ENABLED
342 // Call the virtual member method, which derived classes might override.
343 obj->clear_attributes_vfunc(Glib::wrap(cell)
346 #ifdef GLIBMM_EXCEPTIONS_ENABLED
350 Glib::exception_handlers_invoke();
352 #endif //GLIBMM_EXCEPTIONS_ENABLED
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.
361 // Call the original underlying C function:
362 if(base && base->clear_attributes)
363 (*base->clear_attributes)(self, cell);
366 void CellLayout_Class::reorder_vfunc_callback(GtkCellLayout* self, GtkCellRenderer* cell, gint position)
368 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
369 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
376 if(obj_base && obj_base->is_derived_())
378 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
379 if(obj) // This can be NULL during destruction.
381 #ifdef GLIBMM_EXCEPTIONS_ENABLED
382 try // Trap C++ exceptions which would normally be lost because this is a C callback.
384 #endif //GLIBMM_EXCEPTIONS_ENABLED
385 // Call the virtual member method, which derived classes might override.
386 obj->reorder_vfunc(Glib::wrap(cell)
390 #ifdef GLIBMM_EXCEPTIONS_ENABLED
394 Glib::exception_handlers_invoke();
396 #endif //GLIBMM_EXCEPTIONS_ENABLED
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.
405 // Call the original underlying C function:
406 if(base && base->reorder)
407 (*base->reorder)(self, cell, position);
410 #endif //GLIBMM_VFUNCS_ENABLED
412 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
413 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
416 Glib::ObjectBase* CellLayout_Class::wrap_new(GObject* object)
418 return new CellLayout((GtkCellLayout*)(object));
422 /* The implementation: */
424 CellLayout::CellLayout()
426 Glib::Interface(celllayout_class_.init())
429 CellLayout::CellLayout(GtkCellLayout* castitem)
431 Glib::Interface((GObject*)(castitem))
434 CellLayout::~CellLayout()
438 void CellLayout::add_interface(GType gtype_implementer)
440 celllayout_class_.init().add_interface(gtype_implementer);
443 CellLayout::CppClassType CellLayout::celllayout_class_; // initialize static member
445 GType CellLayout::get_type()
447 return celllayout_class_.init().get_type();
450 GType CellLayout::get_base_type()
452 return gtk_cell_layout_get_type();
456 void CellLayout::pack_start(CellRenderer& cell, bool expand)
458 gtk_cell_layout_pack_start(gobj(), (cell).gobj(), static_cast<int>(expand));
461 void CellLayout::pack_end(CellRenderer& cell, bool expand)
463 gtk_cell_layout_pack_end(gobj(), (cell).gobj(), static_cast<int>(expand));
466 Glib::ListHandle<CellRenderer*> CellLayout::get_cells()
468 return Glib::ListHandle<CellRenderer*>(gtk_cell_layout_get_cells(gobj()), Glib::OWNERSHIP_SHALLOW);
471 Glib::ListHandle<const CellRenderer*> CellLayout::get_cells() const
473 return Glib::ListHandle<const CellRenderer*>(gtk_cell_layout_get_cells(const_cast<GtkCellLayout*>(gobj())), Glib::OWNERSHIP_SHALLOW);
476 void CellLayout::clear()
478 gtk_cell_layout_clear(gobj());
481 void CellLayout::add_attribute(CellRenderer& cell, const Glib::ustring& attribute, int column)
483 gtk_cell_layout_add_attribute(gobj(), (cell).gobj(), attribute.c_str(), column);
486 void CellLayout::clear_attributes(CellRenderer& cell)
488 gtk_cell_layout_clear_attributes(gobj(), (cell).gobj());
491 void CellLayout::reorder(CellRenderer& cell, int position)
493 gtk_cell_layout_reorder(gobj(), (cell).gobj(), position);
497 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
498 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
500 #ifdef GLIBMM_VFUNCS_ENABLED
501 void Gtk::CellLayout::pack_start_vfunc(CellRenderer* cell, bool expand)
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.
508 if(base && base->pack_start)
509 (*base->pack_start)(gobj(),(GtkCellRenderer*)Glib::unwrap(cell),static_cast<int>(expand));
511 void Gtk::CellLayout::pack_end_vfunc(CellRenderer* cell, bool expand)
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.
518 if(base && base->pack_end)
519 (*base->pack_end)(gobj(),(GtkCellRenderer*)Glib::unwrap(cell),static_cast<int>(expand));
521 void Gtk::CellLayout::clear_vfunc()
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.
528 if(base && base->clear)
529 (*base->clear)(gobj());
531 void Gtk::CellLayout::add_attribute_vfunc(CellRenderer* cell, const Glib::ustring& attribute, int column)
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.
538 if(base && base->add_attribute)
539 (*base->add_attribute)(gobj(),(GtkCellRenderer*)Glib::unwrap(cell),attribute.c_str(),column);
541 void Gtk::CellLayout::clear_attributes_vfunc(CellRenderer* cell)
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.
548 if(base && base->clear_attributes)
549 (*base->clear_attributes)(gobj(),(GtkCellRenderer*)Glib::unwrap(cell));
551 void Gtk::CellLayout::reorder_vfunc(CellRenderer* cell, int position)
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.
558 if(base && base->reorder)
559 (*base->reorder)(gobj(),(GtkCellRenderer*)Glib::unwrap(cell),position);
561 #endif //GLIBMM_VFUNCS_ENABLED