File: vdkobj.cc

package info (click to toggle)
vdk2 2.4.0-5.3
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 4,524 kB
  • ctags: 4,975
  • sloc: cpp: 26,950; sh: 10,854; ansic: 9,220; makefile: 603; perl: 113
file content (827 lines) | stat: -rw-r--r-- 18,272 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
/*
 * ===========================
 * VDK Visual Development Kit
 * Version 0.4
 * October 1998
 * Revision on vdk 0.5.3
 * Feb 1999 by mm
 * ===========================
 *
 * Copyright (C) 1998, Mario Motta
 * Developed by Mario Motta <mmotta@guest.net>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 *
 */
#include "vdk/vdkobj.h"
#include "vdk/forms.h"
#include "vdk/evhandle.h"
#include "vdk/evobjhandle.h"
#include "vdk/colors.h"
#include "vdk/tooltips.h"
#include "vdk/vdkfont.h"
#include <config.h>
#include <vdk/widcontain.h>
#include <vdk/vdkcustom.h>
#ifdef VDKDEBUG
int objectC = 0;
int objectD = 0;
extern int objRemoved;
#endif

#define color_nihil VDKRgb(-1,-1,-1)


GtkWidget*
VDKObject::Widget()
{
  return widget ? GTK_WIDGET(widget): (GtkWidget*) NULL;
}
/*
 */
GtkWidget*
VDKObject::ConnectingWidget()
{
  return sigwid ? GTK_WIDGET(sigwid) : widget ? GTK_WIDGET(widget): (GtkWidget*) NULL;
}

GtkWidget*
VDKObject::WrappedWidget()
{
  return ConnectingWidget();
}

/*
 */
VDKObject::VDKObject(VDKForm* owner):
  // sets properties
    NormalBackground("NormalBackGround",this,
		     color_nihil,
		     &VDKObject::SetNormalBackground),
    PrelightBackground("PrelightBackGround",this,
		       color_nihil,
		       &VDKObject::SetPrelightBackground),
    InsensitiveBackground("InsensitiveBackGround",
			  this,
			  color_nihil,
			  &VDKObject::SetInsensitiveBackground),

    ActiveBackground("ActiveBackGround",
		     this,
		     color_nihil,
		     &VDKObject::SetActiveBackground),

    SelectedBackground("SelectedBackGround",
		       this,
		     color_nihil,
		     &VDKObject::SetSelectedBackground),
    Foreground("Foreground",this,
	       color_nihil,
	       &VDKObject::SetNormalForeground),

    Font("Font",this,NULL,&VDKObject::SetFont),
    Usize("Usize",this),
    Enabled("Enabled",this,true,&VDKObject::Enable),
    Cursor("Cursor",this,curDefault,&VDKObject::SetCursor),
    Visible("Visible",this,true,&VDKObject::SetVisible,&VDKObject::GetVisible),
    Tag(0),
    //
    tip(NULL),
    owner(owner),
    widget(NULL),
    sigwid(NULL),
    parent(NULL)
#ifdef USE_SIGCPLUSPLUS
     , OnRawEvent(this)
     , OnButtonEvent(this)
     , OnKeyEvent(this)
     , OnKeyFocusEvent(this)
     , OnPointerFocusEvent(this)
     , OnPointerEvent(this)
     , OnMapEvent(this)
     , OnGeometryEvent(this)
     , OnPaintEvent(this)
#endif     
    {
#ifdef VDKDEBUG
	objectC++;
#endif /* USE_SIGCPLUSPLUS */
    }

/*
 */
VDKObject::VDKObject(VDKForm* owner,GtkWidget* widget):
  // sets properties
    NormalBackground("NormalBackGround",this,
		     color_nihil,
		     &VDKObject::SetNormalBackground),
    PrelightBackground("PrelightBackGround",this,
		       color_nihil,
		       &VDKObject::SetPrelightBackground),
    InsensitiveBackground("InsensitiveBackGround",
			  this,
			  color_nihil,
			  &VDKObject::SetInsensitiveBackground),
    ActiveBackground("ActiveBackGround",
		     this,
		     color_nihil,
		     &VDKObject::SetActiveBackground),
    SelectedBackground("SelectedBackGround",
		       this,
		       color_nihil,
		       &VDKObject::SetSelectedBackground),
    Foreground("Foreground",this,
	       color_nihil,
	       &VDKObject::SetNormalForeground),
    Font("Font",this,NULL,&VDKObject::SetFont),
    Usize("Usize",this),
    Enabled("Enabled",this,true,&VDKObject::Enable),
    Cursor("Cursor",this,curDefault,&VDKObject::SetCursor),
    Visible("Visible",this,true,&VDKObject::SetVisible,&VDKObject::GetVisible),
    Tag(0),
    //
    tip(NULL),
    owner(owner),
    widget(widget),
    sigwid(NULL),
    parent(NULL)
#ifdef USE_SIGCPLUSPLUS
     , OnRawEvent(this)
     , OnButtonEvent(this)
     , OnKeyEvent(this)
     , OnKeyFocusEvent(this)
     , OnPointerFocusEvent(this)
     , OnPointerEvent(this)
     , OnMapEvent(this)
     , OnGeometryEvent(this)
     , OnPaintEvent(this)
#endif /* USE_SIGCPLUSPLUS */
{
#ifdef VDKDEBUG
    objectC++;
#endif
}

/*
 */
void VDKObject::SetCursor(VDKCursorType curType)
{
  GdkCursor *cursor = NULL;
  if( (! widget) || (! widget->window))
    return;
  // restore default cursor
  else if(curType == curDefault)
    gdk_window_set_cursor (widget->window, NULL);
  else
    {
      cursor = gdk_cursor_new ((GdkCursorType) curType);
      gdk_window_set_cursor (widget->window, cursor);
      gdk_cursor_destroy (cursor);
    }
  /* X operations are not synchronous.
     Request is queued by the client
     but not delivered to the server.
     So with this call the change occurs
     immediately
  */
  gdk_flush();
}
/*
  Overridden in some subclasses
 */
void VDKObject::ConnectDefaultEvents()
{

}
/*

 */
void VDKObject::ConnectDefaultSignals()
{
  if(! widget )
    return;
  else if(!(dynamic_cast<VDKObjectContainer*>(this)))
     {
       s_realize.obj = this;
       s_realize.signal = realize_signal;
       GtkWidget* gtkwidget = ConnectingWidget();
       gtk_signal_connect(GTK_OBJECT(gtkwidget),"realize",
			  GTK_SIGNAL_FUNC(VDKObject::VDKSignalPipe),
			  (gpointer) &s_realize);
     }
  /*
  gtk_widget_set_events(widget,GDK_ALL_EVENTS_MASK);
  gtk_widget_set_events(WrappedWidget(),GDK_ALL_EVENTS_MASK);
  */
  //  printf("\nvoid VDKObject::ConnectDefaultSignals()");
  // fflush(stdout);

}
/*
 */
VDKObject::~VDKObject()
{
  /*
    delete items, garbage and raws
  */
  ItemListIterator li(items);
  for(;li;li++)
    delete li.current();

  ItemListIterator lg(garbages);
  for(;lg;lg++)
    delete lg.current();

  RawListIterator lr(raws);
  for(;lr;lr++)
    delete lr.current();

  // deletes signal unit list
  SignalUnitListIterator lu(suList);
  for(;lu;lu++)
    delete lu.current();

  // deletes event unit list
  EventUnitListIterator le(euList);
  for(;le;le++)
    delete le.current();
#ifdef VDKDEBUG
    objectD++;
#endif

}

/*
 */
void
VDKObject::SetVisible(bool visible)
{
  /*
     could be wrong iterate on subwidget tree
     since gtk+ makes the job already
     (who knows ?)
     mm. 5.51999
     ItemListIterator li(items);
     for(;li;li++)
     li.current()->SetVisible(visible);
  */
  ShowWidget(visible);
}

/*
  ==================================
  SIGNAL HANDLING FOR STATIC TABLES
  AND DYNAMIC SIGNAL LISTS
  ==================================
  "the signal is considered treated if and only if a user response
  returned true".
  Signal flow:
  1. to object level and up to his hierarchy if not treated.
  2. to parent level and up to parent hierarchy if not treated.
  if parent has a parent step 2 will be repeated until found
  a parent without parent.
  3. if yet not treated signal is lost.
*/
/*
=======================
handles signal calling
static tables routines
=======================
*/
void
VDKObject::VDKSignalPipe(GtkWidget* w, void* s)
{
  g_return_if_fail(s != NULL);
  VDKObjectSignal* signal =
    reinterpret_cast<VDKObjectSignal*>(s);
  VDKObject* obj = reinterpret_cast<VDKObject*>(signal->obj);
  // visits class level
  if(obj->VDKObjectSignalResponse(w,signal->signal,obj,false))
    return;
  // visit parent level
  VDKObject* parent;
  for(parent = obj->Parent(); parent; parent = parent->Parent())
    if(parent->VDKSignalResponse(w,signal->signal,obj,obj,false))
      break;
}

/*
=======================
handles signal calling
dynamic list  routines
=======================
*/
void
VDKObject::VDKSignalUnitPipe(GtkWidget* w, void* s)
{
  g_return_if_fail(s != NULL);
  VDKObjectSignalUnit* signal =
    reinterpret_cast<VDKObjectSignalUnit*>(s);
  VDKObject* obj = reinterpret_cast<VDKObject*>(signal->obj);
  // visits class level if signal->owner == signal->obj
  // it depends if user call SignalEmit(obj,signal,func)
  // or SignalEmitParent(obj,signal,func)
  if(signal->owner == signal->obj) //SignalEmit()
    {
      if(obj->VDKSignalUnitResponse(w,(char*) signal->signal,obj))
	return;
      VDKForm* f;
      /* if obj is a form, see if has an owner,
	 in this case is a child form so try to disseminate
	 also to his parent form
      */
      if((f = dynamic_cast<VDKForm*>(obj)) )
	{
	  // main application does not have an owner
	  VDKForm* owner = f->Owner();
	  if(owner)
	    {
	      bool result = 
		owner->VDKSignalUnitResponse(w,(char*) signal->signal,obj);
	      if(result)
		return;
	    }
	}
    }
    // else visit parent level  user called SignalEmitParent()
  VDKObject* parent;
  for(parent = obj->Parent(); parent; parent = parent->Parent())
    {
      if(parent->VDKSignalUnitResponse(w,(char*) signal->signal,obj))
	break;
      VDKForm* f;
      /* if parent is a form, see if has an owner,
	 in this case is a child form so try to disseminate
	 also to his parent form
      */
      if((f = dynamic_cast<VDKForm*>(parent)) )
	{
	  // main application does not have an owner
	  VDKForm* owner = f->Owner();
	  if(owner)
	    {
	      bool result = 
		owner->VDKSignalUnitResponse(w,(char*) signal->signal,obj);
	      if(result)
		return;
	    }
	}
    }
}
/*
=======================
handles events calling
static tables routines
=======================
 */
int
VDKObject::VDKEventPipe(GtkWidget* w, GdkEvent* event, void* o)
{
  g_return_val_if_fail(o!= NULL, FALSE);
  VDKObject* obj = reinterpret_cast<VDKObject*>(o);
  if(obj->VDKObjectEventResponse(w,event,o,false))
    return TRUE;
  VDKObject* parent;
  for(parent = obj->Parent(); parent; parent = parent->Parent())
    if(parent->VDKEventResponse(w,event,o,o, false))
      return TRUE;
  return FALSE; //TRUE;
}
/*
=======================
handles events calling
dynamic list  routines
=======================
*/
int
VDKObject::VDKEventUnitPipe(GtkWidget* w, GdkEvent* ev, void* s)
{
  g_return_val_if_fail(s != NULL, TRUE);
  VDKObjectEventUnit* event =
    reinterpret_cast<VDKObjectEventUnit*>(s);
  VDKObject* obj = reinterpret_cast<VDKObject*>(event->obj);
  // visits class level if event->owner == event->obj
  if(event->owner == event->obj)
    {
      if(obj->VDKEventUnitResponse(w,(char*) event->signal, ev, obj))
	return TRUE;
      VDKForm* f;
      /* if obj is a form, see if has an owner,
	 in this case is a child form so try to disseminate
	 also to his parent form
      */
      if((f = dynamic_cast<VDKForm*>(obj)) )
	{
	  // main application form does not have an owner
	  VDKForm* owner = f->Owner();
	  if(owner)
	    {
	      bool result = 
		owner->VDKEventUnitResponse(w,(char*) event->signal,ev,obj);
	      if(result)
		return TRUE;
	    }
	}
    }
    // visit parent level
  VDKObject* parent;
  for(parent = obj->Parent(); parent; parent = parent->Parent())
    {
      if(parent->VDKEventUnitResponse(w,(char*) event->signal,ev, obj))
	return TRUE;
      VDKForm* f;
      /* if parent is a form, see if has an owner,
	 in this case is a child form so try to disseminate
	 also to his parent form
      */
      if((f = dynamic_cast<VDKForm*>(parent)) )
	{
	  // main application form does not have an owner
	  VDKForm* owner = f->Owner();
	  if(owner)
	    {
	      bool result = owner->VDKEventUnitResponse(w,(char*) event->signal,ev,obj);
	      if(result)
		return TRUE;
	    }
	}
    }
  return FALSE;
}
/*
==================
signal emitting
(static tables)
=================
*/
void VDKObject::SignalEmit(int sig)
{
  VDKObjectSignal signal;
  signal.obj = this;
  signal.signal = sig;
  VDKSignalPipe(widget,&signal);
}
/*
==================
signal emitting
(dyna tables)
=================
 */
void VDKObject::SignalEmit(char* sig)
{
  VDKObjectSignalUnit* signal = new VDKObjectSignalUnit(this,this,sig);
  suList.add(signal);
  VDKSignalUnitPipe(widget,signal);
}
/*
==================
signal emitting
to parent level
(dyna lists)
=================
 */
void VDKObject::SignalEmitParent(char* sig)
{
  VDKObjectSignalUnit* signal = new VDKObjectSignalUnit(Parent(),this,sig);
  suList.add(signal);
  VDKSignalUnitPipe(widget,signal);
}
/*
==================
signal emitting
to class or
parent level
(static tables)
=================
private
 */
void VDKObject::SignalEmit(int signal, int level)
{
  VDKObject* obj_parent;
  switch (level)
    {
      // visit class level
    case Class_level:
      if(VDKObjectSignalResponse(widget, signal, this,false))
	return;
      // visit level passing himself as sender
    case Parent_level:
      for(obj_parent = Parent(); obj_parent; obj_parent = obj_parent->Parent())
	if(obj_parent->VDKSignalResponse(widget, signal,
					 this, this, false))
	  break;
    }
}

/*
======================================================================
*/
/*
 */
void
VDKObject::SetFont(VDKFont* font)
{
  if(!widget) return;
  _setFont_(widget,font);
  ItemListIterator li(items);
  for(;li;li++)
	li.current()->SetFont(font);

}
/*
 */
void
VDKObject::_setFont_(GtkWidget* wid, VDKFont* font)
{
  if(GTK_IS_WIDGET(wid) && font)
    {
	
      //      if(!GTK_WIDGET_REALIZED(wid))
      //	{
      	  PangoFontDescription* font_desc = font->AsPangoFontDescription();
      	  g_return_if_fail (font_desc != NULL);
      	  gtk_widget_modify_font (wid,font_desc);
	  
	  // 	}
      /*
      else
	{
	  GtkRcStyle *rc_style;
	  rc_style = gtk_rc_style_new ();
	  rc_style->font_desc = 
	    pango_font_description_copy (font->AsPangoFontDescription());
	  gtk_widget_modify_style (WrappedWidget(), rc_style);
	  gtk_rc_style_unref (rc_style);
	  gtk_widget_size_request (wid, NULL);
	}
	  */
    }
}

/*
 */
void
VDKObject::SetForeground(VDKRgb color, GtkStateType state)
{
  if(!widget) return;
  _setForeground_(widget,color.red,color.green,color.blue, state);
}

/*
 */
void
VDKObject::SetBackground(VDKRgb color, GtkStateType state)
{
  if(!widget) return;
  _setBackground_(widget,color.red,color.green,color.blue, state);
}

/*
read background color property
 */
VDKRgb
VDKObject::GetBackground(GtkStateType state)
{
VDKRgb rgb;
switch(state)
  {
  case GTK_STATE_ACTIVE:
    rgb = ActiveBackground;
    break;
  case GTK_STATE_PRELIGHT:
    rgb = PrelightBackground;
    break;
  case GTK_STATE_SELECTED:
    rgb = SelectedBackground;
    break;
  case GTK_STATE_INSENSITIVE:
    rgb = InsensitiveBackground;
    break;
  default:
    rgb = NormalBackground;
  }
return rgb;
}
/*
read foreground color property
 */
VDKRgb
VDKObject::GetForeground(GtkStateType state)
{
  VDKRgb rgb = Foreground;
  return rgb;
}


void
VDKObject::_setBackground_(GtkWidget* wid,
			   int red,int green, int blue,
			   GtkStateType state)
{
  VDKColor *color = NULL;

  if(!GTK_IS_WIDGET(wid))
    return;
  else
    color = new VDKColor(Owner() ? Owner() : this ,red,green,blue);
  gtk_widget_modify_bg (wid,state,color->Color());
}
/*
 */
void
VDKObject::_setForeground_(GtkWidget* wid,
			   int red,int green, int blue,
			   GtkStateType state)
{
  VDKColor *color = NULL;
  if(!GTK_IS_WIDGET(wid))
    return;
  else
    color = new VDKColor(Owner() ? Owner() : this ,red,green,blue);
  gtk_widget_modify_fg (wid,state,color->Color());
  
}
/*
 */
void
VDKObject::Enable(bool flag)
{
  if(GTK_IS_WIDGET(widget))
     {
       gtk_widget_set_sensitive (widget, flag);
       Enabled(flag);
     }
}
/*
 */
void
VDKObject::SetTip(char* t)
{
  if(tip)
    tip->SetTip(t);
  else
    tip = new VDKTooltip(Owner(), this, t);
}

/*
 */
void
VDKObject::GrabFocus()
{
  if(widget)
    {
      VDKCustom* custom = dynamic_cast<VDKCustom*>(this);
      if(custom)
	gtk_widget_grab_focus(custom->CustomWidget());
      else
	gtk_widget_grab_focus(WrappedWidget());
    }
}
/*
 */
void VDKObject::ShowWidget(bool visible)
{
if(widget && GTK_IS_WIDGET(widget))
  {
    if(visible)
      gtk_widget_show(widget);
    else
      gtk_widget_hide(widget);
  }
}
/*
 */
void
VDKObject::Add(VDKObject*, int, int ,
	       int , int  )
{
g_warning("VDKObject::Add() unuseful call");
}
/*
 */
void VDKObject::AddItem(VDKObject* item)
{
  items.add(item);
}
/*
 */
void VDKObject::RemoveItem(VDKObject* item)
{
  if(items.remove(item))
    {
      if(Owner())
	Owner()->Garbages().add(item);
      else
	Garbages().add(item);
    }
}
/*
recursively removes items
 */
void VDKObject::RemoveItems()
{
  if(items.size() > 0)
    {
      ItemListIterator li(items);
      for(;li;li++)
	{
	  li.current()->RemoveItems();
	  if(Owner())
	    Owner()->Garbages().add(li.current());
	  else
	    Garbages().add(li.current());
	}
#ifdef VDKDEBUG
      objRemoved += items.size();
#endif
      items.flush();
    }
if(Owner())
  Owner()->Garbages().add(this);
else
  Garbages().add(this);
#ifdef VDKDEBUG
  objRemoved ++;
#endif
}

/*
explicitely destroy this
*/

bool VDKObject::Destroy()
{
  VDKObject* parent = NULL;

  for(parent = Parent() ; parent; parent = parent->Parent())
    if( Parent()->Items().remove(this) || Parent()->Garbages().remove(this) )
      break;

  if(parent && widget != NULL && GTK_IS_WIDGET(widget))
    {
#ifdef VDKDEBUG
      printf("\ndestroying widget:%p",Widget());
      fflush(stdout);
#endif      
      gtk_widget_destroy(Widget());
      delete this;
      return true;
    }
  else
    return false;
}

/*
 */
void VDKObject::Draw(GdkRectangle* area)
{
  if(widget)
    gtk_widget_draw(widget,area);
}

/*
 */
void SizeObjectProp::operator = (VDKPoint p)
{
  value = p;
  GtkWidget* wid = object->Widget();
  if(wid)
    gtk_widget_set_size_request(wid,p.X(), p.Y());
}

/*
 */
SizeObjectProp::operator VDKPoint()
{
  GtkWidget* wid = object->Widget();
  return wid ? VDKPoint (wid->allocation.width,
			 wid->allocation.height) : VDKPoint(0,0);
}

#ifdef USE_SIGCPLUSPLUS
// Compiled from here in order to avoid complicated conditionals
// in makefile, will change in near future
#include "sigc_events.cc"
#include "sigc_eventsignals.cc"
#endif /* USE_SIGCPLUSPLUS */