Dialog Editor bug fixes, several other small ones

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@957 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 1998-11-03 15:43:57 +00:00
parent 64d315544f
commit 386af6a2fa
10 changed files with 78 additions and 35 deletions

View File

@ -86,6 +86,9 @@ Add centring, right justify styles to wxStaticText.
Synchronize drawing functions on all platforms, using Chris's Synchronize drawing functions on all platforms, using Chris's
code to test them. code to test them.
Extend wxSystemSettings to get symbols for current nationality,
e.g. ',' instead of '.' for decimal points.
LOW PRIORITY LOW PRIORITY
------------ ------------

View File

@ -960,26 +960,31 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr)
} }
controlItem->SetStringValues(stringList); controlItem->SetStringValues(stringList);
count ++; count ++;
// This is now obsolete: it's in the window style.
// Check for wxSINGLE/wxMULTIPLE // Check for wxSINGLE/wxMULTIPLE
wxExpr *mult = (wxExpr *) NULL; wxExpr *mult = (wxExpr *) NULL;
/*
controlItem->SetValue1(wxLB_SINGLE); controlItem->SetValue1(wxLB_SINGLE);
*/
if ((mult = expr->Nth(count)) && ((mult->Type() == PrologString)||(mult->Type() == PrologWord))) if ((mult = expr->Nth(count)) && ((mult->Type() == PrologString)||(mult->Type() == PrologWord)))
{ {
/*
wxString m(mult->StringValue()); wxString m(mult->StringValue());
if (m == "wxMULTIPLE") if (m == "wxLB_MULTIPLE")
controlItem->SetValue1(wxLB_MULTIPLE); controlItem->SetValue1(wxLB_MULTIPLE);
else if (m == "wxEXTENDED") else if (m == "wxLB_EXTENDED")
controlItem->SetValue1(wxLB_EXTENDED); controlItem->SetValue1(wxLB_EXTENDED);
*/
// Ignore the value
count ++; count ++;
if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) }
{ if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
// controlItem->SetLabelFont(wxResourceInterpretFontSpec(expr->Nth(count))); {
// controlItem->SetLabelFont(wxResourceInterpretFontSpec(expr->Nth(count)));
count ++; count ++;
if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
} }
}
} }
} }
else if (controlType == "wxChoice") else if (controlType == "wxChoice")

View File

@ -42,6 +42,8 @@ BEGIN_EVENT_TABLE(wxTextValidator, wxValidator)
END_EVENT_TABLE() END_EVENT_TABLE()
#endif #endif
static bool wxIsNumeric(const wxString& val);
wxTextValidator::wxTextValidator(long style, wxString *val) wxTextValidator::wxTextValidator(long style, wxString *val)
{ {
m_validatorStyle = style ; m_validatorStyle = style ;
@ -169,7 +171,8 @@ bool wxTextValidator::Validate(wxWindow *parent)
wxMessageBox(buf,_("Validation conflict"), wxOK | wxICON_EXCLAMATION, parent); wxMessageBox(buf,_("Validation conflict"), wxOK | wxICON_EXCLAMATION, parent);
return FALSE; return FALSE;
} }
if ( (m_validatorStyle & wxFILTER_NUMERIC) && !val.IsNumber()) if ( (m_validatorStyle & wxFILTER_NUMERIC) && !wxIsNumeric(val))
{ {
char buf[512]; char buf[512];
sprintf(buf, _("%s should be numeric."), (const char *)val); sprintf(buf, _("%s should be numeric."), (const char *)val);
@ -291,4 +294,14 @@ void wxTextValidator::OnChar(wxKeyEvent& event)
textCtrl->wxTextCtrl::OnChar(event); textCtrl->wxTextCtrl::OnChar(event);
} }
static bool wxIsNumeric(const wxString& val)
{
int i;
for ( i = 0; i < (int)val.Length(); i++)
{
if ((!isdigit(val[i])) && (val[i] != '.'))
return FALSE;
}
return TRUE;
}

View File

@ -927,7 +927,7 @@ void wxGenericGrid::AdjustScrollbars(void)
int noHorizSteps = 0; int noHorizSteps = 0;
int noVertSteps = 0; int noVertSteps = 0;
if (m_totalGridWidth <= cw) if (m_totalGridWidth + vertScrollBarWidth <= cw)
noHorizSteps = 0; noHorizSteps = 0;
else else
{ {
@ -954,7 +954,7 @@ void wxGenericGrid::AdjustScrollbars(void)
noHorizSteps += nx; noHorizSteps += nx;
} }
if (m_totalGridHeight <= ch) if (m_totalGridHeight + horizScrollBarHeight <= ch)
noVertSteps = 0; noVertSteps = 0;
else else
{ {
@ -981,7 +981,7 @@ void wxGenericGrid::AdjustScrollbars(void)
noVertSteps += ny; noVertSteps += ny;
} }
if (m_totalGridWidth <= cw) if (m_totalGridWidth + vertScrollBarWidth <= cw)
{ {
if ( m_hScrollBar ) if ( m_hScrollBar )
m_hScrollBar->Show(FALSE); m_hScrollBar->Show(FALSE);
@ -993,7 +993,7 @@ void wxGenericGrid::AdjustScrollbars(void)
m_hScrollBar->Show(TRUE); m_hScrollBar->Show(TRUE);
} }
if (m_totalGridHeight <= ch) if (m_totalGridHeight + horizScrollBarHeight <= ch)
{ {
if ( m_vScrollBar ) if ( m_vScrollBar )
m_vScrollBar->Show(FALSE); m_vScrollBar->Show(FALSE);

View File

@ -463,7 +463,11 @@ wxTextCtrl* wxListCtrl::GetEditControl(void) const
bool wxListCtrl::GetItem(wxListItem& info) const bool wxListCtrl::GetItem(wxListItem& info) const
{ {
LV_ITEM lvItem; LV_ITEM lvItem;
#ifdef __MINGW32__
memset(&lvItem, 0, sizeof(lvItem));
#else
ZeroMemory(&lvItem, sizeof(lvItem)); // must set all fields to 0 ZeroMemory(&lvItem, sizeof(lvItem)); // must set all fields to 0
#endif
lvItem.iItem = info.m_itemId; lvItem.iItem = info.m_itemId;

View File

@ -433,6 +433,12 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
int width = size.x; int width = size.x;
int height = size.y; int height = size.y;
// To be consistent with wxGTK
if (width == -1)
width = 20;
if (height == -1)
height = 20;
wxSystemSettings settings; wxSystemSettings settings;
m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_WINDOW) ; ; m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_WINDOW) ; ;

Binary file not shown.

View File

@ -1020,7 +1020,7 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
if ((panelResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0) if ((panelResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0)
{ {
wxPoint pt = panel->ConvertPixelsToDialog(pt); wxPoint pt = panel->ConvertPixelsToDialog(wxPoint(x, y));
res->SetSize(pt.x, pt.y, -1, -1); res->SetSize(pt.x, pt.y, -1, -1);
} }
else res->SetSize(x, y, -1, -1); else res->SetSize(x, y, -1, -1);
@ -1159,6 +1159,16 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
if (!newItem) if (!newItem)
return FALSE; return FALSE;
int actualW, actualH;
newItem->GetSize(&actualW, &actualH);
wxSize actualSize(actualW, actualH);
if ((panelResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0)
{
actualSize = panel->ConvertPixelsToDialog(actualSize);
}
res->SetSize(res->GetX(), res->GetY(), actualSize.x, actualSize.y);
wxString newIdName; wxString newIdName;
int id = GenerateWindowId(prefix, newIdName); int id = GenerateWindowId(prefix, newIdName);
res->SetId(id); res->SetId(id);
@ -1759,7 +1769,7 @@ wxWindow *wxResourceManager::RecreateWindowFromResource(wxWindow *win, wxWindowP
wxWindow *parent = win->GetParent(); wxWindow *parent = win->GetParent();
wxItemResource* parentResource = NULL; wxItemResource* parentResource = NULL;
if (parent) if (parent)
FindResourceForWindow(parent); parentResource = FindResourceForWindow(parent);
if (win->IsKindOf(CLASSINFO(wxPanel))) if (win->IsKindOf(CLASSINFO(wxPanel)))
{ {

View File

@ -310,7 +310,9 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource* it
node = node->Next(); node = node->Next();
} }
} }
stream << "], "; stream << "]";
/* Styles are now in the window style, not in a separate arg
stream << ", ";
switch (item->GetValue1()) switch (item->GetValue1())
{ {
case wxLB_MULTIPLE: case wxLB_MULTIPLE:
@ -330,6 +332,8 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource* it
break; break;
} }
} }
*/
if (item->GetFont().Ok()) if (item->GetFont().Ok())
{ {
stream << ",\\\n "; stream << ",\\\n ";

View File

@ -1086,22 +1086,16 @@ wxProperty *wxListBoxPropertyInfo::GetProperty(wxString& name)
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(listBox); wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(listBox);
if (!resource) if (!resource)
return NULL; return NULL;
char *mult = "wxLB_SINGLE";
char *mult = "wxSINGLE"; if ((listBox->GetWindowStyleFlag() & wxLB_MULTIPLE) != 0)
switch (resource->GetValue1())
{
case wxLB_MULTIPLE:
mult = "wxLB_MULTIPLE"; mult = "wxLB_MULTIPLE";
break; else if ((listBox->GetWindowStyleFlag() & wxLB_EXTENDED) != 0)
case wxLB_EXTENDED:
mult = "wxLB_EXTENDED"; mult = "wxLB_EXTENDED";
break; else
default:
case wxLB_SINGLE:
mult = "wxLB_SINGLE"; mult = "wxLB_SINGLE";
break;
}
return new wxProperty("multiple", mult, "string", return new wxProperty("multiple", mult, "string",
new wxStringListValidator(new wxStringList("wxLB_SINGLE", "wxLB_MULTIPLE", "wxLB_EXTENDED", new wxStringListValidator(new wxStringList("wxLB_SINGLE", "wxLB_MULTIPLE", "wxLB_EXTENDED",
NULL))); NULL)));
@ -1128,17 +1122,21 @@ bool wxListBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
} }
else if (name == "multiple") 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()); wxString str(property->GetValue().StringValue());
if (str == "wxLB_MULTIPLE") if (str == "wxLB_MULTIPLE")
mult = wxLB_MULTIPLE; SetWindowStyle(m_propertyWindow, wxLB_MULTIPLE, TRUE);
else if (str == "wxLB_EXTENDED") else if (str == "wxLB_EXTENDED")
mult = wxLB_EXTENDED; SetWindowStyle(m_propertyWindow, wxLB_EXTENDED, TRUE);
else else
mult = wxLB_SINGLE; SetWindowStyle(m_propertyWindow, wxLB_SINGLE, TRUE);
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(listBox); wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(listBox);
if (resource) if (resource)
resource->SetValue1(mult); resource->SetStyle(m_propertyWindow->GetWindowStyleFlag());
wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(listBox, this); wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(listBox, this);
return TRUE; return TRUE;
} }