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> 
  45 // Causes immediate feedback. 
  46 void wxResourcePropertyListView::OnPropertyChanged(wxProperty 
*property
) 
  48   // Sets the value of the property back into the actual object, 
  49   // IF the property value was modified. 
  50   if (property
->GetValue().GetModified()) 
  52     propertyInfo
->SetProperty(property
->GetName(), property
); 
  53     property
->GetValue().SetModified(FALSE
); 
  57 bool wxResourcePropertyListView::OnClose(void) 
  60   GetManagedWindow()->GetSize(& w
, & h
); 
  61   GetManagedWindow()->GetPosition(& x
, & y
); 
  63   wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().width 
= w
; 
  64   wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().height 
= h
; 
  65   wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().x 
= x
; 
  66   wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().y 
= y
; 
  68   return wxPropertyListView::OnClose(); 
  71 wxWindow 
*wxPropertyInfo::sm_propertyWindow
; 
  74  * wxDialogEditorPropertyListDialog 
  77 wxDialogEditorPropertyListDialog::wxDialogEditorPropertyListDialog(wxPropertyListView 
*v
, wxWindow 
*parent
, const wxString
& title
, 
  78         const wxPoint
& pos
, const wxSize
& size
, 
  79         long style
, const wxString
& name
): 
  80             wxPropertyListDialog(v
, parent
, title
, pos
, size
, style
, name
) 
  86 wxDialogEditorPropertyListDialog::~wxDialogEditorPropertyListDialog() 
  90     wxPropertyInfo::sm_propertyWindow 
= NULL
; 
  97 // Edit the information represented by this object, whatever that 
  99 bool wxPropertyInfo::Edit(wxWindow 
*parent
, const wxString
& title
) 
 101     if (sm_propertyWindow
) 
 104   int width 
= wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().width
; 
 105   int height 
= wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().height
; 
 106   int x 
= wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().x
; 
 107   int y 
= wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().y
; 
 109   wxPropertySheet 
*propSheet 
= new wxPropertySheet
; 
 111   wxStringList propNames
; 
 112   GetPropertyNames(propNames
); 
 114   wxNode 
*node 
= propNames
.First(); 
 117     wxString 
name((char *)node
->Data()); 
 118     wxProperty 
*prop 
= GetProperty(name
); 
 121       propSheet
->AddProperty(prop
); 
 126   // Reset 'modified' flags for all property values 
 127   propSheet
->SetAllModified(FALSE
); 
 129   wxResourcePropertyListView 
*view 
= new wxResourcePropertyListView(this, NULL
, 
 131      wxPROP_BUTTON_OK 
| wxPROP_BUTTON_CANCEL 
| 
 133      wxPROP_BUTTON_CHECK_CROSS
|wxPROP_DYNAMIC_VALUE_FIELD
|wxPROP_PULLDOWN
|wxPROP_SHOWVALUES
); 
 135   wxDialogEditorPropertyListDialog 
*propDialog 
= new wxDialogEditorPropertyListDialog(view
, 
 136     wxResourceManager::GetCurrentResourceManager()->GetEditorFrame(), title
, wxPoint(x
, y
), 
 137     wxSize(width
, height
), wxDEFAULT_DIALOG_STYLE
); 
 138   sm_propertyWindow 
= propDialog
; 
 140   propDialog
->m_registry
.RegisterValidator((wxString
)"real", new wxRealListValidator
); 
 141   propDialog
->m_registry
.RegisterValidator((wxString
)"string", new wxStringListValidator
); 
 142   propDialog
->m_registry
.RegisterValidator((wxString
)"integer", new wxIntegerListValidator
); 
 143   propDialog
->m_registry
.RegisterValidator((wxString
)"bool", new wxBoolListValidator
); 
 144   propDialog
->m_registry
.RegisterValidator((wxString
)"filename", new wxFilenameListValidator
); 
 145   propDialog
->m_registry
.RegisterValidator((wxString
)"stringlist", new wxListOfStringsListValidator
); 
 146   propDialog
->m_registry
.RegisterValidator((wxString
)"window_id", new wxResourceSymbolValidator
); 
 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"); 
 293   else if (name 
== "id") 
 295     wxString 
symbolName("TODO"); 
 296     return new wxProperty("id", symbolName
, "window_id"); 
 302 bool wxWindowPropertyInfo::SetProperty(wxString
& name
, wxProperty 
*property
) 
 304   wxFont 
*font 
= propertyWindow
->GetFont(); 
 305   if (font 
&& (name 
== "fontPoints" || name 
== "fontFamily" || name 
== "fontStyle" || name 
== "fontWeight" || name 
== "fontUnderlined" )) 
 307     wxFont 
*newFont 
= SetFontProperty(name
, property
, font
); 
 309       propertyWindow
->SetFont(newFont
); 
 312   else if (name 
== "name") 
 314     // Remove old name from resource table, if it's there. 
 315     wxItemResource 
*oldResource 
= (wxItemResource 
*)wxResourceManager::GetCurrentResourceManager()->GetResourceTable().Delete(propertyWindow
->GetName()); 
 318       // It's a top-level resource 
 319       propertyWindow
->SetName(property
->GetValue().StringValue()); 
 320       oldResource
->SetName(property
->GetValue().StringValue()); 
 321       wxResourceManager::GetCurrentResourceManager()->GetResourceTable().Put(propertyWindow
->GetName(), oldResource
); 
 325       // It's a child of something; just set the name of the resource and the window. 
 326       propertyWindow
->SetName(property
->GetValue().StringValue()); 
 327       propertyResource
->SetName(property
->GetValue().StringValue()); 
 329     // Refresh the resource manager list, because the name changed. 
 330     wxResourceManager::GetCurrentResourceManager()->UpdateResourceList(); 
 333   else if (name 
== "title") 
 335     propertyWindow
->SetTitle(property
->GetValue().StringValue()); 
 338   else if (name 
== "x") 
 341     propertyWindow
->GetPosition(&x
, &y
); 
 342     int newX 
= (int)property
->GetValue().IntegerValue(); 
 344       propertyWindow
->Move(newX
, y
); 
 347   else if (name 
== "y") 
 350     propertyWindow
->GetPosition(&x
, &y
); 
 351     int newY 
= (int)property
->GetValue().IntegerValue(); 
 353       propertyWindow
->Move(x
, newY
); 
 356   else if (name 
== "width") 
 359     propertyWindow
->GetSize(&width
, &height
); 
 360     int newWidth 
= (int)property
->GetValue().IntegerValue(); 
 361     if (width 
!= newWidth
) 
 363       propertyWindow
->SetSize(newWidth
, height
); 
 365       if (propertyWindow->IsKindOf(CLASSINFO(wxPanel)) && !propertyWindow->IsKindOf(CLASSINFO(wxDialog))) 
 367         propertyWindow->GetParent()->SetClientSize(newWidth, height); 
 373   else if (name 
== "height") 
 376     propertyWindow
->GetSize(&width
, &height
); 
 377     int newHeight 
= (int)property
->GetValue().IntegerValue(); 
 378     if (height 
!= newHeight
) 
 380       propertyWindow
->SetSize(width
, newHeight
); 
 382       if (propertyWindow->IsKindOf(CLASSINFO(wxPanel)) && !propertyWindow->IsKindOf(CLASSINFO(wxDialog))) 
 384         propertyWindow->GetParent()->SetClientSize(width, newHeight); 
 390   else if (name 
== "id") 
 399 void wxWindowPropertyInfo::GetPropertyNames(wxStringList
& names
) 
 407   if (!propertyWindow
->IsKindOf(CLASSINFO(wxControl
))) 
 409     names
.Add("fontPoints"); 
 410     names
.Add("fontFamily"); 
 411     names
.Add("fontStyle"); 
 412     names
.Add("fontWeight"); 
 413     names
.Add("fontUnderlined"); 
 417 // Fill in the wxItemResource members to mirror the current window settings 
 418 bool wxWindowPropertyInfo::InstantiateResource(wxItemResource 
*resource
) 
 420   resource
->SetType(propertyWindow
->GetClassInfo()->GetClassName()); 
 422 //  resource->SetStyle(propertyWindow->GetWindowStyleFlag()); 
 423   wxString 
str(propertyWindow
->GetName()); 
 424   resource
->SetName(WXSTRINGCAST str
); 
 426   propertyWindow
->GetSize(&w
, &h
); 
 428   propertyWindow
->GetPosition(&x
, &y
); 
 429   resource
->SetSize(x
, y
, w
, h
); 
 438 wxProperty 
*wxItemPropertyInfo::GetProperty(wxString
& name
) 
 440   wxControl 
*itemWindow 
= (wxControl 
*)propertyWindow
;  
 441   wxFont 
*font 
= itemWindow
->GetFont(); 
 443   if (name 
== "fontPoints" || name 
== "fontFamily" || name 
== "fontStyle" || name 
== "fontWeight" || 
 444       name 
== "fontUnderlined") 
 445     return GetFontProperty(name
, font
); 
 446   else if (name 
== "label" && itemWindow
->GetLabel()) 
 447     return new wxProperty("label", propertyWindow
->GetLabel(), "string"); 
 449     return wxWindowPropertyInfo::GetProperty(name
); 
 452 bool wxItemPropertyInfo::SetProperty(wxString
& name
, wxProperty 
*property
) 
 454   wxControl 
*itemWindow 
= (wxControl 
*)propertyWindow
;  
 455   wxFont 
*font 
= itemWindow
->GetFont(); 
 457   if (font 
&& (name 
== "fontPoints" || name 
== "fontFamily" || name 
== "fontStyle" || name 
== "fontWeight" || name 
== "fontUnderlined" )) 
 459     wxFont 
*newFont 
= SetFontProperty(name
, property
, font
); 
 461       itemWindow
->SetLabelFont(newFont
); 
 464   else if (name 
== "label") 
 466     itemWindow
->SetLabel(property
->GetValue().StringValue()); 
 470     return wxWindowPropertyInfo::SetProperty(name
, property
); 
 473 void wxItemPropertyInfo::GetPropertyNames(wxStringList
& names
) 
 475   wxWindowPropertyInfo::GetPropertyNames(names
); 
 477   names
.Add("fontPoints"); 
 478   names
.Add("fontFamily"); 
 479   names
.Add("fontStyle"); 
 480   names
.Add("fontWeight"); 
 481   names
.Add("fontUnderlined"); 
 484 bool wxItemPropertyInfo::InstantiateResource(wxItemResource 
*resource
) 
 486   wxWindowPropertyInfo::InstantiateResource(resource
); 
 488   wxControl 
*item 
= (wxControl 
*)propertyWindow
; 
 489   wxString 
str(item
->GetLabel()); 
 490   resource
->SetTitle(WXSTRINGCAST str
); 
 491   if (item
->GetFont() && item
->GetFont()->Ok()) 
 492     resource
->SetFont(wxTheFontList
->FindOrCreateFont(item
->GetFont()->GetPointSize(), 
 493                 item
->GetFont()->GetFamily(), item
->GetFont()->GetStyle(), item
->GetFont()->GetWeight(), 
 494                 item
->GetFont()->GetUnderlined(), item
->GetFont()->GetFaceName())); 
 502 wxProperty 
*wxButtonPropertyInfo::GetProperty(wxString
& name
) 
 504   wxButton 
*button 
= (wxButton 
*)propertyWindow
; 
 505   return wxItemPropertyInfo::GetProperty(name
); 
 508 bool wxButtonPropertyInfo::SetProperty(wxString
& name
, wxProperty 
*property
) 
 510   wxButton 
*button 
= (wxButton 
*)propertyWindow
; 
 511   return wxItemPropertyInfo::SetProperty(name
, property
); 
 514 void wxButtonPropertyInfo::GetPropertyNames(wxStringList
& names
) 
 517   wxItemPropertyInfo::GetPropertyNames(names
); 
 520 bool wxButtonPropertyInfo::InstantiateResource(wxItemResource 
*resource
) 
 522   return wxItemPropertyInfo::InstantiateResource(resource
); 
 529 wxProperty 
*wxBitmapButtonPropertyInfo::GetProperty(wxString
& name
) 
 531   wxBitmapButton 
*button 
= (wxBitmapButton 
*)propertyWindow
; 
 534     wxItemResource 
*resource 
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(button
); 
 535     wxString 
str("none.bmp"); 
 539       char *filename 
= wxResourceManager::GetCurrentResourceManager()->FindBitmapFilenameForResource(resource
); 
 543     return new wxProperty("label", str
.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp")); 
 546     return wxButtonPropertyInfo::GetProperty(name
); 
 549 bool wxBitmapButtonPropertyInfo::SetProperty(wxString
& name
, wxProperty 
*property
) 
 551   wxBitmapButton 
*button 
= (wxBitmapButton 
*)propertyWindow
; 
 554     char *s 
= property
->GetValue().StringValue(); 
 555     if (s 
&& wxFileExists(s
)) 
 558       wxBitmap 
*bitmap 
= new wxBitmap(s
, wxBITMAP_TYPE_BMP
); 
 567         wxItemResource 
*resource 
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(button
); 
 570           wxString 
oldResource(resource
->GetValue4()); 
 571           char *resName 
= wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(s
); 
 572           resource
->SetValue4(resName
); 
 574           if (!oldResource
.IsNull()) 
 575             wxResourceManager::GetCurrentResourceManager()->PossiblyDeleteBitmapResource(WXSTRINGCAST oldResource
); 
 578         button
->SetLabel(bitmap
); 
 586     return wxButtonPropertyInfo::SetProperty(name
, property
); 
 589 void wxBitmapButtonPropertyInfo::GetPropertyNames(wxStringList
& names
) 
 591 //  names.Add("label"); 
 592   wxButtonPropertyInfo::GetPropertyNames(names
); 
 595 bool wxBitmapButtonPropertyInfo::InstantiateResource(wxItemResource 
*resource
) 
 597   return wxItemPropertyInfo::InstantiateResource(resource
); 
 604 wxProperty 
*wxStaticTextPropertyInfo::GetProperty(wxString
& name
) 
 606   wxStaticText 
*message 
= (wxStaticText 
*)propertyWindow
; 
 607   return wxItemPropertyInfo::GetProperty(name
); 
 610 bool wxStaticTextPropertyInfo::SetProperty(wxString
& name
, wxProperty 
*property
) 
 612   wxStaticText 
*message 
= (wxStaticText 
*)propertyWindow
; 
 613   return wxItemPropertyInfo::SetProperty(name
, property
); 
 616 void wxStaticTextPropertyInfo::GetPropertyNames(wxStringList
& names
) 
 619   wxItemPropertyInfo::GetPropertyNames(names
); 
 622 bool wxStaticTextPropertyInfo::InstantiateResource(wxItemResource 
*resource
) 
 624   return wxItemPropertyInfo::InstantiateResource(resource
); 
 631 wxProperty 
*wxStaticBitmapPropertyInfo::GetProperty(wxString
& name
) 
 633   wxStaticBitmap 
*message 
= (wxStaticBitmap 
*)propertyWindow
; 
 636     wxItemResource 
*resource 
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(message
); 
 637     wxString 
str("none.bmp"); 
 641       char *filename 
= wxResourceManager::GetCurrentResourceManager()->FindBitmapFilenameForResource(resource
); 
 645     return new wxProperty("label", str
.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp")); 
 648     return wxItemPropertyInfo::GetProperty(name
); 
 651 bool wxStaticBitmapPropertyInfo::SetProperty(wxString
& name
, wxProperty 
*property
) 
 653   wxStaticBitmap 
*message 
= (wxStaticBitmap 
*)propertyWindow
; 
 656     char *s 
= property
->GetValue().StringValue(); 
 657     if (s 
&& wxFileExists(s
)) 
 661       wxBitmap 
*bitmap 
= new wxBitmap(s
, wxBITMAP_TYPE_BMP
); 
 670         wxItemResource 
*resource 
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(message
); 
 673           wxString 
oldResource(resource
->GetValue4()); 
 674           char *resName 
= wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(s
); 
 675           resource
->SetValue4(resName
); 
 677           if (!oldResource
.IsNull()) 
 678             wxResourceManager::GetCurrentResourceManager()->PossiblyDeleteBitmapResource(WXSTRINGCAST oldResource
); 
 681         message
->SetBitmap(bitmap
); 
 689     return wxItemPropertyInfo::SetProperty(name
, property
); 
 692 void wxStaticBitmapPropertyInfo::GetPropertyNames(wxStringList
& names
) 
 695   wxItemPropertyInfo::GetPropertyNames(names
); 
 698 bool wxStaticBitmapPropertyInfo::InstantiateResource(wxItemResource 
*resource
) 
 700   return wxItemPropertyInfo::InstantiateResource(resource
); 
 707 wxProperty 
*wxTextPropertyInfo::GetProperty(wxString
& name
) 
 709   wxTextCtrl 
*text 
= (wxTextCtrl 
*)propertyWindow
; 
 711     return new wxProperty("value", text
->GetValue(), "string"); 
 712   else if (name 
== "password") 
 714     bool isPassword 
= ((text
->GetWindowStyleFlag() & wxTE_PASSWORD
) == wxTE_PASSWORD
); 
 715     return new wxProperty("password", isPassword
, "bool"); 
 717   else if (name 
== "readonly") 
 719     bool isReadOnly 
= ((text
->GetWindowStyleFlag() & wxTE_READONLY
) == wxTE_READONLY
); 
 720     return new wxProperty("readonly", isReadOnly
, "bool"); 
 723     return wxItemPropertyInfo::GetProperty(name
); 
 726 bool wxTextPropertyInfo::SetProperty(wxString
& name
, wxProperty 
*property
) 
 728   wxTextCtrl 
*text 
= (wxTextCtrl 
*)propertyWindow
; 
 731     text
->SetValue(property
->GetValue().StringValue()); 
 734   else if (name 
== "password") 
 736     long flag 
= text
->GetWindowStyleFlag(); 
 737     if (property
->GetValue().BoolValue()) 
 739       if ((flag 
& wxTE_PASSWORD
) != wxTE_PASSWORD
) 
 740         flag 
|= wxTE_PASSWORD
; 
 744       if ((flag 
& wxTE_PASSWORD
) == wxTE_PASSWORD
) 
 745         flag 
-= wxTE_PASSWORD
; 
 747     wxItemResource 
*resource 
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(text
); 
 748     resource
->SetStyle(flag
); 
 750     wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(text
, this); 
 753   else if (name 
== "readonly") 
 755     long flag 
= text
->GetWindowStyleFlag(); 
 756     if (property
->GetValue().BoolValue()) 
 758       if ((flag 
& wxTE_READONLY
) != wxTE_READONLY
) 
 759         flag 
|= wxTE_READONLY
; 
 763       if ((flag 
& wxTE_READONLY
) == wxTE_READONLY
) 
 764         flag 
-= wxTE_READONLY
; 
 766     wxItemResource 
*resource 
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(text
); 
 767     resource
->SetStyle(flag
); 
 769     wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(text
, this); 
 773     return wxItemPropertyInfo::SetProperty(name
, property
); 
 776 void wxTextPropertyInfo::GetPropertyNames(wxStringList
& names
) 
 779   names
.Add("readonly"); 
 780   names
.Add("password"); 
 781   wxItemPropertyInfo::GetPropertyNames(names
);   
 784 bool wxTextPropertyInfo::InstantiateResource(wxItemResource 
*resource
) 
 786   wxTextCtrl 
*text 
= (wxTextCtrl 
*)propertyWindow
; 
 787   wxString 
str(text
->GetValue()); 
 788   resource
->SetValue4(WXSTRINGCAST str
); 
 790   return wxItemPropertyInfo::InstantiateResource(resource
); 
 797 wxProperty 
*wxListBoxPropertyInfo::GetProperty(wxString
& name
) 
 799   wxListBox 
*listBox 
= (wxListBox 
*)propertyWindow
; 
 800   if (name 
== "values") 
 802     wxStringList 
*stringList 
= new wxStringList
; 
 804     for (i 
= 0; i 
< listBox
->Number(); i
++) 
 805       stringList
->Add(listBox
->GetString(i
)); 
 807     return new wxProperty(name
, stringList
, "stringlist"); 
 809   else if (name 
== "multiple") 
 812     wxItemResource 
*resource 
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(listBox
); 
 816     char *mult 
= "wxSINGLE"; 
 818     switch (resource
->GetValue1()) 
 821         mult 
= "wxLB_MULTIPLE"; 
 824         mult 
= "wxLB_EXTENDED"; 
 828         mult 
= "wxLB_SINGLE"; 
 831     return new wxProperty("multiple", mult
, "string", 
 832        new wxStringListValidator(new wxStringList("wxLB_SINGLE", "wxLB_MULTIPLE", "wxLB_EXTENDED", 
 836     return wxItemPropertyInfo::GetProperty(name
); 
 839 bool wxListBoxPropertyInfo::SetProperty(wxString
& name
, wxProperty 
*property
) 
 841   wxListBox 
*listBox 
= (wxListBox 
*)propertyWindow
; 
 842   if (name 
== "values") 
 845     wxPropertyValue 
*expr 
= property
->GetValue().GetFirst(); 
 848       char *s 
= expr
->StringValue(); 
 851       expr 
= expr
->GetNext(); 
 855   else if (name 
== "multiple") 
 857     int mult 
= wxLB_SINGLE
; 
 858     wxString 
str(property
->GetValue().StringValue()); 
 859     if (str 
== "wxLB_MULTIPLE") 
 860       mult 
= wxLB_MULTIPLE
; 
 861     else if (str 
== "wxLB_EXTENDED") 
 862       mult 
= wxLB_EXTENDED
; 
 865     wxItemResource 
*resource 
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(listBox
); 
 867       resource
->SetValue1(mult
); 
 868     wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(listBox
, this); 
 872     return wxItemPropertyInfo::SetProperty(name
, property
); 
 875 void wxListBoxPropertyInfo::GetPropertyNames(wxStringList
& names
) 
 878   names
.Add("multiple"); 
 879   wxItemPropertyInfo::GetPropertyNames(names
);   
 882 bool wxListBoxPropertyInfo::InstantiateResource(wxItemResource 
*resource
) 
 884   wxListBox 
*lbox 
= (wxListBox 
*)propertyWindow
; 
 885   // This will be set for the wxItemResource on reading or in SetProperty 
 886 //  resource->SetValue1(lbox->GetSelectionMode()); 
 888   if (lbox
->Number() == 0) 
 889     resource
->SetStringValues(NULL
); 
 892     wxStringList 
*slist 
= new wxStringList
; 
 894     for (i 
= 0; i 
< lbox
->Number(); i
++) 
 895       slist
->Add(lbox
->GetString(i
)); 
 897     resource
->SetStringValues(slist
); 
 899   return wxItemPropertyInfo::InstantiateResource(resource
); 
 906 wxProperty 
*wxChoicePropertyInfo::GetProperty(wxString
& name
) 
 908   wxChoice 
*choice 
= (wxChoice 
*)propertyWindow
; 
 909   if (name 
== "values") 
 911     wxStringList 
*stringList 
= new wxStringList
; 
 913     for (i 
= 0; i 
< choice
->Number(); i
++) 
 914       stringList
->Add(choice
->GetString(i
)); 
 916     return new wxProperty(name
, stringList
, "stringlist"); 
 919     return wxItemPropertyInfo::GetProperty(name
); 
 922 bool wxChoicePropertyInfo::SetProperty(wxString
& name
, wxProperty 
*property
) 
 924   wxChoice 
*choice 
= (wxChoice 
*)propertyWindow
; 
 925   if (name 
== "values") 
 928     wxPropertyValue 
*expr 
= property
->GetValue().GetFirst(); 
 931       char *s 
= expr
->StringValue(); 
 934       expr 
= expr
->GetNext(); 
 936     if (choice
->Number() > 0) 
 937       choice
->SetSelection(0); 
 941     return wxItemPropertyInfo::SetProperty(name
, property
); 
 944 void wxChoicePropertyInfo::GetPropertyNames(wxStringList
& names
) 
 947   wxItemPropertyInfo::GetPropertyNames(names
); 
 950 bool wxChoicePropertyInfo::InstantiateResource(wxItemResource 
*resource
) 
 952   wxChoice 
*choice 
= (wxChoice 
*)propertyWindow
; 
 954   if (choice
->Number() == 0) 
 955     resource
->SetStringValues(NULL
); 
 958     wxStringList 
*slist 
= new wxStringList
; 
 960     for (i 
= 0; i 
< choice
->Number(); i
++) 
 961       slist
->Add(choice
->GetString(i
)); 
 963     resource
->SetStringValues(slist
); 
 965   return wxItemPropertyInfo::InstantiateResource(resource
); 
 972 wxProperty 
*wxRadioBoxPropertyInfo::GetProperty(wxString
& name
) 
 974   wxRadioBox 
*radioBox 
= (wxRadioBox 
*)propertyWindow
; 
 975   if (name 
== "numberRowsOrCols") 
 977     return new wxProperty("numberRowsOrCols", (long)radioBox
->GetNumberOfRowsOrCols(), "integer"); 
 979   if (name 
== "orientation") 
 982     if (propertyWindow
->GetWindowStyleFlag() & wxHORIZONTAL
) 
 983       pos 
= "wxHORIZONTAL"; 
 987     return new wxProperty("orientation", pos
, "string", 
 988        new wxStringListValidator(new wxStringList("wxHORIZONTAL", "wxVERTICAL", 
 991   else if (name 
== "values") 
 993     wxStringList 
*stringList 
= new wxStringList
; 
 995     for (i 
= 0; i 
< radioBox
->Number(); i
++) 
 996       stringList
->Add(radioBox
->GetString(i
)); 
 998     return new wxProperty(name
, stringList
, "stringlist"); 
1000   return wxItemPropertyInfo::GetProperty(name
); 
1003 bool wxRadioBoxPropertyInfo::SetProperty(wxString
& name
, wxProperty 
*property
) 
1005   wxRadioBox 
*radioBox 
= (wxRadioBox 
*)propertyWindow
; 
1006   if (name 
== "numberRowsOrCols") 
1008     radioBox
->SetNumberOfRowsOrCols((int)property
->GetValue().IntegerValue()); 
1009     wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox
, this); 
1012   else if (name 
== "orientation") 
1014     long windowStyle 
= radioBox
->GetWindowStyleFlag(); 
1015     wxString 
val(property
->GetValue().StringValue()); 
1016     if (val 
== "wxHORIZONTAL") 
1018       if (windowStyle 
& wxVERTICAL
) 
1019         windowStyle 
-= wxVERTICAL
; 
1020       windowStyle 
|= wxHORIZONTAL
; 
1024       if (windowStyle 
& wxHORIZONTAL
) 
1025         windowStyle 
-= wxHORIZONTAL
; 
1026       windowStyle 
|= wxVERTICAL
; 
1028     radioBox
->SetWindowStyleFlag(windowStyle
); 
1030     wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox
, this); 
1033   else if (name 
== "values") 
1035     // Set property into *resource*, not wxRadioBox, and then recreate 
1036     // the wxRadioBox. This is because we can't dynamically set the strings 
1038     wxItemResource 
*resource 
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(propertyWindow
); 
1042     wxStringList 
*stringList 
= resource
->GetStringValues(); 
1045       stringList 
= new wxStringList
; 
1046       resource
->SetStringValues(stringList
); 
1048     stringList
->Clear(); 
1050     wxPropertyValue 
*expr 
= property
->GetValue().GetFirst(); 
1053       char *s 
= expr
->StringValue(); 
1056       expr 
= expr
->GetNext(); 
1058     wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox
, this); 
1061   return wxItemPropertyInfo::SetProperty(name
, property
); 
1064 void wxRadioBoxPropertyInfo::GetPropertyNames(wxStringList
& names
) 
1067   names
.Add("values"); 
1068   names
.Add("orientation"); 
1069   names
.Add("numberRowsOrCols"); 
1070   wxItemPropertyInfo::GetPropertyNames(names
); 
1073 bool wxRadioBoxPropertyInfo::InstantiateResource(wxItemResource 
*resource
) 
1075   wxRadioBox 
*rbox 
= (wxRadioBox 
*)propertyWindow
; 
1076   // Take strings from resource instead 
1079   if (rbox->Number() == 0) 
1080     resource->SetStringValues(NULL); 
1083     wxStringList *slist = new wxStringList; 
1085     for (i = 0; i < rbox->Number(); i++) 
1086       slist->Add(rbox->GetString(i)); 
1088     resource->SetStringValues(slist); 
1091   resource
->SetValue1(rbox
->GetNumberOfRowsOrCols()); 
1092   return wxItemPropertyInfo::InstantiateResource(resource
); 
1099 wxProperty 
*wxGroupBoxPropertyInfo::GetProperty(wxString
& name
) 
1101   wxStaticBox 
*groupBox 
= (wxStaticBox 
*)propertyWindow
; 
1102   return wxItemPropertyInfo::GetProperty(name
); 
1105 bool wxGroupBoxPropertyInfo::SetProperty(wxString
& name
, wxProperty 
*property
) 
1107   return wxItemPropertyInfo::SetProperty(name
, property
); 
1110 void wxGroupBoxPropertyInfo::GetPropertyNames(wxStringList
& names
) 
1113   wxItemPropertyInfo::GetPropertyNames(names
); 
1116 bool wxGroupBoxPropertyInfo::InstantiateResource(wxItemResource 
*resource
) 
1118   wxStaticBox 
*gbox 
= (wxStaticBox 
*)propertyWindow
; 
1119   return wxItemPropertyInfo::InstantiateResource(resource
); 
1126 wxProperty 
*wxCheckBoxPropertyInfo::GetProperty(wxString
& name
) 
1128   wxCheckBox 
*checkBox 
= (wxCheckBox 
*)propertyWindow
; 
1129   if (name 
== "value") 
1130     return new wxProperty("value", checkBox
->GetValue(), "bool"); 
1132     return wxItemPropertyInfo::GetProperty(name
); 
1135 bool wxCheckBoxPropertyInfo::SetProperty(wxString
& name
, wxProperty 
*property
) 
1137   wxCheckBox 
*checkBox 
= (wxCheckBox 
*)propertyWindow
; 
1138   if (name 
== "value") 
1140     checkBox
->SetValue((bool)property
->GetValue().BoolValue()); 
1144     return wxItemPropertyInfo::SetProperty(name
, property
); 
1147 void wxCheckBoxPropertyInfo::GetPropertyNames(wxStringList
& names
) 
1151   wxItemPropertyInfo::GetPropertyNames(names
); 
1154 bool wxCheckBoxPropertyInfo::InstantiateResource(wxItemResource 
*resource
) 
1156   wxCheckBox 
*cbox 
= (wxCheckBox 
*)propertyWindow
; 
1157   resource
->SetValue1(cbox
->GetValue()); 
1158   return wxItemPropertyInfo::InstantiateResource(resource
); 
1165 wxProperty 
*wxRadioButtonPropertyInfo::GetProperty(wxString
& name
) 
1167   wxRadioButton 
*checkBox 
= (wxRadioButton 
*)propertyWindow
; 
1168   if (name 
== "value") 
1169     return new wxProperty("value", checkBox
->GetValue(), "bool"); 
1171     return wxItemPropertyInfo::GetProperty(name
); 
1174 bool wxRadioButtonPropertyInfo::SetProperty(wxString
& name
, wxProperty 
*property
) 
1176   wxRadioButton 
*checkBox 
= (wxRadioButton 
*)propertyWindow
; 
1177   if (name 
== "value") 
1179     checkBox
->SetValue((bool)property
->GetValue().BoolValue()); 
1183     return wxItemPropertyInfo::SetProperty(name
, property
); 
1186 void wxRadioButtonPropertyInfo::GetPropertyNames(wxStringList
& names
) 
1190   wxItemPropertyInfo::GetPropertyNames(names
); 
1193 bool wxRadioButtonPropertyInfo::InstantiateResource(wxItemResource 
*resource
) 
1195   wxRadioButton 
*cbox 
= (wxRadioButton 
*)propertyWindow
; 
1196   resource
->SetValue1(cbox
->GetValue()); 
1197   return wxItemPropertyInfo::InstantiateResource(resource
); 
1204 wxProperty 
*wxSliderPropertyInfo::GetProperty(wxString
& name
) 
1206   wxSlider 
*slider 
= (wxSlider 
*)propertyWindow
; 
1207   if (name 
== "value") 
1208     return new wxProperty("value", (long)slider
->GetValue(), "integer"); 
1209   else if (name 
== "orientation") 
1212     if (propertyWindow
->GetWindowStyleFlag() & wxHORIZONTAL
) 
1213       pos 
= "wxHORIZONTAL"; 
1217     return new wxProperty("orientation", pos
, "string", 
1218        new wxStringListValidator(new wxStringList("wxHORIZONTAL", "wxVERTICAL", 
1221   else if (name 
== "min_value") 
1222     return new wxProperty("min_value", (long)slider
->GetMin(), "integer"); 
1223   else if (name 
== "max_value") 
1224     return new wxProperty("max_value", (long)slider
->GetMax(), "integer"); 
1226     return wxItemPropertyInfo::GetProperty(name
); 
1229 bool wxSliderPropertyInfo::SetProperty(wxString
& name
, wxProperty 
*property
) 
1231   wxSlider 
*slider 
= (wxSlider 
*)propertyWindow
; 
1232   if (name 
== "value") 
1234     slider
->SetValue((int)property
->GetValue().IntegerValue()); 
1237   else if (name 
== "orientation") 
1239     long windowStyle 
= slider
->GetWindowStyleFlag(); 
1240     long oldWindowStyle 
= windowStyle
; 
1241     wxString 
val(property
->GetValue().StringValue()); 
1242     if (val 
== "wxHORIZONTAL") 
1244       if (windowStyle 
& wxVERTICAL
) 
1245         windowStyle 
-= wxVERTICAL
; 
1246       windowStyle 
|= wxHORIZONTAL
; 
1250       if (windowStyle 
& wxHORIZONTAL
) 
1251         windowStyle 
-= wxHORIZONTAL
; 
1252       windowStyle 
|= wxVERTICAL
; 
1255     if (oldWindowStyle 
== windowStyle
) 
1258     slider
->SetWindowStyleFlag(windowStyle
); 
1260     // If the window style has changed, we swap the width and height parameters. 
1262     slider
->GetSize(&w
, &h
); 
1264     slider 
= (wxSlider 
*)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(slider
, this); 
1265     slider
->SetSize(-1, -1, h
, w
); 
1269   else if (name 
== "min_value") 
1271     slider
->SetRange((int)property
->GetValue().IntegerValue(), slider
->GetMax()); 
1274   else if (name 
== "max_value") 
1276     slider
->SetRange(slider
->GetMin(), (int)property
->GetValue().IntegerValue()); 
1280     return wxItemPropertyInfo::SetProperty(name
, property
); 
1283 void wxSliderPropertyInfo::GetPropertyNames(wxStringList
& names
) 
1286   names
.Add("orientation"); 
1287   names
.Add("min_value"); 
1288   names
.Add("max_value"); 
1289   wxItemPropertyInfo::GetPropertyNames(names
); 
1292 bool wxSliderPropertyInfo::InstantiateResource(wxItemResource 
*resource
) 
1294   wxSlider 
*slider 
= (wxSlider 
*)propertyWindow
; 
1295   resource
->SetValue1(slider
->GetValue()); 
1296   resource
->SetValue2(slider
->GetMin()); 
1297   resource
->SetValue3(slider
->GetMax()); 
1298   return wxItemPropertyInfo::InstantiateResource(resource
); 
1305 wxProperty 
*wxGaugePropertyInfo::GetProperty(wxString
& name
) 
1307   wxGauge 
*gauge 
= (wxGauge 
*)propertyWindow
; 
1308   if (name 
== "value") 
1309     return new wxProperty("value", (long)gauge
->GetValue(), "integer"); 
1310   else if (name 
== "max_value") 
1311     return new wxProperty("max_value", (long)gauge
->GetRange(), "integer"); 
1313     return wxItemPropertyInfo::GetProperty(name
); 
1316 bool wxGaugePropertyInfo::SetProperty(wxString
& name
, wxProperty 
*property
) 
1318   wxGauge 
*gauge 
= (wxGauge 
*)propertyWindow
; 
1319   if (name 
== "value") 
1321     gauge
->SetValue((int)property
->GetValue().IntegerValue()); 
1324   else if (name 
== "max_value") 
1326     gauge
->SetRange((int)property
->GetValue().IntegerValue()); 
1330     return wxItemPropertyInfo::SetProperty(name
, property
); 
1333 void wxGaugePropertyInfo::GetPropertyNames(wxStringList
& names
) 
1336   names
.Add("max_value"); 
1337   wxItemPropertyInfo::GetPropertyNames(names
); 
1340 bool wxGaugePropertyInfo::InstantiateResource(wxItemResource 
*resource
) 
1342   wxGauge 
*gauge 
= (wxGauge 
*)propertyWindow
; 
1343   resource
->SetValue1(gauge
->GetValue()); 
1344   resource
->SetValue2(gauge
->GetRange()); 
1345   return wxItemPropertyInfo::InstantiateResource(resource
); 
1352 wxProperty 
*wxScrollBarPropertyInfo::GetProperty(wxString
& name
) 
1354   wxScrollBar 
*scrollBar 
= (wxScrollBar 
*)propertyWindow
; 
1355   if (name 
== "value") 
1356     return new wxProperty("value", (long)scrollBar
->GetValue(), "integer"); 
1357   else if (name 
== "orientation") 
1360     if (propertyWindow
->GetWindowStyleFlag() & wxHORIZONTAL
) 
1361       pos 
= "wxHORIZONTAL"; 
1365     return new wxProperty("orientation", pos
, "string", 
1366        new wxStringListValidator(new wxStringList("wxHORIZONTAL", "wxVERTICAL", 
1369   else if (name 
== "pageSize") 
1371     int viewStart
, pageLength
, objectLength
, viewLength
; 
1372     scrollBar
->GetValues(&viewStart
, &viewLength
, &objectLength
, &pageLength
); 
1374     return new wxProperty("pageSize", (long)pageLength
, "integer"); 
1376   else if (name 
== "viewLength") 
1378     int viewStart
, pageLength
, objectLength
, viewLength
; 
1379     scrollBar
->GetValues(&viewStart
, &viewLength
, &objectLength
, &pageLength
); 
1381     return new wxProperty("viewLength", (long)viewLength
, "integer"); 
1383   else if (name 
== "objectLength") 
1385     int viewStart
, pageLength
, objectLength
, viewLength
; 
1386     scrollBar
->GetValues(&viewStart
, &viewLength
, &objectLength
, &pageLength
); 
1388     return new wxProperty("objectLength", (long)objectLength
, "integer"); 
1391     return wxItemPropertyInfo::GetProperty(name
); 
1394 bool wxScrollBarPropertyInfo::SetProperty(wxString
& name
, wxProperty 
*property
) 
1396   wxScrollBar 
*scrollBar 
= (wxScrollBar 
*)propertyWindow
; 
1397   if (name 
== "value") 
1399     scrollBar
->SetValue((int)property
->GetValue().IntegerValue()); 
1402   else if (name 
== "orientation") 
1404     long windowStyle 
= scrollBar
->GetWindowStyleFlag(); 
1405     long oldWindowStyle 
= windowStyle
; 
1406     wxString 
val(property
->GetValue().StringValue()); 
1407     if (val 
== "wxHORIZONTAL") 
1409       if (windowStyle 
& wxVERTICAL
) 
1410         windowStyle 
-= wxVERTICAL
; 
1411       windowStyle 
|= wxHORIZONTAL
; 
1415       if (windowStyle 
& wxHORIZONTAL
) 
1416         windowStyle 
-= wxHORIZONTAL
; 
1417       windowStyle 
|= wxVERTICAL
; 
1420     if (oldWindowStyle 
== windowStyle
) 
1423     scrollBar
->SetWindowStyleFlag(windowStyle
); 
1425     // If the window style has changed, we swap the width and height parameters. 
1427     scrollBar
->GetSize(&w
, &h
); 
1429     scrollBar 
= (wxScrollBar 
*)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(scrollBar
, this); 
1430     scrollBar
->SetSize(-1, -1, h
, w
); 
1434   else if (name 
== "pageSize") 
1436     scrollBar
->SetPageSize((int)property
->GetValue().IntegerValue()); 
1439   else if (name 
== "viewLength") 
1441     scrollBar
->SetViewLength((int)property
->GetValue().IntegerValue()); 
1444   else if (name 
== "objectLength") 
1446     scrollBar
->SetObjectLength((int)property
->GetValue().IntegerValue()); 
1450     return wxItemPropertyInfo::SetProperty(name
, property
); 
1453 void wxScrollBarPropertyInfo::GetPropertyNames(wxStringList
& names
) 
1455   names
.Add("orientation"); 
1457   names
.Add("pageSize"); 
1458   names
.Add("viewLength"); 
1459   names
.Add("objectLength"); 
1460   wxItemPropertyInfo::GetPropertyNames(names
); 
1462   // Remove some properties we don't inherit 
1463   names
.Delete("fontPoints"); 
1464   names
.Delete("fontFamily"); 
1465   names
.Delete("fontStyle"); 
1466   names
.Delete("fontWeight"); 
1467   names
.Delete("fontUnderlined"); 
1470 bool wxScrollBarPropertyInfo::InstantiateResource(wxItemResource 
*resource
) 
1472   wxScrollBar 
*sbar 
= (wxScrollBar 
*)propertyWindow
; 
1474   resource
->SetValue1(sbar
->GetValue()); 
1476   int viewStart
, pageLength
, objectLength
, viewLength
; 
1477   sbar
->GetValues(&viewStart
, &viewLength
, &objectLength
, &pageLength
); 
1479   resource
->SetValue2(pageLength
); 
1480   resource
->SetValue3(objectLength
); 
1481   resource
->SetValue5(viewLength
); 
1483   return wxItemPropertyInfo::InstantiateResource(resource
); 
1490 wxProperty 
*wxPanelPropertyInfo::GetProperty(wxString
& name
) 
1492   wxPanel 
*panelWindow 
= (wxPanel 
*)propertyWindow
;  
1493   wxFont 
*labelFont 
= panelWindow
->GetLabelFont(); 
1494   wxFont 
*buttonFont 
= panelWindow
->GetButtonFont(); 
1496   if (name 
== "labelFontPoints" || name 
== "labelFontFamily" || name 
== "labelFontStyle" || name 
== "labelFontWeight" || 
1497       name 
== "labelFontUnderlined") 
1498     return GetFontProperty(name
, labelFont
); 
1499   else if (name 
== "buttonFontPoints" || name 
== "buttonFontFamily" || name 
== "buttonFontStyle" || name 
== "buttonFontWeight" || 
1500       name 
== "buttonFontUnderlined") 
1501     return GetFontProperty(name
, buttonFont
); 
1502   else if (name 
== "no3D") 
1505     if (panelWindow
->GetWindowStyleFlag() & wxNO_3D
) 
1508       userColours 
= FALSE
; 
1510     return new wxProperty(name
, (bool)userColours
, "bool"); 
1512   else if (name 
== "backgroundColour") 
1514     wxColour 
col(panelWindow
->GetBackgroundColour()); 
1516     wxDecToHex(col
.Red(), buf
); 
1517     wxDecToHex(col
.Green(), buf
+2); 
1518     wxDecToHex(col
.Blue(), buf
+4); 
1520     return new wxProperty(name
, buf
, "string", new wxColourListValidator
); 
1522   else if (name 
== "title") 
1524     wxItemResource 
*resource 
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow
); 
1526         return new wxProperty(name
, resource
->GetTitle(), "string"); 
1528         return new wxProperty(name
, "Could not get title", "string"); 
1531     return wxWindowPropertyInfo::GetProperty(name
); 
1534 bool wxPanelPropertyInfo::SetProperty(wxString
& name
, wxProperty 
*property
) 
1536   wxPanel 
*panelWindow 
= (wxPanel 
*)propertyWindow
;  
1537   wxFont 
*labelFont 
= panelWindow
->GetLabelFont(); 
1538   wxFont 
*buttonFont 
= panelWindow
->GetButtonFont(); 
1540   if (labelFont 
&& (name 
== "labelFontPoints" || name 
== "labelFontFamily" || name 
== "labelFontStyle" || name 
== "labelFontWeight" || name 
== "labelFontUnderlined" )) 
1542     wxFont 
*newFont 
= SetFontProperty(name
, property
, labelFont
); 
1544       panelWindow
->SetLabelFont(newFont
); 
1547   else if (buttonFont 
&& (name 
== "buttonFontPoints" || name 
== "buttonFontFamily" || name 
== "buttonFontStyle" || name 
== "buttonFontWeight" || name 
== "buttonFontUnderlined" )) 
1549     wxFont 
*newFont 
= SetFontProperty(name
, property
, buttonFont
); 
1551       panelWindow
->SetButtonFont(newFont
); 
1554   else if (name 
== "no3D") 
1556     bool userColours 
= property
->GetValue().BoolValue(); 
1557     long flag 
= panelWindow
->GetWindowStyleFlag(); 
1561       if ((panelWindow
->GetWindowStyleFlag() & wxNO_3D
) != wxNO_3D
) 
1562         panelWindow
->SetWindowStyleFlag(panelWindow
->GetWindowStyleFlag() | wxNO_3D
); 
1566       if ((panelWindow
->GetWindowStyleFlag() & wxNO_3D
) == wxNO_3D
) 
1567         panelWindow
->SetWindowStyleFlag(panelWindow
->GetWindowStyleFlag() - wxNO_3D
); 
1569     wxItemResource 
*resource 
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow
); 
1570     resource
->SetStyle(panelWindow
->GetWindowStyleFlag()); 
1572     panelWindow 
= (wxPanel 
*)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(panelWindow
, this); 
1575   else if (name 
== "backgroundColour") 
1577     char *hex 
= property
->GetValue().StringValue(); 
1578     int r 
= wxHexToDec(hex
); 
1579     int g 
= wxHexToDec(hex
+2); 
1580     int b 
= wxHexToDec(hex
+4); 
1582     wxColour 
col(r
,g
,b
); 
1583     panelWindow
->SetBackgroundColour(col
); 
1584     panelWindow 
= (wxPanel 
*)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(panelWindow
, this); 
1587   else if (name 
== "title") 
1589     wxItemResource 
*resource 
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow
); 
1592         resource
->SetTitle(property
->GetValue().StringValue()); 
1599     return wxWindowPropertyInfo::SetProperty(name
, property
); 
1602 void wxPanelPropertyInfo::GetPropertyNames(wxStringList
& names
) 
1604   wxWindowPropertyInfo::GetPropertyNames(names
); 
1608   names
.Add("backgroundColour"); 
1611 bool wxPanelPropertyInfo::InstantiateResource(wxItemResource 
*resource
) 
1613   wxPanel 
*panel 
= (wxPanel 
*)propertyWindow
; 
1614   if (panel
->GetFont()) 
1615     resource
->SetFont(wxTheFontList
->FindOrCreateFont(panel
->GetFont()->GetPointSize(), 
1616                 panel
->GetFont()->GetFamily(), panel
->GetFont()->GetStyle(), panel
->GetFont()->GetWeight(), 
1617                 panel
->GetFont()->GetUnderlined(), panel
->GetFont()->GetFaceName())); 
1619   resource
->SetBackgroundColour(new wxColour(panel
->GetBackgroundColour())); 
1621   return wxWindowPropertyInfo::InstantiateResource(resource
); 
1629 wxProperty 
*wxDialogPropertyInfo::GetProperty(wxString
& name
) 
1631   wxDialog 
*dialogWindow 
= (wxDialog 
*)propertyWindow
;  
1632   if (name 
== "modal") 
1634     wxItemResource 
*resource 
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(dialogWindow
); 
1638     bool modal 
= (resource
->GetValue1() != 0); 
1639     return new wxProperty(name
, modal
, "bool"); 
1642     return wxPanelPropertyInfo::GetProperty(name
); 
1645 bool wxDialogPropertyInfo::SetProperty(wxString
& name
, wxProperty 
*property
) 
1647   wxDialog 
*dialogWindow 
= (wxDialog 
*)propertyWindow
; 
1649   if (name 
== "modal") 
1651     wxItemResource 
*resource 
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(dialogWindow
); 
1655     resource
->SetValue1(property
->GetValue().BoolValue()); 
1659     return wxPanelPropertyInfo::SetProperty(name
, property
); 
1662 void wxDialogPropertyInfo::GetPropertyNames(wxStringList
& names
) 
1667   wxPanelPropertyInfo::GetPropertyNames(names
); 
1670 bool wxDialogPropertyInfo::InstantiateResource(wxItemResource 
*resource
) 
1672   wxDialog 
*dialog 
= (wxDialog 
*)propertyWindow
; 
1673   wxString 
str(dialog
->GetTitle()); 
1674   resource
->SetTitle(WXSTRINGCAST str
); 
1676   return wxPanelPropertyInfo::InstantiateResource(resource
); 
1684 int wxStringToFontWeight(wxString
& val
) 
1686   if (val 
== "wxBOLD") return wxBOLD
; 
1687   else if (val 
== "wxLIGHT") return wxLIGHT
; 
1688   else return wxNORMAL
; 
1691 int wxStringToFontStyle(wxString
& val
) 
1693   if (val 
== "wxITALIC") return wxITALIC
; 
1694   else if (val 
== "wxSLANT") return wxSLANT
; 
1695   else return wxNORMAL
; 
1698 int wxStringToFontFamily(wxString
& val
) 
1700   if (val 
== "wxDECORATIVE") return wxDECORATIVE
; 
1701   else if (val 
== "wxROMAN") return wxROMAN
; 
1702   else if (val 
== "wxSCRIPT") return wxSCRIPT
; 
1703   else if (val 
== "wxMODERN") return wxMODERN
; 
1704   else if (val 
== "wxTELETYPE") return wxTELETYPE
; 
1705   else return wxSWISS
; 
1709 /// Resource symbol validator 
1711 IMPLEMENT_DYNAMIC_CLASS(wxResourceSymbolValidator
, wxPropertyListValidator
) 
1713 wxResourceSymbolValidator::wxResourceSymbolValidator(long flags
): 
1714   wxPropertyListValidator(flags
) 
1718 wxResourceSymbolValidator::~wxResourceSymbolValidator(void) 
1722 bool wxResourceSymbolValidator::OnCheckValue(wxProperty 
*property
, wxPropertyListView 
*view
, wxWindow 
*parentWindow
) 
1727 // Called when TICK is pressed or focus is lost or view wants to update 
1728 // the property list. 
1729 // Does the transferance from the property editing area to the property itself 
1730 bool wxResourceSymbolValidator::OnRetrieveValue(wxProperty 
*property
, wxPropertyListView 
*view
, wxWindow 
*parentWindow
) 
1732   if (!view
->GetValueText()) 
1734   wxString 
value(view
->GetValueText()->GetValue()); 
1735   property
->GetValue() = value 
; 
1739 // Called when TICK is pressed or focus is lost or view wants to update 
1740 // the property list. 
1741 // Does the transferance from the property editing area to the property itself 
1742 bool wxResourceSymbolValidator::OnDisplayValue(wxProperty 
*property
, wxPropertyListView 
*view
, wxWindow 
*parentWindow
) 
1744   if (!view
->GetValueText()) 
1746   wxString 
str(property
->GetValue().GetStringRepresentation()); 
1747   view
->GetValueText()->SetValue(str
); 
1751 // Called when the property is double clicked. Extra functionality can be provided, 
1752 // cycling through possible values. 
1753 bool wxResourceSymbolValidator::OnDoubleClick(wxProperty 
*property
, wxPropertyListView 
*view
, wxWindow 
*parentWindow
) 
1755   if (!view
->GetValueText()) 
1757   OnEdit(property
, view
, parentWindow
); 
1761 bool wxResourceSymbolValidator::OnPrepareControls(wxProperty 
*property
, wxPropertyListView 
*view
, wxWindow 
*parentWindow
) 
1763   if (view
->GetConfirmButton()) 
1764     view
->GetConfirmButton()->Enable(TRUE
); 
1765   if (view
->GetCancelButton()) 
1766     view
->GetCancelButton()->Enable(TRUE
); 
1767   if (view
->GetEditButton()) 
1768     view
->GetEditButton()->Enable(TRUE
); 
1769   if (view
->GetValueText()) 
1770     view
->GetValueText()->Enable((GetFlags() & wxPROP_ALLOW_TEXT_EDITING
) == wxPROP_ALLOW_TEXT_EDITING
); 
1774 void wxResourceSymbolValidator::OnEdit(wxProperty 
*property
, wxPropertyListView 
*view
, wxWindow 
*parentWindow
) 
1776   if (!view
->GetValueText()) 
1779   wxResourceSymbolDialog
* dialog 
= new wxResourceSymbolDialog(parentWindow
, -1, "Edit Symbol"); 
1781   dialog
->SetSymbol(property
->GetValue().StringValue()); 
1783   // TODO: split name/id pair e.g. "IDC_TEXT=123" or get from symbol table - which? 
1784   dialog
->SetId(1234); 
1788   if (dialog
->ShowModal()) 
1790     wxString 
symbolName(dialog
->GetSymbol()); 
1791     long id 
= dialog
->GetId(); 
1794     // TODO: set id somewhere 
1795     property
->GetValue() = wxString(symbolName
); 
1797     view
->DisplayProperty(property
); 
1798     view
->UpdatePropertyDisplayInList(property
); 
1799     view
->OnPropertyChanged(property
); 
1803   char *s 
= wxFileSelector( 
1804      filenameMessage
.GetData(), 
1805      wxPathOnly(property
->GetValue().StringValue()), 
1806      wxFileNameFromPath(property
->GetValue().StringValue()), 
1808      filenameWildCard
.GetData(), 
1813     property
->GetValue() = wxString(s
); 
1814     view
->DisplayProperty(property
); 
1815     view
->UpdatePropertyDisplayInList(property
); 
1816     view
->OnPropertyChanged(property
); 
1821 BEGIN_EVENT_TABLE(wxResourceSymbolDialog
, wxDialog
) 
1822     EVT_BUTTON(wxID_OK
, wxResourceSymbolDialog::OnOK
) 
1825 wxResourceSymbolDialog::wxResourceSymbolDialog(wxWindow
* parent
, const wxWindowID id
, const wxString
& title
, const wxPoint
& pos
, 
1826         const wxSize
& size
, long style
): 
1827     wxDialog(parent
, id
, title
, pos
, size
, style
) 
1832     (void) new wxStaticText(this, -1, "Name: ", wxPoint(x
, y
)); 
1836     m_nameCtrl 
= new wxComboBox(this, ID_SYMBOLNAME_COMBOBOX
, "", 
1837         wxPoint(x
, y
), wxSize(200, -1), 0, NULL
, wxCB_DROPDOWN
); 
1842     (void) new wxStaticText(this, -1, "Id: ", wxPoint(x
, y
)); 
1846     m_idCtrl 
= new wxTextCtrl(this, ID_SYMBOLID_TEXTCTRL
, "", 
1847         wxPoint(x
, y
), wxSize(200, -1)); 
1851     (void) new wxButton(this, wxID_OK
, "OK", wxPoint(x
, y
), wxSize(90, -1)); 
1854     (void) new wxButton(this, wxID_CANCEL
, "Cancel", wxPoint(x
, y
), wxSize(90, -1)); 
1860 void wxResourceSymbolDialog::Init() 
1863     defaultId
.Printf("%ld", m_symbolId
); 
1865     m_nameCtrl
->SetValue(m_symbolName
); 
1866     m_idCtrl
->SetValue(defaultId
); 
1869 void wxResourceSymbolDialog::OnOK(wxCommandEvent
& event
) 
1873         wxDialog::OnOK(event
); 
1877 bool wxResourceSymbolDialog::CheckValues()