1
// Generated by gtkmmproc -- DO NOT MODIFY!
4
#include <gtkmm/celllayout.h>
5
#include <gtkmm/private/celllayout_p.h>
8
/* $Id: celllayout.ccg,v 1.8 2006/05/11 11:40:24 murrayc Exp $ */
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 Lesser General Public
14
* License as published by the Free Software Foundation; either
15
* version 2.1 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
* Lesser General Public License for more details.
22
* You should have received a copy of the GNU Lesser 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 <glibmm/vectorutils.h>
29
#include <gtkmm/cellarea.h>
33
static void SignalProxy_CellData_gtk_callback(GtkCellLayout* /* cell_layout */, GtkCellRenderer* /* cell */, GtkTreeModel* tree_model, GtkTreeIter* iter, gpointer data)
35
Gtk::CellLayout::SlotCellData* the_slot = static_cast<Gtk::CellLayout::SlotCellData*>(data);
39
//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.
40
//And we ignore the tree_model because that can be obtained from the iter or from the CellLayout itself.
41
(*the_slot)(Gtk::TreeModel::const_iterator(tree_model, iter));
45
Glib::exception_handlers_invoke();
49
static void SignalProxy_CellData_gtk_callback_destroy(void* data)
51
delete static_cast<Gtk::CellLayout::SlotCellData*>(data);
57
void CellLayout::add_attribute(const Glib::PropertyProxy_Base& property, const TreeModelColumnBase& column)
59
gtk_cell_layout_add_attribute(gobj(),
60
(GtkCellRenderer*) property.get_object()->gobj(), property.get_name(), column.index());
63
void CellLayout::add_attribute(CellRenderer& cell, const Glib::ustring& attribute, const TreeModelColumnBase& column)
65
gtk_cell_layout_add_attribute(gobj(),
66
(GtkCellRenderer*) cell.gobj(), attribute.c_str(), column.index());
69
void CellLayout::set_cell_data_func(CellRenderer& cell, const SlotCellData& slot)
71
// Create a copy of the slot object. A pointer to this will be passed
72
// through the callback's data parameter. It will be deleted
73
// when SignalProxy_CellData_gtk_callback_destroy() is called.
74
SlotCellData* slot_copy = new SlotCellData(slot);
76
gtk_cell_layout_set_cell_data_func(gobj(), cell.gobj(),
77
&SignalProxy_CellData_gtk_callback, slot_copy,
78
&SignalProxy_CellData_gtk_callback_destroy);
81
CellRenderer* CellLayout::get_first_cell()
83
typedef std::vector<Gtk::CellRenderer*> type_vecCellRenderers;
84
type_vecCellRenderers vecCellRenderers = get_cells();
85
if(!vecCellRenderers.empty())
86
return vecCellRenderers[0];
91
const CellRenderer* CellLayout::get_first_cell() const
93
//Do some const_cast-ing to avoid repetition of code:
94
return const_cast<CellLayout*>(this)->get_first_cell();
103
} // anonymous namespace
109
Glib::RefPtr<Gtk::CellLayout> wrap(GtkCellLayout* object, bool take_copy)
111
return Glib::RefPtr<Gtk::CellLayout>( dynamic_cast<Gtk::CellLayout*> (Glib::wrap_auto_interface<Gtk::CellLayout> ((GObject*)(object), take_copy)) );
112
//We use dynamic_cast<> in case of multiple inheritance.
122
/* The *_Class implementation: */
124
const Glib::Interface_Class& CellLayout_Class::init()
126
if(!gtype_) // create the GType if necessary
128
// Glib::Interface_Class has to know the interface init function
129
// in order to add interfaces to implementing types.
130
class_init_func_ = &CellLayout_Class::iface_init_function;
132
// We can not derive from another interface, and it is not necessary anyway.
133
gtype_ = gtk_cell_layout_get_type();
139
void CellLayout_Class::iface_init_function(void* g_iface, void*)
141
BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
143
//This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
144
//This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
145
g_assert(klass != 0);
147
klass->pack_start = &pack_start_vfunc_callback;
148
klass->pack_end = &pack_end_vfunc_callback;
149
klass->clear = &clear_vfunc_callback;
150
klass->add_attribute = &add_attribute_vfunc_callback;
151
klass->clear_attributes = &clear_attributes_vfunc_callback;
152
klass->reorder = &reorder_vfunc_callback;
156
void CellLayout_Class::pack_start_vfunc_callback(GtkCellLayout* self, GtkCellRenderer* cell, gboolean expand)
158
Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
159
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
161
// Non-gtkmmproc-generated custom classes implicitly call the default
162
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
163
// generated classes can use this optimisation, which avoids the unnecessary
164
// parameter conversions if there is no possibility of the virtual function
166
if(obj_base && obj_base->is_derived_())
168
CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
169
if(obj) // This can be NULL during destruction.
171
#ifdef GLIBMM_EXCEPTIONS_ENABLED
172
try // Trap C++ exceptions which would normally be lost because this is a C callback.
174
#endif //GLIBMM_EXCEPTIONS_ENABLED
175
// Call the virtual member method, which derived classes might override.
176
obj->pack_start_vfunc(Glib::wrap(cell)
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_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
192
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
195
// Call the original underlying C function:
196
if(base && base->pack_start)
197
(*base->pack_start)(self, cell, expand);
200
void CellLayout_Class::pack_end_vfunc_callback(GtkCellLayout* self, GtkCellRenderer* cell, gboolean expand)
202
Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
203
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
205
// Non-gtkmmproc-generated custom classes implicitly call the default
206
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
207
// generated classes can use this optimisation, which avoids the unnecessary
208
// parameter conversions if there is no possibility of the virtual function
210
if(obj_base && obj_base->is_derived_())
212
CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
213
if(obj) // This can be NULL during destruction.
215
#ifdef GLIBMM_EXCEPTIONS_ENABLED
216
try // Trap C++ exceptions which would normally be lost because this is a C callback.
218
#endif //GLIBMM_EXCEPTIONS_ENABLED
219
// Call the virtual member method, which derived classes might override.
220
obj->pack_end_vfunc(Glib::wrap(cell)
224
#ifdef GLIBMM_EXCEPTIONS_ENABLED
228
Glib::exception_handlers_invoke();
230
#endif //GLIBMM_EXCEPTIONS_ENABLED
234
BaseClassType *const base = static_cast<BaseClassType*>(
235
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
236
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
239
// Call the original underlying C function:
240
if(base && base->pack_end)
241
(*base->pack_end)(self, cell, expand);
244
void CellLayout_Class::clear_vfunc_callback(GtkCellLayout* self)
246
Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
247
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
249
// Non-gtkmmproc-generated custom classes implicitly call the default
250
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
251
// generated classes can use this optimisation, which avoids the unnecessary
252
// parameter conversions if there is no possibility of the virtual function
254
if(obj_base && obj_base->is_derived_())
256
CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
257
if(obj) // This can be NULL during destruction.
259
#ifdef GLIBMM_EXCEPTIONS_ENABLED
260
try // Trap C++ exceptions which would normally be lost because this is a C callback.
262
#endif //GLIBMM_EXCEPTIONS_ENABLED
263
// Call the virtual member method, which derived classes might override.
266
#ifdef GLIBMM_EXCEPTIONS_ENABLED
270
Glib::exception_handlers_invoke();
272
#endif //GLIBMM_EXCEPTIONS_ENABLED
276
BaseClassType *const base = static_cast<BaseClassType*>(
277
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
278
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
281
// Call the original underlying C function:
282
if(base && base->clear)
283
(*base->clear)(self);
286
void CellLayout_Class::add_attribute_vfunc_callback(GtkCellLayout* self, GtkCellRenderer* cell, const gchar* attribute, gint column)
288
Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
289
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
291
// Non-gtkmmproc-generated custom classes implicitly call the default
292
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
293
// generated classes can use this optimisation, which avoids the unnecessary
294
// parameter conversions if there is no possibility of the virtual function
296
if(obj_base && obj_base->is_derived_())
298
CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
299
if(obj) // This can be NULL during destruction.
301
#ifdef GLIBMM_EXCEPTIONS_ENABLED
302
try // Trap C++ exceptions which would normally be lost because this is a C callback.
304
#endif //GLIBMM_EXCEPTIONS_ENABLED
305
// Call the virtual member method, which derived classes might override.
306
obj->add_attribute_vfunc(Glib::wrap(cell)
307
, Glib::convert_const_gchar_ptr_to_ustring(attribute)
311
#ifdef GLIBMM_EXCEPTIONS_ENABLED
315
Glib::exception_handlers_invoke();
317
#endif //GLIBMM_EXCEPTIONS_ENABLED
321
BaseClassType *const base = static_cast<BaseClassType*>(
322
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
323
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
326
// Call the original underlying C function:
327
if(base && base->add_attribute)
328
(*base->add_attribute)(self, cell, attribute, column);
331
void CellLayout_Class::clear_attributes_vfunc_callback(GtkCellLayout* self, GtkCellRenderer* cell)
333
Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
334
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
336
// Non-gtkmmproc-generated custom classes implicitly call the default
337
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
338
// generated classes can use this optimisation, which avoids the unnecessary
339
// parameter conversions if there is no possibility of the virtual function
341
if(obj_base && obj_base->is_derived_())
343
CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
344
if(obj) // This can be NULL during destruction.
346
#ifdef GLIBMM_EXCEPTIONS_ENABLED
347
try // Trap C++ exceptions which would normally be lost because this is a C callback.
349
#endif //GLIBMM_EXCEPTIONS_ENABLED
350
// Call the virtual member method, which derived classes might override.
351
obj->clear_attributes_vfunc(Glib::wrap(cell)
354
#ifdef GLIBMM_EXCEPTIONS_ENABLED
358
Glib::exception_handlers_invoke();
360
#endif //GLIBMM_EXCEPTIONS_ENABLED
364
BaseClassType *const base = static_cast<BaseClassType*>(
365
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
366
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
369
// Call the original underlying C function:
370
if(base && base->clear_attributes)
371
(*base->clear_attributes)(self, cell);
374
void CellLayout_Class::reorder_vfunc_callback(GtkCellLayout* self, GtkCellRenderer* cell, gint position)
376
Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
377
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
379
// Non-gtkmmproc-generated custom classes implicitly call the default
380
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
381
// generated classes can use this optimisation, which avoids the unnecessary
382
// parameter conversions if there is no possibility of the virtual function
384
if(obj_base && obj_base->is_derived_())
386
CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
387
if(obj) // This can be NULL during destruction.
389
#ifdef GLIBMM_EXCEPTIONS_ENABLED
390
try // Trap C++ exceptions which would normally be lost because this is a C callback.
392
#endif //GLIBMM_EXCEPTIONS_ENABLED
393
// Call the virtual member method, which derived classes might override.
394
obj->reorder_vfunc(Glib::wrap(cell)
398
#ifdef GLIBMM_EXCEPTIONS_ENABLED
402
Glib::exception_handlers_invoke();
404
#endif //GLIBMM_EXCEPTIONS_ENABLED
408
BaseClassType *const base = static_cast<BaseClassType*>(
409
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
410
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
413
// Call the original underlying C function:
414
if(base && base->reorder)
415
(*base->reorder)(self, cell, position);
420
Glib::ObjectBase* CellLayout_Class::wrap_new(GObject* object)
422
return new CellLayout((GtkCellLayout*)(object));
426
/* The implementation: */
428
CellLayout::CellLayout()
430
Glib::Interface(celllayout_class_.init())
433
CellLayout::CellLayout(GtkCellLayout* castitem)
435
Glib::Interface((GObject*)(castitem))
438
CellLayout::CellLayout(const Glib::Interface_Class& interface_class)
439
: Glib::Interface(interface_class)
443
CellLayout::~CellLayout()
447
void CellLayout::add_interface(GType gtype_implementer)
449
celllayout_class_.init().add_interface(gtype_implementer);
452
CellLayout::CppClassType CellLayout::celllayout_class_; // initialize static member
454
GType CellLayout::get_type()
456
return celllayout_class_.init().get_type();
460
GType CellLayout::get_base_type()
462
return gtk_cell_layout_get_type();
466
void CellLayout::pack_start(CellRenderer& cell, bool expand)
468
gtk_cell_layout_pack_start(gobj(), (cell).gobj(), static_cast<int>(expand));
471
void CellLayout::pack_end(CellRenderer& cell, bool expand)
473
gtk_cell_layout_pack_end(gobj(), (cell).gobj(), static_cast<int>(expand));
476
std::vector<CellRenderer*> CellLayout::get_cells()
478
return Glib::ListHandler<CellRenderer*>::list_to_vector(gtk_cell_layout_get_cells(gobj()), Glib::OWNERSHIP_SHALLOW);
481
std::vector<const CellRenderer*> CellLayout::get_cells() const
483
return Glib::ListHandler<const CellRenderer*>::list_to_vector(gtk_cell_layout_get_cells(const_cast<GtkCellLayout*>(gobj())), Glib::OWNERSHIP_SHALLOW);
486
void CellLayout::clear()
488
gtk_cell_layout_clear(gobj());
491
void CellLayout::add_attribute(CellRenderer& cell, const Glib::ustring& attribute, int column)
493
gtk_cell_layout_add_attribute(gobj(), (cell).gobj(), attribute.c_str(), column);
496
void CellLayout::clear_attributes(CellRenderer& cell)
498
gtk_cell_layout_clear_attributes(gobj(), (cell).gobj());
501
void CellLayout::reorder(CellRenderer& cell, int position)
503
gtk_cell_layout_reorder(gobj(), (cell).gobj(), position);
506
Glib::RefPtr<CellArea> CellLayout::get_area()
509
Glib::RefPtr<CellArea> retvalue = Glib::wrap(gtk_cell_layout_get_area(gobj()));
511
retvalue->reference(); //The function does not do a ref for us.
516
Glib::RefPtr<const CellArea> CellLayout::get_area() const
518
return const_cast<CellLayout*>(this)->get_area();
522
void Gtk::CellLayout::pack_start_vfunc(CellRenderer* cell, bool expand)
524
BaseClassType *const base = static_cast<BaseClassType*>(
525
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
526
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
529
if(base && base->pack_start)
530
(*base->pack_start)(gobj(),(GtkCellRenderer*)Glib::unwrap(cell),static_cast<int>(expand));
532
void Gtk::CellLayout::pack_end_vfunc(CellRenderer* cell, bool expand)
534
BaseClassType *const base = static_cast<BaseClassType*>(
535
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
536
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
539
if(base && base->pack_end)
540
(*base->pack_end)(gobj(),(GtkCellRenderer*)Glib::unwrap(cell),static_cast<int>(expand));
542
void Gtk::CellLayout::clear_vfunc()
544
BaseClassType *const base = static_cast<BaseClassType*>(
545
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
546
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
549
if(base && base->clear)
550
(*base->clear)(gobj());
552
void Gtk::CellLayout::add_attribute_vfunc(CellRenderer* cell, const Glib::ustring& attribute, int column)
554
BaseClassType *const base = static_cast<BaseClassType*>(
555
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
556
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
559
if(base && base->add_attribute)
560
(*base->add_attribute)(gobj(),(GtkCellRenderer*)Glib::unwrap(cell),attribute.c_str(),column);
562
void Gtk::CellLayout::clear_attributes_vfunc(CellRenderer* cell)
564
BaseClassType *const base = static_cast<BaseClassType*>(
565
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
566
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
569
if(base && base->clear_attributes)
570
(*base->clear_attributes)(gobj(),(GtkCellRenderer*)Glib::unwrap(cell));
572
void Gtk::CellLayout::reorder_vfunc(CellRenderer* cell, int position)
574
BaseClassType *const base = static_cast<BaseClassType*>(
575
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
576
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
579
if(base && base->reorder)
580
(*base->reorder)(gobj(),(GtkCellRenderer*)Glib::unwrap(cell),position);