another cleanup of constraints code in samples (patch #906438)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25996 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2004-02-28 21:13:00 +00:00
parent 90c86c0ca3
commit b598205862
5 changed files with 324 additions and 355 deletions

View File

@@ -131,7 +131,7 @@ class WXDLLIMPEXP_DEPRECATED wxPropertyFormValidator: public wxPropertyValidator
// Called to check value is OK (e.g. when OK is pressed)
// Return FALSE if value didn't check out; signal to restore old value.
virtual bool OnCheckValue( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow) ) { return TRUE; }
wxWindow *WXUNUSED(parentWindow) ) { return true; }
// Does the transferance from the property editing area to the property itself.
// Called by the view, e.g. when closing the window.
@@ -279,7 +279,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = _T("panel"))
: wxPanel(parent, -1, pos, size, style, name)
: wxPanel(parent, wxID_ANY, pos, size, style, name)
{
m_view = v;
}
@@ -311,7 +311,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = _T("frame"))
: wxFrame(parent, -1, title, pos, size, style, name)
: wxFrame(parent, wxID_ANY, title, pos, size, style, name)
{
m_view = v;
m_propertyPanel = NULL;

View File

@@ -97,14 +97,14 @@ public:
virtual bool UpdatePropertyDisplayInList(wxProperty *property);
// Update the whole list
virtual bool UpdatePropertyList(bool clearEditArea = TRUE);
virtual bool UpdatePropertyList(bool clearEditArea = true);
// Find the wxListBox index corresponding to this property
virtual int FindListIndexForProperty(wxProperty *property);
// Select and show string representation in editor the given
// property. NULL resets to show no property.
virtual bool ShowProperty(wxProperty *property, bool select = TRUE);
virtual bool ShowProperty(wxProperty *property, bool select = true);
virtual bool EditProperty(wxProperty *property);
// Update the display from the property
@@ -200,7 +200,7 @@ class WXDLLIMPEXP_DEPRECATED wxPropertyTextEdit: public wxTextCtrl
public:
wxPropertyTextEdit(wxPropertyListView *v = NULL,
wxWindow *parent = NULL,
const wxWindowID id = -1,
const wxWindowID id = wxID_ANY,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
@@ -236,7 +236,7 @@ public:
// cycling through possible values.
inline virtual bool OnDoubleClick(
wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) )
{ return TRUE; }
{ return true; }
// Called when the value listbox is selected. Default behaviour is to copy
// string to text control, and retrieve the value into the property.
@@ -245,19 +245,19 @@ public:
// Called when the property value is edited using standard text control
inline virtual bool OnPrepareControls(
wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) )
{ return TRUE; }
{ return true; }
virtual bool OnClearControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when the property is edited in detail
inline virtual bool OnPrepareDetailControls(
wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) )
{ return TRUE; }
{ return true; }
// Called if focus lost, IF we're in a modeless property editing situation.
inline virtual bool OnClearDetailControls(
wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) )
{ return TRUE; }
{ return true; }
// Called when the edit (...) button is pressed. The default implementation
// calls view->BeginDetailedEditing; the filename validator (for example) overrides
@@ -268,7 +268,7 @@ public:
// Return FALSE if value didn't check out; signal to restore old value.
inline virtual bool OnCheckValue(
wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) )
{ return TRUE; }
{ return true; }
// Called when TICK is pressed or focus is lost or view wants to update
// the property list.
@@ -324,7 +324,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxT("panel"))
: wxPanel(parent, -1, pos, size, style, name)
: wxPanel(parent, wxID_ANY, pos, size, style, name)
{
m_view = v;
}
@@ -362,7 +362,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = _T("frame"))
: wxFrame(parent, -1, title, pos, size, style, name)
: wxFrame(parent, wxID_ANY, title, pos, size, style, name)
{
m_view = v;
m_propertyPanel = NULL;

View File

@@ -72,11 +72,11 @@ bool MyApp::OnInit(void)
m_mainFrame->SetMenuBar(menu_bar);
m_mainFrame->Centre(wxBOTH);
m_mainFrame->Show(TRUE);
m_mainFrame->Show(true);
SetTopWindow(m_mainFrame);
return TRUE;
return true;
}
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
@@ -91,7 +91,7 @@ END_EVENT_TABLE()
// Define my frame constructor
MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, long type):
wxFrame(frame, -1, title, pos, size, type)
wxFrame(frame, wxID_ANY, title, pos, size, type)
{
}
@@ -101,7 +101,7 @@ void MyFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
{
if (wxGetApp().m_childWindow)
{
wxGetApp().m_childWindow->Close(TRUE);
wxGetApp().m_childWindow->Close(true);
}
Destroy();
@@ -109,27 +109,27 @@ void MyFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
Close(TRUE);
Close(true);
}
void MyFrame::OnDialogList(wxCommandEvent& WXUNUSED(event))
{
wxGetApp().PropertyListTest(TRUE);
wxGetApp().PropertyListTest(true);
}
void MyFrame::OnFrameList(wxCommandEvent& WXUNUSED(event))
{
wxGetApp().PropertyListTest(FALSE);
wxGetApp().PropertyListTest(false);
}
void MyFrame::OnDialogForm(wxCommandEvent& WXUNUSED(event))
{
wxGetApp().PropertyFormTest(TRUE);
wxGetApp().PropertyFormTest(true);
}
void MyFrame::OnFrameForm(wxCommandEvent& WXUNUSED(event))
{
wxGetApp().PropertyFormTest(FALSE);
wxGetApp().PropertyFormTest(false);
}
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
@@ -159,7 +159,7 @@ void MyApp::PropertyListTest(bool useDialog)
wxPropertySheet *sheet = new wxPropertySheet;
sheet->AddProperty(new wxProperty(_T("fred"), 1.0, _T("real")));
sheet->AddProperty(new wxProperty(_T("tough choice"), (bool)TRUE, _T("bool")));
sheet->AddProperty(new wxProperty(_T("tough choice"), true, _T("bool")));
sheet->AddProperty(new wxProperty(_T("ian"), (long)45, _T("integer"), new wxIntegerListValidator(-50, 50)));
sheet->AddProperty(new wxProperty(_T("bill"), 25.0, _T("real"), new wxRealListValidator(0.0, 100.0)));
sheet->AddProperty(new wxProperty(_T("julian"), _T("one"), _T("string")));
@@ -174,20 +174,21 @@ void MyApp::PropertyListTest(bool useDialog)
(
NULL,
wxPROP_BUTTON_OK | wxPROP_BUTTON_CANCEL | wxPROP_BUTTON_CHECK_CROSS
|wxPROP_DYNAMIC_VALUE_FIELD|wxPROP_PULLDOWN|wxPROP_SHOWVALUES
| wxPROP_DYNAMIC_VALUE_FIELD | wxPROP_PULLDOWN | wxPROP_SHOWVALUES
);
wxDialog *propDialog = NULL;
wxPropertyListFrame *propFrame = NULL;
PropListDialog *propDialog = NULL;
PropListFrame *propFrame = NULL;
if (useDialog)
{
propDialog = new PropListDialog(view, NULL, _T("Property Sheet Test"),
wxPoint(-1, -1), wxSize(400, 500), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODELESS);
wxDefaultPosition, wxSize(400, 500), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODELESS);
m_childWindow = propDialog;
}
else
{
propFrame = new PropListFrame(view, NULL, _T("Property Sheet Test"), wxPoint(-1, -1), wxSize(400, 500));
propFrame = new PropListFrame(view, NULL, _T("Property Sheet Test"),
wxDefaultPosition, wxSize(400, 500));
m_childWindow = propFrame;
}
@@ -196,17 +197,15 @@ void MyApp::PropertyListTest(bool useDialog)
if (useDialog)
{
view->ShowView(sheet, (wxPanel *)propDialog);
propDialog->Centre(wxBOTH);
propDialog->Show(TRUE);
}
else
{
propFrame->Initialize();
view->ShowView(sheet, propFrame->GetPropertyPanel());
propFrame->Centre(wxBOTH);
propFrame->Show(TRUE);
}
m_childWindow->Centre(wxBOTH);
m_childWindow->Show(true);
}
void MyApp::PropertyFormTest(bool useDialog)
@@ -217,7 +216,7 @@ void MyApp::PropertyFormTest(bool useDialog)
wxPropertySheet *sheet = new wxPropertySheet;
sheet->AddProperty(new wxProperty(_T("fred"), 25.0, _T("real"), new wxRealFormValidator(0.0, 100.0)));
sheet->AddProperty(new wxProperty(_T("tough choice"), (bool)TRUE, _T("bool")));
sheet->AddProperty(new wxProperty(_T("tough choice"), true, _T("bool")));
sheet->AddProperty(new wxProperty(_T("ian"), (long)45, _T("integer"), new wxIntegerFormValidator(-50, 50)));
sheet->AddProperty(new wxProperty(_T("julian"), _T("one"), _T("string")));
wxStringList *strings = new wxStringList(wxT("one"), wxT("two"), wxT("three"), NULL);
@@ -231,13 +230,13 @@ void MyApp::PropertyFormTest(bool useDialog)
if (useDialog)
{
propDialog = new PropFormDialog(view, NULL, _T("Property Form Test"),
wxPoint(-1, -1), wxSize(380, 250), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL);
wxDefaultPosition, wxSize(380, 250), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL);
m_childWindow = propDialog;
}
else
{
propFrame = new PropFormFrame(view, NULL, _T("Property Form Test"),
wxPoint(-1, -1), wxSize(380, 250));
wxDefaultPosition, wxSize(380, 250));
propFrame->Initialize();
m_childWindow = propFrame;
}
@@ -269,13 +268,13 @@ void MyApp::PropertyFormTest(bool useDialog)
#endif
// Add items to the panel
wxButton *okButton = new wxButton(panel, wxID_OK, _T("OK"), wxPoint(-1, -1),
wxButton *okButton = new wxButton(panel, wxID_OK, _T("OK"), wxDefaultPosition,
wxSize(80, 26), 0, wxDefaultValidator, _T("ok"));
wxButton *cancelButton = new wxButton(panel, wxID_CANCEL, _T("Cancel"), wxPoint(-1, -1),
wxButton *cancelButton = new wxButton(panel, wxID_CANCEL, _T("Cancel"), wxDefaultPosition,
wxSize(80, 26), 0, wxDefaultValidator, _T("cancel"));
wxButton *updateButton = new wxButton(panel, wxID_PROP_UPDATE, _T("Update"), wxPoint(-1, -1),
wxButton *updateButton = new wxButton(panel, wxID_PROP_UPDATE, _T("Update"), wxDefaultPosition,
wxSize(80, 26), 0, wxDefaultValidator, _T("update"));
wxButton *revertButton = new wxButton(panel, wxID_PROP_REVERT, _T("Revert"), wxPoint(-1, -1),
wxButton *revertButton = new wxButton(panel, wxID_PROP_REVERT, _T("Revert"), wxDefaultPosition,
wxSize(80, 26), 0, wxDefaultValidator, _T("revert"));
c = new wxLayoutConstraints;
@@ -307,8 +306,8 @@ void MyApp::PropertyFormTest(bool useDialog)
okButton->SetConstraints(c);
// The name of this text item matches the "fred" property
wxTextCtrl *text = new wxTextCtrl(panel, -1, _T("Fred"), wxPoint(-1, -1), wxSize(
200, -1), 0, wxDefaultValidator, _T("fred"));
wxTextCtrl *text = new wxTextCtrl(panel, wxID_ANY, _T("Fred"), wxDefaultPosition,
wxSize( 200, wxDefaultSize.y), 0, wxDefaultValidator, _T("fred"));
c = new wxLayoutConstraints;
c->left.SameAs(panel, wxLeft, 4);
@@ -317,8 +316,8 @@ void MyApp::PropertyFormTest(bool useDialog)
c->width.AsIs();
text->SetConstraints(c);
wxCheckBox *checkBox = new wxCheckBox(panel, -1, _T("Yes or no"), wxPoint(-1, -1),
wxSize(-1, -1), 0, wxDefaultValidator, _T("tough choice"));
wxCheckBox *checkBox = new wxCheckBox(panel, wxID_ANY, _T("Yes or no"), wxDefaultPosition,
wxDefaultSize, 0, wxDefaultValidator, _T("tough choice"));
c = new wxLayoutConstraints;
c->left.SameAs(text, wxRight, 20);
@@ -327,7 +326,7 @@ void MyApp::PropertyFormTest(bool useDialog)
c->width.AsIs();
checkBox->SetConstraints(c);
wxSlider *slider = new wxSlider(panel, -1, -50, 50, 150, wxPoint(-1, -1),
wxSlider *slider = new wxSlider(panel, wxID_ANY, -50, 50, 150, wxDefaultPosition,
wxSize(200,10), 0, wxDefaultValidator, _T("ian"));
c = new wxLayoutConstraints;
@@ -337,7 +336,7 @@ void MyApp::PropertyFormTest(bool useDialog)
c->width.AsIs();
slider->SetConstraints(c);
wxListBox *listBox = new wxListBox(panel, -1, wxPoint(-1, -1),
wxListBox *listBox = new wxListBox(panel, wxID_ANY, wxDefaultPosition,
wxSize(200, 100), 0, NULL, 0, wxDefaultValidator, _T("constrained"));
c = new wxLayoutConstraints;
@@ -349,7 +348,7 @@ void MyApp::PropertyFormTest(bool useDialog)
view->AddRegistry(&myFormValidatorRegistry);
panel->SetAutoLayout(TRUE);
panel->SetAutoLayout(true);
view->ShowView(sheet, panel);
view->AssociateNames();
@@ -357,15 +356,13 @@ void MyApp::PropertyFormTest(bool useDialog)
if (useDialog) {
propDialog->Layout();
propDialog->Centre(wxBOTH);
propDialog->Show(TRUE);
}
else
{
// panel->Layout();
propFrame->Centre(wxBOTH);
propFrame->Show(TRUE);
}
m_childWindow->Centre(wxBOTH);
m_childWindow->Show(true);
}
BEGIN_EVENT_TABLE(PropListFrame, wxPropertyListFrame)

View File

@@ -53,7 +53,7 @@ EVT_BUTTON(wxID_PROP_REVERT, wxPropertyFormView::OnRevert)
EVT_BUTTON(wxID_PROP_UPDATE, wxPropertyFormView::OnUpdate)
END_EVENT_TABLE()
bool wxPropertyFormView::sm_dialogCancelled = FALSE;
bool wxPropertyFormView::sm_dialogCancelled = false;
wxPropertyFormView::wxPropertyFormView(wxWindow *propPanel, long flags):wxPropertyView(flags)
{
@@ -64,7 +64,7 @@ wxPropertyFormView::wxPropertyFormView(wxWindow *propPanel, long flags):wxProper
m_windowCancelButton = NULL;
m_windowHelpButton = NULL;
m_detailedEditing = FALSE;
m_detailedEditing = false;
}
wxPropertyFormView::~wxPropertyFormView(void)
@@ -84,13 +84,13 @@ void wxPropertyFormView::ShowView(wxPropertySheet *ps, wxWindow *panel)
// the object itself.
bool wxPropertyFormView::OnUpdateView(void)
{
return TRUE;
return true;
}
bool wxPropertyFormView::Check(void)
{
if (!m_propertySheet)
return FALSE;
return false;
wxNode *node = m_propertySheet->GetProperties().GetFirst();
while (node)
@@ -101,17 +101,17 @@ bool wxPropertyFormView::Check(void)
{
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
if (!formValidator->OnCheckValue(prop, this, m_propertyWindow))
return FALSE;
return false;
}
node = node->GetNext();
}
return TRUE;
return true;
}
bool wxPropertyFormView::TransferToPropertySheet(void)
{
if (!m_propertySheet)
return FALSE;
return false;
wxNode *node = m_propertySheet->GetProperties().GetFirst();
while (node)
@@ -125,13 +125,13 @@ bool wxPropertyFormView::TransferToPropertySheet(void)
}
node = node->GetNext();
}
return TRUE;
return true;
}
bool wxPropertyFormView::TransferToDialog(void)
{
if (!m_propertySheet)
return FALSE;
return false;
wxNode *node = m_propertySheet->GetProperties().GetFirst();
while (node)
@@ -145,13 +145,13 @@ bool wxPropertyFormView::TransferToDialog(void)
}
node = node->GetNext();
}
return TRUE;
return true;
}
bool wxPropertyFormView::AssociateNames(void)
{
if (!m_propertySheet || !m_propertyWindow)
return FALSE;
return false;
wxWindowList::Node *node = m_propertyWindow->GetChildren().GetFirst();
while (node)
@@ -165,7 +165,7 @@ bool wxPropertyFormView::AssociateNames(void)
}
node = node->GetNext();
}
return TRUE;
return true;
}
@@ -176,7 +176,7 @@ bool wxPropertyFormView::OnClose(void)
((wxPropertyFormPanel*)m_propertyWindow)->SetView(NULL);
}
delete this;
return TRUE;
return true;
}
void wxPropertyFormView::OnOk(wxCommandEvent& WXUNUSED(event))
@@ -185,17 +185,17 @@ void wxPropertyFormView::OnOk(wxCommandEvent& WXUNUSED(event))
if (!Check())
return;
sm_dialogCancelled = FALSE;
sm_dialogCancelled = false;
TransferToPropertySheet();
m_managedWindow->Close(TRUE);
m_managedWindow->Close(true);
}
void wxPropertyFormView::OnCancel(wxCommandEvent& WXUNUSED(event))
{
sm_dialogCancelled = TRUE;
sm_dialogCancelled = true;
m_managedWindow->Close(TRUE);
m_managedWindow->Close(true);
}
void wxPropertyFormView::OnHelp(wxCommandEvent& WXUNUSED(event))
@@ -257,14 +257,14 @@ void wxPropertyFormView::OnCommand(wxWindow& win, wxCommandEvent& event)
bool wxPropertyFormView::ProcessEvent(wxEvent& event)
{
if (wxEvtHandler::ProcessEvent(event))
return TRUE;
return true;
else if (event.IsCommandEvent() && !event.IsKindOf(CLASSINFO(wxUpdateUIEvent)) && event.GetEventObject())
{
OnCommand(* ((wxWindow*) event.GetEventObject()), (wxCommandEvent&) event);
return TRUE;
return true;
}
else
return FALSE;
return false;
}
void wxPropertyFormView::OnDoubleClick(wxControl *item)
@@ -303,12 +303,12 @@ END_EVENT_TABLE()
wxPropertyFormDialog::wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title,
const wxPoint& pos, const wxSize& size, long style, const wxString& name):
wxDialog(parent, -1, title, pos, size, style, name)
wxDialog(parent, wxID_ANY, title, pos, size, style, name)
{
m_view = v;
m_view->AssociatePanel(this);
m_view->SetManagedWindow(this);
// SetAutoLayout(TRUE);
// SetAutoLayout(true);
}
void wxPropertyFormDialog::OnCloseWindow(wxCloseEvent& event)
@@ -340,7 +340,7 @@ bool wxPropertyFormDialog::ProcessEvent(wxEvent& event)
if ( !m_view || ! m_view->ProcessEvent(event) )
return wxEvtHandler::ProcessEvent(event);
else
return TRUE;
return true;
}
@@ -366,7 +366,7 @@ bool wxPropertyFormPanel::ProcessEvent(wxEvent& event)
if ( !m_view || ! m_view->ProcessEvent(event) )
return wxEvtHandler::ProcessEvent(event);
else
return TRUE;
return true;
}
/*
@@ -399,10 +399,10 @@ bool wxPropertyFormFrame::Initialize(void)
{
m_view->AssociatePanel(m_propertyPanel);
m_view->SetManagedWindow(this);
return TRUE;
return true;
}
else
return FALSE;
return false;
}
/*
@@ -425,12 +425,12 @@ bool wxRealFormValidator::OnCheckValue( wxProperty *property, wxPropertyFormView
wxWindow *parentWindow)
{
if (m_realMin == 0.0 && m_realMax == 0.0)
return TRUE;
return true;
// The item used for viewing the real number: should be a text item.
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
return FALSE;
return false;
wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
@@ -440,7 +440,7 @@ bool wxRealFormValidator::OnCheckValue( wxProperty *property, wxPropertyFormView
wxChar buf[200];
wxSprintf(buf, wxT("Value %s is not a valid real number!"), (const wxChar *)value);
wxMessageBox(buf, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE;
return false;
}
if (val < m_realMin || val > m_realMax)
@@ -448,9 +448,9 @@ bool wxRealFormValidator::OnCheckValue( wxProperty *property, wxPropertyFormView
wxChar buf[200];
wxSprintf(buf, wxT("Value must be a real number between %.2f and %.2f!"), m_realMin, m_realMax);
wxMessageBox(buf, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE;
return false;
}
return TRUE;
return true;
}
bool wxRealFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
@@ -459,16 +459,16 @@ bool wxRealFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormVi
// The item used for viewing the real number: should be a text item.
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
return FALSE;
return false;
wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
if (value.Length() == 0)
return FALSE;
return false;
float f = (float)wxAtof((const wxChar *)value);
property->GetValue() = f;
return TRUE;
return true;
}
bool wxRealFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
@@ -477,11 +477,11 @@ bool wxRealFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormVie
// The item used for viewing the real number: should be a text item.
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
return FALSE;
return false;
wxTextCtrl *textItem = (wxTextCtrl *)m_propertyWindow;
textItem->SetValue(FloatToString(property->GetValue().RealValue()));
return TRUE;
return true;
}
///
@@ -493,12 +493,12 @@ bool wxIntegerFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormVi
wxWindow *parentWindow)
{
if (m_integerMin == 0.0 && m_integerMax == 0.0)
return TRUE;
return true;
// The item used for viewing the real number: should be a text item or a slider
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow)
return FALSE;
return false;
long val = 0;
@@ -511,7 +511,7 @@ bool wxIntegerFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormVi
wxChar buf[200];
wxSprintf(buf, wxT("Value %s is not a valid integer!"), (const wxChar *)value);
wxMessageBox(buf, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE;
return false;
}
}
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxSlider)))
@@ -519,16 +519,16 @@ bool wxIntegerFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormVi
val = (long)((wxSlider *)m_propertyWindow)->GetValue();
}
else
return FALSE;
return false;
if (val < m_integerMin || val > m_integerMax)
{
wxChar buf[200];
wxSprintf(buf, wxT("Value must be an integer between %ld and %ld!"), m_integerMin, m_integerMax);
wxMessageBox(buf, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE;
return false;
}
return TRUE;
return true;
}
bool wxIntegerFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
@@ -537,14 +537,14 @@ bool wxIntegerFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFor
// The item used for viewing the real number: should be a text item or a slider
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow)
return FALSE;
return false;
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{
wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
if (value.Length() == 0)
return FALSE;
return false;
long i = wxAtol((const wxChar *)value);
property->GetValue() = i;
@@ -554,9 +554,9 @@ bool wxIntegerFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFor
property->GetValue() = (long)((wxSlider *)m_propertyWindow)->GetValue();
}
else
return FALSE;
return false;
return TRUE;
return true;
}
bool wxIntegerFormValidator::OnDisplayValue( wxProperty *property, wxPropertyFormView *WXUNUSED(view),
@@ -565,7 +565,7 @@ bool wxIntegerFormValidator::OnDisplayValue( wxProperty *property, wxPropertyFor
// The item used for viewing the real number: should be a text item or a slider
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow)
return FALSE;
return false;
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{
@@ -577,8 +577,8 @@ bool wxIntegerFormValidator::OnDisplayValue( wxProperty *property, wxPropertyFor
((wxSlider *)m_propertyWindow)->SetValue((int)property->GetValue().IntegerValue());
}
else
return FALSE;
return TRUE;
return false;
return true;
}
///
@@ -592,9 +592,9 @@ bool wxBoolFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView
// The item used for viewing the boolean: should be a checkbox
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
return FALSE;
return false;
return TRUE;
return true;
}
bool wxBoolFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
@@ -603,12 +603,12 @@ bool wxBoolFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormVi
// The item used for viewing the boolean: should be a checkbox.
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
return FALSE;
return false;
wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow;
property->GetValue() = (bool)checkBox->GetValue();
return TRUE;
return true;
}
bool wxBoolFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
@@ -617,11 +617,11 @@ bool wxBoolFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormVie
// The item used for viewing the boolean: should be a checkbox.
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
return FALSE;
return false;
wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow;
checkBox->SetValue((bool)property->GetValue().BoolValue());
return TRUE;
return true;
}
///
@@ -639,12 +639,12 @@ bool wxStringFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormVie
wxWindow *parentWindow )
{
if (!m_strings)
return TRUE;
return true;
// The item used for viewing the string: should be a text item, choice item or listbox.
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow)
return FALSE;
return false;
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{
wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow;
@@ -654,7 +654,7 @@ bool wxStringFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormVie
str += text->GetValue();
str += wxT(" is not valid.");
wxMessageBox(str, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE;
return false;
}
}
else
@@ -662,7 +662,7 @@ bool wxStringFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormVie
// Any other item constrains the string value,
// so we don't have to check it.
}
return TRUE;
return true;
}
bool wxStringFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
@@ -671,7 +671,7 @@ bool wxStringFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyForm
// The item used for viewing the string: should be a text item, choice item or listbox.
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow)
return FALSE;
return false;
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{
wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow;
@@ -699,8 +699,8 @@ bool wxStringFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyForm
property->GetValue() = choice->GetStringSelection();
}
else
return FALSE;
return TRUE;
return false;
return true;
}
bool wxStringFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
@@ -709,7 +709,7 @@ bool wxStringFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormV
// The item used for viewing the string: should be a text item, choice item or listbox.
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow)
return FALSE;
return false;
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{
wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow;
@@ -756,8 +756,8 @@ bool wxStringFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormV
choice->SetStringSelection(property->GetValue().StringValue());
}
else
return FALSE;
return TRUE;
return false;
return true;
}
#endif // wxUSE_PROPSHEET

File diff suppressed because it is too large Load Diff