1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Window properties
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "winprop.h"
16 // For compilers that support precompilation, includes "wx/wx.h".
17 #include "wx/wxprec.h"
32 #if defined(__WXMSW__) && !defined(__GNUWIN32__)
35 #include <strstream.h>
46 // Causes immediate feedback.
47 void wxResourcePropertyListView::OnPropertyChanged(wxProperty
*property
)
49 // Sets the value of the property back into the actual object,
50 // IF the property value was modified.
51 if (property
->GetValue().GetModified())
53 propertyInfo
->SetProperty(property
->GetName(), property
);
54 property
->GetValue().SetModified(FALSE
);
58 bool wxResourcePropertyListView::OnClose(void)
61 GetManagedWindow()->GetSize(& w
, & h
);
62 GetManagedWindow()->GetPosition(& x
, & y
);
64 wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().width
= w
;
65 wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().height
= h
;
66 wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().x
= x
;
67 wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().y
= y
;
69 return wxPropertyListView::OnClose();
72 wxWindow
*wxPropertyInfo::sm_propertyWindow
;
75 * wxDialogEditorPropertyListDialog
78 wxDialogEditorPropertyListDialog::wxDialogEditorPropertyListDialog(wxPropertyListView
*v
, wxWindow
*parent
, const wxString
& title
,
79 const wxPoint
& pos
, const wxSize
& size
,
80 long style
, const wxString
& name
):
81 wxPropertyListDialog(v
, parent
, title
, pos
, size
, style
, name
)
87 wxDialogEditorPropertyListDialog::~wxDialogEditorPropertyListDialog()
91 wxPropertyInfo::sm_propertyWindow
= NULL
;
98 // Edit the information represented by this object, whatever that
100 bool wxPropertyInfo::Edit(wxWindow
*parent
, const wxString
& title
)
102 if (sm_propertyWindow
)
105 int width
= wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().width
;
106 int height
= wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().height
;
107 int x
= wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().x
;
108 int y
= wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().y
;
110 wxPropertySheet
*propSheet
= new wxPropertySheet
;
112 wxStringList propNames
;
113 GetPropertyNames(propNames
);
115 wxNode
*node
= propNames
.First();
118 wxString
name((char *)node
->Data());
119 wxProperty
*prop
= GetProperty(name
);
122 propSheet
->AddProperty(prop
);
127 // Reset 'modified' flags for all property values
128 propSheet
->SetAllModified(FALSE
);
130 wxResourcePropertyListView
*view
= new wxResourcePropertyListView(this, NULL
,
132 wxPROP_BUTTON_OK
| wxPROP_BUTTON_CANCEL
|
134 wxPROP_BUTTON_CHECK_CROSS
|wxPROP_DYNAMIC_VALUE_FIELD
|wxPROP_PULLDOWN
|wxPROP_SHOWVALUES
);
136 wxDialogEditorPropertyListDialog
*propDialog
= new wxDialogEditorPropertyListDialog(view
,
137 wxResourceManager::GetCurrentResourceManager()->GetEditorFrame(), title
, wxPoint(x
, y
),
138 wxSize(width
, height
), wxDEFAULT_DIALOG_STYLE
);
139 sm_propertyWindow
= propDialog
;
141 propDialog
->m_registry
.RegisterValidator((wxString
)"real", new wxRealListValidator
);
142 propDialog
->m_registry
.RegisterValidator((wxString
)"string", new wxStringListValidator
);
143 propDialog
->m_registry
.RegisterValidator((wxString
)"integer", new wxIntegerListValidator
);
144 propDialog
->m_registry
.RegisterValidator((wxString
)"bool", new wxBoolListValidator
);
145 propDialog
->m_registry
.RegisterValidator((wxString
)"filename", new wxFilenameListValidator
);
146 propDialog
->m_registry
.RegisterValidator((wxString
)"stringlist", new wxListOfStringsListValidator
);
148 propDialog
->m_propInfo
= this;
149 propDialog
->m_propSheet
= propSheet
;
151 // view->propertyWindow = propDialog;
152 view
->AddRegistry(&(propDialog
->m_registry
));
153 view
->ShowView(propSheet
, propDialog
);
155 propDialog
->Show(TRUE
);
160 * wxWindowPropertyInfo
163 wxWindowPropertyInfo::wxWindowPropertyInfo(wxWindow
*win
, wxItemResource
*res
)
165 propertyWindow
= win
;
166 propertyResource
= res
;
169 wxWindowPropertyInfo::~wxWindowPropertyInfo(void)
173 wxProperty
*wxWindowPropertyInfo::GetFontProperty(wxString
& name
, wxFont
*font
)
178 if (name
.Contains("Points"))
179 return new wxProperty(name
, (long)font
->GetPointSize(), "integer", new wxIntegerListValidator(1, 100));
180 else if (name
.Contains("Family"))
181 return new wxProperty(name
, font
->GetFamilyString(), "string",
182 new wxStringListValidator(new wxStringList("wxDECORATIVE", "wxROMAN", "wxSCRIPT", "wxSWISS", "wxMODERN",
184 else if (name
.Contains("Style"))
185 return new wxProperty(name
, font
->GetStyleString(), "string",
186 new wxStringListValidator(new wxStringList("wxNORMAL", "wxITALIC", "wxSLANT", NULL
)));
187 else if (name
.Contains("Weight"))
188 return new wxProperty(name
, font
->GetWeightString(), "string",
189 new wxStringListValidator(new wxStringList("wxNORMAL", "wxBOLD", "wxLIGHT", NULL
)));
190 else if (name
.Contains("Underlined"))
191 return new wxProperty(name
, (bool)font
->GetUnderlined(), "bool");
196 wxFont
*wxWindowPropertyInfo::SetFontProperty(wxString
& name
, wxProperty
*property
, wxFont
*font
)
199 int fontFamily
= wxMODERN
;
200 int fontStyle
= wxNORMAL
;
201 int fontWeight
= wxNORMAL
;
202 bool fontUnderlined
= FALSE
;
204 if (name
.Contains("Points"))
206 pointSize
= (int)property
->GetValue().IntegerValue();
207 if (font
&& (pointSize
== font
->GetPointSize()))
208 return NULL
; // No change
210 else if (font
) pointSize
= font
->GetPointSize();
212 if (name
.Contains("Family"))
214 wxString val
= property
->GetValue().StringValue();
215 fontFamily
= wxStringToFontFamily(val
);
217 if (font
&& (fontFamily
== font
->GetFamily()))
218 return NULL
; // No change
220 else if (font
) fontFamily
= font
->GetFamily();
222 if (name
.Contains("Style"))
224 wxString val
= property
->GetValue().StringValue();
225 fontStyle
= wxStringToFontStyle(val
);
227 if (font
&& (fontStyle
== font
->GetStyle()))
228 return NULL
; // No change
230 else if (font
) fontStyle
= font
->GetStyle();
231 if (name
.Contains("Weight"))
233 wxString val
= property
->GetValue().StringValue();
234 fontWeight
= wxStringToFontWeight(val
);
236 if (font
&& (fontWeight
== font
->GetWeight()))
237 return NULL
; // No change
239 else if (font
) fontWeight
= font
->GetWeight();
241 if (name
.Contains("Underlined"))
243 fontUnderlined
= property
->GetValue().BoolValue();
245 if (font
&& (fontUnderlined
== font
->GetUnderlined()))
246 return NULL
; // No change
248 else if (font
) fontUnderlined
= font
->GetUnderlined();
250 wxFont
*newFont
= wxTheFontList
->FindOrCreateFont(pointSize
, fontFamily
, fontStyle
, fontWeight
, fontUnderlined
);
259 wxProperty
*wxWindowPropertyInfo::GetProperty(wxString
& name
)
261 wxFont
*font
= propertyWindow
->GetFont();
262 if (name
== "fontPoints" || name
== "fontFamily" || name
== "fontStyle" || name
== "fontWeight" ||
263 name
== "fontUnderlined")
264 return GetFontProperty(name
, font
);
265 else if (name
== "name")
266 return new wxProperty("name", propertyWindow
->GetName(), "string");
267 else if (name
== "title")
268 return new wxProperty("title", propertyWindow
->GetTitle(), "string");
269 else if (name
== "x")
272 propertyWindow
->GetPosition(&x
, &y
);
273 return new wxProperty("x", (long)x
, "integer");
275 else if (name
== "y")
278 propertyWindow
->GetPosition(&x
, &y
);
279 return new wxProperty("y", (long)y
, "integer");
281 else if (name
== "width")
284 propertyWindow
->GetSize(&width
, &height
);
285 return new wxProperty("width", (long)width
, "integer");
287 else if (name
== "height")
290 propertyWindow
->GetSize(&width
, &height
);
291 return new wxProperty("height", (long)height
, "integer");
297 bool wxWindowPropertyInfo::SetProperty(wxString
& name
, wxProperty
*property
)
299 wxFont
*font
= propertyWindow
->GetFont();
300 if (font
&& (name
== "fontPoints" || name
== "fontFamily" || name
== "fontStyle" || name
== "fontWeight" || name
== "fontUnderlined" ))
302 wxFont
*newFont
= SetFontProperty(name
, property
, font
);
304 propertyWindow
->SetFont(newFont
);
307 else if (name
== "name")
309 // Remove old name from resource table, if it's there.
310 wxItemResource
*oldResource
= (wxItemResource
*)wxResourceManager::GetCurrentResourceManager()->GetResourceTable().Delete(propertyWindow
->GetName());
313 // It's a top-level resource
314 propertyWindow
->SetName(property
->GetValue().StringValue());
315 oldResource
->SetName(property
->GetValue().StringValue());
316 wxResourceManager::GetCurrentResourceManager()->GetResourceTable().Put(propertyWindow
->GetName(), oldResource
);
320 // It's a child of something; just set the name of the resource and the window.
321 propertyWindow
->SetName(property
->GetValue().StringValue());
322 propertyResource
->SetName(property
->GetValue().StringValue());
324 // Refresh the resource manager list, because the name changed.
325 wxResourceManager::GetCurrentResourceManager()->UpdateResourceList();
328 else if (name
== "title")
330 propertyWindow
->SetTitle(property
->GetValue().StringValue());
333 else if (name
== "x")
336 propertyWindow
->GetPosition(&x
, &y
);
337 int newX
= (int)property
->GetValue().IntegerValue();
339 propertyWindow
->Move(newX
, y
);
342 else if (name
== "y")
345 propertyWindow
->GetPosition(&x
, &y
);
346 int newY
= (int)property
->GetValue().IntegerValue();
348 propertyWindow
->Move(x
, newY
);
351 else if (name
== "width")
354 propertyWindow
->GetSize(&width
, &height
);
355 int newWidth
= (int)property
->GetValue().IntegerValue();
356 if (width
!= newWidth
)
358 propertyWindow
->SetSize(newWidth
, height
);
360 if (propertyWindow->IsKindOf(CLASSINFO(wxPanel)) && !propertyWindow->IsKindOf(CLASSINFO(wxDialog)))
362 propertyWindow->GetParent()->SetClientSize(newWidth, height);
368 else if (name
== "height")
371 propertyWindow
->GetSize(&width
, &height
);
372 int newHeight
= (int)property
->GetValue().IntegerValue();
373 if (height
!= newHeight
)
375 propertyWindow
->SetSize(width
, newHeight
);
377 if (propertyWindow->IsKindOf(CLASSINFO(wxPanel)) && !propertyWindow->IsKindOf(CLASSINFO(wxDialog)))
379 propertyWindow->GetParent()->SetClientSize(width, newHeight);
389 void wxWindowPropertyInfo::GetPropertyNames(wxStringList
& names
)
396 if (!propertyWindow
->IsKindOf(CLASSINFO(wxControl
)))
398 names
.Add("fontPoints");
399 names
.Add("fontFamily");
400 names
.Add("fontStyle");
401 names
.Add("fontWeight");
402 names
.Add("fontUnderlined");
406 // Fill in the wxItemResource members to mirror the current window settings
407 bool wxWindowPropertyInfo::InstantiateResource(wxItemResource
*resource
)
409 resource
->SetType(propertyWindow
->GetClassInfo()->GetClassName());
411 // resource->SetStyle(propertyWindow->GetWindowStyleFlag());
412 wxString
str(propertyWindow
->GetName());
413 resource
->SetName(WXSTRINGCAST str
);
415 propertyWindow
->GetSize(&w
, &h
);
417 propertyWindow
->GetPosition(&x
, &y
);
418 resource
->SetSize(x
, y
, w
, h
);
427 wxProperty
*wxItemPropertyInfo::GetProperty(wxString
& name
)
429 wxControl
*itemWindow
= (wxControl
*)propertyWindow
;
430 wxFont
*font
= itemWindow
->GetFont();
432 if (name
== "fontPoints" || name
== "fontFamily" || name
== "fontStyle" || name
== "fontWeight" ||
433 name
== "fontUnderlined")
434 return GetFontProperty(name
, font
);
435 else if (name
== "label" && itemWindow
->GetLabel())
436 return new wxProperty("label", propertyWindow
->GetLabel(), "string");
438 return wxWindowPropertyInfo::GetProperty(name
);
441 bool wxItemPropertyInfo::SetProperty(wxString
& name
, wxProperty
*property
)
443 wxControl
*itemWindow
= (wxControl
*)propertyWindow
;
444 wxFont
*font
= itemWindow
->GetFont();
446 if (font
&& (name
== "fontPoints" || name
== "fontFamily" || name
== "fontStyle" || name
== "fontWeight" || name
== "fontUnderlined" ))
448 wxFont
*newFont
= SetFontProperty(name
, property
, font
);
450 itemWindow
->SetLabelFont(newFont
);
453 else if (name
== "label")
455 itemWindow
->SetLabel(property
->GetValue().StringValue());
459 return wxWindowPropertyInfo::SetProperty(name
, property
);
462 void wxItemPropertyInfo::GetPropertyNames(wxStringList
& names
)
464 wxWindowPropertyInfo::GetPropertyNames(names
);
466 names
.Add("fontPoints");
467 names
.Add("fontFamily");
468 names
.Add("fontStyle");
469 names
.Add("fontWeight");
470 names
.Add("fontUnderlined");
473 bool wxItemPropertyInfo::InstantiateResource(wxItemResource
*resource
)
475 wxWindowPropertyInfo::InstantiateResource(resource
);
477 wxControl
*item
= (wxControl
*)propertyWindow
;
478 wxString
str(item
->GetLabel());
479 resource
->SetTitle(WXSTRINGCAST str
);
480 if (item
->GetFont() && item
->GetFont()->Ok())
481 resource
->SetFont(wxTheFontList
->FindOrCreateFont(item
->GetFont()->GetPointSize(),
482 item
->GetFont()->GetFamily(), item
->GetFont()->GetStyle(), item
->GetFont()->GetWeight(),
483 item
->GetFont()->GetUnderlined(), item
->GetFont()->GetFaceName()));
491 wxProperty
*wxButtonPropertyInfo::GetProperty(wxString
& name
)
493 wxButton
*button
= (wxButton
*)propertyWindow
;
494 return wxItemPropertyInfo::GetProperty(name
);
497 bool wxButtonPropertyInfo::SetProperty(wxString
& name
, wxProperty
*property
)
499 wxButton
*button
= (wxButton
*)propertyWindow
;
500 return wxItemPropertyInfo::SetProperty(name
, property
);
503 void wxButtonPropertyInfo::GetPropertyNames(wxStringList
& names
)
506 wxItemPropertyInfo::GetPropertyNames(names
);
509 bool wxButtonPropertyInfo::InstantiateResource(wxItemResource
*resource
)
511 return wxItemPropertyInfo::InstantiateResource(resource
);
518 wxProperty
*wxBitmapButtonPropertyInfo::GetProperty(wxString
& name
)
520 wxBitmapButton
*button
= (wxBitmapButton
*)propertyWindow
;
523 wxItemResource
*resource
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(button
);
524 wxString
str("none.bmp");
528 char *filename
= wxResourceManager::GetCurrentResourceManager()->FindBitmapFilenameForResource(resource
);
532 return new wxProperty("label", str
.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"));
535 return wxButtonPropertyInfo::GetProperty(name
);
538 bool wxBitmapButtonPropertyInfo::SetProperty(wxString
& name
, wxProperty
*property
)
540 wxBitmapButton
*button
= (wxBitmapButton
*)propertyWindow
;
543 char *s
= property
->GetValue().StringValue();
544 if (s
&& wxFileExists(s
))
547 wxBitmap
*bitmap
= new wxBitmap(s
, wxBITMAP_TYPE_BMP
);
556 wxItemResource
*resource
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(button
);
559 wxString
oldResource(resource
->GetValue4());
560 char *resName
= wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(s
);
561 resource
->SetValue4(resName
);
563 if (!oldResource
.IsNull())
564 wxResourceManager::GetCurrentResourceManager()->PossiblyDeleteBitmapResource(WXSTRINGCAST oldResource
);
567 button
->SetLabel(bitmap
);
575 return wxButtonPropertyInfo::SetProperty(name
, property
);
578 void wxBitmapButtonPropertyInfo::GetPropertyNames(wxStringList
& names
)
580 // names.Add("label");
581 wxButtonPropertyInfo::GetPropertyNames(names
);
584 bool wxBitmapButtonPropertyInfo::InstantiateResource(wxItemResource
*resource
)
586 return wxItemPropertyInfo::InstantiateResource(resource
);
593 wxProperty
*wxStaticTextPropertyInfo::GetProperty(wxString
& name
)
595 wxStaticText
*message
= (wxStaticText
*)propertyWindow
;
596 return wxItemPropertyInfo::GetProperty(name
);
599 bool wxStaticTextPropertyInfo::SetProperty(wxString
& name
, wxProperty
*property
)
601 wxStaticText
*message
= (wxStaticText
*)propertyWindow
;
602 return wxItemPropertyInfo::SetProperty(name
, property
);
605 void wxStaticTextPropertyInfo::GetPropertyNames(wxStringList
& names
)
608 wxItemPropertyInfo::GetPropertyNames(names
);
611 bool wxStaticTextPropertyInfo::InstantiateResource(wxItemResource
*resource
)
613 return wxItemPropertyInfo::InstantiateResource(resource
);
620 wxProperty
*wxStaticBitmapPropertyInfo::GetProperty(wxString
& name
)
622 wxStaticBitmap
*message
= (wxStaticBitmap
*)propertyWindow
;
625 wxItemResource
*resource
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(message
);
626 wxString
str("none.bmp");
630 char *filename
= wxResourceManager::GetCurrentResourceManager()->FindBitmapFilenameForResource(resource
);
634 return new wxProperty("label", str
.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"));
637 return wxItemPropertyInfo::GetProperty(name
);
640 bool wxStaticBitmapPropertyInfo::SetProperty(wxString
& name
, wxProperty
*property
)
642 wxStaticBitmap
*message
= (wxStaticBitmap
*)propertyWindow
;
645 char *s
= property
->GetValue().StringValue();
646 if (s
&& wxFileExists(s
))
650 wxBitmap
*bitmap
= new wxBitmap(s
, wxBITMAP_TYPE_BMP
);
659 wxItemResource
*resource
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(message
);
662 wxString
oldResource(resource
->GetValue4());
663 char *resName
= wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(s
);
664 resource
->SetValue4(resName
);
666 if (!oldResource
.IsNull())
667 wxResourceManager::GetCurrentResourceManager()->PossiblyDeleteBitmapResource(WXSTRINGCAST oldResource
);
670 message
->SetBitmap(bitmap
);
678 return wxItemPropertyInfo::SetProperty(name
, property
);
681 void wxStaticBitmapPropertyInfo::GetPropertyNames(wxStringList
& names
)
684 wxItemPropertyInfo::GetPropertyNames(names
);
687 bool wxStaticBitmapPropertyInfo::InstantiateResource(wxItemResource
*resource
)
689 return wxItemPropertyInfo::InstantiateResource(resource
);
696 wxProperty
*wxTextPropertyInfo::GetProperty(wxString
& name
)
698 wxTextCtrl
*text
= (wxTextCtrl
*)propertyWindow
;
700 return new wxProperty("value", text
->GetValue(), "string");
701 else if (name
== "password")
703 bool isPassword
= ((text
->GetWindowStyleFlag() & wxTE_PASSWORD
) == wxTE_PASSWORD
);
704 return new wxProperty("password", isPassword
, "bool");
706 else if (name
== "readonly")
708 bool isReadOnly
= ((text
->GetWindowStyleFlag() & wxTE_READONLY
) == wxTE_READONLY
);
709 return new wxProperty("readonly", isReadOnly
, "bool");
712 return wxItemPropertyInfo::GetProperty(name
);
715 bool wxTextPropertyInfo::SetProperty(wxString
& name
, wxProperty
*property
)
717 wxTextCtrl
*text
= (wxTextCtrl
*)propertyWindow
;
720 text
->SetValue(property
->GetValue().StringValue());
723 else if (name
== "password")
725 long flag
= text
->GetWindowStyleFlag();
726 if (property
->GetValue().BoolValue())
728 if ((flag
& wxTE_PASSWORD
) != wxTE_PASSWORD
)
729 flag
|= wxTE_PASSWORD
;
733 if ((flag
& wxTE_PASSWORD
) == wxTE_PASSWORD
)
734 flag
-= wxTE_PASSWORD
;
736 wxItemResource
*resource
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(text
);
737 resource
->SetStyle(flag
);
739 wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(text
, this);
742 else if (name
== "readonly")
744 long flag
= text
->GetWindowStyleFlag();
745 if (property
->GetValue().BoolValue())
747 if ((flag
& wxTE_READONLY
) != wxTE_READONLY
)
748 flag
|= wxTE_READONLY
;
752 if ((flag
& wxTE_READONLY
) == wxTE_READONLY
)
753 flag
-= wxTE_READONLY
;
755 wxItemResource
*resource
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(text
);
756 resource
->SetStyle(flag
);
758 wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(text
, this);
762 return wxItemPropertyInfo::SetProperty(name
, property
);
765 void wxTextPropertyInfo::GetPropertyNames(wxStringList
& names
)
768 names
.Add("readonly");
769 names
.Add("password");
770 wxItemPropertyInfo::GetPropertyNames(names
);
773 bool wxTextPropertyInfo::InstantiateResource(wxItemResource
*resource
)
775 wxTextCtrl
*text
= (wxTextCtrl
*)propertyWindow
;
776 wxString
str(text
->GetValue());
777 resource
->SetValue4(WXSTRINGCAST str
);
779 return wxItemPropertyInfo::InstantiateResource(resource
);
786 wxProperty
*wxListBoxPropertyInfo::GetProperty(wxString
& name
)
788 wxListBox
*listBox
= (wxListBox
*)propertyWindow
;
789 if (name
== "values")
791 wxStringList
*stringList
= new wxStringList
;
793 for (i
= 0; i
< listBox
->Number(); i
++)
794 stringList
->Add(listBox
->GetString(i
));
796 return new wxProperty(name
, stringList
, "stringlist");
798 else if (name
== "multiple")
801 wxItemResource
*resource
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(listBox
);
805 char *mult
= "wxSINGLE";
807 switch (resource
->GetValue1())
810 mult
= "wxLB_MULTIPLE";
813 mult
= "wxLB_EXTENDED";
817 mult
= "wxLB_SINGLE";
820 return new wxProperty("multiple", mult
, "string",
821 new wxStringListValidator(new wxStringList("wxLB_SINGLE", "wxLB_MULTIPLE", "wxLB_EXTENDED",
825 return wxItemPropertyInfo::GetProperty(name
);
828 bool wxListBoxPropertyInfo::SetProperty(wxString
& name
, wxProperty
*property
)
830 wxListBox
*listBox
= (wxListBox
*)propertyWindow
;
831 if (name
== "values")
834 wxPropertyValue
*expr
= property
->GetValue().GetFirst();
837 char *s
= expr
->StringValue();
840 expr
= expr
->GetNext();
844 else if (name
== "multiple")
846 int mult
= wxLB_SINGLE
;
847 wxString
str(property
->GetValue().StringValue());
848 if (str
== "wxLB_MULTIPLE")
849 mult
= wxLB_MULTIPLE
;
850 else if (str
== "wxLB_EXTENDED")
851 mult
= wxLB_EXTENDED
;
854 wxItemResource
*resource
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(listBox
);
856 resource
->SetValue1(mult
);
857 wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(listBox
, this);
861 return wxItemPropertyInfo::SetProperty(name
, property
);
864 void wxListBoxPropertyInfo::GetPropertyNames(wxStringList
& names
)
867 names
.Add("multiple");
868 wxItemPropertyInfo::GetPropertyNames(names
);
871 bool wxListBoxPropertyInfo::InstantiateResource(wxItemResource
*resource
)
873 wxListBox
*lbox
= (wxListBox
*)propertyWindow
;
874 // This will be set for the wxItemResource on reading or in SetProperty
875 // resource->SetValue1(lbox->GetSelectionMode());
877 if (lbox
->Number() == 0)
878 resource
->SetStringValues(NULL
);
881 wxStringList
*slist
= new wxStringList
;
883 for (i
= 0; i
< lbox
->Number(); i
++)
884 slist
->Add(lbox
->GetString(i
));
886 resource
->SetStringValues(slist
);
888 return wxItemPropertyInfo::InstantiateResource(resource
);
895 wxProperty
*wxChoicePropertyInfo::GetProperty(wxString
& name
)
897 wxChoice
*choice
= (wxChoice
*)propertyWindow
;
898 if (name
== "values")
900 wxStringList
*stringList
= new wxStringList
;
902 for (i
= 0; i
< choice
->Number(); i
++)
903 stringList
->Add(choice
->GetString(i
));
905 return new wxProperty(name
, stringList
, "stringlist");
908 return wxItemPropertyInfo::GetProperty(name
);
911 bool wxChoicePropertyInfo::SetProperty(wxString
& name
, wxProperty
*property
)
913 wxChoice
*choice
= (wxChoice
*)propertyWindow
;
914 if (name
== "values")
917 wxPropertyValue
*expr
= property
->GetValue().GetFirst();
920 char *s
= expr
->StringValue();
923 expr
= expr
->GetNext();
925 if (choice
->Number() > 0)
926 choice
->SetSelection(0);
930 return wxItemPropertyInfo::SetProperty(name
, property
);
933 void wxChoicePropertyInfo::GetPropertyNames(wxStringList
& names
)
936 wxItemPropertyInfo::GetPropertyNames(names
);
939 bool wxChoicePropertyInfo::InstantiateResource(wxItemResource
*resource
)
941 wxChoice
*choice
= (wxChoice
*)propertyWindow
;
943 if (choice
->Number() == 0)
944 resource
->SetStringValues(NULL
);
947 wxStringList
*slist
= new wxStringList
;
949 for (i
= 0; i
< choice
->Number(); i
++)
950 slist
->Add(choice
->GetString(i
));
952 resource
->SetStringValues(slist
);
954 return wxItemPropertyInfo::InstantiateResource(resource
);
961 wxProperty
*wxRadioBoxPropertyInfo::GetProperty(wxString
& name
)
963 wxRadioBox
*radioBox
= (wxRadioBox
*)propertyWindow
;
964 if (name
== "numberRowsOrCols")
966 return new wxProperty("numberRowsOrCols", (long)radioBox
->GetNumberOfRowsOrCols(), "integer");
968 if (name
== "orientation")
971 if (propertyWindow
->GetWindowStyleFlag() & wxHORIZONTAL
)
972 pos
= "wxHORIZONTAL";
976 return new wxProperty("orientation", pos
, "string",
977 new wxStringListValidator(new wxStringList("wxHORIZONTAL", "wxVERTICAL",
980 else if (name
== "values")
982 wxStringList
*stringList
= new wxStringList
;
984 for (i
= 0; i
< radioBox
->Number(); i
++)
985 stringList
->Add(radioBox
->GetString(i
));
987 return new wxProperty(name
, stringList
, "stringlist");
989 return wxItemPropertyInfo::GetProperty(name
);
992 bool wxRadioBoxPropertyInfo::SetProperty(wxString
& name
, wxProperty
*property
)
994 wxRadioBox
*radioBox
= (wxRadioBox
*)propertyWindow
;
995 if (name
== "numberRowsOrCols")
997 radioBox
->SetNumberOfRowsOrCols((int)property
->GetValue().IntegerValue());
998 wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox
, this);
1001 else if (name
== "orientation")
1003 long windowStyle
= radioBox
->GetWindowStyleFlag();
1004 wxString
val(property
->GetValue().StringValue());
1005 if (val
== "wxHORIZONTAL")
1007 if (windowStyle
& wxVERTICAL
)
1008 windowStyle
-= wxVERTICAL
;
1009 windowStyle
|= wxHORIZONTAL
;
1013 if (windowStyle
& wxHORIZONTAL
)
1014 windowStyle
-= wxHORIZONTAL
;
1015 windowStyle
|= wxVERTICAL
;
1017 radioBox
->SetWindowStyleFlag(windowStyle
);
1019 wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox
, this);
1022 else if (name
== "values")
1024 // Set property into *resource*, not wxRadioBox, and then recreate
1025 // the wxRadioBox. This is because we can't dynamically set the strings
1027 wxItemResource
*resource
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(propertyWindow
);
1031 wxStringList
*stringList
= resource
->GetStringValues();
1034 stringList
= new wxStringList
;
1035 resource
->SetStringValues(stringList
);
1037 stringList
->Clear();
1039 wxPropertyValue
*expr
= property
->GetValue().GetFirst();
1042 char *s
= expr
->StringValue();
1045 expr
= expr
->GetNext();
1047 wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox
, this);
1050 return wxItemPropertyInfo::SetProperty(name
, property
);
1053 void wxRadioBoxPropertyInfo::GetPropertyNames(wxStringList
& names
)
1056 names
.Add("values");
1057 names
.Add("orientation");
1058 names
.Add("numberRowsOrCols");
1059 wxItemPropertyInfo::GetPropertyNames(names
);
1062 bool wxRadioBoxPropertyInfo::InstantiateResource(wxItemResource
*resource
)
1064 wxRadioBox
*rbox
= (wxRadioBox
*)propertyWindow
;
1065 // Take strings from resource instead
1068 if (rbox->Number() == 0)
1069 resource->SetStringValues(NULL);
1072 wxStringList *slist = new wxStringList;
1074 for (i = 0; i < rbox->Number(); i++)
1075 slist->Add(rbox->GetString(i));
1077 resource->SetStringValues(slist);
1080 resource
->SetValue1(rbox
->GetNumberOfRowsOrCols());
1081 return wxItemPropertyInfo::InstantiateResource(resource
);
1088 wxProperty
*wxGroupBoxPropertyInfo::GetProperty(wxString
& name
)
1090 wxStaticBox
*groupBox
= (wxStaticBox
*)propertyWindow
;
1091 return wxItemPropertyInfo::GetProperty(name
);
1094 bool wxGroupBoxPropertyInfo::SetProperty(wxString
& name
, wxProperty
*property
)
1096 return wxItemPropertyInfo::SetProperty(name
, property
);
1099 void wxGroupBoxPropertyInfo::GetPropertyNames(wxStringList
& names
)
1102 wxItemPropertyInfo::GetPropertyNames(names
);
1105 bool wxGroupBoxPropertyInfo::InstantiateResource(wxItemResource
*resource
)
1107 wxStaticBox
*gbox
= (wxStaticBox
*)propertyWindow
;
1108 return wxItemPropertyInfo::InstantiateResource(resource
);
1115 wxProperty
*wxCheckBoxPropertyInfo::GetProperty(wxString
& name
)
1117 wxCheckBox
*checkBox
= (wxCheckBox
*)propertyWindow
;
1118 if (name
== "value")
1119 return new wxProperty("value", checkBox
->GetValue(), "bool");
1121 return wxItemPropertyInfo::GetProperty(name
);
1124 bool wxCheckBoxPropertyInfo::SetProperty(wxString
& name
, wxProperty
*property
)
1126 wxCheckBox
*checkBox
= (wxCheckBox
*)propertyWindow
;
1127 if (name
== "value")
1129 checkBox
->SetValue((bool)property
->GetValue().BoolValue());
1133 return wxItemPropertyInfo::SetProperty(name
, property
);
1136 void wxCheckBoxPropertyInfo::GetPropertyNames(wxStringList
& names
)
1140 wxItemPropertyInfo::GetPropertyNames(names
);
1143 bool wxCheckBoxPropertyInfo::InstantiateResource(wxItemResource
*resource
)
1145 wxCheckBox
*cbox
= (wxCheckBox
*)propertyWindow
;
1146 resource
->SetValue1(cbox
->GetValue());
1147 return wxItemPropertyInfo::InstantiateResource(resource
);
1154 wxProperty
*wxSliderPropertyInfo::GetProperty(wxString
& name
)
1156 wxSlider
*slider
= (wxSlider
*)propertyWindow
;
1157 if (name
== "value")
1158 return new wxProperty("value", (long)slider
->GetValue(), "integer");
1159 else if (name
== "orientation")
1162 if (propertyWindow
->GetWindowStyleFlag() & wxHORIZONTAL
)
1163 pos
= "wxHORIZONTAL";
1167 return new wxProperty("orientation", pos
, "string",
1168 new wxStringListValidator(new wxStringList("wxHORIZONTAL", "wxVERTICAL",
1171 else if (name
== "min_value")
1172 return new wxProperty("min_value", (long)slider
->GetMin(), "integer");
1173 else if (name
== "max_value")
1174 return new wxProperty("max_value", (long)slider
->GetMax(), "integer");
1176 return wxItemPropertyInfo::GetProperty(name
);
1179 bool wxSliderPropertyInfo::SetProperty(wxString
& name
, wxProperty
*property
)
1181 wxSlider
*slider
= (wxSlider
*)propertyWindow
;
1182 if (name
== "value")
1184 slider
->SetValue((int)property
->GetValue().IntegerValue());
1187 else if (name
== "orientation")
1189 long windowStyle
= slider
->GetWindowStyleFlag();
1190 long oldWindowStyle
= windowStyle
;
1191 wxString
val(property
->GetValue().StringValue());
1192 if (val
== "wxHORIZONTAL")
1194 if (windowStyle
& wxVERTICAL
)
1195 windowStyle
-= wxVERTICAL
;
1196 windowStyle
|= wxHORIZONTAL
;
1200 if (windowStyle
& wxHORIZONTAL
)
1201 windowStyle
-= wxHORIZONTAL
;
1202 windowStyle
|= wxVERTICAL
;
1205 if (oldWindowStyle
== windowStyle
)
1208 slider
->SetWindowStyleFlag(windowStyle
);
1210 // If the window style has changed, we swap the width and height parameters.
1212 slider
->GetSize(&w
, &h
);
1214 slider
= (wxSlider
*)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(slider
, this);
1215 slider
->SetSize(-1, -1, h
, w
);
1219 else if (name
== "min_value")
1221 slider
->SetRange((int)property
->GetValue().IntegerValue(), slider
->GetMax());
1224 else if (name
== "max_value")
1226 slider
->SetRange(slider
->GetMin(), (int)property
->GetValue().IntegerValue());
1230 return wxItemPropertyInfo::SetProperty(name
, property
);
1233 void wxSliderPropertyInfo::GetPropertyNames(wxStringList
& names
)
1236 names
.Add("orientation");
1237 names
.Add("min_value");
1238 names
.Add("max_value");
1239 wxItemPropertyInfo::GetPropertyNames(names
);
1242 bool wxSliderPropertyInfo::InstantiateResource(wxItemResource
*resource
)
1244 wxSlider
*slider
= (wxSlider
*)propertyWindow
;
1245 resource
->SetValue1(slider
->GetValue());
1246 resource
->SetValue2(slider
->GetMin());
1247 resource
->SetValue3(slider
->GetMax());
1248 return wxItemPropertyInfo::InstantiateResource(resource
);
1255 wxProperty
*wxGaugePropertyInfo::GetProperty(wxString
& name
)
1257 wxGauge
*gauge
= (wxGauge
*)propertyWindow
;
1258 if (name
== "value")
1259 return new wxProperty("value", (long)gauge
->GetValue(), "integer");
1260 else if (name
== "max_value")
1261 return new wxProperty("max_value", (long)gauge
->GetRange(), "integer");
1263 return wxItemPropertyInfo::GetProperty(name
);
1266 bool wxGaugePropertyInfo::SetProperty(wxString
& name
, wxProperty
*property
)
1268 wxGauge
*gauge
= (wxGauge
*)propertyWindow
;
1269 if (name
== "value")
1271 gauge
->SetValue((int)property
->GetValue().IntegerValue());
1274 else if (name
== "max_value")
1276 gauge
->SetRange((int)property
->GetValue().IntegerValue());
1280 return wxItemPropertyInfo::SetProperty(name
, property
);
1283 void wxGaugePropertyInfo::GetPropertyNames(wxStringList
& names
)
1286 names
.Add("max_value");
1287 wxItemPropertyInfo::GetPropertyNames(names
);
1290 bool wxGaugePropertyInfo::InstantiateResource(wxItemResource
*resource
)
1292 wxGauge
*gauge
= (wxGauge
*)propertyWindow
;
1293 resource
->SetValue1(gauge
->GetValue());
1294 resource
->SetValue2(gauge
->GetRange());
1295 return wxItemPropertyInfo::InstantiateResource(resource
);
1302 wxProperty
*wxScrollBarPropertyInfo::GetProperty(wxString
& name
)
1304 wxScrollBar
*scrollBar
= (wxScrollBar
*)propertyWindow
;
1305 if (name
== "value")
1306 return new wxProperty("value", (long)scrollBar
->GetValue(), "integer");
1307 else if (name
== "orientation")
1310 if (propertyWindow
->GetWindowStyleFlag() & wxHORIZONTAL
)
1311 pos
= "wxHORIZONTAL";
1315 return new wxProperty("orientation", pos
, "string",
1316 new wxStringListValidator(new wxStringList("wxHORIZONTAL", "wxVERTICAL",
1319 else if (name
== "pageSize")
1321 int viewStart
, pageLength
, objectLength
, viewLength
;
1322 scrollBar
->GetValues(&viewStart
, &viewLength
, &objectLength
, &pageLength
);
1324 return new wxProperty("pageSize", (long)pageLength
, "integer");
1326 else if (name
== "viewLength")
1328 int viewStart
, pageLength
, objectLength
, viewLength
;
1329 scrollBar
->GetValues(&viewStart
, &viewLength
, &objectLength
, &pageLength
);
1331 return new wxProperty("viewLength", (long)viewLength
, "integer");
1333 else if (name
== "objectLength")
1335 int viewStart
, pageLength
, objectLength
, viewLength
;
1336 scrollBar
->GetValues(&viewStart
, &viewLength
, &objectLength
, &pageLength
);
1338 return new wxProperty("objectLength", (long)objectLength
, "integer");
1341 return wxItemPropertyInfo::GetProperty(name
);
1344 bool wxScrollBarPropertyInfo::SetProperty(wxString
& name
, wxProperty
*property
)
1346 wxScrollBar
*scrollBar
= (wxScrollBar
*)propertyWindow
;
1347 if (name
== "value")
1349 scrollBar
->SetValue((int)property
->GetValue().IntegerValue());
1352 else if (name
== "orientation")
1354 long windowStyle
= scrollBar
->GetWindowStyleFlag();
1355 long oldWindowStyle
= windowStyle
;
1356 wxString
val(property
->GetValue().StringValue());
1357 if (val
== "wxHORIZONTAL")
1359 if (windowStyle
& wxVERTICAL
)
1360 windowStyle
-= wxVERTICAL
;
1361 windowStyle
|= wxHORIZONTAL
;
1365 if (windowStyle
& wxHORIZONTAL
)
1366 windowStyle
-= wxHORIZONTAL
;
1367 windowStyle
|= wxVERTICAL
;
1370 if (oldWindowStyle
== windowStyle
)
1373 scrollBar
->SetWindowStyleFlag(windowStyle
);
1375 // If the window style has changed, we swap the width and height parameters.
1377 scrollBar
->GetSize(&w
, &h
);
1379 scrollBar
= (wxScrollBar
*)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(scrollBar
, this);
1380 scrollBar
->SetSize(-1, -1, h
, w
);
1384 else if (name
== "pageSize")
1386 scrollBar
->SetPageSize((int)property
->GetValue().IntegerValue());
1389 else if (name
== "viewLength")
1391 scrollBar
->SetViewLength((int)property
->GetValue().IntegerValue());
1394 else if (name
== "objectLength")
1396 scrollBar
->SetObjectLength((int)property
->GetValue().IntegerValue());
1400 return wxItemPropertyInfo::SetProperty(name
, property
);
1403 void wxScrollBarPropertyInfo::GetPropertyNames(wxStringList
& names
)
1405 names
.Add("orientation");
1407 names
.Add("pageSize");
1408 names
.Add("viewLength");
1409 names
.Add("objectLength");
1410 wxItemPropertyInfo::GetPropertyNames(names
);
1412 // Remove some properties we don't inherit
1413 names
.Delete("fontPoints");
1414 names
.Delete("fontFamily");
1415 names
.Delete("fontStyle");
1416 names
.Delete("fontWeight");
1417 names
.Delete("fontUnderlined");
1420 bool wxScrollBarPropertyInfo::InstantiateResource(wxItemResource
*resource
)
1422 wxScrollBar
*sbar
= (wxScrollBar
*)propertyWindow
;
1424 resource
->SetValue1(sbar
->GetValue());
1426 int viewStart
, pageLength
, objectLength
, viewLength
;
1427 sbar
->GetValues(&viewStart
, &viewLength
, &objectLength
, &pageLength
);
1429 resource
->SetValue2(pageLength
);
1430 resource
->SetValue3(objectLength
);
1431 resource
->SetValue5(viewLength
);
1433 return wxItemPropertyInfo::InstantiateResource(resource
);
1440 wxProperty
*wxPanelPropertyInfo::GetProperty(wxString
& name
)
1442 wxPanel
*panelWindow
= (wxPanel
*)propertyWindow
;
1443 wxFont
*labelFont
= panelWindow
->GetLabelFont();
1444 wxFont
*buttonFont
= panelWindow
->GetButtonFont();
1446 if (name
== "labelFontPoints" || name
== "labelFontFamily" || name
== "labelFontStyle" || name
== "labelFontWeight" ||
1447 name
== "labelFontUnderlined")
1448 return GetFontProperty(name
, labelFont
);
1449 else if (name
== "buttonFontPoints" || name
== "buttonFontFamily" || name
== "buttonFontStyle" || name
== "buttonFontWeight" ||
1450 name
== "buttonFontUnderlined")
1451 return GetFontProperty(name
, buttonFont
);
1452 else if (name
== "no3D")
1455 if (panelWindow
->GetWindowStyleFlag() & wxNO_3D
)
1458 userColours
= FALSE
;
1460 return new wxProperty(name
, (bool)userColours
, "bool");
1462 else if (name
== "backgroundColour")
1464 wxColour
col(panelWindow
->GetBackgroundColour());
1466 wxDecToHex(col
.Red(), buf
);
1467 wxDecToHex(col
.Green(), buf
+2);
1468 wxDecToHex(col
.Blue(), buf
+4);
1470 return new wxProperty(name
, buf
, "string", new wxColourListValidator
);
1472 else if (name
== "title")
1474 wxItemResource
*resource
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow
);
1476 return new wxProperty(name
, resource
->GetTitle(), "string");
1478 return new wxProperty(name
, "Could not get title", "string");
1481 return wxWindowPropertyInfo::GetProperty(name
);
1484 bool wxPanelPropertyInfo::SetProperty(wxString
& name
, wxProperty
*property
)
1486 wxPanel
*panelWindow
= (wxPanel
*)propertyWindow
;
1487 wxFont
*labelFont
= panelWindow
->GetLabelFont();
1488 wxFont
*buttonFont
= panelWindow
->GetButtonFont();
1490 if (labelFont
&& (name
== "labelFontPoints" || name
== "labelFontFamily" || name
== "labelFontStyle" || name
== "labelFontWeight" || name
== "labelFontUnderlined" ))
1492 wxFont
*newFont
= SetFontProperty(name
, property
, labelFont
);
1494 panelWindow
->SetLabelFont(newFont
);
1497 else if (buttonFont
&& (name
== "buttonFontPoints" || name
== "buttonFontFamily" || name
== "buttonFontStyle" || name
== "buttonFontWeight" || name
== "buttonFontUnderlined" ))
1499 wxFont
*newFont
= SetFontProperty(name
, property
, buttonFont
);
1501 panelWindow
->SetButtonFont(newFont
);
1504 else if (name
== "no3D")
1506 bool userColours
= property
->GetValue().BoolValue();
1507 long flag
= panelWindow
->GetWindowStyleFlag();
1511 if ((panelWindow
->GetWindowStyleFlag() & wxNO_3D
) != wxNO_3D
)
1512 panelWindow
->SetWindowStyleFlag(panelWindow
->GetWindowStyleFlag() | wxNO_3D
);
1516 if ((panelWindow
->GetWindowStyleFlag() & wxNO_3D
) == wxNO_3D
)
1517 panelWindow
->SetWindowStyleFlag(panelWindow
->GetWindowStyleFlag() - wxNO_3D
);
1519 wxItemResource
*resource
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow
);
1520 resource
->SetStyle(panelWindow
->GetWindowStyleFlag());
1522 panelWindow
= (wxPanel
*)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(panelWindow
, this);
1525 else if (name
== "backgroundColour")
1527 char *hex
= property
->GetValue().StringValue();
1528 int r
= wxHexToDec(hex
);
1529 int g
= wxHexToDec(hex
+2);
1530 int b
= wxHexToDec(hex
+4);
1532 wxColour
col(r
,g
,b
);
1533 panelWindow
->SetBackgroundColour(col
);
1534 panelWindow
= (wxPanel
*)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(panelWindow
, this);
1537 else if (name
== "title")
1539 wxItemResource
*resource
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow
);
1542 resource
->SetTitle(property
->GetValue().StringValue());
1549 return wxWindowPropertyInfo::SetProperty(name
, property
);
1552 void wxPanelPropertyInfo::GetPropertyNames(wxStringList
& names
)
1554 wxWindowPropertyInfo::GetPropertyNames(names
);
1558 names
.Add("backgroundColour");
1561 bool wxPanelPropertyInfo::InstantiateResource(wxItemResource
*resource
)
1563 wxPanel
*panel
= (wxPanel
*)propertyWindow
;
1564 if (panel
->GetFont())
1565 resource
->SetFont(wxTheFontList
->FindOrCreateFont(panel
->GetFont()->GetPointSize(),
1566 panel
->GetFont()->GetFamily(), panel
->GetFont()->GetStyle(), panel
->GetFont()->GetWeight(),
1567 panel
->GetFont()->GetUnderlined(), panel
->GetFont()->GetFaceName()));
1569 resource
->SetBackgroundColour(new wxColour(panel
->GetBackgroundColour()));
1571 return wxWindowPropertyInfo::InstantiateResource(resource
);
1579 wxProperty
*wxDialogPropertyInfo::GetProperty(wxString
& name
)
1581 wxDialog
*dialogWindow
= (wxDialog
*)propertyWindow
;
1582 if (name
== "modal")
1584 wxItemResource
*resource
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(dialogWindow
);
1588 bool modal
= (resource
->GetValue1() != 0);
1589 return new wxProperty(name
, modal
, "bool");
1592 return wxPanelPropertyInfo::GetProperty(name
);
1595 bool wxDialogPropertyInfo::SetProperty(wxString
& name
, wxProperty
*property
)
1597 wxDialog
*dialogWindow
= (wxDialog
*)propertyWindow
;
1599 if (name
== "modal")
1601 wxItemResource
*resource
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(dialogWindow
);
1605 resource
->SetValue1(property
->GetValue().BoolValue());
1609 return wxPanelPropertyInfo::SetProperty(name
, property
);
1612 void wxDialogPropertyInfo::GetPropertyNames(wxStringList
& names
)
1617 wxPanelPropertyInfo::GetPropertyNames(names
);
1620 bool wxDialogPropertyInfo::InstantiateResource(wxItemResource
*resource
)
1622 wxDialog
*dialog
= (wxDialog
*)propertyWindow
;
1623 wxString
str(dialog
->GetTitle());
1624 resource
->SetTitle(WXSTRINGCAST str
);
1626 return wxPanelPropertyInfo::InstantiateResource(resource
);
1634 int wxStringToFontWeight(wxString
& val
)
1636 if (val
== "wxBOLD") return wxBOLD
;
1637 else if (val
== "wxLIGHT") return wxLIGHT
;
1638 else return wxNORMAL
;
1641 int wxStringToFontStyle(wxString
& val
)
1643 if (val
== "wxITALIC") return wxITALIC
;
1644 else if (val
== "wxSLANT") return wxSLANT
;
1645 else return wxNORMAL
;
1648 int wxStringToFontFamily(wxString
& val
)
1650 if (val
== "wxDECORATIVE") return wxDECORATIVE
;
1651 else if (val
== "wxROMAN") return wxROMAN
;
1652 else if (val
== "wxSCRIPT") return wxSCRIPT
;
1653 else if (val
== "wxMODERN") return wxMODERN
;
1654 else if (val
== "wxTELETYPE") return wxTELETYPE
;
1655 else return wxSWISS
;