Added wxPoem sample; fixed some Dialog Editor problems; wxStaticBitmap and wxBitmapButton
now recognised by resource.cpp. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1181 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1318,7 +1318,22 @@ void wxResourceManager::AlignItems(int flag)
|
||||
break;
|
||||
}
|
||||
|
||||
wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item);
|
||||
wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item->GetParent());
|
||||
|
||||
item->SetSize(newX, newY, w, h);
|
||||
|
||||
// Also update the associated resource
|
||||
// We need to convert to dialog units if this is not a dialog or panel, but
|
||||
// the parent resource specifies dialog units.
|
||||
if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
|
||||
{
|
||||
wxPoint pt = item->GetParent()->ConvertPixelsToDialog(wxPoint(newX, newY));
|
||||
newX = pt.x; newY = pt.y;
|
||||
wxSize sz = item->GetParent()->ConvertPixelsToDialog(wxSize(w, h));
|
||||
w = sz.x; h = sz.y;
|
||||
}
|
||||
resource->SetSize(newX, newY, w, h);
|
||||
}
|
||||
}
|
||||
win->Refresh();
|
||||
@@ -1348,7 +1363,23 @@ void wxResourceManager::CopySize()
|
||||
{
|
||||
wxControl *item = (wxControl *)node->Data();
|
||||
if (item->GetParent() == win)
|
||||
{
|
||||
item->SetSize(-1, -1, firstW, firstH);
|
||||
|
||||
wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item);
|
||||
wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item->GetParent());
|
||||
|
||||
// Also update the associated resource
|
||||
// We need to convert to dialog units if this is not a dialog or panel, but
|
||||
// the parent resource specifies dialog units.
|
||||
if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
|
||||
{
|
||||
wxSize sz = item->GetParent()->ConvertPixelsToDialog(wxSize(firstW, firstH));
|
||||
firstW = sz.x; firstH = sz.y;
|
||||
}
|
||||
resource->SetSize(resource->GetX(), resource->GetY(), firstW, firstH);
|
||||
|
||||
}
|
||||
}
|
||||
win->Refresh();
|
||||
}
|
||||
@@ -1931,30 +1962,30 @@ wxWindowPropertyInfo *wxResourceManager::CreatePropertyInfoForWindow(wxWindow *w
|
||||
{
|
||||
info = new wxRadioButtonPropertyInfo(win);
|
||||
}
|
||||
else if (win->IsKindOf(CLASSINFO(wxChoice)))
|
||||
{
|
||||
info = new wxChoicePropertyInfo(win);
|
||||
}
|
||||
else if (win->IsKindOf(CLASSINFO(wxComboBox)))
|
||||
{
|
||||
info = new wxComboBoxPropertyInfo(win);
|
||||
}
|
||||
else if (win->IsKindOf(CLASSINFO(wxButton)))
|
||||
else if (win->IsKindOf(CLASSINFO(wxChoice)))
|
||||
{
|
||||
info = new wxButtonPropertyInfo(win);
|
||||
info = new wxChoicePropertyInfo(win);
|
||||
}
|
||||
else if (win->IsKindOf(CLASSINFO(wxBitmapButton)))
|
||||
{
|
||||
info = new wxBitmapButtonPropertyInfo(win);
|
||||
}
|
||||
else if (win->IsKindOf(CLASSINFO(wxStaticText)))
|
||||
else if (win->IsKindOf(CLASSINFO(wxButton)))
|
||||
{
|
||||
info = new wxStaticTextPropertyInfo(win);
|
||||
info = new wxButtonPropertyInfo(win);
|
||||
}
|
||||
else if (win->IsKindOf(CLASSINFO(wxStaticBitmap)))
|
||||
{
|
||||
info = new wxStaticBitmapPropertyInfo(win);
|
||||
}
|
||||
else if (win->IsKindOf(CLASSINFO(wxStaticText)))
|
||||
{
|
||||
info = new wxStaticTextPropertyInfo(win);
|
||||
}
|
||||
else if (win->IsKindOf(CLASSINFO(wxTextCtrl)))
|
||||
{
|
||||
info = new wxTextPropertyInfo(win);
|
||||
|
@@ -810,7 +810,7 @@ bool wxButtonPropertyInfo::InstantiateResource(wxItemResource *resource)
|
||||
wxProperty *wxBitmapButtonPropertyInfo::GetProperty(wxString& name)
|
||||
{
|
||||
wxBitmapButton *button = (wxBitmapButton *)m_propertyWindow;
|
||||
if (name == "label")
|
||||
if (name == "bitmapFilename")
|
||||
{
|
||||
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(button);
|
||||
wxString str("none.bmp");
|
||||
@@ -819,7 +819,7 @@ wxProperty *wxBitmapButtonPropertyInfo::GetProperty(wxString& name)
|
||||
{
|
||||
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);
|
||||
@@ -828,7 +828,7 @@ wxProperty *wxBitmapButtonPropertyInfo::GetProperty(wxString& name)
|
||||
bool wxBitmapButtonPropertyInfo::SetProperty(wxString& name, wxProperty *property)
|
||||
{
|
||||
wxBitmapButton *button = (wxBitmapButton *)m_propertyWindow;
|
||||
if (name == "label")
|
||||
if (name == "bitmapFilename")
|
||||
{
|
||||
char *s = property->GetValue().StringValue();
|
||||
if (s && wxFileExists(s))
|
||||
@@ -867,8 +867,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)
|
||||
@@ -908,7 +909,7 @@ bool wxStaticTextPropertyInfo::InstantiateResource(wxItemResource *resource)
|
||||
wxProperty *wxStaticBitmapPropertyInfo::GetProperty(wxString& name)
|
||||
{
|
||||
wxStaticBitmap *message = (wxStaticBitmap *)m_propertyWindow;
|
||||
if (name == "label")
|
||||
if (name == "bitmapFilename")
|
||||
{
|
||||
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(message);
|
||||
wxString str("none.bmp");
|
||||
@@ -917,7 +918,7 @@ wxProperty *wxStaticBitmapPropertyInfo::GetProperty(wxString& name)
|
||||
{
|
||||
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);
|
||||
@@ -926,7 +927,7 @@ wxProperty *wxStaticBitmapPropertyInfo::GetProperty(wxString& name)
|
||||
bool wxStaticBitmapPropertyInfo::SetProperty(wxString& name, wxProperty *property)
|
||||
{
|
||||
wxStaticBitmap *message = (wxStaticBitmap *)m_propertyWindow;
|
||||
if (name == "label")
|
||||
if (name == "bitmapFilename")
|
||||
{
|
||||
char *s = property->GetValue().StringValue();
|
||||
if (s && wxFileExists(s))
|
||||
@@ -967,7 +968,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)
|
||||
|
Reference in New Issue
Block a user