Misc. Dialog Editor/resource bugs fixed

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5570 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2000-01-21 17:01:44 +00:00
parent 1b7274a8c0
commit 30b5fc118f
8 changed files with 177 additions and 83 deletions

View File

@@ -88,7 +88,7 @@ applications.
<H3>How can I prepare for wxWindows 2?</H3> <H3>How can I prepare for wxWindows 2?</H3>
To make porting to wxWindows 2 easier in the future, take a look at some To make porting to wxWindows 2 easier in the future, take a look at some
<a href="http://web.ukonline.co.uk/julian.smart/wxwin/prepare.htm">tips</a> for writing existing code in a 2-compatible way.<P> <a href="http://www.wxwindows.org/prepare.htm">tips</a> for writing existing code in a 2-compatible way.<P>
<H3>How much has the API changed since 1.xx?</H3> <H3>How much has the API changed since 1.xx?</H3>
@@ -224,8 +224,8 @@ from Java, and the level of interest in wxWindows is as high as ever.<P>
<H3>How can I help the project?</H3> <H3>How can I help the project?</H3>
Please check out the <a href="http://web.ukonline.co.uk/julian.smart/wxwin/develop.htm" target=main>Backroom</a> pages, Please check out the <a href="http://www.wxwindows.org/develop.htm" target=main>Backroom</a> pages,
in particular the <a href="http://web.ukonline.co.uk/julian.smart/wxwin/projects.htm">suggested projects</a>, and in particular the <a href="http://www.wxwindows.org/projects.htm">suggested projects</a>, and
mail <a href="mailto:julian.smart@ukonline.co.uk">Julian Smart</a> or the developers' mailing list with your own suggestions.<P> mail <a href="mailto:julian.smart@ukonline.co.uk">Julian Smart</a> or the developers' mailing list with your own suggestions.<P>
</font> </font>

View File

@@ -25,7 +25,7 @@ See also <a href="faq.htm">top-level FAQ page</a>.
<h3>When is wxMac 2 due to be released?</h3> <h3>When is wxMac 2 due to be released?</h3>
There is a <a href="http://web.ukonline.co.uk/julian.smart/wxwin/dl_mac2.htm">preview</a> available. There is a <a href="http://www.wxwindows.org/dl_mac2.htm">preview</a> available.
A beta release can be expected by early Q2 1999. The author of this port A beta release can be expected by early Q2 1999. The author of this port
is Stefan Csomor (csomor@advancedconcepts.ch). is Stefan Csomor (csomor@advancedconcepts.ch).
<P> <P>

View File

@@ -537,7 +537,18 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c
else else
{ {
if (control && childResource->GetFont().Ok()) if (control && childResource->GetFont().Ok())
{
control->SetFont(childResource->GetFont()); control->SetFont(childResource->GetFont());
#ifdef __WXMSW__
// Force the layout algorithm since the size changes the layout
if (control->IsKindOf(CLASSINFO(wxRadioBox)))
{
wxSize sz = control->GetSize();
control->SetSize(-1, -1, -1, -1, wxSIZE_AUTO_WIDTH|wxSIZE_AUTO_HEIGHT);
}
#endif
}
} }
return control; return control;
} }
@@ -962,11 +973,9 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr)
if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
{ {
// controlItem->SetLabelFont(wxResourceInterpretFontSpec(expr->Nth(count))); // Skip past the obsolete label font spec if there are two consecutive specs
// Do nothing if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList)
count ++; count ++;
if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
} }
} }
@@ -1067,9 +1076,9 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr)
} }
if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
{ {
// controlItem->SetLabelFont(wxResourceInterpretFontSpec(expr->Nth(count))); // Skip past the obsolete label font spec if there are two consecutive specs
if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList)
count ++; count ++;
if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
} }
} }
@@ -1093,10 +1102,9 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr)
if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
{ {
// controlItem->SetLabelFont(wxResourceInterpretFontSpec(expr->Nth(count))); // Skip past the obsolete label font spec if there are two consecutive specs
if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList)
count ++; count ++;
if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
} }
} }
@@ -1129,10 +1137,9 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr)
if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
{ {
// controlItem->SetLabelFont(wxResourceInterpretFontSpec(expr->Nth(count))); // Skip past the obsolete label font spec if there are two consecutive specs
if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList)
count ++; count ++;
if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
} }
} }
@@ -1167,10 +1174,9 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr)
if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
{ {
// controlItem->SetLabelFont(wxResourceInterpretFontSpec(expr->Nth(count))); // Skip past the obsolete label font spec if there are two consecutive specs
if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList)
count ++; count ++;
if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
} }
} }

View File

@@ -47,6 +47,7 @@ wxPropertyValue::wxPropertyValue(void)
wxPropertyValue::wxPropertyValue(const wxPropertyValue& copyFrom) wxPropertyValue::wxPropertyValue(const wxPropertyValue& copyFrom)
{ {
m_value.string = (wxChar*) NULL;
m_modifiedFlag = FALSE; m_modifiedFlag = FALSE;
Copy((wxPropertyValue& )copyFrom); Copy((wxPropertyValue& )copyFrom);
} }
@@ -336,6 +337,11 @@ wxPropertyValue *wxPropertyValue::NewCopy(void) const
void wxPropertyValue::Copy(wxPropertyValue& copyFrom) void wxPropertyValue::Copy(wxPropertyValue& copyFrom)
{ {
if (m_type == wxPropertyValueString)
{
delete[] m_value.string ;
m_value.string = NULL;
}
m_type = copyFrom.Type(); m_type = copyFrom.Type();
switch (m_type) switch (m_type)
@@ -587,6 +593,14 @@ void wxPropertyValue::operator=(const wxString& val1)
const wxChar *val = (const wxChar *)val1; const wxChar *val = (const wxChar *)val1;
m_modifiedFlag = TRUE; m_modifiedFlag = TRUE;
wxPropertyValueType oldType = m_type;
if (oldType == wxPropertyValueString)
{
delete[] m_value.string ;
m_value.string = NULL;
}
if (m_type == wxPropertyValueNull) if (m_type == wxPropertyValueNull)
m_type = wxPropertyValueString; m_type = wxPropertyValueString;
@@ -599,8 +613,7 @@ void wxPropertyValue::operator=(const wxString& val1)
} }
else if (m_type == wxPropertyValueStringPtr) else if (m_type == wxPropertyValueStringPtr)
{ {
if (*m_value.stringPtr) wxFAIL_MSG( "Shouldn't try to assign a wxString reference to a char* pointer.");
delete[] *m_value.stringPtr;
if (val) if (val)
*m_value.stringPtr = copystring(val); *m_value.stringPtr = copystring(val);
else else
@@ -615,6 +628,13 @@ void wxPropertyValue::operator=(const wxString& val1)
void wxPropertyValue::operator=(const long val) void wxPropertyValue::operator=(const long val)
{ {
wxPropertyValueType oldType = m_type;
if (oldType == wxPropertyValueString)
{
delete[] m_value.string ;
m_value.string = NULL;
}
m_modifiedFlag = TRUE; m_modifiedFlag = TRUE;
if (m_type == wxPropertyValueNull) if (m_type == wxPropertyValueNull)
m_type = wxPropertyValueInteger; m_type = wxPropertyValueInteger;
@@ -634,6 +654,13 @@ void wxPropertyValue::operator=(const long val)
void wxPropertyValue::operator=(const bool val) void wxPropertyValue::operator=(const bool val)
{ {
wxPropertyValueType oldType = m_type;
if (oldType == wxPropertyValueString)
{
delete[] m_value.string ;
m_value.string = NULL;
}
m_modifiedFlag = TRUE; m_modifiedFlag = TRUE;
if (m_type == wxPropertyValueNull) if (m_type == wxPropertyValueNull)
m_type = wxPropertyValuebool; m_type = wxPropertyValuebool;
@@ -649,6 +676,13 @@ void wxPropertyValue::operator=(const bool val)
void wxPropertyValue::operator=(const float val) void wxPropertyValue::operator=(const float val)
{ {
wxPropertyValueType oldType = m_type;
if (oldType == wxPropertyValueString)
{
delete[] m_value.string ;
m_value.string = NULL;
}
m_modifiedFlag = TRUE; m_modifiedFlag = TRUE;
if (m_type == wxPropertyValueNull) if (m_type == wxPropertyValueNull)
m_type = wxPropertyValueReal; m_type = wxPropertyValueReal;
@@ -668,6 +702,13 @@ void wxPropertyValue::operator=(const float val)
void wxPropertyValue::operator=(const wxChar **val) void wxPropertyValue::operator=(const wxChar **val)
{ {
wxPropertyValueType oldType = m_type;
if (oldType == wxPropertyValueString)
{
delete[] m_value.string ;
m_value.string = NULL;
}
m_modifiedFlag = TRUE; m_modifiedFlag = TRUE;
m_type = wxPropertyValueStringPtr; m_type = wxPropertyValueStringPtr;

View File

@@ -486,6 +486,8 @@ bool wxResourceManager::New(bool loadFromFile, const wxString& filename)
bool wxResourceManager::Clear(bool WXUNUSED(deleteWindows), bool force) bool wxResourceManager::Clear(bool WXUNUSED(deleteWindows), bool force)
{ {
wxPropertyInfo::CloseWindow();
if (!force && Modified()) if (!force && Modified())
{ {
int ans = wxMessageBox("Save modified resource file?", "Dialog Editor", wxYES_NO | wxCANCEL); int ans = wxMessageBox("Save modified resource file?", "Dialog Editor", wxYES_NO | wxCANCEL);
@@ -927,6 +929,8 @@ bool wxResourceManager::EditSelectedResource()
bool wxResourceManager::Edit(wxItemResource *res) bool wxResourceManager::Edit(wxItemResource *res)
{ {
wxPropertyInfo::CloseWindow();
ClearCurrentDialog(); ClearCurrentDialog();
wxString resType(res->GetType()); wxString resType(res->GetType());
@@ -966,6 +970,8 @@ bool wxResourceManager::Edit(wxItemResource *res)
bool wxResourceManager::CreateNewPanel() bool wxResourceManager::CreateNewPanel()
{ {
wxPropertyInfo::CloseWindow();
ClearCurrentDialog(); ClearCurrentDialog();
char buf[256]; char buf[256];
@@ -1456,6 +1462,25 @@ void wxResourceManager::RemoveSelection(wxWindow *win)
m_selections.DeleteObject(win); m_selections.DeleteObject(win);
} }
void wxResourceManager::DeselectItemIfNecessary(wxWindow *win)
{
if (win->IsKindOf(CLASSINFO(wxControl)) && (win->GetEventHandler() != win))
{
// Deselect and refresh window in case we leave selection
// handles behind
wxControl *item = (wxControl *)win;
wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler();
if (childHandler->IsSelected())
{
wxResourceManager::GetCurrentResourceManager()->RemoveSelection(item);
childHandler->SelectItem(FALSE);
#ifndef __WXGTK__
item->GetParent()->Refresh();
#endif
}
}
}
// Need to search through resource table removing this from // Need to search through resource table removing this from
// any resource which has this as a parent. // any resource which has this as a parent.
bool wxResourceManager::RemoveResourceFromParent(wxItemResource *res) bool wxResourceManager::RemoveResourceFromParent(wxItemResource *res)
@@ -1515,24 +1540,7 @@ bool wxResourceManager::DeleteResource(wxItemResource *res)
bool wxResourceManager::DeleteResource(wxWindow *win) bool wxResourceManager::DeleteResource(wxWindow *win)
{ {
if (win->IsKindOf(CLASSINFO(wxControl)) && (win->GetEventHandler() != win)) DeselectItemIfNecessary(win);
{
// Deselect and refresh window in case we leave selection
// handles behind
wxControl *item = (wxControl *)win;
wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler();
wxASSERT_MSG( win->GetEventHandler()->IsKindOf(CLASSINFO(wxResourceEditorControlHandler)), "Wrong kind of handler in DeleteResource" );
if (childHandler->IsSelected())
{
RemoveSelection(item);
childHandler->SelectItem(FALSE);
#ifndef __WXGTK__
item->GetParent()->Refresh();
#endif
}
}
wxItemResource *res = FindResourceForWindow(win); wxItemResource *res = FindResourceForWindow(win);
@@ -1803,7 +1811,7 @@ bool wxResourceManager::RepairResourceIds()
// Deletes 'win' and creates a new window from the resource that // Deletes 'win' and creates a new window from the resource that
// was associated with it. E.g. if you can't change properties on the // was associated with it. E.g. if you can't change properties on the
// fly, you'll need to delete the window and create it again. // fly, you'll need to delete the window and create it again.
wxWindow *wxResourceManager::RecreateWindowFromResource(wxWindow *win, wxWindowPropertyInfo *info) wxWindow *wxResourceManager::RecreateWindowFromResource(wxWindow *win, wxWindowPropertyInfo *info, bool instantiateFirst)
{ {
wxItemResource *resource = FindResourceForWindow(win); wxItemResource *resource = FindResourceForWindow(win);
@@ -1816,6 +1824,8 @@ wxWindow *wxResourceManager::RecreateWindowFromResource(wxWindow *win, wxWindowP
info = newInfo; info = newInfo;
} }
// May not always want to copy values back from the resource
if (instantiateFirst)
info->InstantiateResource(resource); info->InstantiateResource(resource);
wxWindow *newWin = NULL; wxWindow *newWin = NULL;
@@ -2175,6 +2185,7 @@ void wxResourceEditorFrame::OnRecreateSelection(wxCommandEvent& WXUNUSED(event))
void wxResourceEditorFrame::OnCloseWindow(wxCloseEvent& event) void wxResourceEditorFrame::OnCloseWindow(wxCloseEvent& event)
{ {
wxPropertyInfo::CloseWindow();
if (manager->Modified()) if (manager->Modified())
{ {
if (!manager->Clear(TRUE, FALSE)) if (!manager->Clear(TRUE, FALSE))
@@ -2273,21 +2284,7 @@ void ObjectMenuProc(wxMenu *menu, wxCommandEvent& event)
} }
case OBJECT_MENU_DELETE: case OBJECT_MENU_DELETE:
{ {
if (data->IsKindOf(CLASSINFO(wxControl)) && (data->GetEventHandler() != data)) wxResourceManager::GetCurrentResourceManager()->DeselectItemIfNecessary(data);
{
// Deselect and refresh window in case we leave selection
// handles behind
wxControl *item = (wxControl *)data;
wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler();
if (childHandler->IsSelected())
{
wxResourceManager::GetCurrentResourceManager()->RemoveSelection(item);
childHandler->SelectItem(FALSE);
#ifndef __WXGTK__
item->GetParent()->Refresh();
#endif
}
}
wxResourceManager::GetCurrentResourceManager()->SaveInfoAndDeleteHandler(data); wxResourceManager::GetCurrentResourceManager()->SaveInfoAndDeleteHandler(data);
wxResourceManager::GetCurrentResourceManager()->DeleteResource(data); wxResourceManager::GetCurrentResourceManager()->DeleteResource(data);

View File

@@ -252,10 +252,13 @@ public:
// Deletes 'win' and creates a new window from the resource that // Deletes 'win' and creates a new window from the resource that
// was associated with it. E.g. if you can't change properties on the // was associated with it. E.g. if you can't change properties on the
// fly, you'll need to delete the window and create it again. // fly, you'll need to delete the window and create it again.
virtual wxWindow *RecreateWindowFromResource(wxWindow *win, wxWindowPropertyInfo *info = NULL); virtual wxWindow *RecreateWindowFromResource(wxWindow *win, wxWindowPropertyInfo *info = NULL, bool instantiateFirst = TRUE);
virtual bool RecreateSelection(); virtual bool RecreateSelection();
// Remove selection handles if this control is selected
void DeselectItemIfNecessary(wxWindow *win);
// Need to search through resource table removing this from // Need to search through resource table removing this from
// any resource which has this as a parent. // any resource which has this as a parent.
virtual bool RemoveResourceFromParent(wxItemResource *res); virtual bool RemoveResourceFromParent(wxItemResource *res);

View File

@@ -123,18 +123,7 @@ bool wxPropertyInfo::Edit(wxWindow *WXUNUSED(parent), const wxString& title)
} }
else else
{ {
int w, h, x, y; CloseWindow(); // Close the window so we can open a new one
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;
} }
} }
@@ -164,7 +153,7 @@ bool wxPropertyInfo::Edit(wxWindow *WXUNUSED(parent), const wxString& title)
propSheet->SetAllModified(FALSE); propSheet->SetAllModified(FALSE);
wxResourcePropertyListView *view = new wxResourcePropertyListView(this, NULL, wxResourcePropertyListView *view = new wxResourcePropertyListView(this, NULL,
wxPROP_BUTTON_OK | wxPROP_BUTTON_CANCEL | wxPROP_BUTTON_OK | // wxPROP_BUTTON_CANCEL |
wxPROP_BUTTON_CHECK_CROSS|wxPROP_DYNAMIC_VALUE_FIELD|wxPROP_PULLDOWN|wxPROP_SHOWVALUES); wxPROP_BUTTON_CHECK_CROSS|wxPROP_DYNAMIC_VALUE_FIELD|wxPROP_PULLDOWN|wxPROP_SHOWVALUES);
wxDialogEditorPropertyListFrame *propWin = new wxDialogEditorPropertyListFrame(view, wxDialogEditorPropertyListFrame *propWin = new wxDialogEditorPropertyListFrame(view,
@@ -200,6 +189,24 @@ bool wxPropertyInfo::Edit(wxWindow *WXUNUSED(parent), const wxString& title)
return TRUE; return TRUE;
} }
void wxPropertyInfo::CloseWindow()
{
if (sm_propertyWindow)
{
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;
sm_propertyWindow->Destroy();
sm_propertyWindow = (wxDialogEditorPropertyListFrame *) NULL;
}
}
/* /*
* wxWindowPropertyInfo * wxWindowPropertyInfo
*/ */
@@ -376,7 +383,15 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{ {
wxFont *newFont = SetFontProperty(name, property, font); wxFont *newFont = SetFontProperty(name, property, font);
if (newFont) if (newFont)
{
m_propertyWindow->SetFont(* newFont); m_propertyWindow->SetFont(* newFont);
wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
if (resource)
{
resource->SetFont(* newFont);
}
}
return TRUE; return TRUE;
} }
else if (name == "name") else if (name == "name")
@@ -771,6 +786,7 @@ wxProperty *wxItemPropertyInfo::GetProperty(wxString& name)
bool wxItemPropertyInfo::SetProperty(wxString& name, wxProperty *property) bool wxItemPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{ {
wxControl *itemWindow = (wxControl *)m_propertyWindow; wxControl *itemWindow = (wxControl *)m_propertyWindow;
#if 0
wxFont *font = & itemWindow->GetFont(); wxFont *font = & itemWindow->GetFont();
if (font && (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" || name == "fontUnderlined" )) if (font && (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" || name == "fontUnderlined" ))
@@ -780,7 +796,9 @@ bool wxItemPropertyInfo::SetProperty(wxString& name, wxProperty *property)
itemWindow->SetFont(* newFont); itemWindow->SetFont(* newFont);
return TRUE; return TRUE;
} }
else if (name == "label") else
#endif
if (name == "label")
{ {
itemWindow->SetLabel(property->GetValue().StringValue()); itemWindow->SetLabel(property->GetValue().StringValue());
return TRUE; return TRUE;
@@ -1460,6 +1478,8 @@ bool wxRadioBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
wxRadioBox *radioBox = (wxRadioBox *)m_propertyWindow; wxRadioBox *radioBox = (wxRadioBox *)m_propertyWindow;
if (name == "numberRowsOrCols") if (name == "numberRowsOrCols")
{ {
wxResourceManager::GetCurrentResourceManager()->DeselectItemIfNecessary(radioBox);
radioBox->SetNumberOfRowsOrCols((int)property->GetValue().IntegerValue()); radioBox->SetNumberOfRowsOrCols((int)property->GetValue().IntegerValue());
m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this); m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this);
return TRUE; return TRUE;
@@ -1480,11 +1500,14 @@ bool wxRadioBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
windowStyle -= wxRA_SPECIFY_COLS; windowStyle -= wxRA_SPECIFY_COLS;
windowStyle |= wxRA_SPECIFY_ROWS; windowStyle |= wxRA_SPECIFY_ROWS;
} }
wxResourceManager::GetCurrentResourceManager()->DeselectItemIfNecessary(radioBox);
radioBox->SetWindowStyleFlag(windowStyle); radioBox->SetWindowStyleFlag(windowStyle);
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(radioBox); wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(radioBox);
resource->SetStyle(windowStyle); resource->SetStyle(windowStyle);
resource->SetSize(resource->GetX(), resource->GetY(), -1, -1); // Let it calculate it's own size
m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this); m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this, FALSE);
return TRUE; return TRUE;
} }
else if (name == "values") else if (name == "values")
@@ -1506,9 +1529,32 @@ bool wxRadioBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
expr = expr->GetNext(); expr = expr->GetNext();
} }
resource->SetStringValues(stringList); resource->SetStringValues(stringList);
m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this); resource->SetSize(resource->GetX(), resource->GetY(), -1, -1); // Let it calculate it's own size
m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this, FALSE);
return TRUE; return TRUE;
} }
else if (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" || name == "fontUnderlined" )
{
wxFont *font = & m_propertyWindow->GetFont();
if (!font)
return FALSE;
wxFont *newFont = SetFontProperty(name, property, font);
if (newFont)
{
wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
if (resource)
{
resource->SetFont(* newFont);
}
wxResourceManager::GetCurrentResourceManager()->DeselectItemIfNecessary(radioBox);
radioBox->SetFont(* newFont);
radioBox->SetSize(-1, -1, -1, -1, wxSIZE_AUTO_WIDTH | wxSIZE_AUTO_HEIGHT);
return TRUE;
}
}
return wxItemPropertyInfo::SetProperty(name, property); return wxItemPropertyInfo::SetProperty(name, property);
} }

View File

@@ -74,6 +74,7 @@ class wxPropertyInfo: public wxObject
virtual bool SetProperty(wxString& propName, wxProperty *property) = 0; virtual bool SetProperty(wxString& propName, wxProperty *property) = 0;
virtual void GetPropertyNames(wxStringList& names) = 0; virtual void GetPropertyNames(wxStringList& names) = 0;
virtual bool Edit(wxWindow *parent, const wxString& title); virtual bool Edit(wxWindow *parent, const wxString& title);
static void CloseWindow(); // Close the current window if open.
}; };
// For all windows // For all windows