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;
}
{
wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
- wxFont *font = m_propertyWindow->GetFont();
+ wxFont *font = & m_propertyWindow->GetFont();
if (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" ||
name == "fontUnderlined")
return GetFontProperty(name, font);
bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
- wxFont *font = m_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)
- m_propertyWindow->SetFont(newFont);
+ m_propertyWindow->SetFont(* newFont);
return TRUE;
}
else if (name == "name")
}
else if (name == "x")
{
+ wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
int x, y;
m_propertyWindow->GetPosition(&x, &y);
int newX = (int)property->GetValue().IntegerValue();
+ 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 (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
{
wxPoint pt = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxPoint(newX, y));
- newX = pt.x;
+ pixelX = pt.x;
}
}
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel)))
if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
{
wxPoint pt = m_propertyWindow->ConvertDialogToPixels(wxPoint(newX, y));
- newX = pt.x;
+ pixelX = pt.x;
}
}
- if (x != newX)
- m_propertyWindow->Move(newX, y);
+ 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;
m_propertyWindow->GetPosition(&x, &y);
int newY = (int)property->GetValue().IntegerValue();
+ 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 (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
{
wxPoint pt = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxPoint(x, newY));
- newY = pt.y;
+ pixelY = pt.y;
}
}
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel)))
if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
{
wxPoint pt = m_propertyWindow->ConvertDialogToPixels(wxPoint(x, newY));
- newY = pt.y;
+ pixelY = pt.y;
}
}
- if (y != newY)
- m_propertyWindow->Move(x, newY);
+ 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;
m_propertyWindow->GetSize(&width, &height);
int newWidth = (int)property->GetValue().IntegerValue();
+ 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 (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
{
wxSize sz = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxSize(newWidth, height));
- newWidth = sz.x;
+ pixelWidth = sz.x;
}
}
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel)))
if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
{
wxSize sz = m_propertyWindow->ConvertDialogToPixels(wxSize(newWidth, height));
- newWidth = sz.x;
+ pixelWidth = sz.x;
}
}
- if (width != newWidth)
+ if (width != pixelWidth)
{
- m_propertyWindow->SetSize(newWidth, height);
+ 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;
m_propertyWindow->GetSize(&width, &height);
int newHeight = (int)property->GetValue().IntegerValue();
+ 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 (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
{
wxSize sz = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxSize(width, newHeight));
- newHeight = sz.y;
+ pixelHeight = sz.y;
}
}
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel)))
if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
{
wxSize sz = m_propertyWindow->ConvertDialogToPixels(wxSize(width, newHeight));
- newHeight = sz.y;
+ pixelHeight = sz.y;
}
}
- if (height != newHeight)
+ if (height != pixelHeight)
{
- m_propertyWindow->SetSize(width, newHeight);
+ m_propertyWindow->SetSize(width, pixelHeight);
+ resource->SetSize(resource->GetX(), resource->GetY(), resource->GetWidth(), newHeight);
}
return TRUE;
}
wxProperty *wxItemPropertyInfo::GetProperty(wxString& name)
{
wxControl *itemWindow = (wxControl *)m_propertyWindow;
- wxFont *font = itemWindow->GetFont();
+ wxFont *font = & itemWindow->GetFont();
if (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" ||
name == "fontUnderlined")
bool wxItemPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
wxControl *itemWindow = (wxControl *)m_propertyWindow;
- wxFont *font = itemWindow->GetFont();
+ 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")
wxControl *item = (wxControl *)m_propertyWindow;
wxString str(item->GetLabel());
resource->SetTitle(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()));
+
+ 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;
}
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");
{
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);
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))
{
- 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
if (resource)
{
wxString oldResource(resource->GetValue4());
- wxString resName = wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(s);
+ wxString resName = wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(str);
resource->SetValue4(resName);
if (!oldResource.IsNull())
wxResourceManager::GetCurrentResourceManager()->PossiblyDeleteBitmapResource(oldResource);
}
- button->SetLabel(bitmap);
- delete[] s;
+ button->SetLabel(* bitmap);
return TRUE;
}
}
void wxBitmapButtonPropertyInfo::GetPropertyNames(wxStringList& names)
{
-// names.Add("label");
wxButtonPropertyInfo::GetPropertyNames(names);
+ names.Delete("label");
+ names.Add("bitmapFilename");
}
bool wxBitmapButtonPropertyInfo::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");
{
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);
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))
{
- 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
if (resource)
{
wxString oldResource(resource->GetValue4());
- wxString resName = wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(s);
+ wxString resName = wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(str);
resource->SetValue4(resName);
if (!oldResource.IsNull())
wxResourceManager::GetCurrentResourceManager()->PossiblyDeleteBitmapResource(oldResource);
}
- message->SetBitmap(bitmap);
- delete[] s;
+ message->SetBitmap(* bitmap);
return TRUE;
}
}
void wxStaticBitmapPropertyInfo::GetPropertyNames(wxStringList& names)
{
wxItemPropertyInfo::GetPropertyNames(names);
- names.Add("label");
+ names.Add("bitmapFilename");
}
bool wxStaticBitmapPropertyInfo::InstantiateResource(wxItemResource *resource)
if (name == "orientation")
{
wxString orient;
- if (m_propertyWindow->GetWindowStyleFlag() & wxRA_HORIZONTAL)
- orient = "wxRA_HORIZONTAL";
+ if (m_propertyWindow->GetWindowStyleFlag() & wxRA_SPECIFY_COLS)
+ orient = "wxRA_SPECIFY_COLS";
else
- orient = "wxRA_VERTICAL";
+ orient = "wxRA_SPECIFY_ROWS";
return new wxProperty("orientation", orient, "string",
- new wxStringListValidator(new wxStringList("wxRA_HORIZONTAL", "wxRA_VERTICAL",
+ new wxStringListValidator(new wxStringList("wxRA_SPECIFY_COLS", "wxRA_SPECIFY_ROWS",
NULL)));
}
else if (name == "values")
{
long windowStyle = radioBox->GetWindowStyleFlag();
wxString val(property->GetValue().StringValue());
- if (val == "wxRA_HORIZONTAL")
+ if (val == "wxRA_SPECIFY_COLS")
{
- if (windowStyle & wxRA_VERTICAL)
- windowStyle -= wxRA_VERTICAL;
- windowStyle |= wxRA_HORIZONTAL;
+ if (windowStyle & wxRA_SPECIFY_ROWS)
+ windowStyle -= wxRA_SPECIFY_ROWS;
+ windowStyle |= wxRA_SPECIFY_COLS;
}
else
{
- if (windowStyle & wxRA_HORIZONTAL)
- windowStyle -= wxRA_HORIZONTAL;
- windowStyle |= wxRA_VERTICAL;
+ if (windowStyle & wxRA_SPECIFY_COLS)
+ windowStyle -= wxRA_SPECIFY_COLS;
+ windowStyle |= wxRA_SPECIFY_ROWS;
}
radioBox->SetWindowStyleFlag(windowStyle);
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(radioBox);
wxProperty *wxScrollBarPropertyInfo::GetProperty(wxString& name)
{
wxScrollBar *scrollBar = (wxScrollBar *)m_propertyWindow;
- if (name == "value")
- return new wxProperty("value", (long)scrollBar->GetValue(), "integer");
+ if (name == "thumbPosition")
+ return new wxProperty("value", (long)scrollBar->GetThumbPosition(), "integer");
else if (name == "orientation")
{
char *pos = NULL;
}
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);
bool wxScrollBarPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
wxScrollBar *scrollBar = (wxScrollBar *)m_propertyWindow;
- if (name == "value")
+ if (name == "thumbPosition")
{
- scrollBar->SetValue((int)property->GetValue().IntegerValue());
+ scrollBar->SetThumbPosition((int)property->GetValue().IntegerValue());
return TRUE;
}
else if (name == "orientation")
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);
-
+
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
{
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");
{
wxScrollBar *sbar = (wxScrollBar *)m_propertyWindow;
- resource->SetValue1(sbar->GetValue());
-
- 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);
}
wxProperty *wxPanelPropertyInfo::GetProperty(wxString& name)
{
wxPanel *panelWindow = (wxPanel *)m_propertyWindow;
+
+/*
wxFont *labelFont = panelWindow->GetLabelFont();
wxFont *buttonFont = panelWindow->GetButtonFont();
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)
bool wxPanelPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
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();
bool wxPanelPropertyInfo::InstantiateResource(wxItemResource *resource)
{
wxPanel *panel = (wxPanel *)m_propertyWindow;
- if (panel->GetFont() && 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()));
+ 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(wxColour(panel->GetBackgroundColour()));
}
resource->SetSize(pt.x, pt.y, sz.x, sz.y);
- wxNode* node = m_propertyWindow->GetChildren()->First();
+ wxNode* node = m_propertyWindow->GetChildren().First();
while (node)
{
wxWindow* child = (wxWindow*) node->Data();