]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/dialoged/src/winprop.cpp
new 'dynamic' SetColDefs fix
[wxWidgets.git] / utils / dialoged / src / winprop.cpp
index 6e94d9fde5223b3199219562c53c77a8328cdcc0..1d9318bc9584bcd25fccac422d91d105c62ba668 100644 (file)
 #include <math.h>
 #include <string.h>
 
-#if defined(__WXMSW__) && !defined(__GNUWIN32__)
-#include <strstrea.h>
-#else
-#include <strstream.h>
-#endif
-
 #ifdef __WXMSW__
 #include <windows.h>
 #endif
@@ -49,8 +43,9 @@ void wxResourcePropertyListView::OnPropertyChanged(wxProperty *property)
   // IF the property value was modified.
   if (property->GetValue().GetModified())
   {
-    propertyInfo->SetProperty(property->GetName(), property);
+    m_propertyInfo->SetProperty(property->GetName(), property);
     property->GetValue().SetModified(FALSE);
+    wxResourceManager::GetCurrentResourceManager()->Modify(TRUE);
   }
 }
 
@@ -105,7 +100,8 @@ wxDialogEditorPropertyListFrame::~wxDialogEditorPropertyListFrame()
 {
     delete m_propSheet;
     delete m_propInfo;
-    wxPropertyInfo::sm_propertyWindow = NULL;
+    if (wxPropertyInfo::sm_propertyWindow == this)
+        wxPropertyInfo::sm_propertyWindow = NULL;
 }
 
 /*
@@ -114,10 +110,33 @@ wxDialogEditorPropertyListFrame::~wxDialogEditorPropertyListFrame()
 
 // Edit the information represented by this object, whatever that
 // might be.
-bool wxPropertyInfo::Edit(wxWindow *parent, const wxString& title)
+bool wxPropertyInfo::Edit(wxWindow *WXUNUSED(parent), const wxString& title)
 {
-    if (sm_propertyWindow)
-        return FALSE;
+  if (sm_propertyWindow)
+  {
+      wxWindowPropertyInfo* thisProp = (wxWindowPropertyInfo*) this;
+      wxWindowPropertyInfo* oldProp = (wxWindowPropertyInfo*) (((wxDialogEditorPropertyListFrame *) sm_propertyWindow)->GetInfo());
+      if (oldProp->GetWindow() == thisProp->GetWindow())
+      {
+        sm_propertyWindow->Raise();
+        return TRUE;
+      }
+      else
+      {
+        int w, h, x, y;
+        sm_propertyWindow->GetSize(& w, & h);
+        sm_propertyWindow->GetPosition(& x, & y);
+
+        wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().width = w;
+        wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().height = h;
+        wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().x = x;
+        wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().y = y;
+
+        // Close the window, so we can create a new one for the different window
+        sm_propertyWindow->Destroy();
+        sm_propertyWindow = (wxDialogEditorPropertyListFrame *) NULL;
+      }
+  }
 
   int width = wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().width;
   int height = wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().height;
@@ -153,24 +172,31 @@ bool wxPropertyInfo::Edit(wxWindow *parent, const wxString& title)
     wxSize(width, height), wxDEFAULT_FRAME_STYLE);
   sm_propertyWindow = propWin;
 
-  propWin->m_registry.RegisterValidator((wxString)"real", new wxRealListValidator);
-  propWin->m_registry.RegisterValidator((wxString)"string", new wxStringListValidator);
-  propWin->m_registry.RegisterValidator((wxString)"integer", new wxIntegerListValidator);
-  propWin->m_registry.RegisterValidator((wxString)"bool", new wxBoolListValidator);
-  propWin->m_registry.RegisterValidator((wxString)"filename", new wxFilenameListValidator);
-  propWin->m_registry.RegisterValidator((wxString)"stringlist", new wxListOfStringsListValidator);
-  propWin->m_registry.RegisterValidator((wxString)"window_id", new wxResourceSymbolValidator);
+  propWin->m_registry.RegisterValidator(wxString("real"), new wxRealListValidator);
+  propWin->m_registry.RegisterValidator(wxString("string"), new wxStringListValidator);
+  propWin->m_registry.RegisterValidator(wxString("integer"), new wxIntegerListValidator);
+  propWin->m_registry.RegisterValidator(wxString("bool"), new wxBoolListValidator);
+  propWin->m_registry.RegisterValidator(wxString("filename"), new wxFilenameListValidator);
+  propWin->m_registry.RegisterValidator(wxString("stringlist"), new wxListOfStringsListValidator);
+  propWin->m_registry.RegisterValidator(wxString("window_id"), new wxResourceSymbolValidator);
 
   propWin->m_propInfo = this;
   propWin->m_propSheet = propSheet;
 
-//  view->propertyWindow = propWin;
+//  view->m_propertyWindow = propWin;
   view->AddRegistry(&(propWin->m_registry));
 
   propWin->Initialize();
   view->ShowView(propSheet, propWin->GetPropertyPanel());
 
   propWin->Show(TRUE);
+
+  // Otherwise doesn't show itself
+#ifdef __WXMOTIF__
+  wxNoOptimize noOptimize;
+  propWin->SetSize(-1, -1, width, height);
+#endif
+
   return TRUE;
 }
 
@@ -180,8 +206,8 @@ bool wxPropertyInfo::Edit(wxWindow *parent, const wxString& title)
 
 wxWindowPropertyInfo::wxWindowPropertyInfo(wxWindow *win, wxItemResource *res)
 {
-  propertyWindow = win;
-  propertyResource = res;
+  m_propertyWindow = win;
+  m_propertyResource = res;
 }
 
 wxWindowPropertyInfo::~wxWindowPropertyInfo(void)
@@ -276,41 +302,35 @@ wxFont *wxWindowPropertyInfo::SetFontProperty(wxString& name, wxProperty *proper
 
 wxProperty *wxWindowPropertyInfo::GetProperty(wxString& name)
 {
-  wxFont *font = propertyWindow->GetFont();
+  wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
+
+  wxFont *font = & m_propertyWindow->GetFont();
   if (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" ||
       name == "fontUnderlined")
     return GetFontProperty(name, font);
   else if (name == "name")
-    return new wxProperty("name", propertyWindow->GetName(), "string");
+    return new wxProperty("name", m_propertyWindow->GetName(), "string");
   else if (name == "title")
-    return new wxProperty("title", propertyWindow->GetTitle(), "string");
+    return new wxProperty("title", m_propertyWindow->GetTitle(), "string");
   else if (name == "x")
   {
-    int x, y;
-    propertyWindow->GetPosition(&x, &y);
-    return new wxProperty("x", (long)x, "integer");
+    return new wxProperty("x", (long)resource->GetX(), "integer");
   }
   else if (name == "y")
   {
-    int x, y;
-    propertyWindow->GetPosition(&x, &y);
-    return new wxProperty("y", (long)y, "integer");
+    return new wxProperty("y", (long)resource->GetY(), "integer");
   }
   else if (name == "width")
   {
-    int width, height;
-    propertyWindow->GetSize(&width, &height);
-    return new wxProperty("width", (long)width, "integer");
+    return new wxProperty("width", (long)resource->GetWidth(), "integer");
   }
   else if (name == "height")
   {
-    int width, height;
-    propertyWindow->GetSize(&width, &height);
-    return new wxProperty("height", (long)height, "integer");
+    return new wxProperty("height", (long)resource->GetHeight(), "integer");
   }
   else if (name == "id")
   {
-    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(propertyWindow);
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
     if (resource)
     {
         int id = resource->GetId();
@@ -328,15 +348,15 @@ wxProperty *wxWindowPropertyInfo::GetProperty(wxString& name)
   else if (name == "border")
   {
     wxString border("");
-    if (propertyWindow->GetWindowStyleFlag() & wxSIMPLE_BORDER)
+    if (m_propertyWindow->GetWindowStyleFlag() & wxSIMPLE_BORDER)
       border = "wxSIMPLE_BORDER";
-    else if (propertyWindow->GetWindowStyleFlag() & wxRAISED_BORDER)
+    else if (m_propertyWindow->GetWindowStyleFlag() & wxRAISED_BORDER)
       border = "wxRAISED_BORDER";
-    else if (propertyWindow->GetWindowStyleFlag() & wxSUNKEN_BORDER)
+    else if (m_propertyWindow->GetWindowStyleFlag() & wxSUNKEN_BORDER)
       border = "wxSUNKEN_BORDER";
-    else if (propertyWindow->GetWindowStyleFlag() & wxDOUBLE_BORDER)
+    else if (m_propertyWindow->GetWindowStyleFlag() & wxDOUBLE_BORDER)
       border = "wxDOUBLE_BORDER";
-    else if (propertyWindow->GetWindowStyleFlag() & wxSTATIC_BORDER)
+    else if (m_propertyWindow->GetWindowStyleFlag() & wxSTATIC_BORDER)
       border = "wxSTATIC_BORDER";
     else
       border = "wxNO_BORDER";
@@ -351,30 +371,30 @@ wxProperty *wxWindowPropertyInfo::GetProperty(wxString& name)
 
 bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
 {
-  wxFont *font = propertyWindow->GetFont();
+  wxFont *font = & m_propertyWindow->GetFont();
   if (font && (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" || name == "fontUnderlined" ))
   {
     wxFont *newFont = SetFontProperty(name, property, font);
     if (newFont)
-      propertyWindow->SetFont(newFont);
+      m_propertyWindow->SetFont(* newFont);
     return TRUE;
   }
   else if (name == "name")
   {
     // Remove old name from resource table, if it's there.
-    wxItemResource *oldResource = (wxItemResource *)wxResourceManager::GetCurrentResourceManager()->GetResourceTable().Delete(propertyWindow->GetName());
+    wxItemResource *oldResource = (wxItemResource *)wxResourceManager::GetCurrentResourceManager()->GetResourceTable().Delete(m_propertyWindow->GetName());
     if (oldResource)
     {
       // It's a top-level resource
-      propertyWindow->SetName(property->GetValue().StringValue());
+      m_propertyWindow->SetName(property->GetValue().StringValue());
       oldResource->SetName(property->GetValue().StringValue());
-      wxResourceManager::GetCurrentResourceManager()->GetResourceTable().Put(propertyWindow->GetName(), oldResource);
+      wxResourceManager::GetCurrentResourceManager()->GetResourceTable().Put(m_propertyWindow->GetName(), oldResource);
     }
     else
     {
       // It's a child of something; just set the name of the resource and the window.
-      propertyWindow->SetName(property->GetValue().StringValue());
-      propertyResource->SetName(property->GetValue().StringValue());
+      m_propertyWindow->SetName(property->GetValue().StringValue());
+      m_propertyResource->SetName(property->GetValue().StringValue());
     }
     // Refresh the resource manager list, because the name changed.
     wxResourceManager::GetCurrentResourceManager()->UpdateResourceList();
@@ -382,64 +402,156 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
   }
   else if (name == "title")
   {
-    propertyWindow->SetTitle(property->GetValue().StringValue());
+    m_propertyWindow->SetTitle(property->GetValue().StringValue());
     return TRUE;
   }
   else if (name == "x")
   {
+    wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
     int x, y;
-    propertyWindow->GetPosition(&x, &y);
+    m_propertyWindow->GetPosition(&x, &y);
     int newX = (int)property->GetValue().IntegerValue();
-    if (x != newX)
-      propertyWindow->Move(newX, y);
+    int pixelX = newX;
+
+    // We need to convert to pixels if this is not a dialog or panel, but
+    // the parent resource specifies dialog units.
+    if (m_propertyWindow->GetParent() && m_propertyWindow->IsKindOf(CLASSINFO(wxControl)))
+    {
+        wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent());
+        if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+        {
+            wxPoint pt = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxPoint(newX, y));
+            pixelX = pt.x;
+        }
+    }
+    else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel)))
+    {
+        wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
+        if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+        {
+            wxPoint pt = m_propertyWindow->ConvertDialogToPixels(wxPoint(newX, y));
+            pixelX = pt.x;
+        }
+    }
+
+    if (x != pixelX)
+    {
+      m_propertyWindow->Move(pixelX, y);
+      resource->SetSize(newX, resource->GetY(), resource->GetWidth(), resource->GetHeight());
+    }
     return TRUE;
   }
   else if (name == "y")
   {
+    wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
     int x, y;
-    propertyWindow->GetPosition(&x, &y);
+    m_propertyWindow->GetPosition(&x, &y);
     int newY = (int)property->GetValue().IntegerValue();
-    if (y != newY)
-      propertyWindow->Move(x, newY);
+    int pixelY = newY;
+
+    // We need to convert to pixels if this is not a dialog or panel, but
+    // the parent resource specifies dialog units.
+    if (m_propertyWindow->GetParent() && m_propertyWindow->IsKindOf(CLASSINFO(wxControl)))
+    {
+        wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent());
+        if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+        {
+            wxPoint pt = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxPoint(x, newY));
+            pixelY = pt.y;
+        }
+    }
+    else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel)))
+    {
+        wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
+        if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+        {
+            wxPoint pt = m_propertyWindow->ConvertDialogToPixels(wxPoint(x, newY));
+            pixelY = pt.y;
+        }
+    }
+
+    if (y != pixelY)
+    {
+      m_propertyWindow->Move(x, pixelY);
+      resource->SetSize(resource->GetX(), newY, resource->GetWidth(), resource->GetHeight());
+    }
     return TRUE;
   }
   else if (name == "width")
   {
+    wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
     int width, height;
-    propertyWindow->GetSize(&width, &height);
+    m_propertyWindow->GetSize(&width, &height);
     int newWidth = (int)property->GetValue().IntegerValue();
-    if (width != newWidth)
+    int pixelWidth = newWidth;
+
+    // We need to convert to pixels if this is not a dialog or panel, but
+    // the parent resource specifies dialog units.
+    if (m_propertyWindow->GetParent() && m_propertyWindow->IsKindOf(CLASSINFO(wxControl)))
     {
-      propertyWindow->SetSize(newWidth, height);
-/*
-      if (propertyWindow->IsKindOf(CLASSINFO(wxPanel)) && !propertyWindow->IsKindOf(CLASSINFO(wxDialog)))
-      {
-        propertyWindow->GetParent()->SetClientSize(newWidth, height);
-      }
-*/
+        wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent());
+        if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+        {
+            wxSize sz = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxSize(newWidth, height));
+            pixelWidth = sz.x;
+        }
+    }
+    else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel)))
+    {
+        wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
+        if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+        {
+            wxSize sz = m_propertyWindow->ConvertDialogToPixels(wxSize(newWidth, height));
+            pixelWidth = sz.x;
+        }
+    }
+
+    if (width != pixelWidth)
+    {
+      m_propertyWindow->SetSize(pixelWidth, height);
+      resource->SetSize(resource->GetX(), resource->GetY(), newWidth, resource->GetHeight());
     }
     return TRUE;
   }
   else if (name == "height")
   {
+    wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
     int width, height;
-    propertyWindow->GetSize(&width, &height);
+    m_propertyWindow->GetSize(&width, &height);
     int newHeight = (int)property->GetValue().IntegerValue();
-    if (height != newHeight)
+    int pixelHeight = newHeight;
+
+    // We need to convert to pixels if this is not a dialog or panel, but
+    // the parent resource specifies dialog units.
+    if (m_propertyWindow->GetParent() && m_propertyWindow->IsKindOf(CLASSINFO(wxControl)))
     {
-      propertyWindow->SetSize(width, newHeight);
-/*
-      if (propertyWindow->IsKindOf(CLASSINFO(wxPanel)) && !propertyWindow->IsKindOf(CLASSINFO(wxDialog)))
-      {
-        propertyWindow->GetParent()->SetClientSize(width, newHeight);
-      }
-*/
+        wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent());
+        if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+        {
+            wxSize sz = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxSize(width, newHeight));
+            pixelHeight = sz.y;
+        }
+    }
+    else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel)))
+    {
+        wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
+        if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+        {
+            wxSize sz = m_propertyWindow->ConvertDialogToPixels(wxSize(width, newHeight));
+            pixelHeight = sz.y;
+        }
+    }
+
+    if (height != pixelHeight)
+    {
+      m_propertyWindow->SetSize(width, pixelHeight);
+      resource->SetSize(resource->GetX(), resource->GetY(), resource->GetWidth(), newHeight);
     }
     return TRUE;
   }
   else if (name == "id")
   {
-    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(propertyWindow);
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
     if (resource)
     {
         wxString value = property->GetValue().StringValue();
@@ -529,17 +641,17 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     else
         borderStyle = wxNO_BORDER;
 
-    SetWindowStyle(propertyWindow, wxSIMPLE_BORDER, FALSE);
-    SetWindowStyle(propertyWindow, wxRAISED_BORDER, FALSE);
-    SetWindowStyle(propertyWindow, wxSUNKEN_BORDER, FALSE);
-    SetWindowStyle(propertyWindow, wxDOUBLE_BORDER, FALSE);
-    SetWindowStyle(propertyWindow, wxSTATIC_BORDER, FALSE);
-    SetWindowStyle(propertyWindow, wxNO_BORDER, FALSE);
+    SetWindowStyle(m_propertyWindow, wxSIMPLE_BORDER, FALSE);
+    SetWindowStyle(m_propertyWindow, wxRAISED_BORDER, FALSE);
+    SetWindowStyle(m_propertyWindow, wxSUNKEN_BORDER, FALSE);
+    SetWindowStyle(m_propertyWindow, wxDOUBLE_BORDER, FALSE);
+    SetWindowStyle(m_propertyWindow, wxSTATIC_BORDER, FALSE);
+    SetWindowStyle(m_propertyWindow, wxNO_BORDER, FALSE);
 
-    SetWindowStyle(propertyWindow, borderStyle, TRUE);
+    SetWindowStyle(m_propertyWindow, borderStyle, TRUE);
 
-    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(propertyWindow);
-    resource->SetStyle(propertyWindow->GetWindowStyleFlag());
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
+    resource->SetStyle(m_propertyWindow->GetWindowStyleFlag());
     return TRUE;
   }
   else
@@ -555,7 +667,7 @@ void wxWindowPropertyInfo::GetPropertyNames(wxStringList& names)
   names.Add("width");
   names.Add("height");
   names.Add("border");
-  if (!propertyWindow->IsKindOf(CLASSINFO(wxControl)))
+  if (!m_propertyWindow->IsKindOf(CLASSINFO(wxControl)))
   {
     names.Add("fontPoints");
     names.Add("fontFamily");
@@ -568,16 +680,51 @@ void wxWindowPropertyInfo::GetPropertyNames(wxStringList& names)
 // Fill in the wxItemResource members to mirror the current window settings
 bool wxWindowPropertyInfo::InstantiateResource(wxItemResource *resource)
 {
-//  resource->SetType(propertyWindow->GetClassInfo()->GetClassName());
-  
-//  resource->SetStyle(propertyWindow->GetWindowStyleFlag());
-  wxString str(propertyWindow->GetName());
-  resource->SetName(WXSTRINGCAST str);
+//  resource->SetType(m_propertyWindow->GetClassInfo()->GetClassName());
+
+//  resource->SetStyle(m_propertyWindow->GetWindowStyleFlag());
+  wxString str(m_propertyWindow->GetName());
+  resource->SetName(str);
+
+#if 0 // Why did we comment this out? Possibly because of rounding errors
+  // that will build up as the conversion is repeatedly done.
+  // so only do the conversion when a resize happens.
   int x, y, w, h;
-  propertyWindow->GetSize(&w, &h);
 
-  propertyWindow->GetPosition(&x, &y);
+  if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel)))
+      m_propertyWindow->GetClientSize(&w, &h);
+  else
+      m_propertyWindow->GetSize(&w, &h);
+
+  m_propertyWindow->GetPosition(&x, &y);
+
+  // We need to convert to dialog units if this is not a dialog or panel, but
+  // the parent resource specifies dialog units.
+  if (m_propertyWindow->GetParent() && m_propertyWindow->IsKindOf(CLASSINFO(wxControl)))
+  {
+      wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent());
+      if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+      {
+          wxPoint pt = m_propertyWindow->GetParent()->ConvertPixelsToDialog(wxPoint(x, y));
+          x = pt.x; y = pt.y;
+          wxSize sz = m_propertyWindow->GetParent()->ConvertPixelsToDialog(wxSize(w, h));
+          w = sz.x; h = sz.y;
+      }
+  }
+  else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel)))
+  {
+      if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+      {
+          wxPoint pt = m_propertyWindow->ConvertPixelsToDialog(wxPoint(x, y));
+          x = pt.x; y = pt.y;
+          wxSize sz = m_propertyWindow->ConvertPixelsToDialog(wxSize(w, h));
+          w = sz.x; h = sz.y;
+      }
+  }
+
   resource->SetSize(x, y, w, h);
+#endif
+
   return TRUE;
 }
 
@@ -609,28 +756,28 @@ void wxWindowPropertyInfo::SetWindowStyle(wxWindow* win, long style, bool set)
 
 wxProperty *wxItemPropertyInfo::GetProperty(wxString& name)
 {
-  wxControl *itemWindow = (wxControl *)propertyWindow; 
-  wxFont *font = itemWindow->GetFont();
+  wxControl *itemWindow = (wxControl *)m_propertyWindow; 
+  wxFont *font = itemWindow->GetFont();
 
   if (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" ||
       name == "fontUnderlined")
     return GetFontProperty(name, font);
   else if (name == "label" && itemWindow->GetLabel())
-    return new wxProperty("label", propertyWindow->GetLabel(), "string");
+    return new wxProperty("label", m_propertyWindow->GetLabel(), "string");
   else
     return wxWindowPropertyInfo::GetProperty(name);
 }
 
 bool wxItemPropertyInfo::SetProperty(wxString& name, wxProperty *property)
 {
-  wxControl *itemWindow = (wxControl *)propertyWindow; 
-  wxFont *font = itemWindow->GetFont();
+  wxControl *itemWindow = (wxControl *)m_propertyWindow; 
+  wxFont *font = itemWindow->GetFont();
 
   if (font && (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" || name == "fontUnderlined" ))
   {
     wxFont *newFont = SetFontProperty(name, property, font);
     if (newFont)
-      itemWindow->SetLabelFont(newFont);
+      itemWindow->SetFont(* newFont);
     return TRUE;
   }
   else if (name == "label")
@@ -657,13 +804,14 @@ bool wxItemPropertyInfo::InstantiateResource(wxItemResource *resource)
 {
   wxWindowPropertyInfo::InstantiateResource(resource);
   
-  wxControl *item = (wxControl *)propertyWindow;
+  wxControl *item = (wxControl *)m_propertyWindow;
   wxString str(item->GetLabel());
-  resource->SetTitle(WXSTRINGCAST str);
-  if (item->GetFont() && item->GetFont()->Ok())
-    resource->SetFont(wxTheFontList->FindOrCreateFont(item->GetFont()->GetPointSize(),
-               item->GetFont()->GetFamily(), item->GetFont()->GetStyle(), item->GetFont()->GetWeight(),
-               item->GetFont()->GetUnderlined(), item->GetFont()->GetFaceName()));
+  resource->SetTitle(str);
+
+  if (item->GetFont().Ok())
+    resource->SetFont(* wxTheFontList->FindOrCreateFont(item->GetFont().GetPointSize(),
+               item->GetFont().GetFamily(), item->GetFont().GetStyle(), item->GetFont().GetWeight(),
+               item->GetFont().GetUnderlined(), item->GetFont().GetFaceName()));
   return TRUE;
 }
 
@@ -673,13 +821,11 @@ bool wxItemPropertyInfo::InstantiateResource(wxItemResource *resource)
 
 wxProperty *wxButtonPropertyInfo::GetProperty(wxString& name)
 {
-  wxButton *button = (wxButton *)propertyWindow;
   return wxItemPropertyInfo::GetProperty(name);
 }
 
 bool wxButtonPropertyInfo::SetProperty(wxString& name, wxProperty *property)
 {
-  wxButton *button = (wxButton *)propertyWindow;
   return wxItemPropertyInfo::SetProperty(name, property);
 }
 
@@ -700,19 +846,17 @@ bool wxButtonPropertyInfo::InstantiateResource(wxItemResource *resource)
 
 wxProperty *wxBitmapButtonPropertyInfo::GetProperty(wxString& name)
 {
-  wxBitmapButton *button = (wxBitmapButton *)propertyWindow;
-  if (name == "label")
+  wxBitmapButton *button = (wxBitmapButton *)m_propertyWindow;
+  if (name == "bitmapFilename")
   {
     wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(button);
     wxString str("none.bmp");
    
     if (resource)
     {
-      char *filename = wxResourceManager::GetCurrentResourceManager()->FindBitmapFilenameForResource(resource);
-      if (filename)
-        str = filename;
+      str = wxResourceManager::GetCurrentResourceManager()->FindBitmapFilenameForResource(resource);
     }
-    return new wxProperty("label", str.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"));
+    return new wxProperty("bitmapFilename", str.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"));
   }
   else
     return wxButtonPropertyInfo::GetProperty(name);
@@ -720,18 +864,17 @@ wxProperty *wxBitmapButtonPropertyInfo::GetProperty(wxString& name)
 
 bool wxBitmapButtonPropertyInfo::SetProperty(wxString& name, wxProperty *property)
 {
-  wxBitmapButton *button = (wxBitmapButton *)propertyWindow;
-  if (name == "label")
+  wxBitmapButton *button = (wxBitmapButton *)m_propertyWindow;
+  if (name == "bitmapFilename")
   {
     char *s = property->GetValue().StringValue();
     if (s && wxFileExists(s))
     {
-      s = copystring(s);
-      wxBitmap *bitmap = new wxBitmap(s, wxBITMAP_TYPE_BMP);
+      wxString str(s);
+      wxBitmap *bitmap = new wxBitmap(str, wxBITMAP_TYPE_BMP);
       if (!bitmap->Ok())
       {
         delete bitmap;
-        delete[] s;
         return FALSE;
       }
       else
@@ -740,15 +883,14 @@ bool wxBitmapButtonPropertyInfo::SetProperty(wxString& name, wxProperty *propert
         if (resource)
         {
           wxString oldResource(resource->GetValue4());
-          char *resName = wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(s);
+          wxString resName = wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(str);
           resource->SetValue4(resName);
           
           if (!oldResource.IsNull())
-            wxResourceManager::GetCurrentResourceManager()->PossiblyDeleteBitmapResource(WXSTRINGCAST oldResource);
+            wxResourceManager::GetCurrentResourceManager()->PossiblyDeleteBitmapResource(oldResource);
         }
 
-        button->SetLabel(bitmap);
-        delete[] s;
+        button->SetLabel(* bitmap);
         return TRUE;
       }
     }
@@ -760,8 +902,9 @@ bool wxBitmapButtonPropertyInfo::SetProperty(wxString& name, wxProperty *propert
 
 void wxBitmapButtonPropertyInfo::GetPropertyNames(wxStringList& names)
 {
-//  names.Add("label");
   wxButtonPropertyInfo::GetPropertyNames(names);
+  names.Delete("label");
+  names.Add("bitmapFilename");
 }
 
 bool wxBitmapButtonPropertyInfo::InstantiateResource(wxItemResource *resource)
@@ -775,14 +918,42 @@ bool wxBitmapButtonPropertyInfo::InstantiateResource(wxItemResource *resource)
 
 wxProperty *wxStaticTextPropertyInfo::GetProperty(wxString& name)
 {
-  wxStaticText *message = (wxStaticText *)propertyWindow;
   return wxItemPropertyInfo::GetProperty(name);
 }
 
 bool wxStaticTextPropertyInfo::SetProperty(wxString& name, wxProperty *property)
 {
-  wxStaticText *message = (wxStaticText *)propertyWindow;
-  return wxItemPropertyInfo::SetProperty(name, property);
+  wxStaticText* itemWindow = (wxStaticText*) m_propertyWindow;
+  if (name == "label")
+  {
+    // Because setting a wxStaticText control's label may change the
+    // size, we must get the size and instantiate the resource immediately.
+    itemWindow->SetLabel(property->GetValue().StringValue());
+    int w, h;
+
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(itemWindow);
+
+    m_propertyWindow->GetSize(&w, &h);
+    // m_propertyWindow->GetPosition(&x, &y);
+
+    // We need to convert to dialog units if 
+    // the parent resource specifies dialog units.
+    if (m_propertyWindow->GetParent())
+    {
+        wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent());
+        if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+        {
+            // wxPoint pt = m_propertyWindow->GetParent()->ConvertPixelsToDialog(wxPoint(x, y));
+            // x = pt.x; y = pt.y;
+            wxSize sz = m_propertyWindow->GetParent()->ConvertPixelsToDialog(wxSize(w, h));
+            w = sz.x; h = sz.y;
+        }
+    }
+    resource->SetSize(resource->GetX(), resource->GetY(), w, h);
+    return TRUE;
+  }
+  else
+    return wxItemPropertyInfo::SetProperty(name, property);
 }
 
 void wxStaticTextPropertyInfo::GetPropertyNames(wxStringList& names)
@@ -802,19 +973,17 @@ bool wxStaticTextPropertyInfo::InstantiateResource(wxItemResource *resource)
 
 wxProperty *wxStaticBitmapPropertyInfo::GetProperty(wxString& name)
 {
-  wxStaticBitmap *message = (wxStaticBitmap *)propertyWindow;
-  if (name == "label")
+  wxStaticBitmap *message = (wxStaticBitmap *)m_propertyWindow;
+  if (name == "bitmapFilename")
   {
     wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(message);
     wxString str("none.bmp");
    
     if (resource)
     {
-      char *filename = wxResourceManager::GetCurrentResourceManager()->FindBitmapFilenameForResource(resource);
-      if (filename)
-        str = filename;
+      str = wxResourceManager::GetCurrentResourceManager()->FindBitmapFilenameForResource(resource);
     }
-    return new wxProperty("label", str.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"));
+    return new wxProperty("bitmapFilename", str.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"));
   }
   else
     return wxItemPropertyInfo::GetProperty(name);
@@ -822,19 +991,18 @@ wxProperty *wxStaticBitmapPropertyInfo::GetProperty(wxString& name)
 
 bool wxStaticBitmapPropertyInfo::SetProperty(wxString& name, wxProperty *property)
 {
-  wxStaticBitmap *message = (wxStaticBitmap *)propertyWindow;
-  if (name == "label")
+  wxStaticBitmap *message = (wxStaticBitmap *)m_propertyWindow;
+  if (name == "bitmapFilename")
   {
     char *s = property->GetValue().StringValue();
     if (s && wxFileExists(s))
     {
-      s = copystring(s);
+      wxString str(s);
       
-      wxBitmap *bitmap = new wxBitmap(s, wxBITMAP_TYPE_BMP);
+      wxBitmap *bitmap = new wxBitmap(str, wxBITMAP_TYPE_BMP);
       if (!bitmap->Ok())
       {
         delete bitmap;
-        delete[] s;
         return FALSE;
       }
       else
@@ -843,15 +1011,14 @@ bool wxStaticBitmapPropertyInfo::SetProperty(wxString& name, wxProperty *propert
         if (resource)
         {
           wxString oldResource(resource->GetValue4());
-          char *resName = wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(s);
+          wxString resName = wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(str);
           resource->SetValue4(resName);
           
           if (!oldResource.IsNull())
-            wxResourceManager::GetCurrentResourceManager()->PossiblyDeleteBitmapResource(WXSTRINGCAST oldResource);
+            wxResourceManager::GetCurrentResourceManager()->PossiblyDeleteBitmapResource(oldResource);
         }
 
-        message->SetBitmap(bitmap);
-        delete[] s;
+        message->SetBitmap(* bitmap);
         return TRUE;
       }
     }
@@ -864,7 +1031,7 @@ bool wxStaticBitmapPropertyInfo::SetProperty(wxString& name, wxProperty *propert
 void wxStaticBitmapPropertyInfo::GetPropertyNames(wxStringList& names)
 {
   wxItemPropertyInfo::GetPropertyNames(names);
-  names.Add("label");
+  names.Add("bitmapFilename");
 }
 
 bool wxStaticBitmapPropertyInfo::InstantiateResource(wxItemResource *resource)
@@ -878,7 +1045,7 @@ bool wxStaticBitmapPropertyInfo::InstantiateResource(wxItemResource *resource)
 
 wxProperty *wxTextPropertyInfo::GetProperty(wxString& name)
 {
-  wxTextCtrl *text = (wxTextCtrl *)propertyWindow;
+  wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow;
   if (name == "value")
     return new wxProperty("value", text->GetValue(), "string");
   else if (name == "password")
@@ -897,7 +1064,7 @@ wxProperty *wxTextPropertyInfo::GetProperty(wxString& name)
 
 bool wxTextPropertyInfo::SetProperty(wxString& name, wxProperty *property)
 {
-  wxTextCtrl *text = (wxTextCtrl *)propertyWindow;
+  wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow;
   if (name == "value")
   {
     text->SetValue(property->GetValue().StringValue());
@@ -919,7 +1086,7 @@ bool wxTextPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(text);
     resource->SetStyle(flag);
 
-    wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(text, this);
+    m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(text, this);
     return TRUE;
   }
   else if (name == "readonly")
@@ -938,7 +1105,7 @@ bool wxTextPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(text);
     resource->SetStyle(flag);
 
-    wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(text, this);
+    m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(text, this);
     return TRUE;
   }
   else
@@ -955,9 +1122,9 @@ void wxTextPropertyInfo::GetPropertyNames(wxStringList& names)
 
 bool wxTextPropertyInfo::InstantiateResource(wxItemResource *resource)
 {
-  wxTextCtrl *text = (wxTextCtrl *)propertyWindow;
+  wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow;
   wxString str(text->GetValue());
-  resource->SetValue4(WXSTRINGCAST str);
+  resource->SetValue4(str);
     
   return wxItemPropertyInfo::InstantiateResource(resource);
 }
@@ -968,7 +1135,7 @@ bool wxTextPropertyInfo::InstantiateResource(wxItemResource *resource)
 
 wxProperty *wxListBoxPropertyInfo::GetProperty(wxString& name)
 {
-  wxListBox *listBox = (wxListBox *)propertyWindow;
+  wxListBox *listBox = (wxListBox *)m_propertyWindow;
   if (name == "values")
   {
     wxStringList *stringList = new wxStringList;
@@ -980,26 +1147,19 @@ wxProperty *wxListBoxPropertyInfo::GetProperty(wxString& name)
   }
   else if (name == "multiple")
   {
-    char *pos = NULL;
     wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(listBox);
     if (!resource)
       return NULL;
+
+    char *mult = "wxLB_SINGLE";
       
-    char *mult = "wxSINGLE";
-      
-    switch (resource->GetValue1())
-    {
-      case wxLB_MULTIPLE:
+    if ((listBox->GetWindowStyleFlag() & wxLB_MULTIPLE) != 0)
         mult = "wxLB_MULTIPLE";
-        break;
-      case wxLB_EXTENDED:
+    else if ((listBox->GetWindowStyleFlag() & wxLB_EXTENDED) != 0)
         mult = "wxLB_EXTENDED";
-        break;
-      default:
-      case wxLB_SINGLE:
+    else
         mult = "wxLB_SINGLE";
-        break;
-    }
+
     return new wxProperty("multiple", mult, "string",
        new wxStringListValidator(new wxStringList("wxLB_SINGLE", "wxLB_MULTIPLE", "wxLB_EXTENDED",
           NULL)));
@@ -1010,7 +1170,7 @@ wxProperty *wxListBoxPropertyInfo::GetProperty(wxString& name)
 
 bool wxListBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
 {
-  wxListBox *listBox = (wxListBox *)propertyWindow;
+  wxListBox *listBox = (wxListBox *)m_propertyWindow;
   if (name == "values")
   {
     listBox->Clear();
@@ -1026,18 +1186,22 @@ bool wxListBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
   }
   else if (name == "multiple")
   {
-    int mult = wxLB_SINGLE;
+    SetWindowStyle(m_propertyWindow, wxLB_SINGLE, FALSE);
+    SetWindowStyle(m_propertyWindow, wxLB_MULTIPLE, FALSE);
+    SetWindowStyle(m_propertyWindow, wxLB_EXTENDED, FALSE);
+
     wxString str(property->GetValue().StringValue());
     if (str == "wxLB_MULTIPLE")
-      mult = wxLB_MULTIPLE;
+      SetWindowStyle(m_propertyWindow, wxLB_MULTIPLE, TRUE);
     else if (str == "wxLB_EXTENDED")
-      mult = wxLB_EXTENDED;
+      SetWindowStyle(m_propertyWindow, wxLB_EXTENDED, TRUE);
     else
-      mult = wxLB_SINGLE;
+      SetWindowStyle(m_propertyWindow, wxLB_SINGLE, TRUE);
+
     wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(listBox);
     if (resource)
-      resource->SetValue1(mult);
-    wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(listBox, this);
+      resource->SetStyle(m_propertyWindow->GetWindowStyleFlag());
+    m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(listBox, this);
     return TRUE;
   }
   else
@@ -1053,7 +1217,7 @@ void wxListBoxPropertyInfo::GetPropertyNames(wxStringList& names)
 
 bool wxListBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
 {
-  wxListBox *lbox = (wxListBox *)propertyWindow;
+  wxListBox *lbox = (wxListBox *)m_propertyWindow;
   // This will be set for the wxItemResource on reading or in SetProperty
 //  resource->SetValue1(lbox->GetSelectionMode());
   int i;
@@ -1061,10 +1225,10 @@ bool wxListBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
     resource->SetStringValues(NULL);
   else
   {
-    wxStringList *slist = new wxStringList;
+    wxStringList slist;
     
     for (i = 0; i < lbox->Number(); i++)
-      slist->Add(lbox->GetString(i));
+      slist.Add(lbox->GetString(i));
       
     resource->SetStringValues(slist);
   }
@@ -1077,10 +1241,10 @@ bool wxListBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
 
 wxProperty *wxChoicePropertyInfo::GetProperty(wxString& name)
 {
-  wxChoice *choice = (wxChoice *)propertyWindow;
+  wxChoice *choice = (wxChoice *)m_propertyWindow;
   if (name == "values")
   {
-    wxStringList *stringList = new wxStringList;
+    wxStringListstringList = new wxStringList;
     int i;
     for (i = 0; i < choice->Number(); i++)
       stringList->Add(choice->GetString(i));
@@ -1093,7 +1257,7 @@ wxProperty *wxChoicePropertyInfo::GetProperty(wxString& name)
 
 bool wxChoicePropertyInfo::SetProperty(wxString& name, wxProperty *property)
 {
-  wxChoice *choice = (wxChoice *)propertyWindow;
+  wxChoice *choice = (wxChoice *)m_propertyWindow;
   if (name == "values")
   {
     choice->Clear();
@@ -1121,16 +1285,16 @@ void wxChoicePropertyInfo::GetPropertyNames(wxStringList& names)
 
 bool wxChoicePropertyInfo::InstantiateResource(wxItemResource *resource)
 {
-  wxChoice *choice = (wxChoice *)propertyWindow;
+  wxChoice *choice = (wxChoice *)m_propertyWindow;
   int i;
   if (choice->Number() == 0)
     resource->SetStringValues(NULL);
   else
   {
-    wxStringList *slist = new wxStringList;
+    wxStringList slist;
     
     for (i = 0; i < choice->Number(); i++)
-      slist->Add(choice->GetString(i));
+      slist.Add(choice->GetString(i));
       
     resource->SetStringValues(slist);
   }
@@ -1143,7 +1307,7 @@ bool wxChoicePropertyInfo::InstantiateResource(wxItemResource *resource)
 
 wxProperty *wxComboBoxPropertyInfo::GetProperty(wxString& name)
 {
-  wxComboBox *choice = (wxComboBox *)propertyWindow;
+  wxComboBox *choice = (wxComboBox *)m_propertyWindow;
   if (name == "values")
   {
     wxStringList *stringList = new wxStringList;
@@ -1155,15 +1319,15 @@ wxProperty *wxComboBoxPropertyInfo::GetProperty(wxString& name)
   }
   else if (name == "sort")
   {
-    bool sort = ((propertyWindow->GetWindowStyleFlag() & wxCB_SORT) == wxCB_SORT);
+    bool sort = ((m_propertyWindow->GetWindowStyleFlag() & wxCB_SORT) == wxCB_SORT);
     return new wxProperty(name, sort, "bool");
   }
   else if (name == "style")
   {
     wxString styleStr("dropdown");
-    if (propertyWindow->GetWindowStyleFlag() & wxCB_SIMPLE)
+    if (m_propertyWindow->GetWindowStyleFlag() & wxCB_SIMPLE)
       styleStr = "simple";
-    else if (propertyWindow->GetWindowStyleFlag() & wxCB_READONLY)
+    else if (m_propertyWindow->GetWindowStyleFlag() & wxCB_READONLY)
       styleStr = "readonly";
     else
       styleStr = "dropdown";
@@ -1178,7 +1342,7 @@ wxProperty *wxComboBoxPropertyInfo::GetProperty(wxString& name)
 
 bool wxComboBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
 {
-  wxComboBox *choice = (wxComboBox *)propertyWindow;
+  wxComboBox *choice = (wxComboBox *)m_propertyWindow;
   if (name == "values")
   {
     choice->Clear();
@@ -1196,33 +1360,33 @@ bool wxComboBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
   }
   else if (name == "sort")
   {
-    SetWindowStyle(propertyWindow, wxCB_SORT, property->GetValue().BoolValue());
+    SetWindowStyle(m_propertyWindow, wxCB_SORT, property->GetValue().BoolValue());
 
-    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(propertyWindow);
-    resource->SetStyle(propertyWindow->GetWindowStyleFlag());
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
+    resource->SetStyle(m_propertyWindow->GetWindowStyleFlag());
 
-    wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(propertyWindow, this);
+    m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(m_propertyWindow, this);
     return TRUE;
   }
   else if (name == "style")
   {
-    SetWindowStyle(propertyWindow, wxCB_SIMPLE, FALSE);
-    SetWindowStyle(propertyWindow, wxCB_DROPDOWN, FALSE);
-    SetWindowStyle(propertyWindow, wxCB_READONLY, FALSE);
+    SetWindowStyle(m_propertyWindow, wxCB_SIMPLE, FALSE);
+    SetWindowStyle(m_propertyWindow, wxCB_DROPDOWN, FALSE);
+    SetWindowStyle(m_propertyWindow, wxCB_READONLY, FALSE);
 
     wxString styleStr(property->GetValue().StringValue());
     if (styleStr == "simple")
-      SetWindowStyle(propertyWindow, wxCB_SIMPLE, TRUE);
+      SetWindowStyle(m_propertyWindow, wxCB_SIMPLE, TRUE);
     else if (styleStr == "dropdown")
-      SetWindowStyle(propertyWindow, wxCB_DROPDOWN, TRUE);
+      SetWindowStyle(m_propertyWindow, wxCB_DROPDOWN, TRUE);
     else if (styleStr == "readonly")
-      SetWindowStyle(propertyWindow, wxCB_READONLY, TRUE);
+      SetWindowStyle(m_propertyWindow, wxCB_READONLY, TRUE);
 
       // Necesary?
-    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(propertyWindow);
-    resource->SetStyle(propertyWindow->GetWindowStyleFlag());
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
+    resource->SetStyle(m_propertyWindow->GetWindowStyleFlag());
 
-    wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(propertyWindow, this);
+    m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(m_propertyWindow, this);
 
     return TRUE;
   }
@@ -1240,16 +1404,16 @@ void wxComboBoxPropertyInfo::GetPropertyNames(wxStringList& names)
 
 bool wxComboBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
 {
-  wxComboBox *choice = (wxComboBox *)propertyWindow;
+  wxComboBox *choice = (wxComboBox *)m_propertyWindow;
   int i;
   if (choice->Number() == 0)
     resource->SetStringValues(NULL);
   else
   {
-    wxStringList *slist = new wxStringList;
+    wxStringList slist;
     
     for (i = 0; i < choice->Number(); i++)
-      slist->Add(choice->GetString(i));
+      slist.Add(choice->GetString(i));
       
     resource->SetStringValues(slist);
   }
@@ -1262,21 +1426,21 @@ bool wxComboBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
 
 wxProperty *wxRadioBoxPropertyInfo::GetProperty(wxString& name)
 {
-  wxRadioBox *radioBox = (wxRadioBox *)propertyWindow;
+  wxRadioBox *radioBox = (wxRadioBox *)m_propertyWindow;
   if (name == "numberRowsOrCols")
   {
     return new wxProperty("numberRowsOrCols", (long)radioBox->GetNumberOfRowsOrCols(), "integer");
   }
   if (name == "orientation")
   {
-    char *pos = NULL;
-    if (propertyWindow->GetWindowStyleFlag() & wxHORIZONTAL)
-      pos = "wxHORIZONTAL";
+    wxString orient;
+    if (m_propertyWindow->GetWindowStyleFlag() & wxRA_SPECIFY_COLS)
+      orient = "wxRA_SPECIFY_COLS";
     else
-      pos = "wxVERTICAL";
+      orient = "wxRA_SPECIFY_ROWS";
 
-    return new wxProperty("orientation", pos, "string",
-       new wxStringListValidator(new wxStringList("wxHORIZONTAL", "wxVERTICAL",
+    return new wxProperty("orientation", orient, "string",
+       new wxStringListValidator(new wxStringList("wxRA_SPECIFY_COLS", "wxRA_SPECIFY_ROWS",
           NULL)));
   }
   else if (name == "values")
@@ -1293,32 +1457,34 @@ wxProperty *wxRadioBoxPropertyInfo::GetProperty(wxString& name)
 
 bool wxRadioBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
 {
-  wxRadioBox *radioBox = (wxRadioBox *)propertyWindow;
+  wxRadioBox *radioBox = (wxRadioBox *)m_propertyWindow;
   if (name == "numberRowsOrCols")
   {
     radioBox->SetNumberOfRowsOrCols((int)property->GetValue().IntegerValue());
-    wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this);
+    m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this);
     return TRUE;
   }
   else if (name == "orientation")
   {
     long windowStyle = radioBox->GetWindowStyleFlag();
     wxString val(property->GetValue().StringValue());
-    if (val == "wxHORIZONTAL")
+    if (val == "wxRA_SPECIFY_COLS")
     {
-      if (windowStyle & wxVERTICAL)
-        windowStyle -= wxVERTICAL;
-      windowStyle |= wxHORIZONTAL;
+      if (windowStyle & wxRA_SPECIFY_ROWS)
+        windowStyle -= wxRA_SPECIFY_ROWS;
+      windowStyle |= wxRA_SPECIFY_COLS;
     }
     else
     {
-      if (windowStyle & wxHORIZONTAL)
-        windowStyle -= wxHORIZONTAL;
-      windowStyle |= wxVERTICAL;
+      if (windowStyle & wxRA_SPECIFY_COLS)
+        windowStyle -= wxRA_SPECIFY_COLS;
+      windowStyle |= wxRA_SPECIFY_ROWS;
     }
     radioBox->SetWindowStyleFlag(windowStyle);
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(radioBox);
+    resource->SetStyle(windowStyle);
     
-    wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this);
+    m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this);
     return TRUE;
   }
   else if (name == "values")
@@ -1326,27 +1492,21 @@ bool wxRadioBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     // Set property into *resource*, not wxRadioBox, and then recreate
     // the wxRadioBox. This is because we can't dynamically set the strings
     // of a wxRadioBox.
-    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(propertyWindow);
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
     if (!resource)
       return FALSE;
       
-    wxStringList *stringList = resource->GetStringValues();
-    if (!stringList)
-    {
-      stringList = new wxStringList;
-      resource->SetStringValues(stringList);
-    }
-    stringList->Clear();
-      
+    wxStringList stringList;
     wxPropertyValue *expr = property->GetValue().GetFirst();
     while (expr)
     {
       char *s = expr->StringValue();
       if (s)
-        stringList->Add(s);
+        stringList.Add(s);
       expr = expr->GetNext();
     }
-    wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this);
+    resource->SetStringValues(stringList);
+    m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this);
     return TRUE;
   }
   return wxItemPropertyInfo::SetProperty(name, property);
@@ -1363,7 +1523,7 @@ void wxRadioBoxPropertyInfo::GetPropertyNames(wxStringList& names)
 
 bool wxRadioBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
 {
-  wxRadioBox *rbox = (wxRadioBox *)propertyWindow;
+  wxRadioBox *rbox = (wxRadioBox *)m_propertyWindow;
   // Take strings from resource instead
 /*
   int i;
@@ -1389,7 +1549,6 @@ bool wxRadioBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
 
 wxProperty *wxGroupBoxPropertyInfo::GetProperty(wxString& name)
 {
-  wxStaticBox *groupBox = (wxStaticBox *)propertyWindow;
   return wxItemPropertyInfo::GetProperty(name);
 }
 
@@ -1406,7 +1565,6 @@ void wxGroupBoxPropertyInfo::GetPropertyNames(wxStringList& names)
 
 bool wxGroupBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
 {
-  wxStaticBox *gbox = (wxStaticBox *)propertyWindow;
   return wxItemPropertyInfo::InstantiateResource(resource);
 }
 
@@ -1416,7 +1574,7 @@ bool wxGroupBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
 
 wxProperty *wxCheckBoxPropertyInfo::GetProperty(wxString& name)
 {
-  wxCheckBox *checkBox = (wxCheckBox *)propertyWindow;
+  wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow;
   if (name == "value")
     return new wxProperty("value", checkBox->GetValue(), "bool");
   else
@@ -1425,7 +1583,7 @@ wxProperty *wxCheckBoxPropertyInfo::GetProperty(wxString& name)
 
 bool wxCheckBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
 {
-  wxCheckBox *checkBox = (wxCheckBox *)propertyWindow;
+  wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow;
   if (name == "value")
   {
     checkBox->SetValue((bool)property->GetValue().BoolValue());
@@ -1444,7 +1602,7 @@ void wxCheckBoxPropertyInfo::GetPropertyNames(wxStringList& names)
 
 bool wxCheckBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
 {
-  wxCheckBox *cbox = (wxCheckBox *)propertyWindow;
+  wxCheckBox *cbox = (wxCheckBox *)m_propertyWindow;
   resource->SetValue1(cbox->GetValue());
   return wxItemPropertyInfo::InstantiateResource(resource);
 }
@@ -1455,7 +1613,7 @@ bool wxCheckBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
 
 wxProperty *wxRadioButtonPropertyInfo::GetProperty(wxString& name)
 {
-  wxRadioButton *checkBox = (wxRadioButton *)propertyWindow;
+  wxRadioButton *checkBox = (wxRadioButton *)m_propertyWindow;
   if (name == "value")
     return new wxProperty("value", checkBox->GetValue(), "bool");
   else
@@ -1464,7 +1622,7 @@ wxProperty *wxRadioButtonPropertyInfo::GetProperty(wxString& name)
 
 bool wxRadioButtonPropertyInfo::SetProperty(wxString& name, wxProperty *property)
 {
-  wxRadioButton *checkBox = (wxRadioButton *)propertyWindow;
+  wxRadioButton *checkBox = (wxRadioButton *)m_propertyWindow;
   if (name == "value")
   {
     checkBox->SetValue((bool)property->GetValue().BoolValue());
@@ -1483,7 +1641,7 @@ void wxRadioButtonPropertyInfo::GetPropertyNames(wxStringList& names)
 
 bool wxRadioButtonPropertyInfo::InstantiateResource(wxItemResource *resource)
 {
-  wxRadioButton *cbox = (wxRadioButton *)propertyWindow;
+  wxRadioButton *cbox = (wxRadioButton *)m_propertyWindow;
   resource->SetValue1(cbox->GetValue());
   return wxItemPropertyInfo::InstantiateResource(resource);
 }
@@ -1494,13 +1652,13 @@ bool wxRadioButtonPropertyInfo::InstantiateResource(wxItemResource *resource)
 
 wxProperty *wxSliderPropertyInfo::GetProperty(wxString& name)
 {
-  wxSlider *slider = (wxSlider *)propertyWindow;
+  wxSlider *slider = (wxSlider *)m_propertyWindow;
   if (name == "value")
     return new wxProperty("value", (long)slider->GetValue(), "integer");
   else if (name == "orientation")
   {
     char *pos = NULL;
-    if (propertyWindow->GetWindowStyleFlag() & wxHORIZONTAL)
+    if (m_propertyWindow->GetWindowStyleFlag() & wxHORIZONTAL)
       pos = "wxHORIZONTAL";
     else
       pos = "wxVERTICAL";
@@ -1519,7 +1677,7 @@ wxProperty *wxSliderPropertyInfo::GetProperty(wxString& name)
 
 bool wxSliderPropertyInfo::SetProperty(wxString& name, wxProperty *property)
 {
-  wxSlider *slider = (wxSlider *)propertyWindow;
+  wxSlider *slider = (wxSlider *)m_propertyWindow;
   if (name == "value")
   {
     slider->SetValue((int)property->GetValue().IntegerValue());
@@ -1554,6 +1712,7 @@ bool wxSliderPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     
     slider = (wxSlider *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(slider, this);
     slider->SetSize(-1, -1, h, w);
+    m_propertyWindow = slider;
     
     return TRUE;
   }
@@ -1582,7 +1741,7 @@ void wxSliderPropertyInfo::GetPropertyNames(wxStringList& names)
 
 bool wxSliderPropertyInfo::InstantiateResource(wxItemResource *resource)
 {
-  wxSlider *slider = (wxSlider *)propertyWindow;
+  wxSlider *slider = (wxSlider *)m_propertyWindow;
   resource->SetValue1(slider->GetValue());
   resource->SetValue2(slider->GetMin());
   resource->SetValue3(slider->GetMax());
@@ -1595,7 +1754,7 @@ bool wxSliderPropertyInfo::InstantiateResource(wxItemResource *resource)
 
 wxProperty *wxGaugePropertyInfo::GetProperty(wxString& name)
 {
-  wxGauge *gauge = (wxGauge *)propertyWindow;
+  wxGauge *gauge = (wxGauge *)m_propertyWindow;
   if (name == "value")
     return new wxProperty("value", (long)gauge->GetValue(), "integer");
   else if (name == "maxValue")
@@ -1606,7 +1765,7 @@ wxProperty *wxGaugePropertyInfo::GetProperty(wxString& name)
 
 bool wxGaugePropertyInfo::SetProperty(wxString& name, wxProperty *property)
 {
-  wxGauge *gauge = (wxGauge *)propertyWindow;
+  wxGauge *gauge = (wxGauge *)m_propertyWindow;
   if (name == "value")
   {
     gauge->SetValue((int)property->GetValue().IntegerValue());
@@ -1630,7 +1789,7 @@ void wxGaugePropertyInfo::GetPropertyNames(wxStringList& names)
 
 bool wxGaugePropertyInfo::InstantiateResource(wxItemResource *resource)
 {
-  wxGauge *gauge = (wxGauge *)propertyWindow;
+  wxGauge *gauge = (wxGauge *)m_propertyWindow;
   resource->SetValue1(gauge->GetValue());
   resource->SetValue2(gauge->GetRange());
   return wxItemPropertyInfo::InstantiateResource(resource);
@@ -1642,13 +1801,13 @@ bool wxGaugePropertyInfo::InstantiateResource(wxItemResource *resource)
 
 wxProperty *wxScrollBarPropertyInfo::GetProperty(wxString& name)
 {
-  wxScrollBar *scrollBar = (wxScrollBar *)propertyWindow;
-  if (name == "value")
-    return new wxProperty("value", (long)scrollBar->GetValue(), "integer");
+  wxScrollBar *scrollBar = (wxScrollBar *)m_propertyWindow;
+  if (name == "thumbPosition")
+    return new wxProperty("value", (long)scrollBar->GetThumbPosition(), "integer");
   else if (name == "orientation")
   {
     char *pos = NULL;
-    if (propertyWindow->GetWindowStyleFlag() & wxHORIZONTAL)
+    if (m_propertyWindow->GetWindowStyleFlag() & wxHORIZONTAL)
       pos = "wxHORIZONTAL";
     else
       pos = "wxVERTICAL";
@@ -1659,24 +1818,20 @@ wxProperty *wxScrollBarPropertyInfo::GetProperty(wxString& name)
   }
   else if (name == "pageSize")
   {
-    int viewStart, pageLength, objectLength, viewLength;
-    scrollBar->GetValues(&viewStart, &viewLength, &objectLength, &pageLength);
+    int pageLength = scrollBar->GetPageSize();
     
     return new wxProperty("pageSize", (long)pageLength, "integer");
   }
-  else if (name == "viewLength")
+  else if (name == "thumbSize")
   {
-    int viewStart, pageLength, objectLength, viewLength;
-    scrollBar->GetValues(&viewStart, &viewLength, &objectLength, &pageLength);
+    int thumbSize = scrollBar->GetThumbSize();
     
-    return new wxProperty("viewLength", (long)viewLength, "integer");
+    return new wxProperty("thumbSize", (long)thumbSize, "integer");
   }
-  else if (name == "objectLength")
+  else if (name == "range")
   {
-    int viewStart, pageLength, objectLength, viewLength;
-    scrollBar->GetValues(&viewStart, &viewLength, &objectLength, &pageLength);
-    
-    return new wxProperty("objectLength", (long)objectLength, "integer");
+    int range = scrollBar->GetRange();
+    return new wxProperty("range", (long)range, "integer");
   }
   else
     return wxItemPropertyInfo::GetProperty(name);
@@ -1684,10 +1839,10 @@ wxProperty *wxScrollBarPropertyInfo::GetProperty(wxString& name)
 
 bool wxScrollBarPropertyInfo::SetProperty(wxString& name, wxProperty *property)
 {
-  wxScrollBar *scrollBar = (wxScrollBar *)propertyWindow;
-  if (name == "value")
+  wxScrollBar *scrollBar = (wxScrollBar *)m_propertyWindow;
+  if (name == "thumbPosition")
   {
-    scrollBar->SetValue((int)property->GetValue().IntegerValue());
+    scrollBar->SetThumbPosition((int)property->GetValue().IntegerValue());
     return TRUE;
   }
   else if (name == "orientation")
@@ -1714,27 +1869,41 @@ bool wxScrollBarPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     scrollBar->SetWindowStyleFlag(windowStyle);
     
     // If the window style has changed, we swap the width and height parameters.
-    int w, h;
-    scrollBar->GetSize(&w, &h);
-    
+//    int w, h;
+//    scrollBar->GetSize(&w, &h);
+    wxItemResource     *item = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(scrollBar);
+       if ( item ) {
+               item->SetSize(item->GetX(), item->GetY(), item->GetHeight(), item->GetWidth());
+               item->SetStyle(windowStyle);
+       } /* IF */
+
     scrollBar = (wxScrollBar *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(scrollBar, this);
-    scrollBar->SetSize(-1, -1, h, w);
-    
+    m_propertyWindow = scrollBar;
+
     return TRUE;
   }
   else if (name == "pageSize")
   {
-    scrollBar->SetPageSize((int)property->GetValue().IntegerValue());
+    int pos = scrollBar->GetThumbPosition();
+    int range = scrollBar->GetRange();
+    int thumbSize = scrollBar->GetThumbSize();
+    scrollBar->SetScrollbar(pos, thumbSize, range, (int)property->GetValue().IntegerValue());
     return TRUE;
   }
-  else if (name == "viewLength")
+  else if (name == "thumbSize")
   {
-    scrollBar->SetViewLength((int)property->GetValue().IntegerValue());
+    int pos = scrollBar->GetThumbPosition();
+    int range = scrollBar->GetRange();
+    int pageSize = scrollBar->GetPageSize();
+    scrollBar->SetScrollbar(pos, (int)property->GetValue().IntegerValue(), range, pageSize);
     return TRUE;
   }
-  else if (name == "objectLength")
+  else if (name == "range")
   {
-    scrollBar->SetObjectLength((int)property->GetValue().IntegerValue());
+    int pos = scrollBar->GetThumbPosition();
+    int thumbSize = scrollBar->GetThumbSize();
+    int pageSize = scrollBar->GetPageSize();
+    scrollBar->SetScrollbar(pos, thumbSize, (int)property->GetValue().IntegerValue(), pageSize);
     return TRUE;
   }
   else
@@ -1745,10 +1914,10 @@ void wxScrollBarPropertyInfo::GetPropertyNames(wxStringList& names)
 {
   wxItemPropertyInfo::GetPropertyNames(names);
   names.Add("orientation");
-  names.Add("value");
+  names.Add("thumbPosition");
+  names.Add("thumbSize");
   names.Add("pageSize");
-  names.Add("viewLength");
-  names.Add("objectLength");
+  names.Add("range");
 
   // Remove some properties we don't inherit
   names.Delete("fontPoints");
@@ -1760,16 +1929,17 @@ void wxScrollBarPropertyInfo::GetPropertyNames(wxStringList& names)
 
 bool wxScrollBarPropertyInfo::InstantiateResource(wxItemResource *resource)
 {
-  wxScrollBar *sbar = (wxScrollBar *)propertyWindow;
-  
-  resource->SetValue1(sbar->GetValue());
+  wxScrollBar *sbar = (wxScrollBar *)m_propertyWindow;
 
-  int viewStart, pageLength, objectLength, viewLength;
-  sbar->GetValues(&viewStart, &viewLength, &objectLength, &pageLength);
+  int thumbPosition = sbar->GetThumbPosition();
+  int thumbSize = sbar->GetThumbSize();
+  int pageSize = sbar->GetPageSize();
+  int range = sbar->GetRange();
   
-  resource->SetValue2(pageLength);
-  resource->SetValue3(objectLength);
-  resource->SetValue5(viewLength);
+  resource->SetValue1(thumbPosition);
+  resource->SetValue2(thumbSize);
+  resource->SetValue3(range);
+  resource->SetValue5(pageSize);
 
   return wxItemPropertyInfo::InstantiateResource(resource);
 }
@@ -1780,7 +1950,9 @@ bool wxScrollBarPropertyInfo::InstantiateResource(wxItemResource *resource)
 
 wxProperty *wxPanelPropertyInfo::GetProperty(wxString& name)
 {
-  wxPanel *panelWindow = (wxPanel *)propertyWindow; 
+  wxPanel *panelWindow = (wxPanel *)m_propertyWindow; 
+
+/*
   wxFont *labelFont = panelWindow->GetLabelFont();
   wxFont *buttonFont = panelWindow->GetButtonFont();
   
@@ -1790,7 +1962,9 @@ wxProperty *wxPanelPropertyInfo::GetProperty(wxString& name)
   else if (name == "buttonFontPoints" || name == "buttonFontFamily" || name == "buttonFontStyle" || name == "buttonFontWeight" ||
       name == "buttonFontUnderlined")
     return GetFontProperty(name, buttonFont);
-  else if (name == "no3D")
+*/
+
+  if (name == "no3D")
   {
     bool userColours;
     if (panelWindow->GetWindowStyleFlag() & wxNO_3D)
@@ -1833,34 +2007,48 @@ wxProperty *wxPanelPropertyInfo::GetProperty(wxString& name)
     return new wxProperty(name, ((panelWindow->GetWindowStyleFlag() & wxTHICK_FRAME) == wxTHICK_FRAME),
         "bool");
   }
+  else if (name == "useSystemDefaults")
+  {
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow);
+    return new wxProperty(name, ((resource->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS) == wxRESOURCE_USE_DEFAULTS),
+        "bool");
+  }
+  else if (name == "useDialogUnits")
+  {
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow);
+    return new wxProperty(name, ((resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) == wxRESOURCE_DIALOG_UNITS),
+        "bool");
+  }
   else
     return wxWindowPropertyInfo::GetProperty(name);
 }
 
 bool wxPanelPropertyInfo::SetProperty(wxString& name, wxProperty *property)
 {
-  wxPanel *panelWindow = (wxPanel *)propertyWindow; 
+  wxPanel *panelWindow = (wxPanel *)m_propertyWindow; 
+/*
   wxFont *labelFont = panelWindow->GetLabelFont();
   wxFont *buttonFont = panelWindow->GetButtonFont();
-  
+
   if (labelFont && (name == "labelFontPoints" || name == "labelFontFamily" || name == "labelFontStyle" || name == "labelFontWeight" || name == "labelFontUnderlined" ))
   {
     wxFont *newFont = SetFontProperty(name, property, labelFont);
     if (newFont)
-      panelWindow->SetLabelFont(newFont);
+      panelWindow->SetLabelFont(newFont);
     return TRUE;
   }
   else if (buttonFont && (name == "buttonFontPoints" || name == "buttonFontFamily" || name == "buttonFontStyle" || name == "buttonFontWeight" || name == "buttonFontUnderlined" ))
   {
     wxFont *newFont = SetFontProperty(name, property, buttonFont);
     if (newFont)
-      panelWindow->SetButtonFont(newFont);
+      panelWindow->SetButtonFont(newFont);
     return TRUE;
   }
-  else if (name == "no3D")
+*/
+
+  if (name == "no3D")
   {
     bool userColours = property->GetValue().BoolValue();
-    long flag = panelWindow->GetWindowStyleFlag();
     
     if (userColours)
     {
@@ -1888,6 +2076,7 @@ bool wxPanelPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     wxColour col(r,g,b);
     panelWindow->SetBackgroundColour(col);
     panelWindow = (wxPanel *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(panelWindow, this);
+    m_propertyWindow = panelWindow;
    return TRUE;
   }
   else if (name == "title")
@@ -1925,6 +2114,52 @@ bool wxPanelPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     resource->SetStyle(panelWindow->GetWindowStyleFlag());
     return TRUE;
   }
+  else if (name == "useSystemDefaults")
+  {
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow);
+    bool useDefaults = property->GetValue().BoolValue();
+    long style = resource->GetResourceStyle();
+    if (useDefaults)
+    {
+        if ((style & wxRESOURCE_USE_DEFAULTS) == 0)
+            style |= wxRESOURCE_USE_DEFAULTS;
+    }
+    else
+    {
+        if ((style & wxRESOURCE_USE_DEFAULTS) != 0)
+            style -= wxRESOURCE_USE_DEFAULTS;
+    }
+    resource->SetResourceStyle(style);
+    panelWindow = (wxPanel *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(panelWindow, this);
+    return TRUE;
+  }
+  else if (name == "useDialogUnits")
+  {
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow);
+    bool useDialogUnits = property->GetValue().BoolValue();
+    long style = resource->GetResourceStyle();
+    if (useDialogUnits)
+    {
+        if ((style & wxRESOURCE_DIALOG_UNITS) == 0)
+        {
+            style |= wxRESOURCE_DIALOG_UNITS;
+            ConvertDialogUnits(TRUE); // Convert all resources
+        }
+    }
+    else
+    {
+        if ((style & wxRESOURCE_DIALOG_UNITS) != 0)
+        {
+            style -= wxRESOURCE_DIALOG_UNITS;
+            ConvertDialogUnits(FALSE); // Convert all resources
+        }
+    }
+    resource->SetResourceStyle(style);
+    panelWindow = (wxPanel *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(panelWindow, this);
+    m_propertyWindow = panelWindow;
+    // TODO: need to regenerate the width and height properties else they'll be inconsistent.
+    return TRUE;
+  }
   else
     return wxWindowPropertyInfo::SetProperty(name, property);
 }
@@ -1939,21 +2174,65 @@ void wxPanelPropertyInfo::GetPropertyNames(wxStringList& names)
   names.Add("caption");
   names.Add("systemMenu");
   names.Add("thickFrame");
+  names.Add("useSystemDefaults");
+  names.Add("useDialogUnits");
 }
 
 bool wxPanelPropertyInfo::InstantiateResource(wxItemResource *resource)
 {
-  wxPanel *panel = (wxPanel *)propertyWindow;
-  if (panel->GetFont())
-    resource->SetFont(wxTheFontList->FindOrCreateFont(panel->GetFont()->GetPointSize(),
-               panel->GetFont()->GetFamily(), panel->GetFont()->GetStyle(), panel->GetFont()->GetWeight(),
-               panel->GetFont()->GetUnderlined(), panel->GetFont()->GetFaceName()));
+  wxPanel *panel = (wxPanel *)m_propertyWindow;
+  if (panel->GetFont().Ok())
+    resource->SetFont(* wxTheFontList->FindOrCreateFont(panel->GetFont().GetPointSize(),
+               panel->GetFont().GetFamily(), panel->GetFont().GetStyle(), panel->GetFont().GetWeight(),
+               panel->GetFont().GetUnderlined(), panel->GetFont().GetFaceName()));
 
-  resource->SetBackgroundColour(new wxColour(panel->GetBackgroundColour()));
+  resource->SetBackgroundColour(wxColour(panel->GetBackgroundColour()));
 
   return wxWindowPropertyInfo::InstantiateResource(resource);
 }
 
+// Convert this dialog, and its children, to or from dialog units
+void wxPanelPropertyInfo::ConvertDialogUnits(bool toDialogUnits)
+{
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
+
+    wxPoint pt;
+    wxSize sz;
+    if (toDialogUnits)
+    {
+        sz = m_propertyWindow->ConvertPixelsToDialog(wxSize(resource->GetWidth(), resource->GetHeight()));
+        pt = m_propertyWindow->ConvertPixelsToDialog(wxPoint(resource->GetX(), resource->GetY()));
+    }
+    else
+    {
+        sz = m_propertyWindow->ConvertDialogToPixels(wxSize(resource->GetWidth(), resource->GetHeight()));
+        pt = m_propertyWindow->ConvertDialogToPixels(wxPoint(resource->GetX(), resource->GetY()));
+    }
+    resource->SetSize(pt.x, pt.y, sz.x, sz.y);
+
+    wxNode* node = m_propertyWindow->GetChildren().First();
+    while (node)
+    {
+        wxWindow* child = (wxWindow*) node->Data();
+        if (child->IsKindOf(CLASSINFO(wxControl)))
+        {
+            resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(child);
+            if (toDialogUnits)
+            {
+                sz = m_propertyWindow->ConvertPixelsToDialog(wxSize(resource->GetWidth(), resource->GetHeight()));
+                pt = m_propertyWindow->ConvertPixelsToDialog(wxPoint(resource->GetX(), resource->GetY()));
+            }
+            else
+            {
+                sz = m_propertyWindow->ConvertDialogToPixels(wxSize(resource->GetWidth(), resource->GetHeight()));
+                pt = m_propertyWindow->ConvertDialogToPixels(wxPoint(resource->GetX(), resource->GetY()));
+            }
+            resource->SetSize(pt.x, pt.y, sz.x, sz.y);
+        }
+        node = node->Next();
+    }
+}
+
 #if 0
 /*
  * Dialog boxes
@@ -1961,7 +2240,7 @@ bool wxPanelPropertyInfo::InstantiateResource(wxItemResource *resource)
 
 wxProperty *wxDialogPropertyInfo::GetProperty(wxString& name)
 {
-  wxDialog *dialogWindow = (wxDialog *)propertyWindow; 
+  wxDialog *dialogWindow = (wxDialog *)m_propertyWindow; 
   if (name == "modal")
   {
     wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(dialogWindow);
@@ -1977,7 +2256,7 @@ wxProperty *wxDialogPropertyInfo::GetProperty(wxString& name)
 
 bool wxDialogPropertyInfo::SetProperty(wxString& name, wxProperty *property)
 {
-  wxDialog *dialogWindow = (wxDialog *)propertyWindow;
+  wxDialog *dialogWindow = (wxDialog *)m_propertyWindow;
 
   if (name == "modal")
   {
@@ -2001,9 +2280,9 @@ void wxDialogPropertyInfo::GetPropertyNames(wxStringList& names)
 
 bool wxDialogPropertyInfo::InstantiateResource(wxItemResource *resource)
 {
-  wxDialog *dialog = (wxDialog *)propertyWindow;
+  wxDialog *dialog = (wxDialog *)m_propertyWindow;
   wxString str(dialog->GetTitle());
-  resource->SetTitle(WXSTRINGCAST str);
+  resource->SetTitle(str);
     
   return wxPanelPropertyInfo::InstantiateResource(resource);
 }
@@ -2051,7 +2330,7 @@ wxResourceSymbolValidator::~wxResourceSymbolValidator(void)
 {
 }
 
-bool wxResourceSymbolValidator::OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow)
+bool wxResourceSymbolValidator::OnCheckValue(wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow))
 {
   return TRUE;
 }
@@ -2059,7 +2338,7 @@ bool wxResourceSymbolValidator::OnCheckValue(wxProperty *property, wxPropertyLis
 // Called when TICK is pressed or focus is lost or view wants to update
 // the property list.
 // Does the transferance from the property editing area to the property itself
-bool wxResourceSymbolValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow)
+bool wxResourceSymbolValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow))
 {
   if (!view->GetValueText())
     return FALSE;
@@ -2071,7 +2350,7 @@ bool wxResourceSymbolValidator::OnRetrieveValue(wxProperty *property, wxProperty
 // Called when TICK is pressed or focus is lost or view wants to update
 // the property list.
 // Does the transferance from the property editing area to the property itself
-bool wxResourceSymbolValidator::OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow)
+bool wxResourceSymbolValidator::OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow))
 {
   if (!view->GetValueText())
     return FALSE;
@@ -2090,7 +2369,7 @@ bool wxResourceSymbolValidator::OnDoubleClick(wxProperty *property, wxPropertyLi
   return TRUE;
 }
 
-bool wxResourceSymbolValidator::OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow)
+bool wxResourceSymbolValidator::OnPrepareControls(wxProperty *WXUNUSED(property), wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow))
 {
   if (view->GetConfirmButton())
     view->GetConfirmButton()->Enable(TRUE);
@@ -2125,7 +2404,6 @@ void wxResourceSymbolValidator::OnEdit(wxProperty *property, wxPropertyListView
   {
     wxString symbolName(dialog->GetSymbol());
     long id = dialog->GetId();
-    dialog->Destroy();
 
     wxString str;
     str.Printf("%d", id);
@@ -2135,6 +2413,8 @@ void wxResourceSymbolValidator::OnEdit(wxProperty *property, wxPropertyListView
     view->UpdatePropertyDisplayInList(property);
     view->OnPropertyChanged(property);
   }
+  // Moved from the 'if' branch on suggestion of Roman Pavlov
+  dialog->Destroy();
 }
 
 BEGIN_EVENT_TABLE(wxResourceSymbolDialog, wxDialog)
@@ -2272,7 +2552,7 @@ bool wxResourceSymbolDialog::CheckValues()
     return TRUE;
 }
 
-void wxResourceSymbolDialog::OnComboBoxSelect(wxCommandEvent& event)
+void wxResourceSymbolDialog::OnComboBoxSelect(wxCommandEvent& WXUNUSED(event))
 {
     wxString str(m_nameCtrl->GetStringSelection());
     if (wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().IsStandardSymbol(str))
@@ -2296,7 +2576,7 @@ void wxResourceSymbolDialog::OnComboBoxSelect(wxCommandEvent& event)
     }
 }
 
-void wxResourceSymbolDialog::OnSymbolNameUpdate(wxCommandEvent& event)
+void wxResourceSymbolDialog::OnSymbolNameUpdate(wxCommandEvent& WXUNUSED(event))
 {
     wxString str(m_nameCtrl->GetValue());
     if (wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().IsStandardSymbol(str))