]> git.saurik.com Git - wxWidgets.git/blob - src/generic/propform.cpp
Fixed wxFileDialog and VC++ DLL compilation
[wxWidgets.git] / src / generic / propform.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: propform.cpp
3 // Purpose: Property form classes
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "propform.h"
14 #endif
15
16 // For compilers that support precompilation, includes "wx/wx.h".
17 #include "wx/wxprec.h"
18
19 #ifdef __BORLANDC__
20 #pragma hdrstop
21 #endif
22
23 #ifndef WX_PRECOMP
24 #include "wx/wx.h"
25 #endif
26
27 #include <ctype.h>
28 #include <stdlib.h>
29 #include <math.h>
30 #include <string.h>
31
32 #if wxUSE_IOSTREAMH
33 #if defined(__WXMSW__) && !defined(__GNUWIN32__)
34 #include <strstrea.h>
35 #else
36 #include <strstream.h>
37 #endif
38 #else
39 #include <strstream>
40 #endif
41
42 #include "wx/window.h"
43 #include "wx/utils.h"
44 #include "wx/list.h"
45 #include "wx/propform.h"
46
47 /*
48 * Property view
49 */
50
51 IMPLEMENT_DYNAMIC_CLASS(wxPropertyFormView, wxPropertyView)
52
53 BEGIN_EVENT_TABLE(wxPropertyFormView, wxPropertyView)
54 EVT_BUTTON(wxID_OK, wxPropertyFormView::OnOk)
55 EVT_BUTTON(wxID_CANCEL, wxPropertyFormView::OnCancel)
56 EVT_BUTTON(wxID_HELP, wxPropertyFormView::OnHelp)
57 EVT_BUTTON(wxID_PROP_REVERT, wxPropertyFormView::OnRevert)
58 EVT_BUTTON(wxID_PROP_UPDATE, wxPropertyFormView::OnUpdate)
59 END_EVENT_TABLE()
60
61 bool wxPropertyFormView::sm_dialogCancelled = FALSE;
62
63 wxPropertyFormView::wxPropertyFormView(wxWindow *propPanel, long flags):wxPropertyView(flags)
64 {
65 m_propertyWindow = propPanel;
66 m_managedWindow = NULL;
67
68 m_windowCloseButton = NULL;
69 m_windowCancelButton = NULL;
70 m_windowHelpButton = NULL;
71
72 m_detailedEditing = FALSE;
73 }
74
75 wxPropertyFormView::~wxPropertyFormView(void)
76 {
77 }
78
79 void wxPropertyFormView::ShowView(wxPropertySheet *ps, wxWindow *panel)
80 {
81 m_propertySheet = ps;
82
83 AssociatePanel(panel);
84 // CreateControls();
85 // UpdatePropertyList();
86 }
87
88 // Update this view of the viewed object, called e.g. by
89 // the object itself.
90 bool wxPropertyFormView::OnUpdateView(void)
91 {
92 return TRUE;
93 }
94
95 bool wxPropertyFormView::Check(void)
96 {
97 if (!m_propertySheet)
98 return FALSE;
99
100 wxNode *node = m_propertySheet->GetProperties().First();
101 while (node)
102 {
103 wxProperty *prop = (wxProperty *)node->Data();
104 wxPropertyValidator *validator = FindPropertyValidator(prop);
105 if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
106 {
107 wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
108 if (!formValidator->OnCheckValue(prop, this, m_propertyWindow))
109 return FALSE;
110 }
111 node = node->Next();
112 }
113 return TRUE;
114 }
115
116 bool wxPropertyFormView::TransferToPropertySheet(void)
117 {
118 if (!m_propertySheet)
119 return FALSE;
120
121 wxNode *node = m_propertySheet->GetProperties().First();
122 while (node)
123 {
124 wxProperty *prop = (wxProperty *)node->Data();
125 wxPropertyValidator *validator = FindPropertyValidator(prop);
126 if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
127 {
128 wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
129 formValidator->OnRetrieveValue(prop, this, m_propertyWindow);
130 }
131 node = node->Next();
132 }
133 return TRUE;
134 }
135
136 bool wxPropertyFormView::TransferToDialog(void)
137 {
138 if (!m_propertySheet)
139 return FALSE;
140
141 wxNode *node = m_propertySheet->GetProperties().First();
142 while (node)
143 {
144 wxProperty *prop = (wxProperty *)node->Data();
145 wxPropertyValidator *validator = FindPropertyValidator(prop);
146 if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
147 {
148 wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
149 formValidator->OnDisplayValue(prop, this, m_propertyWindow);
150 }
151 node = node->Next();
152 }
153 return TRUE;
154 }
155
156 bool wxPropertyFormView::AssociateNames(void)
157 {
158 if (!m_propertySheet || !m_propertyWindow)
159 return FALSE;
160
161 wxNode *node = m_propertyWindow->GetChildren().First();
162 while (node)
163 {
164 wxWindow *win = (wxWindow *)node->Data();
165 if (win->GetName() != "")
166 {
167 wxProperty *prop = m_propertySheet->GetProperty(win->GetName());
168 if (prop)
169 prop->SetWindow(win);
170 }
171 node = node->Next();
172 }
173 return TRUE;
174 }
175
176
177 bool wxPropertyFormView::OnClose(void)
178 {
179 delete this;
180 return TRUE;
181 }
182
183 void wxPropertyFormView::OnOk(wxCommandEvent& WXUNUSED(event))
184 {
185 // Retrieve the value if any
186 if (!Check())
187 return;
188
189 sm_dialogCancelled = FALSE;
190 TransferToPropertySheet();
191
192 m_managedWindow->Close(TRUE);
193 }
194
195 void wxPropertyFormView::OnCancel(wxCommandEvent& WXUNUSED(event))
196 {
197 sm_dialogCancelled = TRUE;
198
199 m_managedWindow->Close(TRUE);
200 }
201
202 void wxPropertyFormView::OnHelp(wxCommandEvent& WXUNUSED(event))
203 {
204 }
205
206 void wxPropertyFormView::OnUpdate(wxCommandEvent& WXUNUSED(event))
207 {
208 if (Check())
209 TransferToPropertySheet();
210 }
211
212 void wxPropertyFormView::OnRevert(wxCommandEvent& WXUNUSED(event))
213 {
214 TransferToDialog();
215 }
216
217 void wxPropertyFormView::OnCommand(wxWindow& win, wxCommandEvent& event)
218 {
219 if (!m_propertySheet)
220 return;
221
222 if (win.GetName() == "")
223 return;
224
225 if (strcmp(win.GetName(), "ok") == 0)
226 OnOk(event);
227 else if (strcmp(win.GetName(), "cancel") == 0)
228 OnCancel(event);
229 else if (strcmp(win.GetName(), "help") == 0)
230 OnHelp(event);
231 else if (strcmp(win.GetName(), "update") == 0)
232 OnUpdate(event);
233 else if (strcmp(win.GetName(), "revert") == 0)
234 OnRevert(event);
235 else
236 {
237 // Find a validator to route the command to.
238 wxNode *node = m_propertySheet->GetProperties().First();
239 while (node)
240 {
241 wxProperty *prop = (wxProperty *)node->Data();
242 if (prop->GetWindow() && (prop->GetWindow() == &win))
243 {
244 wxPropertyValidator *validator = FindPropertyValidator(prop);
245 if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
246 {
247 wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
248 formValidator->OnCommand(prop, this, m_propertyWindow, event);
249 return;
250 }
251 }
252 node = node->Next();
253 }
254 }
255 }
256
257 void wxPropertyFormView::OnDoubleClick(wxControl *item)
258 {
259 if (!m_propertySheet)
260 return;
261
262 // Find a validator to route the command to.
263 wxNode *node = m_propertySheet->GetProperties().First();
264 while (node)
265 {
266 wxProperty *prop = (wxProperty *)node->Data();
267 if (prop->GetWindow() && ((wxControl *)prop->GetWindow() == item))
268 {
269 wxPropertyValidator *validator = FindPropertyValidator(prop);
270 if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
271 {
272 wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
273 formValidator->OnDoubleClick(prop, this, m_propertyWindow);
274 return;
275 }
276 }
277 node = node->Next();
278 }
279 }
280
281 /*
282 * Property form dialog box
283 */
284
285 IMPLEMENT_CLASS(wxPropertyFormDialog, wxDialog)
286
287 wxPropertyFormDialog::wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title,
288 const wxPoint& pos, const wxSize& size, long style, const wxString& name):
289 wxDialog(parent, -1, title, pos, size, style, name)
290 {
291 m_view = v;
292 m_view->AssociatePanel(this);
293 m_view->SetManagedWindow(this);
294 // SetAutoLayout(TRUE);
295 }
296
297 bool wxPropertyFormDialog::OnClose(void)
298 {
299 if (m_view)
300 {
301 m_view->OnClose();
302 m_view = NULL;
303 return TRUE;
304 }
305 else
306 return FALSE;
307 }
308
309 void wxPropertyFormDialog::OnDefaultAction(wxControl *item)
310 {
311 m_view->OnDoubleClick(item);
312 }
313
314 void wxPropertyFormDialog::OnCommand(wxWindow& win, wxCommandEvent& event)
315 {
316 if ( m_view )
317 m_view->OnCommand(win, event);
318 }
319
320 // Extend event processing to search the view's event table
321 bool wxPropertyFormDialog::ProcessEvent(wxEvent& event)
322 {
323 if ( !m_view || ! m_view->ProcessEvent(event) )
324 return wxEvtHandler::ProcessEvent(event);
325 else
326 return TRUE;
327 }
328
329
330 /*
331 * Property form panel
332 */
333
334 IMPLEMENT_CLASS(wxPropertyFormPanel, wxPanel)
335
336 void wxPropertyFormPanel::OnDefaultAction(wxControl *item)
337 {
338 m_view->OnDoubleClick(item);
339 }
340
341 void wxPropertyFormPanel::OnCommand(wxWindow& win, wxCommandEvent& event)
342 {
343 m_view->OnCommand(win, event);
344 }
345
346 // Extend event processing to search the view's event table
347 bool wxPropertyFormPanel::ProcessEvent(wxEvent& event)
348 {
349 if ( !m_view || ! m_view->ProcessEvent(event) )
350 return wxEvtHandler::ProcessEvent(event);
351 else
352 return TRUE;
353 }
354
355 /*
356 * Property frame
357 */
358
359 IMPLEMENT_CLASS(wxPropertyFormFrame, wxFrame)
360
361 bool wxPropertyFormFrame::OnClose(void)
362 {
363 if (m_view)
364 return m_view->OnClose();
365 else
366 return FALSE;
367 }
368
369 wxPanel *wxPropertyFormFrame::OnCreatePanel(wxFrame *parent, wxPropertyFormView *v)
370 {
371 return new wxPropertyFormPanel(v, parent);
372 }
373
374 bool wxPropertyFormFrame::Initialize(void)
375 {
376 m_propertyPanel = OnCreatePanel(this, m_view);
377 if (m_propertyPanel)
378 {
379 m_view->AssociatePanel(m_propertyPanel);
380 m_view->SetManagedWindow(this);
381 return TRUE;
382 }
383 else
384 return FALSE;
385 }
386
387 /*
388 * Property form specific validator
389 */
390
391 IMPLEMENT_ABSTRACT_CLASS(wxPropertyFormValidator, wxPropertyValidator)
392
393
394 /*
395 * Default validators
396 */
397
398 IMPLEMENT_DYNAMIC_CLASS(wxRealFormValidator, wxPropertyFormValidator)
399
400 ///
401 /// Real number form validator
402 ///
403 bool wxRealFormValidator::OnCheckValue( wxProperty *property, wxPropertyFormView *WXUNUSED(view),
404 wxWindow *parentWindow)
405 {
406 if (m_realMin == 0.0 && m_realMax == 0.0)
407 return TRUE;
408
409 // The item used for viewing the real number: should be a text item.
410 wxWindow *m_propertyWindow = property->GetWindow();
411 if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
412 return FALSE;
413
414 wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
415
416 float val = 0.0;
417 if (!StringToFloat(WXSTRINGCAST value, &val))
418 {
419 char buf[200];
420 sprintf(buf, "Value %s is not a valid real number!", (const char *)value);
421 wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
422 return FALSE;
423 }
424
425 if (val < m_realMin || val > m_realMax)
426 {
427 char buf[200];
428 sprintf(buf, "Value must be a real number between %.2f and %.2f!", m_realMin, m_realMax);
429 wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
430 return FALSE;
431 }
432 return TRUE;
433 }
434
435 bool wxRealFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
436 wxWindow *WXUNUSED(parentWindow) )
437 {
438 // The item used for viewing the real number: should be a text item.
439 wxWindow *m_propertyWindow = property->GetWindow();
440 if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
441 return FALSE;
442
443 wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
444
445 if (value.Length() == 0)
446 return FALSE;
447
448 float f = (float)atof((const char *)value);
449 property->GetValue() = f;
450 return TRUE;
451 }
452
453 bool wxRealFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
454 wxWindow *WXUNUSED(parentWindow) )
455 {
456 // The item used for viewing the real number: should be a text item.
457 wxWindow *m_propertyWindow = property->GetWindow();
458 if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
459 return FALSE;
460
461 wxTextCtrl *textItem = (wxTextCtrl *)m_propertyWindow;
462 textItem->SetValue(FloatToString(property->GetValue().RealValue()));
463 return TRUE;
464 }
465
466 ///
467 /// Integer validator
468 ///
469 IMPLEMENT_DYNAMIC_CLASS(wxIntegerFormValidator, wxPropertyFormValidator)
470
471 bool wxIntegerFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
472 wxWindow *parentWindow)
473 {
474 if (m_integerMin == 0.0 && m_integerMax == 0.0)
475 return TRUE;
476
477 // The item used for viewing the real number: should be a text item or a slider
478 wxWindow *m_propertyWindow = property->GetWindow();
479 if (!m_propertyWindow)
480 return FALSE;
481
482 long val = 0;
483
484 if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
485 {
486 wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
487
488 if (!StringToLong(WXSTRINGCAST value, &val))
489 {
490 char buf[200];
491 sprintf(buf, "Value %s is not a valid integer!", (const char *)value);
492 wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
493 return FALSE;
494 }
495 }
496 else if (m_propertyWindow->IsKindOf(CLASSINFO(wxSlider)))
497 {
498 val = (long)((wxSlider *)m_propertyWindow)->GetValue();
499 }
500 else
501 return FALSE;
502
503 if (val < m_integerMin || val > m_integerMax)
504 {
505 char buf[200];
506 sprintf(buf, "Value must be an integer between %ld and %ld!", m_integerMin, m_integerMax);
507 wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
508 return FALSE;
509 }
510 return TRUE;
511 }
512
513 bool wxIntegerFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
514 wxWindow *WXUNUSED(parentWindow))
515 {
516 // The item used for viewing the real number: should be a text item or a slider
517 wxWindow *m_propertyWindow = property->GetWindow();
518 if (!m_propertyWindow)
519 return FALSE;
520
521 if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
522 {
523 wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
524
525 if (value.Length() == 0)
526 return FALSE;
527
528 long i = atol((const char *)value);
529 property->GetValue() = i;
530 }
531 else if (m_propertyWindow->IsKindOf(CLASSINFO(wxSlider)))
532 {
533 property->GetValue() = (long)((wxSlider *)m_propertyWindow)->GetValue();
534 }
535 else
536 return FALSE;
537
538 return TRUE;
539 }
540
541 bool wxIntegerFormValidator::OnDisplayValue( wxProperty *property, wxPropertyFormView *WXUNUSED(view),
542 wxWindow *WXUNUSED(parentWindow))
543 {
544 // The item used for viewing the real number: should be a text item or a slider
545 wxWindow *m_propertyWindow = property->GetWindow();
546 if (!m_propertyWindow)
547 return FALSE;
548
549 if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
550 {
551 wxTextCtrl *textItem = (wxTextCtrl *)m_propertyWindow;
552 textItem->SetValue(LongToString(property->GetValue().IntegerValue()));
553 }
554 else if (m_propertyWindow->IsKindOf(CLASSINFO(wxSlider)))
555 {
556 ((wxSlider *)m_propertyWindow)->SetValue((int)property->GetValue().IntegerValue());
557 }
558 else
559 return FALSE;
560 return TRUE;
561 }
562
563 ///
564 /// Boolean validator
565 ///
566 IMPLEMENT_DYNAMIC_CLASS(wxBoolFormValidator, wxPropertyFormValidator)
567
568 bool wxBoolFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
569 wxWindow *WXUNUSED(parentWindow))
570 {
571 // The item used for viewing the boolean: should be a checkbox
572 wxWindow *m_propertyWindow = property->GetWindow();
573 if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
574 return FALSE;
575
576 return TRUE;
577 }
578
579 bool wxBoolFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
580 wxWindow *WXUNUSED(parentWindow) )
581 {
582 // The item used for viewing the boolean: should be a checkbox.
583 wxWindow *m_propertyWindow = property->GetWindow();
584 if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
585 return FALSE;
586
587 wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow;
588
589 property->GetValue() = (bool)checkBox->GetValue();
590 return TRUE;
591 }
592
593 bool wxBoolFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
594 wxWindow *WXUNUSED(parentWindow))
595 {
596 // The item used for viewing the boolean: should be a checkbox.
597 wxWindow *m_propertyWindow = property->GetWindow();
598 if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
599 return FALSE;
600
601 wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow;
602 checkBox->SetValue((bool)property->GetValue().BoolValue());
603 return TRUE;
604 }
605
606 ///
607 /// String validator
608 ///
609 IMPLEMENT_DYNAMIC_CLASS(wxStringFormValidator, wxPropertyFormValidator)
610
611 wxStringFormValidator::wxStringFormValidator(wxStringList *list, long flags):
612 wxPropertyFormValidator(flags)
613 {
614 m_strings = list;
615 }
616
617 bool wxStringFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
618 wxWindow *parentWindow )
619 {
620 if (!m_strings)
621 return TRUE;
622
623 // The item used for viewing the string: should be a text item, choice item or listbox.
624 wxWindow *m_propertyWindow = property->GetWindow();
625 if (!m_propertyWindow)
626 return FALSE;
627 if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
628 {
629 wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow;
630 if (!m_strings->Member(text->GetValue()))
631 {
632 wxString s("Value ");
633 s += text->GetValue();
634 s += " is not valid.";
635 wxMessageBox(s, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
636 return FALSE;
637 }
638 }
639 else
640 {
641 // Any other item constrains the string value,
642 // so we don't have to check it.
643 }
644 return TRUE;
645 }
646
647 bool wxStringFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
648 wxWindow *WXUNUSED(parentWindow) )
649 {
650 // The item used for viewing the string: should be a text item, choice item or listbox.
651 wxWindow *m_propertyWindow = property->GetWindow();
652 if (!m_propertyWindow)
653 return FALSE;
654 if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
655 {
656 wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow;
657 property->GetValue() = text->GetValue();
658 }
659 else if (m_propertyWindow->IsKindOf(CLASSINFO(wxListBox)))
660 {
661 wxListBox *lbox = (wxListBox *)m_propertyWindow;
662 if (lbox->GetSelection() > -1)
663 property->GetValue() = lbox->GetStringSelection();
664 }
665 /*
666 else if (m_propertyWindow->IsKindOf(CLASSINFO(wxRadioBox)))
667 {
668 wxRadioBox *rbox = (wxRadioBox *)m_propertyWindow;
669 int n = 0;
670 if ((n = rbox->GetSelection()) > -1)
671 property->GetValue() = rbox->GetString(n);
672 }
673 */
674 else if (m_propertyWindow->IsKindOf(CLASSINFO(wxChoice)))
675 {
676 wxChoice *choice = (wxChoice *)m_propertyWindow;
677 if (choice->GetSelection() > -1)
678 property->GetValue() = choice->GetStringSelection();
679 }
680 else
681 return FALSE;
682 return TRUE;
683 }
684
685 bool wxStringFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
686 wxWindow *WXUNUSED(parentWindow) )
687 {
688 // The item used for viewing the string: should be a text item, choice item or listbox.
689 wxWindow *m_propertyWindow = property->GetWindow();
690 if (!m_propertyWindow)
691 return FALSE;
692 if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
693 {
694 wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow;
695 text->SetValue(property->GetValue().StringValue());
696 }
697 else if (m_propertyWindow->IsKindOf(CLASSINFO(wxListBox)))
698 {
699 wxListBox *lbox = (wxListBox *)m_propertyWindow;
700 if (lbox->Number() == 0 && m_strings)
701 {
702 // Try to initialize the listbox from 'strings'
703 wxNode *node = m_strings->First();
704 while (node)
705 {
706 char *s = (char *)node->Data();
707 lbox->Append(s);
708 node = node->Next();
709 }
710 }
711 lbox->SetStringSelection(property->GetValue().StringValue());
712 }
713 /*
714 else if (m_propertyWindow->IsKindOf(CLASSINFO(wxRadioBox)))
715 {
716 wxRadioBox *rbox = (wxRadioBox *)m_propertyWindow;
717 rbox->SetStringSelection(property->GetValue().StringValue());
718 }
719 */
720 else if (m_propertyWindow->IsKindOf(CLASSINFO(wxChoice)))
721 {
722 wxChoice *choice = (wxChoice *)m_propertyWindow;
723 #ifndef __XVIEW__
724 if (choice->Number() == 0 && m_strings)
725 {
726 // Try to initialize the choice item from 'strings'
727 // XView doesn't allow this kind of thing.
728 wxNode *node = m_strings->First();
729 while (node)
730 {
731 char *s = (char *)node->Data();
732 choice->Append(s);
733 node = node->Next();
734 }
735 }
736 #endif
737 choice->SetStringSelection(property->GetValue().StringValue());
738 }
739 else
740 return FALSE;
741 return TRUE;
742 }
743