File: wx_pform.cpp

package info (click to toggle)
wxxt 1.67c-6
  • links: PTS
  • area: main
  • in suites: potato
  • size: 9,176 kB
  • ctags: 12,722
  • sloc: cpp: 89,350; sh: 5,110; ansic: 4,510; makefile: 596; lex: 184; yacc: 105
file content (710 lines) | stat: -rw-r--r-- 18,437 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
/*
 * File:	wx_pform.cpp
 * Purpose:	wxPropertyFormView and associated classes
 * Author:	Julian Smart
 * Created:	1995
 * Updated:	
 * Copyright:	(c) 1995, AIAI, University of Edinburgh
 */

#ifdef __GNUG__
#pragma implementation
#endif

// For compilers that support precompilation, includes "wx.h".
#include "wx_prec.h"

#ifdef __BORLANDC__
#pragma hdrstop
#endif

#ifndef WX_PRECOMP
#include "wx.h"
#endif

#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

#if defined(wx_msw) && !defined(GNUWIN32)
#include <strstrea.h>
#else
#include <strstream.h>
#endif

#include "wx_win.h"
#include "wx_utils.h"
#include "wx_list.h"
#include "wx_pform.h"

/*
 * Property view
 */

IMPLEMENT_DYNAMIC_CLASS(wxPropertyFormView, wxPropertyView)

static void wxPropertyViewOkProc(wxButton& but, wxCommandEvent& ev)
{
  wxPanel *panel = (wxPanel *)but.GetParent();
  wxPropertyView *view = (wxPropertyView *)panel->GetClientData();
  view->OnOk();
}

static void wxPropertyViewCancelProc(wxButton& but, wxCommandEvent& ev)
{
  wxPanel *panel = (wxPanel *)but.GetParent();
  wxPropertyView *view = (wxPropertyView *)panel->GetClientData();
  view->OnOk();
}

static void wxPropertyViewHelpProc(wxButton& but, wxCommandEvent& ev)
{
  wxPanel *panel = (wxPanel *)but.GetParent();
  wxPropertyView *view = (wxPropertyView *)panel->GetClientData();
  view->OnHelp();
}

Bool wxPropertyFormView::dialogCancelled = FALSE;

wxPropertyFormView::wxPropertyFormView(wxPanel *propPanel, long flags):wxPropertyView(flags)
{
  propertyWindow = propPanel;
  managedWindow = NULL;

  windowCloseButton = NULL;
  windowCancelButton = NULL;
  windowHelpButton = NULL;

  detailedEditing = FALSE;
}

wxPropertyFormView::~wxPropertyFormView(void)
{
}

void wxPropertyFormView::ShowView(wxPropertySheet *ps, wxPanel *panel)
{
  propertySheet = ps;
  
  AssociatePanel(panel);
//  CreateControls();
//  UpdatePropertyList();
}

// Update this view of the viewed object, called e.g. by
// the object itself.
Bool wxPropertyFormView::OnUpdateView(void)
{
  return TRUE;
}

Bool wxPropertyFormView::Check(void)
{
  if (!propertySheet)
    return FALSE;
    
  wxNode *node = propertySheet->GetProperties().First();
  while (node)
  {
    wxProperty *prop = (wxProperty *)node->Data();
    wxPropertyValidator *validator = FindPropertyValidator(prop);
    if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
    {
      wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
      if (!formValidator->OnCheckValue(prop, this, propertyWindow))
        return FALSE;
    }
    node = node->Next();
  }
  return TRUE;
}

Bool wxPropertyFormView::TransferToPropertySheet(void)
{
  if (!propertySheet)
    return FALSE;
    
  wxNode *node = propertySheet->GetProperties().First();
  while (node)
  {
    wxProperty *prop = (wxProperty *)node->Data();
    wxPropertyValidator *validator = FindPropertyValidator(prop);
    if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
    {
      wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
      formValidator->OnRetrieveValue(prop, this, propertyWindow);
    }
    node = node->Next();
  }
  return TRUE;
}

Bool wxPropertyFormView::TransferToDialog(void)
{
  if (!propertySheet)
    return FALSE;
    
  wxNode *node = propertySheet->GetProperties().First();
  while (node)
  {
    wxProperty *prop = (wxProperty *)node->Data();
    wxPropertyValidator *validator = FindPropertyValidator(prop);
    if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
    {
      wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
      formValidator->OnDisplayValue(prop, this, propertyWindow);
    }
    node = node->Next();
  }
  return TRUE;
}

Bool wxPropertyFormView::AssociateNames(void)
{
  if (!propertySheet || !propertyWindow)
    return FALSE;

  wxNode *node = propertyWindow->GetChildren()->First();
  while (node)
  {
    wxWindow *win = (wxWindow *)node->Data();
    if (win->GetName())
    {
      wxString str(win->GetName());
      wxProperty *prop = propertySheet->GetProperty(str);
      if (prop)
        prop->SetWindow(win);
    }
    node = node->Next();
  }
  return TRUE;
}


Bool wxPropertyFormView::OnClose(void)
{
  delete this;
  return TRUE;
}

void wxPropertyFormView::OnOk(void)
{
  // Retrieve the value if any
  if (!Check())
    return;
  
  dialogCancelled = FALSE;

  managedWindow->Close(TRUE);
}

void wxPropertyFormView::OnCancel(void)
{
  dialogCancelled = TRUE;
  
  managedWindow->Close(TRUE);
}

void wxPropertyFormView::OnHelp(void)
{
}

void wxPropertyFormView::OnUpdate(void)
{
  TransferToPropertySheet();
}

void wxPropertyFormView::OnRevert(void)
{
  TransferToDialog();
}

void wxPropertyFormView::OnCommand(wxWindow& win, wxCommandEvent& event)
{
  if (!propertySheet)
    return;
    
  if (!win.GetName())
    return;
    
  if (strcmp(win.GetName(), "ok") == 0)
    OnOk();
  else if (strcmp(win.GetName(), "cancel") == 0)
    OnCancel();
  else if (strcmp(win.GetName(), "help") == 0)
    OnHelp();
  else if (strcmp(win.GetName(), "update") == 0)
    OnUpdate();
  else if (strcmp(win.GetName(), "revert") == 0)
    OnRevert();
  else
  {
    // Find a validator to route the command to.
    wxNode *node = propertySheet->GetProperties().First();
    while (node)
    {
      wxProperty *prop = (wxProperty *)node->Data();
      if (prop->GetWindow() && (prop->GetWindow() == &win))
      {
        wxPropertyValidator *validator = FindPropertyValidator(prop);
        if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
        {
          wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
          formValidator->OnCommand(prop, this, propertyWindow, event);
          return;
        }
      }
      node = node->Next();
    }
  }
}

void wxPropertyFormView::OnDoubleClick(wxItem *item)
{
  if (!propertySheet)
    return;
    
  // Find a validator to route the command to.
  wxNode *node = propertySheet->GetProperties().First();
  while (node)
  {
    wxProperty *prop = (wxProperty *)node->Data();
    if (prop->GetWindow() && ((wxItem *)prop->GetWindow() == item))
    {
      wxPropertyValidator *validator = FindPropertyValidator(prop);
      if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
      {
        wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
        formValidator->OnDoubleClick(prop, this, propertyWindow);
        return;
      }
    }
    node = node->Next();
  }
}

/*
 * Property form dialog box
 */
 
IMPLEMENT_CLASS(wxPropertyFormDialog, wxDialogBox)

wxPropertyFormDialog::wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *parent, char *title, Bool modal, int x, int y,
    int w, int h, long style, char *name):
     wxDialogBox(parent, title, modal, x, y, w, h, style, name)
{
  view = v;
  view->AssociatePanel(this);
  view->SetManagedWindow(this);
//  SetAutoLayout(TRUE);
}

Bool wxPropertyFormDialog::OnClose(void)
{
  if (view)
    return view->OnClose();
  else
    return FALSE;
}

void wxPropertyFormDialog::OnDefaultAction(wxItem *item)
{
  view->OnDoubleClick(item);
}

void wxPropertyFormDialog::OnCommand(wxWindow& win, wxCommandEvent& event)
{
  view->OnCommand(win, event);
}

/*
 * Property form panel
 */
 
IMPLEMENT_CLASS(wxPropertyFormPanel, wxPanel)

void wxPropertyFormPanel::OnDefaultAction(wxItem *item)
{
  view->OnDoubleClick(item);
}

void wxPropertyFormPanel::OnCommand(wxWindow& win, wxCommandEvent& event)
{
  view->OnCommand(win, event);
}

/*
 * Property frame
 */
 
IMPLEMENT_CLASS(wxPropertyFormFrame, wxFrame)

Bool wxPropertyFormFrame::OnClose(void)
{
  if (view)
    return view->OnClose();
  else
    return FALSE;
}

wxPanel *wxPropertyFormFrame::OnCreatePanel(wxFrame *parent, wxPropertyFormView *v)
{
  return new wxPropertyFormPanel(v, parent);
}

Bool wxPropertyFormFrame::Initialize(void)
{
  propertyPanel = OnCreatePanel(this, view);
  if (propertyPanel)
  {
    view->AssociatePanel(propertyPanel);
    view->SetManagedWindow(this);
//    propertyPanel->SetAutoLayout(TRUE);
    return TRUE;
  }
  else
    return FALSE;
}

 /*
  * Property form specific validator
  */
  
IMPLEMENT_ABSTRACT_CLASS(wxPropertyFormValidator, wxPropertyValidator)


/*
 * Default validators
 */

IMPLEMENT_DYNAMIC_CLASS(wxRealFormValidator, wxPropertyFormValidator)

///
/// Real number form validator
/// 
Bool wxRealFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow)
{
  if (realMin == 0.0 && realMax == 0.0)
    return TRUE;
    
  // The item used for viewing the real number: should be a text item.
  wxWindow *propertyWindow = property->GetWindow();
  if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxText)))
    return FALSE;

  wxString value(((wxText *)propertyWindow)->GetValue());

  float val = 0.0;
  if (!StringToFloat(value.GetData(), &val))
  {
    char buf[200];
    sprintf(buf, "Value %s is not a valid real number!", value.GetData());
    wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
    return FALSE;
  }
  
  if (val < realMin || val > realMax)
  {
    char buf[200];
    sprintf(buf, "Value must be a real number between %.2f and %.2f!", realMin, realMax);
    wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
    return FALSE;
  }
  return TRUE;
}

Bool wxRealFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow)
{
  // The item used for viewing the real number: should be a text item.
  wxWindow *propertyWindow = property->GetWindow();
  if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxText)))
    return FALSE;

  wxString value(((wxText *)propertyWindow)->GetValue());

  if (value.Length() == 0)
    return FALSE;
    
  float f = (float)atof(value.GetData());
  property->GetValue() = f;
  return TRUE;
}

Bool wxRealFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow)
{
  // The item used for viewing the real number: should be a text item.
  wxWindow *propertyWindow = property->GetWindow();
  if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxText)))
    return FALSE;

  wxText *textItem = (wxText *)propertyWindow;
  textItem->SetValue(FloatToString(property->GetValue().RealValue()));
  return TRUE;
}

///
/// Integer validator
/// 
IMPLEMENT_DYNAMIC_CLASS(wxIntegerFormValidator, wxPropertyFormValidator)

Bool wxIntegerFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow)
{
  if (integerMin == 0.0 && integerMax == 0.0)
    return TRUE;
    
  // The item used for viewing the real number: should be a text item or a slider
  wxWindow *propertyWindow = property->GetWindow();
  if (!propertyWindow)
    return FALSE;

  long val = 0;

  if (propertyWindow->IsKindOf(CLASSINFO(wxText)))
  {
    wxString value(((wxText *)propertyWindow)->GetValue());

    if (!StringToLong(value.GetData(), &val))
    {
      char buf[200];
      sprintf(buf, "Value %s is not a valid integer!", value.GetData());
      wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
      return FALSE;
    }
  }
  else if (propertyWindow->IsKindOf(CLASSINFO(wxSlider)))
  {
    val = (long)((wxSlider *)propertyWindow)->GetValue();
  }
  else
    return FALSE;
    
  if (val < integerMin || val > integerMax)
  {
    char buf[200];
    sprintf(buf, "Value must be an integer between %ld and %ld!", integerMin, integerMax);
    wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
    return FALSE;
  }
  return TRUE;
}

Bool wxIntegerFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow)
{
  // The item used for viewing the real number: should be a text item or a slider
  wxWindow *propertyWindow = property->GetWindow();
  if (!propertyWindow)
    return FALSE;

  if (propertyWindow->IsKindOf(CLASSINFO(wxText)))
  {
    wxString value(((wxText *)propertyWindow)->GetValue());

    if (value.Length() == 0)
      return FALSE;
    
    long i = atol(value.GetData());
    property->GetValue() = i;
  }
  else if (propertyWindow->IsKindOf(CLASSINFO(wxSlider)))
  {
    property->GetValue() = (long)((wxSlider *)propertyWindow)->GetValue();
  }
  else
    return FALSE;
    
  return TRUE;
}

Bool wxIntegerFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow)
{
  // The item used for viewing the real number: should be a text item or a slider
  wxWindow *propertyWindow = property->GetWindow();
  if (!propertyWindow)
    return FALSE;

  if (propertyWindow->IsKindOf(CLASSINFO(wxText)))
  {
    wxText *textItem = (wxText *)propertyWindow;
    textItem->SetValue(LongToString(property->GetValue().IntegerValue()));
  }
  else if (propertyWindow->IsKindOf(CLASSINFO(wxSlider)))
  {
    ((wxSlider *)propertyWindow)->SetValue((int)property->GetValue().IntegerValue());
  }
  else
    return FALSE;
  return TRUE;
}

///
/// Boolean validator
/// 
IMPLEMENT_DYNAMIC_CLASS(wxBoolFormValidator, wxPropertyFormValidator)

Bool wxBoolFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow)
{
  // The item used for viewing the boolean: should be a checkbox
  wxWindow *propertyWindow = property->GetWindow();
  if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
    return FALSE;

  return TRUE;
}

Bool wxBoolFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow)
{
  // The item used for viewing the boolean: should be a checkbox.
  wxWindow *propertyWindow = property->GetWindow();
  if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
    return FALSE;

  wxCheckBox *checkBox = (wxCheckBox *)propertyWindow;
  
  property->GetValue() = (Bool)checkBox->GetValue();
  return TRUE;
}

Bool wxBoolFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow)
{
  // The item used for viewing the boolean: should be a checkbox.
  wxWindow *propertyWindow = property->GetWindow();
  if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
    return FALSE;

  wxCheckBox *checkBox = (wxCheckBox *)propertyWindow;
  checkBox->SetValue((Bool)property->GetValue().BoolValue());
  return TRUE;
}

///
/// String validator
/// 
IMPLEMENT_DYNAMIC_CLASS(wxStringFormValidator, wxPropertyFormValidator)

wxStringFormValidator::wxStringFormValidator(wxStringList *list, long flags):
  wxPropertyFormValidator(flags)
{
  strings = list;
}

Bool wxStringFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow)
{
  if (!strings)
    return TRUE;

  // The item used for viewing the string: should be a text item, choice item or listbox.
  wxWindow *propertyWindow = property->GetWindow();
  if (!propertyWindow)
    return FALSE;
  if (propertyWindow->IsKindOf(CLASSINFO(wxText)))
  {
    wxText *text = (wxText *)propertyWindow;
    if (!strings->Member(text->GetValue()))
    {
      wxString s("Value ");
      s += text->GetValue();
      s += " is not valid.";
      wxMessageBox(s.GetData(), "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
      return FALSE;
    }
  }
  else
  {
    // Any other item constrains the string value,
    // so we don't have to check it.
  }
  return TRUE;
}

Bool wxStringFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow)
{
  // The item used for viewing the string: should be a text item, choice item or listbox.
  wxWindow *propertyWindow = property->GetWindow();
  if (!propertyWindow)
    return FALSE;
  if (propertyWindow->IsKindOf(CLASSINFO(wxText)))
  {
    wxText *text = (wxText *)propertyWindow;
    property->GetValue() = text->GetValue();
  }
  else if (propertyWindow->IsKindOf(CLASSINFO(wxListBox)))
  {
    wxListBox *lbox = (wxListBox *)propertyWindow;
    if (lbox->GetSelection() > -1)
      property->GetValue() = lbox->GetStringSelection();
  }
  else if (propertyWindow->IsKindOf(CLASSINFO(wxRadioBox)))
  {
    wxRadioBox *rbox = (wxRadioBox *)propertyWindow;
    int n = 0;
    if ((n = rbox->GetSelection()) > -1)
      property->GetValue() = rbox->GetString(n);
  }
  else if (propertyWindow->IsKindOf(CLASSINFO(wxChoice)))
  {
    wxChoice *choice = (wxChoice *)propertyWindow;
    if (choice->GetSelection() > -1)
      property->GetValue() = choice->GetStringSelection();
  }
  else
    return FALSE;
  return TRUE;
}

Bool wxStringFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow)
{
  // The item used for viewing the string: should be a text item, choice item or listbox.
  wxWindow *propertyWindow = property->GetWindow();
  if (!propertyWindow)
    return FALSE;
  if (propertyWindow->IsKindOf(CLASSINFO(wxText)))
  {
    wxText *text = (wxText *)propertyWindow;
    text->SetValue(property->GetValue().StringValue());
  }
  else if (propertyWindow->IsKindOf(CLASSINFO(wxListBox)))
  {
    wxListBox *lbox = (wxListBox *)propertyWindow;
    if (lbox->Number() == 0 && strings)
    {
      // Try to initialize the listbox from 'strings'
      wxNode *node = strings->First();
      while (node)
      {
        char *s = (char *)node->Data();
        lbox->Append(s);
        node = node->Next();
      }
    }
    lbox->SetStringSelection(property->GetValue().StringValue());
  }
  else if (propertyWindow->IsKindOf(CLASSINFO(wxRadioBox)))
  {
    wxRadioBox *rbox = (wxRadioBox *)propertyWindow;
    rbox->SetStringSelection(property->GetValue().StringValue());
  }
  else if (propertyWindow->IsKindOf(CLASSINFO(wxChoice)))
  {
    wxChoice *choice = (wxChoice *)propertyWindow;
#ifndef wx_xview
    if (choice->Number() == 0 && strings)
    {
      // Try to initialize the choice item from 'strings'
      // XView doesn't allow this kind of thing.
      wxNode *node = strings->First();
      while (node)
      {
        char *s = (char *)node->Data();
        choice->Append(s);
        node = node->Next();
      }
    }
#endif
    choice->SetStringSelection(property->GetValue().StringValue());
  }
  else
    return FALSE;
  return TRUE;
}