1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3
4 #include <libgnomecanvasmm/item.h>
5 #include <libgnomecanvasmm/private/item_p.h>
6
7 // -*- C++ -*-
8 /* $Id: item.ccg,v 1.4 2005/06/09 11:26:34 murrayc Exp $ */
9
10 /* item.cc
11 *
12 * Copyright (C) 1998 EMC Capital Management Inc.
13 * Developed by Havoc Pennington <hp@pobox.com>
14 *
15 * This library is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU Lesser General Public
17 * License as published by the Free Software Foundation; either
18 * version 2.1 of the License, or (at your option) any later version.
19 *
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
24 *
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with this library; if not, write to the Free
27 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 */
29
30 extern "C"
31 {
32 #include <stdarg.h>
33 }
34
35 #include <libgnomecanvasmm/canvas.h>
36 #include <libgnomecanvasmm/group.h>
37 #include <libgnomecanvas/gnome-canvas-util.h>
38
39 namespace Gnome
40 {
41
42 namespace Canvas
43 {
44
45 //This function creates an empty va_list instead of just passing 0 to gnome_canvas_item_construct().
46 //This is necessary on the alpha platform.
47 //It needs to be a separate helper function because we need a ... argument.
48 static void
item_construct_helper(GnomeCanvasItem * item,GnomeCanvasGroup * group,...)49 item_construct_helper(GnomeCanvasItem *item, GnomeCanvasGroup *group, ...)
50 {
51 va_list va;
52 va_start(va, group);
53 gnome_canvas_item_construct(item, group, 0, va);
54 va_end(va);
55 }
56
57 void
item_construct(Group & group)58 Item::item_construct(Group& group)
59 {
60 item_construct_helper(GNOME_CANVAS_ITEM(gobj()), group.gobj()); //With no ... arguments.
61 }
62
63 void
item_construct(Group & group,const gchar * first_arg_name,va_list ap)64 Item::item_construct(Group& group, const gchar* first_arg_name,
65 va_list ap)
66 {
67 gnome_canvas_item_construct(GNOME_CANVAS_ITEM(gobj()), group.gobj(),
68 first_arg_name,
69 ap);
70 }
71
72 void
set(const gchar * first_arg_name,...)73 Item::set(const gchar* first_arg_name, ...)
74 {
75 va_list args;
76 va_start(args,first_arg_name);
77 gnome_canvas_item_set_valist(gobj(), first_arg_name, args);
78 va_end(args);
79 }
80
grab(unsigned int event_mask,const Gdk::Cursor & cursor,guint32 etime)81 int Item::grab(unsigned int event_mask, const Gdk::Cursor& cursor, guint32 etime)
82 {
83 return gnome_canvas_item_grab(gobj(), event_mask, const_cast<GdkCursor*>(cursor.gobj()), etime);
84 }
85
grab(unsigned int event_mask,guint32 etime)86 int Item::grab(unsigned int event_mask, guint32 etime)
87 {
88 return gnome_canvas_item_grab(gobj(), event_mask, 0, etime);
89 }
90
91 void
affine_relative(const Art::AffineTrans & affine)92 Item::affine_relative(const Art::AffineTrans &affine)
93 {
94 gnome_canvas_item_affine_relative (gobj(), affine.gobj());
95 }
96
97 void
affine_absolute(const Art::AffineTrans & affine)98 Item::affine_absolute (const Art::AffineTrans &affine)
99 {
100 gnome_canvas_item_affine_absolute (gobj(), affine.gobj());
101 }
102
103 Art::AffineTrans
get_i2w_affine() const104 Item::get_i2w_affine() const
105 {
106 double tmp[6] = {0};
107
108 gnome_canvas_item_i2w_affine(const_cast<GnomeCanvasItem*>(gobj()), tmp);
109 return Art::AffineTrans(tmp);
110 }
111
112 Art::AffineTrans
get_i2c_affine() const113 Item::get_i2c_affine() const
114 {
115 double tmp[6] = {0};
116
117 gnome_canvas_item_i2c_affine(const_cast<GnomeCanvasItem*>(gobj()), tmp);
118 return Art::AffineTrans(tmp);
119 }
120
get_parent_group()121 Group* Item::get_parent_group()
122 {
123 //This is implemented in C, instead of using our C++ PropertyProxy, because uses of PropertyProxy<Object*>
124 //do not compile with some versions of SUN Forte C++.
125
126 GValue value = { 0, };
127 g_value_init(&value, GNOME_TYPE_CANVAS_ITEM);
128 //The property is specified as ITEM, but it's actually always a GNOME_TYPE_CANVAS_GROUP.
129
130 g_object_get_property(G_OBJECT(gobj()), "parent", &value);
131
132 GnomeCanvasGroup* cgroup = GNOME_CANVAS_GROUP(g_value_get_object(&value));
133
134 return Glib::wrap(cgroup);
135 }
136
get_parent_group() const137 const Group* Item::get_parent_group() const
138 {
139 Item* nonconstthis = const_cast<Item*>(this);
140 return nonconstthis->get_parent_group();
141 }
142
143 } /* namespace Canvas */
144 } /* namespace Gnome */
145
146 namespace
147 {
148
149
Item_signal_event_callback(GnomeCanvasItem * self,GdkEvent * p0,void * data)150 static gboolean Item_signal_event_callback(GnomeCanvasItem* self, GdkEvent* p0,void* data)
151 {
152 using namespace Gnome::Canvas;
153 typedef sigc::slot< bool,GdkEvent* > SlotType;
154
155 // Do not try to call a signal on a disassociated wrapper.
156 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
157 {
158 #ifdef GLIBMM_EXCEPTIONS_ENABLED
159 try
160 {
161 #endif //GLIBMM_EXCEPTIONS_ENABLED
162 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
163 return static_cast<int>((*static_cast<SlotType*>(slot))(p0));
164 #ifdef GLIBMM_EXCEPTIONS_ENABLED
165 }
166 catch(...)
167 {
168 Glib::exception_handlers_invoke();
169 }
170 #endif //GLIBMM_EXCEPTIONS_ENABLED
171 }
172
173 typedef gboolean RType;
174 return RType();
175 }
176
Item_signal_event_notify_callback(GnomeCanvasItem * self,GdkEvent * p0,void * data)177 static gboolean Item_signal_event_notify_callback(GnomeCanvasItem* self, GdkEvent* p0, void* data)
178 {
179 using namespace Gnome::Canvas;
180 typedef sigc::slot< void,GdkEvent* > SlotType;
181
182 // Do not try to call a signal on a disassociated wrapper.
183 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
184 {
185 #ifdef GLIBMM_EXCEPTIONS_ENABLED
186 try
187 {
188 #endif //GLIBMM_EXCEPTIONS_ENABLED
189 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
190 (*static_cast<SlotType*>(slot))(p0);
191 #ifdef GLIBMM_EXCEPTIONS_ENABLED
192 }
193 catch(...)
194 {
195 Glib::exception_handlers_invoke();
196 }
197 #endif //GLIBMM_EXCEPTIONS_ENABLED
198 }
199
200 typedef gboolean RType;
201 return RType();
202 }
203
204 static const Glib::SignalProxyInfo Item_signal_event_info =
205 {
206 "event",
207 (GCallback) &Item_signal_event_callback,
208 (GCallback) &Item_signal_event_notify_callback
209 };
210
211
212 } // anonymous namespace
213
214
215 namespace Glib
216 {
217
wrap(GnomeCanvasItem * object,bool take_copy)218 Gnome::Canvas::Item* wrap(GnomeCanvasItem* object, bool take_copy)
219 {
220 return dynamic_cast<Gnome::Canvas::Item *> (Glib::wrap_auto ((GObject*)(object), take_copy));
221 }
222
223 } /* namespace Glib */
224
225 namespace Gnome
226 {
227
228 namespace Canvas
229 {
230
231
232 /* The *_Class implementation: */
233
init()234 const Glib::Class& Item_Class::init()
235 {
236 if(!gtype_) // create the GType if necessary
237 {
238 // Glib::Class has to know the class init function to clone custom types.
239 class_init_func_ = &Item_Class::class_init_function;
240
241 // This is actually just optimized away, apparently with no harm.
242 // Make sure that the parent type has been created.
243 //CppClassParent::CppObjectType::get_type();
244
245 // Create the wrapper type, with the same class/instance size as the base type.
246 register_derived_type(gnome_canvas_item_get_type());
247
248 // Add derived versions of interfaces, if the C type implements any interfaces:
249
250 }
251
252 return *this;
253 }
254
class_init_function(void * g_class,void * class_data)255 void Item_Class::class_init_function(void* g_class, void* class_data)
256 {
257 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
258 CppClassParent::class_init_function(klass, class_data);
259
260 #ifdef GLIBMM_VFUNCS_ENABLED
261 klass->update = &update_vfunc_callback;
262 klass->realize = &realize_vfunc_callback;
263 klass->unrealize = &unrealize_vfunc_callback;
264 klass->map = &map_vfunc_callback;
265 klass->unmap = &unmap_vfunc_callback;
266 klass->coverage = &coverage_vfunc_callback;
267 klass->draw = &draw_vfunc_callback;
268 klass->render = &render_vfunc_callback;
269 klass->point = &point_vfunc_callback;
270 klass->bounds = &bounds_vfunc_callback;
271 #endif //GLIBMM_VFUNCS_ENABLED
272
273 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
274 klass->event = &event_callback;
275 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
276 }
277
278 #ifdef GLIBMM_VFUNCS_ENABLED
update_vfunc_callback(GnomeCanvasItem * self,double * affine,ArtSVP * clip_path,int flags)279 void Item_Class::update_vfunc_callback(GnomeCanvasItem* self, double* affine, ArtSVP* clip_path, int flags)
280 {
281 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
282 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
283
284 // Non-gtkmmproc-generated custom classes implicitly call the default
285 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
286 // generated classes can use this optimisation, which avoids the unnecessary
287 // parameter conversions if there is no possibility of the virtual function
288 // being overridden:
289 if(obj_base && obj_base->is_derived_())
290 {
291 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
292 if(obj) // This can be NULL during destruction.
293 {
294 #ifdef GLIBMM_EXCEPTIONS_ENABLED
295 try // Trap C++ exceptions which would normally be lost because this is a C callback.
296 {
297 #endif //GLIBMM_EXCEPTIONS_ENABLED
298 // Call the virtual member method, which derived classes might override.
299 obj->update_vfunc(affine, clip_path, flags);
300 return;
301 #ifdef GLIBMM_EXCEPTIONS_ENABLED
302 }
303 catch(...)
304 {
305 Glib::exception_handlers_invoke();
306 }
307 #endif //GLIBMM_EXCEPTIONS_ENABLED
308 }
309 }
310
311 BaseClassType *const base = static_cast<BaseClassType*>(
312 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
313 );
314
315 // Call the original underlying C function:
316 if(base && base->update)
317 (*base->update)(self, affine, clip_path, flags);
318
319 }
realize_vfunc_callback(GnomeCanvasItem * self)320 void Item_Class::realize_vfunc_callback(GnomeCanvasItem* self)
321 {
322 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
323 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
324
325 // Non-gtkmmproc-generated custom classes implicitly call the default
326 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
327 // generated classes can use this optimisation, which avoids the unnecessary
328 // parameter conversions if there is no possibility of the virtual function
329 // being overridden:
330 if(obj_base && obj_base->is_derived_())
331 {
332 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
333 if(obj) // This can be NULL during destruction.
334 {
335 #ifdef GLIBMM_EXCEPTIONS_ENABLED
336 try // Trap C++ exceptions which would normally be lost because this is a C callback.
337 {
338 #endif //GLIBMM_EXCEPTIONS_ENABLED
339 // Call the virtual member method, which derived classes might override.
340 obj->realize_vfunc();
341 return;
342 #ifdef GLIBMM_EXCEPTIONS_ENABLED
343 }
344 catch(...)
345 {
346 Glib::exception_handlers_invoke();
347 }
348 #endif //GLIBMM_EXCEPTIONS_ENABLED
349 }
350 }
351
352 BaseClassType *const base = static_cast<BaseClassType*>(
353 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
354 );
355
356 // Call the original underlying C function:
357 if(base && base->realize)
358 (*base->realize)(self);
359
360 }
unrealize_vfunc_callback(GnomeCanvasItem * self)361 void Item_Class::unrealize_vfunc_callback(GnomeCanvasItem* self)
362 {
363 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
364 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
365
366 // Non-gtkmmproc-generated custom classes implicitly call the default
367 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
368 // generated classes can use this optimisation, which avoids the unnecessary
369 // parameter conversions if there is no possibility of the virtual function
370 // being overridden:
371 if(obj_base && obj_base->is_derived_())
372 {
373 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
374 if(obj) // This can be NULL during destruction.
375 {
376 #ifdef GLIBMM_EXCEPTIONS_ENABLED
377 try // Trap C++ exceptions which would normally be lost because this is a C callback.
378 {
379 #endif //GLIBMM_EXCEPTIONS_ENABLED
380 // Call the virtual member method, which derived classes might override.
381 obj->unrealize_vfunc();
382 return;
383 #ifdef GLIBMM_EXCEPTIONS_ENABLED
384 }
385 catch(...)
386 {
387 Glib::exception_handlers_invoke();
388 }
389 #endif //GLIBMM_EXCEPTIONS_ENABLED
390 }
391 }
392
393 BaseClassType *const base = static_cast<BaseClassType*>(
394 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
395 );
396
397 // Call the original underlying C function:
398 if(base && base->unrealize)
399 (*base->unrealize)(self);
400
401 }
map_vfunc_callback(GnomeCanvasItem * self)402 void Item_Class::map_vfunc_callback(GnomeCanvasItem* self)
403 {
404 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
405 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
406
407 // Non-gtkmmproc-generated custom classes implicitly call the default
408 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
409 // generated classes can use this optimisation, which avoids the unnecessary
410 // parameter conversions if there is no possibility of the virtual function
411 // being overridden:
412 if(obj_base && obj_base->is_derived_())
413 {
414 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
415 if(obj) // This can be NULL during destruction.
416 {
417 #ifdef GLIBMM_EXCEPTIONS_ENABLED
418 try // Trap C++ exceptions which would normally be lost because this is a C callback.
419 {
420 #endif //GLIBMM_EXCEPTIONS_ENABLED
421 // Call the virtual member method, which derived classes might override.
422 obj->map_vfunc();
423 return;
424 #ifdef GLIBMM_EXCEPTIONS_ENABLED
425 }
426 catch(...)
427 {
428 Glib::exception_handlers_invoke();
429 }
430 #endif //GLIBMM_EXCEPTIONS_ENABLED
431 }
432 }
433
434 BaseClassType *const base = static_cast<BaseClassType*>(
435 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
436 );
437
438 // Call the original underlying C function:
439 if(base && base->map)
440 (*base->map)(self);
441
442 }
unmap_vfunc_callback(GnomeCanvasItem * self)443 void Item_Class::unmap_vfunc_callback(GnomeCanvasItem* self)
444 {
445 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
446 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
447
448 // Non-gtkmmproc-generated custom classes implicitly call the default
449 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
450 // generated classes can use this optimisation, which avoids the unnecessary
451 // parameter conversions if there is no possibility of the virtual function
452 // being overridden:
453 if(obj_base && obj_base->is_derived_())
454 {
455 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
456 if(obj) // This can be NULL during destruction.
457 {
458 #ifdef GLIBMM_EXCEPTIONS_ENABLED
459 try // Trap C++ exceptions which would normally be lost because this is a C callback.
460 {
461 #endif //GLIBMM_EXCEPTIONS_ENABLED
462 // Call the virtual member method, which derived classes might override.
463 obj->unmap_vfunc();
464 return;
465 #ifdef GLIBMM_EXCEPTIONS_ENABLED
466 }
467 catch(...)
468 {
469 Glib::exception_handlers_invoke();
470 }
471 #endif //GLIBMM_EXCEPTIONS_ENABLED
472 }
473 }
474
475 BaseClassType *const base = static_cast<BaseClassType*>(
476 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
477 );
478
479 // Call the original underlying C function:
480 if(base && base->unmap)
481 (*base->unmap)(self);
482
483 }
coverage_vfunc_callback(GnomeCanvasItem * self)484 ArtUta* Item_Class::coverage_vfunc_callback(GnomeCanvasItem* self)
485 {
486 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
487 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
488
489 // Non-gtkmmproc-generated custom classes implicitly call the default
490 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
491 // generated classes can use this optimisation, which avoids the unnecessary
492 // parameter conversions if there is no possibility of the virtual function
493 // being overridden:
494 if(obj_base && obj_base->is_derived_())
495 {
496 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
497 if(obj) // This can be NULL during destruction.
498 {
499 #ifdef GLIBMM_EXCEPTIONS_ENABLED
500 try // Trap C++ exceptions which would normally be lost because this is a C callback.
501 {
502 #endif //GLIBMM_EXCEPTIONS_ENABLED
503 // Call the virtual member method, which derived classes might override.
504 return obj->coverage_vfunc();
505 #ifdef GLIBMM_EXCEPTIONS_ENABLED
506 }
507 catch(...)
508 {
509 Glib::exception_handlers_invoke();
510 }
511 #endif //GLIBMM_EXCEPTIONS_ENABLED
512 }
513 }
514
515 BaseClassType *const base = static_cast<BaseClassType*>(
516 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
517 );
518
519 // Call the original underlying C function:
520 if(base && base->coverage)
521 return (*base->coverage)(self);
522
523
524 typedef ArtUta* RType;
525 return RType();
526 }
draw_vfunc_callback(GnomeCanvasItem * self,GdkDrawable * drawable,int x,int y,int width,int height)527 void Item_Class::draw_vfunc_callback(GnomeCanvasItem* self, GdkDrawable* drawable, int x, int y, int width, int height)
528 {
529 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
530 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
531
532 // Non-gtkmmproc-generated custom classes implicitly call the default
533 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
534 // generated classes can use this optimisation, which avoids the unnecessary
535 // parameter conversions if there is no possibility of the virtual function
536 // being overridden:
537 if(obj_base && obj_base->is_derived_())
538 {
539 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
540 if(obj) // This can be NULL during destruction.
541 {
542 #ifdef GLIBMM_EXCEPTIONS_ENABLED
543 try // Trap C++ exceptions which would normally be lost because this is a C callback.
544 {
545 #endif //GLIBMM_EXCEPTIONS_ENABLED
546 // Call the virtual member method, which derived classes might override.
547 obj->draw_vfunc(Glib::wrap(drawable, true)
548 , x, y, width, height);
549 return;
550 #ifdef GLIBMM_EXCEPTIONS_ENABLED
551 }
552 catch(...)
553 {
554 Glib::exception_handlers_invoke();
555 }
556 #endif //GLIBMM_EXCEPTIONS_ENABLED
557 }
558 }
559
560 BaseClassType *const base = static_cast<BaseClassType*>(
561 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
562 );
563
564 // Call the original underlying C function:
565 if(base && base->draw)
566 (*base->draw)(self, drawable, x, y, width, height);
567
568 }
render_vfunc_callback(GnomeCanvasItem * self,GnomeCanvasBuf * buf)569 void Item_Class::render_vfunc_callback(GnomeCanvasItem* self, GnomeCanvasBuf* buf)
570 {
571 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
572 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
573
574 // Non-gtkmmproc-generated custom classes implicitly call the default
575 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
576 // generated classes can use this optimisation, which avoids the unnecessary
577 // parameter conversions if there is no possibility of the virtual function
578 // being overridden:
579 if(obj_base && obj_base->is_derived_())
580 {
581 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
582 if(obj) // This can be NULL during destruction.
583 {
584 #ifdef GLIBMM_EXCEPTIONS_ENABLED
585 try // Trap C++ exceptions which would normally be lost because this is a C callback.
586 {
587 #endif //GLIBMM_EXCEPTIONS_ENABLED
588 // Call the virtual member method, which derived classes might override.
589 obj->render_vfunc(buf);
590 return;
591 #ifdef GLIBMM_EXCEPTIONS_ENABLED
592 }
593 catch(...)
594 {
595 Glib::exception_handlers_invoke();
596 }
597 #endif //GLIBMM_EXCEPTIONS_ENABLED
598 }
599 }
600
601 BaseClassType *const base = static_cast<BaseClassType*>(
602 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
603 );
604
605 // Call the original underlying C function:
606 if(base && base->render)
607 (*base->render)(self, buf);
608
609 }
point_vfunc_callback(GnomeCanvasItem * self,double x,double y,int cx,int cy,GnomeCanvasItem ** actual_item)610 double Item_Class::point_vfunc_callback(GnomeCanvasItem* self, double x, double y, int cx, int cy, GnomeCanvasItem** actual_item)
611 {
612 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
613 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
614
615 // Non-gtkmmproc-generated custom classes implicitly call the default
616 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
617 // generated classes can use this optimisation, which avoids the unnecessary
618 // parameter conversions if there is no possibility of the virtual function
619 // being overridden:
620 if(obj_base && obj_base->is_derived_())
621 {
622 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
623 if(obj) // This can be NULL during destruction.
624 {
625 #ifdef GLIBMM_EXCEPTIONS_ENABLED
626 try // Trap C++ exceptions which would normally be lost because this is a C callback.
627 {
628 #endif //GLIBMM_EXCEPTIONS_ENABLED
629 // Call the virtual member method, which derived classes might override.
630 return obj->point_vfunc(x, y, cx, cy, actual_item);
631 #ifdef GLIBMM_EXCEPTIONS_ENABLED
632 }
633 catch(...)
634 {
635 Glib::exception_handlers_invoke();
636 }
637 #endif //GLIBMM_EXCEPTIONS_ENABLED
638 }
639 }
640
641 BaseClassType *const base = static_cast<BaseClassType*>(
642 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
643 );
644
645 // Call the original underlying C function:
646 if(base && base->point)
647 return (*base->point)(self, x, y, cx, cy, actual_item);
648
649
650 typedef double RType;
651 return RType();
652 }
bounds_vfunc_callback(GnomeCanvasItem * self,double * x1,double * y1,double * x2,double * y2)653 void Item_Class::bounds_vfunc_callback(GnomeCanvasItem* self, double* x1, double* y1, double* x2, double* y2)
654 {
655 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
656 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
657
658 // Non-gtkmmproc-generated custom classes implicitly call the default
659 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
660 // generated classes can use this optimisation, which avoids the unnecessary
661 // parameter conversions if there is no possibility of the virtual function
662 // being overridden:
663 if(obj_base && obj_base->is_derived_())
664 {
665 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
666 if(obj) // This can be NULL during destruction.
667 {
668 #ifdef GLIBMM_EXCEPTIONS_ENABLED
669 try // Trap C++ exceptions which would normally be lost because this is a C callback.
670 {
671 #endif //GLIBMM_EXCEPTIONS_ENABLED
672 // Call the virtual member method, which derived classes might override.
673 obj->bounds_vfunc(x1, y1, x2, y2);
674 return;
675 #ifdef GLIBMM_EXCEPTIONS_ENABLED
676 }
677 catch(...)
678 {
679 Glib::exception_handlers_invoke();
680 }
681 #endif //GLIBMM_EXCEPTIONS_ENABLED
682 }
683 }
684
685 BaseClassType *const base = static_cast<BaseClassType*>(
686 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
687 );
688
689 // Call the original underlying C function:
690 if(base && base->bounds)
691 (*base->bounds)(self, x1, y1, x2, y2);
692
693 }
694 #endif //GLIBMM_VFUNCS_ENABLED
695
696 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
event_callback(GnomeCanvasItem * self,GdkEvent * p0)697 gboolean Item_Class::event_callback(GnomeCanvasItem* self, GdkEvent* p0)
698 {
699 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
700 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
701
702 // Non-gtkmmproc-generated custom classes implicitly call the default
703 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
704 // generated classes can use this optimisation, which avoids the unnecessary
705 // parameter conversions if there is no possibility of the virtual function
706 // being overridden:
707 if(obj_base && obj_base->is_derived_())
708 {
709 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
710 if(obj) // This can be NULL during destruction.
711 {
712 #ifdef GLIBMM_EXCEPTIONS_ENABLED
713 try // Trap C++ exceptions which would normally be lost because this is a C callback.
714 {
715 #endif //GLIBMM_EXCEPTIONS_ENABLED
716 // Call the virtual member method, which derived classes might override.
717 return static_cast<int>(obj->on_event(p0));
718 #ifdef GLIBMM_EXCEPTIONS_ENABLED
719 }
720 catch(...)
721 {
722 Glib::exception_handlers_invoke();
723 }
724 #endif //GLIBMM_EXCEPTIONS_ENABLED
725 }
726 }
727
728 BaseClassType *const base = static_cast<BaseClassType*>(
729 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
730 );
731
732 // Call the original underlying C function:
733 if(base && base->event)
734 return (*base->event)(self, p0);
735
736 typedef gboolean RType;
737 return RType();
738 }
739 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
740
741
wrap_new(GObject * o)742 Glib::ObjectBase* Item_Class::wrap_new(GObject* o)
743 {
744 return manage(new Item((GnomeCanvasItem*)(o)));
745
746 }
747
748
749 /* The implementation: */
750
Item(const Glib::ConstructParams & construct_params)751 Item::Item(const Glib::ConstructParams& construct_params)
752 :
753 Gtk::Object(construct_params)
754 {
755 }
756
Item(GnomeCanvasItem * castitem)757 Item::Item(GnomeCanvasItem* castitem)
758 :
759 Gtk::Object((GtkObject*)(castitem))
760 {
761 }
762
~Item()763 Item::~Item()
764 {
765 destroy_();
766 }
767
768 Item::CppClassType Item::item_class_; // initialize static member
769
get_type()770 GType Item::get_type()
771 {
772 return item_class_.init().get_type();
773 }
774
get_base_type()775 GType Item::get_base_type()
776 {
777 return gnome_canvas_item_get_type();
778 }
779
780
move(double dx,double dy)781 void Item::move(double dx, double dy)
782 {
783 gnome_canvas_item_move(gobj(), dx, dy);
784 }
785
raise(int positions)786 void Item::raise(int positions)
787 {
788 gnome_canvas_item_raise(gobj(), positions);
789 }
790
lower(int positions)791 void Item::lower(int positions)
792 {
793 gnome_canvas_item_lower(gobj(), positions);
794 }
795
raise_to_top()796 void Item::raise_to_top()
797 {
798 gnome_canvas_item_raise_to_top(gobj());
799 }
800
lower_to_bottom()801 void Item::lower_to_bottom()
802 {
803 gnome_canvas_item_lower_to_bottom(gobj());
804 }
805
ungrab(guint32 etime)806 void Item::ungrab(guint32 etime)
807 {
808 gnome_canvas_item_ungrab(gobj(), etime);
809 }
810
w2i(double & x,double & y)811 void Item::w2i(double& x, double& y)
812 {
813 gnome_canvas_item_w2i(gobj(), &(x), &(y));
814 }
815
i2w(double & x,double & y)816 void Item::i2w(double& x, double& y)
817 {
818 gnome_canvas_item_i2w(gobj(), &(x), &(y));
819 }
820
grab_focus()821 void Item::grab_focus()
822 {
823 gnome_canvas_item_grab_focus(gobj());
824 }
825
get_bounds(double & x1,double & y1,double & x2,double & y2) const826 void Item::get_bounds(double& x1, double& y1, double& x2, double& y2) const
827 {
828 gnome_canvas_item_get_bounds(const_cast<GnomeCanvasItem*>(gobj()), &(x1), &(y1), &(x2), &(y2));
829 }
830
show()831 void Item::show()
832 {
833 gnome_canvas_item_show(gobj());
834 }
835
hide()836 void Item::hide()
837 {
838 gnome_canvas_item_hide(gobj());
839 }
840
reparent(Group & new_group)841 void Item::reparent(Group& new_group)
842 {
843 gnome_canvas_item_reparent(gobj(), (new_group).gobj());
844 }
845
get_canvas() const846 Canvas* Item::get_canvas() const
847 {
848 return Glib::wrap(gobj()->canvas);
849 }
850
request_update()851 void Item::request_update()
852 {
853 gnome_canvas_item_request_update(gobj());
854 }
855
reset_bounds()856 void Item::reset_bounds()
857 {
858 gnome_canvas_item_reset_bounds(gobj());
859 }
860
update_svp(ArtSVP ** p_svp,ArtSVP * new_svp)861 void Item::update_svp(ArtSVP ** p_svp, ArtSVP * new_svp)
862 {
863 gnome_canvas_item_update_svp(gobj(), p_svp, new_svp);
864 }
865
update_svp_clip(ArtSVP ** p_svp,ArtSVP * new_svp,ArtSVP * clip_svp)866 void Item::update_svp_clip(ArtSVP ** p_svp, ArtSVP * new_svp, ArtSVP * clip_svp)
867 {
868 gnome_canvas_item_update_svp_clip(gobj(), p_svp, new_svp, clip_svp);
869 }
870
request_redraw_svp(const ArtSVP * svp)871 void Item::request_redraw_svp(const ArtSVP* svp)
872 {
873 gnome_canvas_item_request_redraw_svp(gobj(), svp);
874 }
875
update_bbox(int x1,int y1,int x2,int y2)876 void Item::update_bbox(int x1, int y1, int x2, int y2)
877 {
878 gnome_canvas_update_bbox(gobj(), x1, y1, x2, y2);
879 }
880
881
signal_event()882 Glib::SignalProxy1< bool,GdkEvent* > Item::signal_event()
883 {
884 return Glib::SignalProxy1< bool,GdkEvent* >(this, &Item_signal_event_info);
885 }
886
887
888 #ifdef GLIBMM_PROPERTIES_ENABLED
property_parent()889 Glib::PropertyProxy<Group*> Item::property_parent()
890 {
891 return Glib::PropertyProxy<Group*>(this, "parent");
892 }
893 #endif //GLIBMM_PROPERTIES_ENABLED
894
895 #ifdef GLIBMM_PROPERTIES_ENABLED
property_parent() const896 Glib::PropertyProxy_ReadOnly<Group*> Item::property_parent() const
897 {
898 return Glib::PropertyProxy_ReadOnly<Group*>(this, "parent");
899 }
900 #endif //GLIBMM_PROPERTIES_ENABLED
901
902
903 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
on_event(GdkEvent * p1)904 bool Gnome::Canvas::Item::on_event(GdkEvent* p1)
905 {
906 BaseClassType *const base = static_cast<BaseClassType*>(
907 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
908 );
909
910 if(base && base->event)
911 return (*base->event)(gobj(),p1);
912
913 typedef bool RType;
914 return RType();
915 }
916 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
917
918 #ifdef GLIBMM_VFUNCS_ENABLED
update_vfunc(double * affine,ArtSVP * clip_path,int flags)919 void Gnome::Canvas::Item::update_vfunc(double* affine, ArtSVP* clip_path, int flags)
920 {
921 BaseClassType *const base = static_cast<BaseClassType*>(
922 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
923 );
924
925 if(base && base->update)
926 (*base->update)(gobj(),affine,clip_path,flags);
927 }
realize_vfunc()928 void Gnome::Canvas::Item::realize_vfunc()
929 {
930 BaseClassType *const base = static_cast<BaseClassType*>(
931 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
932 );
933
934 if(base && base->realize)
935 (*base->realize)(gobj());
936 }
unrealize_vfunc()937 void Gnome::Canvas::Item::unrealize_vfunc()
938 {
939 BaseClassType *const base = static_cast<BaseClassType*>(
940 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
941 );
942
943 if(base && base->unrealize)
944 (*base->unrealize)(gobj());
945 }
map_vfunc()946 void Gnome::Canvas::Item::map_vfunc()
947 {
948 BaseClassType *const base = static_cast<BaseClassType*>(
949 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
950 );
951
952 if(base && base->map)
953 (*base->map)(gobj());
954 }
unmap_vfunc()955 void Gnome::Canvas::Item::unmap_vfunc()
956 {
957 BaseClassType *const base = static_cast<BaseClassType*>(
958 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
959 );
960
961 if(base && base->unmap)
962 (*base->unmap)(gobj());
963 }
coverage_vfunc()964 ArtUta* Gnome::Canvas::Item::coverage_vfunc()
965 {
966 BaseClassType *const base = static_cast<BaseClassType*>(
967 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
968 );
969
970 if(base && base->coverage)
971 return (*base->coverage)(gobj());
972
973 typedef ArtUta* RType;
974 return RType();
975 }
draw_vfunc(const Glib::RefPtr<Gdk::Drawable> & drawable,int x,int y,int width,int height)976 void Gnome::Canvas::Item::draw_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable, int x, int y, int width, int height)
977 {
978 BaseClassType *const base = static_cast<BaseClassType*>(
979 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
980 );
981
982 if(base && base->draw)
983 (*base->draw)(gobj(),Glib::unwrap(drawable),x,y,width,height);
984 }
render_vfunc(GnomeCanvasBuf * buf)985 void Gnome::Canvas::Item::render_vfunc(GnomeCanvasBuf* buf)
986 {
987 BaseClassType *const base = static_cast<BaseClassType*>(
988 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
989 );
990
991 if(base && base->render)
992 (*base->render)(gobj(),buf);
993 }
point_vfunc(double x,double y,int cx,int cy,GnomeCanvasItem ** actual_item)994 double Gnome::Canvas::Item::point_vfunc(double x, double y, int cx, int cy, GnomeCanvasItem** actual_item)
995 {
996 BaseClassType *const base = static_cast<BaseClassType*>(
997 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
998 );
999
1000 if(base && base->point)
1001 return (*base->point)(gobj(),x,y,cx,cy,actual_item);
1002
1003 typedef double RType;
1004 return RType();
1005 }
bounds_vfunc(double * x1,double * y1,double * x2,double * y2)1006 void Gnome::Canvas::Item::bounds_vfunc(double* x1, double* y1, double* x2, double* y2)
1007 {
1008 BaseClassType *const base = static_cast<BaseClassType*>(
1009 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1010 );
1011
1012 if(base && base->bounds)
1013 (*base->bounds)(gobj(),x1,y1,x2,y2);
1014 }
1015 #endif //GLIBMM_VFUNCS_ENABLED
1016
1017
1018 } // namespace Canvas
1019
1020 } // namespace Gnome
1021
1022
1023