File: vdkb_custombutton.cc

package info (click to toggle)
vdkbuilder2 2.4.0-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 5,680 kB
  • ctags: 4,989
  • sloc: cpp: 40,647; sh: 10,346; ansic: 2,718; makefile: 710; sed: 93
file content (806 lines) | stat: -rw-r--r-- 22,807 bytes parent folder | download | duplicates (3)
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
/*
 * ===========================
 * VDK Builder
 * Version 0.1.1
 * Revision 0.0
 * March 1999
 * ===========================
 *
 * 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-130
 */ 
#if HAVE_CONFIG_H
#include <config.h>
#endif

#if !HAVE_GNOME
  #if ENABLE_NLS
    #include <libintl.h>
//#define _(str) gettext(str)
#define _(str) \
    ( g_utf8_validate(gettext(str),-1,NULL) ? \
    gettext(str) : \
    g_locale_to_utf8(gettext(str),-1,NULL,NULL,NULL) )
#define N_(str) str
  #else
    #define _(str) str
    #define N_(str) str 
  #endif
#else
 #include <gnome.h>
#endif

#include <vdkb2/vdkb_custombutton.h>
#include <vdkb2/vdkb_evbox.h>
#include <vdkb2/vdkb_utils.h>
#include <vdkb2/vdkb_form.h>
#include <vdkb2/vdkb_parser.h>
#include <vdkb2/vdkb_objinspect.h>
#include <stdlib.h>
#include <vdk/FileDialog.h>
#include <vdkb2/vdkb_prjman.h>
#include <vdkb2/vdkxpmbrowser.h>
#include <vdkb2/vdkb_fixed.h>
#include <vdkb2/vdkb_cbuttdlg.h>
#include "./pixmaps/apple.xpm"
#include "./pixmaps/copy.xpm"
#include "./pixmaps/caption.xpm"
#include "./pixmaps/relief.xpm"
extern char* wi_widget_prompts[];
static char *default_xpm[] = {
/* width height num_colors chars_per_pixel */
"    24    22        6            1",
/* colors */
". c #000000",
"# c #828282",
//"a c #c3c3c3",
"a c #none",
"b c #ffff00",
"c c #0000ff",
"d c #ffffff",
/* pixels */
"a......................a",
".ddddddddddddddddddddd#.",
".daaaaaaaaaaaaaaaaaaa##.",
".daaaaaadddddaaaaaaaa##.",
".daaadddaaadddaaaaaaa##.",
".daaaaaaaa.ddd.daaaaa##.",
".daa#aaadd..dd..ddaaa##.",
".daab#aa.d#.#dd.dcaaa##.",
".daab#a..dd..dd.#ddaa##.",
".daabb#..dd..dd..ddda##.",
".daabb#..dd..dd..ddda##.",
".daab#a..d#.#dd.#ddaa##.",
".daab#aa.d..ddd.ddaaa##.",
".daa#aaaad.ddd.ddaaaa##.",
".daaaaaaaa.ddd.daaaaa##.",
".daaaaaaaaaaa..aaaaaa##.",
".daaaaaaaaaa..a.aaaaa##.",
".daaaaaaaaa..aaa.aaaa##.",
".daaaaaaaaaaaaaaaaaaa##.",
".d#####################.",
".######################.",
"a......................a"
};
/*
================================
symbolic constants to templatize
a bit 
================================
*/
// for methods and other stuff
#define CLASS VDKBCustomButton
// put here vdk class name string
#define VDK_CLASS "VDKCustomButton"
// put here vdk class name 
#define VDK_ANCESTOR  VDKCustomButton
// put here here the widget will be named
// (name+counter)
#define VDK_WIDGET "custombutton"

static char buff[256];

// used to autogenerate default
// labelbutton  names and captions

int CLASS::Counter = 0;
/* 
 label button properties names
 */
char* vdkcustombutton_props[] =
{ 
  CAPTION,CAPTIONWRAP,RELIEF,GLYPH,GLYPH_BYDATA,
  PIXMAPPED_INTERNAL,CB_TYPE_INTERNAL,
  CB_POS_INTERNAL,0
};
/*
label button signals names && nicknames
Default response method name will be made by:
On<object name><nickname>.
For instance if object name = <Abutton> and nickname = <Click>
default response method name will be: <OnAbuttonClick>
*/
char* vdkcustombutton_signals[] =
{
SIGNAL_CLICKED,SIGNAL_ENTER,SIGNAL_LEAVE,0
};
char* vdkcustombutton_nicknames[] =
{
NICK_CLICKED,NICK_ENTER,NICK_LEAVE,0
};
//////////////////////////////////////////////////
// dynamic tables
DEFINE_SIGNAL_LIST(CLASS,VDK_ANCESTOR);
DEFINE_EVENT_LIST(CLASS,VDK_ANCESTOR);
//////////////////////////////////////////////////////////////

int
PassMotionNotifyEvent(GtkWidget *w,  
				  GdkEventMotion* event,  
				  void* o) 
{
  printf("\nPassMotionNotifyEvent()");
  fflush(stdout);
  return FALSE;
}
/*
  - constructor
 */
CLASS::CLASS(char* name, 
	     VDKForm* owner,
	     char* pixfile, 
	     char* label, 
	     unsigned int type,
	     GtkPositionType position):
  VDK_ANCESTOR(owner, pixfile , 
	       label, 
	       type, 
	       position),
  VDKBObject(name)
{
  int t;
  // newly constructed widget counter is incremented
  // each time 
  Counter++;
  // assign this to VDKBObject <object> member.
  object = this;
  // add to VDKBObject properties list label button properties
  // names. (Others props are prepended  by VDKBObject constructor)
  for(t=0; vdkcustombutton_props[t]; t++)
    proplist.add(VDKBProperty(vdkcustombutton_props[t]));
  if(label)
    SetPropValue(CAPTION,label);
  if(pixfile)
    SetPropValue(PIXMAPPED_INTERNAL,(char*) "true");
  sprintf(buff,"%u",type);
  SetPropValue(CB_TYPE_INTERNAL,buff);
  sprintf(buff,"%u",position);
  SetPropValue(CB_POS_INTERNAL,buff);
  // add to VDKBObject signal list label button signals
  for(t=0; vdkcustombutton_signals[t]; t++)
    siglist.add(VDKBSignal(vdkcustombutton_signals[t],
			   this,
			   vdkcustombutton_nicknames[t]));
  // makes a pop menu common to all widgets (in vdkb_widpopmenu.cc/h)
  // this pop menu will be popped at righ button press event.
  popmenu = new VDKBWidgetPopMenu(this);
  CONNECT_COMMON_EVENTS;
  gtk_widget_add_events(WrappedWidget(),GDK_POINTER_MOTION_MASK); 
  EventConnect("motion_notify_event",&VDKBObject::OnMouseMove);
}

CLASS::CLASS(char* name, 
	     VDKForm* owner,
	     char** pixdata, 
	     char* label, 
	     unsigned int type,
	     GtkPositionType position):
  VDK_ANCESTOR(owner, (const char**) pixdata , label,  type, position),
  VDKBObject(name)
{
  int t;
  // newly constructed widget counter is incremented
  // each time 
  Counter++;
  // assign this to VDKBObject <object> member.
  object = this;
  // add to VDKBObject properties list label button properties
  // names. (Others props are prepended  by VDKBObject constructor)
  for(t=0; vdkcustombutton_props[t]; t++)
    proplist.add(VDKBProperty(vdkcustombutton_props[t]));
  if(label)
    SetPropValue(CAPTION,label);
  if(pixdata)
    SetPropValue(PIXMAPPED_INTERNAL,(char*) "true");
  sprintf(buff,"%u",type);
  SetPropValue(CB_TYPE_INTERNAL,buff);
  sprintf(buff,"%u",position);
  SetPropValue(CB_POS_INTERNAL,buff);
  // add to VDKBObject signal list label button signals
  for(t=0; vdkcustombutton_signals[t]; t++)
    siglist.add(VDKBSignal(vdkcustombutton_signals[t],
			   this,
			   vdkcustombutton_nicknames[t]));
  // makes a pop menu common to all widgets (in vdkb_widpopmenu.cc/h)
  // this pop menu will be popped at righ button press event.
  popmenu = new VDKBWidgetPopMenu(this);
  CONNECT_COMMON_EVENTS;
  gtk_widget_set_events(WrappedWidget(),GDK_POINTER_MOTION_MASK);
  EventConnect("motion_notify_event",&VDKBObject::OnMouseMove);

}
////////////////////////////////////////////////////////////////
//
//               WRITER TO .FRM FILE
//
///////////////////////////////////////////////////////////////
/*
Writes a .frm format representation of label button widget
This virtual function is called by VDKBForm::WriteBoxesOnFrm()
a recursive algorithm that scans VDKBForm widget tree.
*/
void
CLASS::WriteOnFrm(FILE* fp, VDKBObject* parentobj)
{
  // first of all call ancestor to write common properties
  VDKBObject::WriteOnFrm(fp,parentobj);
  fprintf(fp,"\n\t%s\"%s\";",PROP_CAPTION,(char*) GetProp(CAPTION));
  fprintf(fp,"\n\t%s%s;",PROP_CAPTIONWRAP,(char*) GetProp(CAPTIONWRAP));
  fprintf(fp,"\n\t%s%s;", PROP_RELIEF,(char*) GetProp(RELIEF));
  fprintf(fp,"\n\t%s%s;",PROP_GLYPH,(char*) GetProp(GLYPH));
  fprintf(fp,"\n\t%s%s;", PROP_GLYPH_BYDATA,
	  (char*) GetProp(GLYPH_BYDATA));
  fprintf(fp,"\n\t%s%s;",PROP_PIXMAPPED_INTERNAL,
	  (char*) GetProp(PIXMAPPED_INTERNAL));
  fprintf(fp,"\n\t%s%s;",PROP_CB_TYPE_INTERNAL,
	  (char*) GetProp(CB_TYPE_INTERNAL));
  fprintf(fp,"\n\t%s%s;",PROP_CB_POS_INTERNAL,
	  (char*) GetProp(CB_POS_INTERNAL));
}
//////////////////////////////////////////////////////////////////
//
//               PREPARE GUI WIDGETS
//
//////////////////////////////////////////////////////////////////
/*
This method is called by global MakeWidget() in vdkb_design.cc
MakeWidget() scans a table that maps class id's with each
static MakeWidget() for each class. Class id's are generated
during clicks on widget palette.
 */
int
CLASS::MakeWidget(VDKBGuiForm* owner, GdkEvent* ev)
{
  // autogenerate first suitable button counter
  // to ensure unicity
  CLASS* button;
  int pixmapped;
  unsigned int type;
  GtkPositionType labelpos = GTK_POS_RIGHT;

  VDKBComboButtonDlg *dlg = new VDKBComboButtonDlg(owner,
						   NULL,
						   &pixmapped,
						   &type,
						   &labelpos);
  dlg->Setup();
  dlg->ShowModal();
  // widget name generation failed
  if(!owner->GenerateWidgetName(buff,VDK_WIDGET,&CLASS::Counter))
    // unauthorized operation
    return 2; 
  else
    // actually makes widget
      button = new CLASS(buff,
			 owner,      
			 pixmapped ? default_xpm : (char**) NULL,
			 buff, type, labelpos);
  // add widget to form
  return owner->AddToSelf(button,ev);
}
/*
This is called by a global CreateSource() in vdkb_parser.cc.
CreateSource() scans a table that maps class names with
each static CreateSource() in widget class.
 */
char*
CLASS::CreateSource(char* buffer,VDKBParser& parser)
{
  char* source;
  char obj_name[128];
  char obj_parent[128];
  char arg[64];
  char tmp[256];
  char obj_caption[128];
  char obj_glyph[256];
  char bydata[16];
  unsigned int buttontype, labelpos;
  bool nls_support = parser.CheckNLSSupport();
// gets widget name and parent name
  if(! parser.GetNameAndParent(buffer, obj_name, obj_parent))
     return NULL;
  source = new char[4096];
  if(!parser.GetParam(obj_caption,buffer,PROP_CAPTION))
    strcpy(obj_caption,"none");

  if(parser.GetParam(obj_glyph,buffer, PROP_GLYPH) && 
     strcmp(obj_glyph,NIHIL_PROP))
    ;
  else
    *obj_glyph = '\0';

  if(parser.GetParam(bydata,buffer,PROP_GLYPH_BYDATA) && 
     strcmp(bydata,NIHIL_PROP))
    ;
  else
    strcpy(bydata,"");

  if(parser.GetParam(arg,buffer, PROP_CB_TYPE_INTERNAL) && 
     strcmp(arg,NIHIL_PROP))
    buttontype = atoi(arg);
  else
    buttontype = VDK_CBUTTON_UNTOGGLED | VDK_CBUTTON_NORMAL;

  if(parser.GetParam(arg,buffer, PROP_CB_POS_INTERNAL) && 
     strcmp(arg,NIHIL_PROP))
    labelpos = atoi(arg);
  else
    labelpos = (unsigned int) GTK_POS_RIGHT;

  // some cases...
  if(*obj_glyph)
    {
      if(strcmp(bydata,CHECK_YES))
	{
	  if(nls_support)
	    sprintf(tmp,
	    "\n%s = new %s(this,%s%s%s,_(\"%s\"),%d,(GtkPositionType) %d);",
		    obj_name, VDK_CLASS,"\"",obj_glyph,"\"",
		    obj_caption, buttontype,(GtkPositionType) labelpos);
	  else
	    sprintf(tmp,
	    "\n%s = new %s(this,%s%s%s,\"%s\",%d,(GtkPositionType) %d);",
		    obj_name, VDK_CLASS,"\"",obj_glyph,"\"",
		    obj_caption, buttontype,(GtkPositionType) labelpos);
	}
      else
	{
	  int z = 0;
	  char* local = new char[strlen(obj_glyph)+1], *p = NULL;
	  strcpy(local,obj_glyph);
	  sprintf(buff,"\n#include \"%s\"",local);
	  // refuses to include twice same file
	  VDKString symbol(local);
	  if(parser.decSymbols.find(symbol))
	    {
#if 0
	      printf("\nsymbol:%s already declared", (char*) symbol);
	      fflush(stdout);
#endif
	      strcpy(tmp,"");
	    }
	  else
	    {
	      strcpy(tmp,buff);
	      parser.decSymbols.add(symbol);
	    }

	  p = get_shortfilename(local);
	  // changes . to _
	  if(!p)
	    p = local;
	  for(; p[z];z++)
	    {
	      if((p[z] == '.') || 
		 (p[z] == '-')
		 )
		p[z] = '_';
	    }
	  if(nls_support)
	    sprintf(buff,
	    "\n%s = new %s(this,(const char**) %s,_(\"%s\"),%d,(GtkPositionType) %d);",
		    obj_name, VDK_CLASS, p, obj_caption, buttontype,
		    (GtkPositionType) labelpos);
	  else
	    sprintf(buff,
		    "\n%s = new %s(this,(const char**) %s,\"%s\",%d,(GtkPositionType) %d);",
		    obj_name, VDK_CLASS, p, obj_caption, buttontype,
		    (GtkPositionType) labelpos);
	  strcat(tmp,buff);
	  delete [] local;
	}
      
    }
  else	  
    {
      if(nls_support)
	sprintf(tmp,
	"\n%s = new %s(this,%s%s%s,_(\"%s\"),%d,(GtkPositionType) %d);",
		obj_name,
		VDK_CLASS,
		*obj_glyph ? "\"" : "",
		*obj_glyph ? obj_glyph : "(const char*) NULL",
		*obj_glyph ? "\"" : "",
		obj_caption,
		buttontype,
		(GtkPositionType) labelpos);
      else
	sprintf(tmp,
		"\n%s = new %s(this,%s%s%s,\"%s\",%d,(GtkPositionType) %d);",
		obj_name,
		VDK_CLASS,
		*obj_glyph ? "\"" : "",
		*obj_glyph ? obj_glyph : "(const char*) NULL",
		*obj_glyph ? "\"" : "",
		obj_caption,
		buttontype,
		(GtkPositionType) labelpos);
    }
  strcpy(source,tmp);
  // call ancestor to set common properties
  char* props = VDKBObject::CreateSource(buffer,parser,obj_name);
  if(props)
    {
      strcat(source,props);
      delete[] props;
    }
 /*
    this code is widget specific
  */
  if(
     parser.GetParam(arg,buffer,PROP_CAPTIONWRAP) && 
     strcmp(arg,NIHIL_PROP)
     )
   {
     sprintf(tmp,"\n%s->%s = %s;", obj_name, CAPTIONWRAP, arg);
     strcat(source,tmp);
   }    
  if(
     parser.GetParam(arg,buffer,PROP_RELIEF) && 
     strcmp(arg,NIHIL_PROP))
   {
     sprintf(tmp,"\n%s->%s = (GtkReliefStyle) %s;", obj_name,RELIEF,arg);
     strcat(source,tmp);
   }    
  // get code that adds widget to container
  parser.WriteCodeToPack(obj_parent,obj_name,source,buffer,tmp);
  /*
    visible property must be wrote after adding it to a parent
    container. That's the reason why is written here and not
    in vdkb_object class as should be. Written only if == false
  */
  parser.WriteVisible( obj_name, arg, source,buffer,  tmp);
  return source;
}
/*
Invoked by VDKBGuiForm::MakeGuiObjects() during gui creation
reading .frm file.
MakeGuiObjects() scans .frm file and call a global CreateWidget()
that scans a table that maps class names with
each static CreateWidget() in widget class.
*/
bool
CLASS::CreateWidget(VDKBGuiForm* owner, 
			      char* buffer,VDKBParser& parser)
{
  char obj_name[128];
  char obj_parent[128];
  char obj_caption[256];
  char arg[64];
  char obj_glyph[256];
  char bydata[16];
  unsigned int buttontype;
  GtkPositionType labelpos;
  bool pixmapped;
  CLASS* button;
 // get widget name and parent
  if(! parser.GetNameAndParent(buffer, obj_name, obj_parent))
     return false;
  // get caption,pixmapped,glyph,type
  if(!parser.GetParam(obj_caption,buffer, PROP_CAPTION))
    strcpy(obj_caption,"none");

  if(parser.GetParam(arg,buffer, PROP_PIXMAPPED_INTERNAL) && 
     !strcmp(arg,"true"))
    pixmapped = true;
  else
    pixmapped = false;
  
  if(pixmapped && parser.GetParam(obj_glyph,buffer,PROP_GLYPH) && 
     strcmp(obj_glyph,NIHIL_PROP))
    ;
  else
      strcpy(obj_glyph,"");
  
// get glyph by data
  if(parser.GetParam(bydata,buffer,PROP_GLYPH_BYDATA) && 
     strcmp(bydata,NIHIL_PROP))
    ;
  else
      strcpy(bydata,"");
  if(parser.GetParam(arg,buffer, PROP_CB_TYPE_INTERNAL) && 
     strcmp(arg,NIHIL_PROP))
    buttontype = atoi(arg);
  else
    buttontype = VDK_CBUTTON_UNTOGGLED | VDK_CBUTTON_NORMAL;

  if(parser.GetParam(arg,buffer, PROP_CB_POS_INTERNAL) && 
     strcmp(arg,NIHIL_PROP))
    labelpos = (GtkPositionType) atoi(arg);
  else
    labelpos = GTK_POS_RIGHT;

  VDKObject* p = owner->ChildWithName(obj_parent);
  VDKBEventContainer* container = p ? 
    dynamic_cast<VDKBEventContainer*>(p) : (VDKBEventContainer*) NULL;
  if(container)
    {
      if(*obj_glyph)
	button = new CLASS(obj_name,owner,
			   obj_glyph,
			   obj_caption,
			   buttontype,
			   labelpos);
      else
	button = new CLASS(obj_name,
			   owner,
			   pixmapped ? default_xpm : (char**) NULL,
			   obj_caption,
			   buttontype,
			   labelpos);
      if(parser.GetParam(arg,buffer, PROP_CAPTIONWRAP) && 
	 strcmp(arg,NIHIL_PROP))
	{
	button->CaptionWrap = !strcmp(arg,CHECK_TRUE);
	button->SetPropValue(CAPTIONWRAP,arg);
	}
      if(parser.GetParam(arg,buffer,PROP_RELIEF) && strcmp(arg,NIHIL_PROP))
	{
	  button->Relief = (GtkReliefStyle) atoi(arg);
	  button->SetPropValue(RELIEF,arg);
	}
      if(*obj_glyph)
	button->SetPropValue(GLYPH,obj_glyph);
      // glyph by data
      if(*bydata)
	button->SetPropValue(GLYPH_BYDATA,bydata);
      if(parser.GetParam(arg,buffer,PROP_PIXMAPPED_INTERNAL) && 
	 strcmp(arg,NIHIL_PROP))
	  button->SetPropValue(PIXMAPPED_INTERNAL,arg);
      if(parser.GetParam(arg,buffer,PROP_CB_TYPE_INTERNAL) && 
	 strcmp(arg,NIHIL_PROP))
	  button->SetPropValue(CB_TYPE_INTERNAL,arg);
      if(parser.GetParam(arg,buffer, PROP_CB_POS_INTERNAL) && 
	 strcmp(arg,NIHIL_PROP))
	button->SetPropValue(CB_POS_INTERNAL,arg);
      // pack widget to container
      return owner->PackToSelf(button, container, buffer, parser);
    }
  else
    return false;
}
/////////////////////////////////////////////////////
//           OBJECT INSPECTOR MANAGEMENT
////////////////////////////////////////////////////
/*
 */
static char *reliefs[] = 
{ "Normal","Half","None",0 };
/*
 */
VDKObjectContainer* 
CLASS::ExtraWidget(VDKBObjectInspector* isp) 
{ 
  inspector = isp;
  VDKFrame* bframe = new VDKFrame(inspector,NULL,v_box,shadow_etched_in);
  // FIX ME: lang support
  VDKTable* table = new VDKTable(inspector,3,2,true);
  VDKBox* box1 = new VDKBox(inspector,h_box);
  VDKCustomButton* button = new VDKCustomButton(inspector,(const char**) caption_xpm,NULL);
  button->SetTip(_(wi_widget_prompts[0]));
  button->Relief = (GtkReliefStyle) 2;
  box1->Add(button,l_justify,false,false,0);
  button->Parent(this);
  SignalConnect(button,"clicked",&CLASS::OnSetCaption);

  caption = new VDKEntry(inspector,0,(char*) GetProp(CAPTION));
  caption->SetSize(80,-1);
  box1->Add(caption,l_justify,false,false,0);
  caption->Parent(this);
  SignalConnect(caption,"activate",&CLASS::OnSetCaption);

  table->AddToCell(box1,0,0);

  wrap = new VDKCheckButton(inspector,_(wi_widget_prompts[1]));
  wrap->Parent(this);
  SignalConnect(wrap,"toggled",&CLASS::OnSetCaptionWrap);
  table->AddToCell(wrap,0,1);



  VDKBox* box2 = new VDKBox(inspector,h_box);
  button = new VDKCustomButton(inspector,(const char**) relief_xpm,NULL);
  button->SetTip(_(wi_widget_prompts[6]));
  button->Relief = (GtkReliefStyle) 2;
  box2->Add(button,l_justify,false,false,0);
  button->Parent(this);
  SignalConnect(button,"clicked",&CLASS::OnSetRelief);

  int r = atoi(GetProp(RELIEF));
  relief = new VDKCombo(inspector,NULL);
  relief->SetSize(80,-1);
  StringList sl;
  int t = 0;
  for(;reliefs[t];t++)
    sl.add(VDKString(reliefs[t]));
  relief->PopdownStrings = sl;
  relief->SelectItem(r);
  box2->Add(relief,l_justify,false,false,0);
  table->AddToCell(box2,1,0);

  // does not show glyph controls if the button isn't pixmapped
  bool isEnabled = !strcmp(GetProp(PIXMAPPED_INTERNAL),"true");
  if(isEnabled)
    {
      VDKBox* bbox = new VDKBox(inspector,h_box);

      button = new VDKCustomButton(inspector,(const char**) apple_xpm, NULL);
      button->SetTip(_(wi_widget_prompts[7]));
      button->Relief = (GtkReliefStyle) 2;
      bbox->Add(button,l_justify,false,false,0);
      button->Parent(this);
      SignalConnect(button,"clicked",&CLASS::OnSetGlyph);

      VDKString s = GetProp(GLYPH);
      shortname = new VDKCustomButton(inspector,(const char**) copy_xpm,NULL);
      shortname->Relief = (GtkReliefStyle) 2;
      shortname->SetTip(_(wi_widget_prompts[9]));
      shortname->Enabled = strcmp((char*) s,NIHIL_PROP);
      bbox->Add(shortname,l_justify,false,false,0);
      shortname->Parent(this);
      SignalConnect(shortname,"clicked",&CLASS::OnSetShortName);
      table->AddToCell(bbox,2,0);


      pixfile = new VDKEntry(inspector,0, !strcmp((char*) s,NIHIL_PROP) ? NULL : (char*) s);
      table->AddToCell(pixfile,2,1);
      pixfile->SetSize(80,-1);
      pixfile->Editable = false;

      s = GetProp(GLYPH_BYDATA);
      bydata = new VDKCheckButton(inspector,_(wi_widget_prompts[58]));
      bydata->SetTip(_(wi_widget_prompts[59]));
      table->AddToCell(bydata,1,1);
      bydata->Checked = !strcmp((char*) s, CHECK_YES);
      bydata->Parent(this);
      SignalConnect(bydata,"toggled",&CLASS::OnToggleBydata);

    }
  bframe->Add(table,l_justify,false,false,false);
  return bframe; 
}
//////////////////////////////////////////////////////
// These response methods actually change both 
// properties on widget and gui widget properties
//////////////////////////////////////////////////////

/*
 */
bool
CLASS::OnToggleBydata(VDKObject*)
{
  SetPropValue(GLYPH_BYDATA, bydata->Checked ? CHECK_YES : CHECK_NO);
  inspector->FormNeedToBeChanged();
  return true;
}

/*
 */
bool
CLASS::OnSetCaptionWrap(VDKObject*)
{
  SetPropValue(CAPTIONWRAP, wrap->Checked ? CHECK_TRUE : CHECK_FALSE);
  CaptionWrap = wrap->Checked ? true : false;
  inspector->FormNeedToBeChanged();
  return true;
}
/*
 */
bool
CLASS::OnSetRelief(VDKObject*)
{
  int sel = relief->Selected;
  sprintf(buff,"%d", sel >= 0 ? sel : 0);
  int relief = atoi(buff);
  SetPropValue(RELIEF,buff);
  Relief = (GtkReliefStyle) relief;
  inspector->FormNeedToBeChanged();
  return true;
}
/*
 */
bool
CLASS::OnSetCaption(VDKObject*)
{
  if(strlen(caption->Text)>0)
    {
      sprintf(buff,"%s",(char*) caption->Text);
      SetPropValue(CAPTION,buff);
      Caption = caption->Text;
      inspector->FormNeedToBeChanged();
    }
  return true;
}

/*
 */
bool
CLASS::OnSetGlyph(VDKObject* sender)
{
  FileStringArray selections;
  VDKXpmBrowser *child = new VDKXpmBrowser(Owner(),&selections,
					   _(file_dialog_prompts[0]));
  
  child->ShowModal();
  if(selections.size() > 0)
    {
      VDKImage* pixmap = Pixmap;
      pixmap->SetImage((char*) selections[0]);
      pixfile->Text = (char*) selections[0];
      SetPropValue(GLYPH,(char*) selections[0]);
      SetPropValue(PIXMAPPED_INTERNAL,"true");
      inspector->FormNeedToBeChanged();
      shortname->Enabled = true;
    }
  return true;
}
/*
 */
bool
CLASS::OnSetShortName(VDKObject*)
{
  VDKString s = GetProp(GLYPH);
  VDKString path;
  VDKBProject* project;
  VDKBProjectManager* prjman;
  if(!inspector)
    return true;
  prjman =  dynamic_cast<VDKBProjectManager*>(inspector->Owner());
  if(!prjman)
    return true;
  project = prjman->Project();
  if(!project)
    return true;
  path = project->Path;
  sprintf(buff,"cp %s %s/",(char*) s, (char*) path);
  system(buff);
  char* p = get_shortfilename((char*) s);
  if(p)
    {
      VDKString short_name = p;
      pixfile->Text = (char*) short_name;
      SetPropValue(GLYPH,(char*) short_name);
      inspector->FormNeedToBeChanged();
    }
  return true;
}