+// 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();
+ }
+}
+