~ubuntu-branches/ubuntu/vivid/ardour/vivid-proposed

« back to all changes in this revision

Viewing changes to libs/gtkmm2/gtk/gtkmm/celllayout.cc

  • Committer: Package Import Robot
  • Author(s): Felipe Sateler, Jaromír Mikeš, Felipe Sateler
  • Date: 2014-05-22 14:39:25 UTC
  • mfrom: (29 sid)
  • mto: This revision was merged to the branch mainline in revision 30.
  • Revision ID: package-import@ubuntu.com-20140522143925-vwqfo9287pmkrroe
Tags: 1:2.8.16+git20131003-3
* Team upload

[ Jaromír Mikeš ]
* Add -dbg package

[ Felipe Sateler ]
* Upload to experimental

Show diffs side-by-side

added added

removed removed

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