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)
{
m_windowCancelButton = NULL;
m_windowHelpButton = NULL;
- m_detailedEditing = FALSE;
+ m_detailedEditing = false;
}
wxPropertyFormView::~wxPropertyFormView(void)
// 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)
{
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)
}
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)
}
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)
}
node = node->GetNext();
}
- return TRUE;
+ return true;
}
((wxPropertyFormPanel*)m_propertyWindow)->SetView(NULL);
}
delete this;
- return TRUE;
+ return true;
}
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))
if (!m_propertySheet)
return;
- if (win.GetName() == wxT(""))
+ if (win.GetName().empty())
return;
if (wxStrcmp(win.GetName(), wxT("ok")) == 0)
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)
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)
if ( !m_view || ! m_view->ProcessEvent(event) )
return wxEvtHandler::ProcessEvent(event);
else
- return TRUE;
+ return true;
}
if ( !m_view || ! m_view->ProcessEvent(event) )
return wxEvtHandler::ProcessEvent(event);
else
- return TRUE;
+ return true;
}
/*
{
m_view->AssociatePanel(m_propertyPanel);
m_view->SetManagedWindow(this);
- return TRUE;
+ return true;
}
else
- return FALSE;
+ return false;
}
/*
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());
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)
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),
// 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),
// 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;
}
///
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;
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)))
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),
// 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;
property->GetValue() = (long)((wxSlider *)m_propertyWindow)->GetValue();
}
else
- return FALSE;
+ return false;
- return TRUE;
+ return true;
}
bool wxIntegerFormValidator::OnDisplayValue( wxProperty *property, wxPropertyFormView *WXUNUSED(view),
// 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)))
{
((wxSlider *)m_propertyWindow)->SetValue((int)property->GetValue().IntegerValue());
}
else
- return FALSE;
- return TRUE;
+ return false;
+ return true;
}
///
// 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),
// 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),
// 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;
}
///
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;
str += text->GetValue();
str += wxT(" is not valid.");
wxMessageBox(str, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
- return FALSE;
+ return false;
}
}
else
// 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),
// 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;
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxListBox)))
{
wxListBox *lbox = (wxListBox *)m_propertyWindow;
- if (lbox->GetSelection() > -1)
+ if (lbox->GetSelection() != wxNOT_FOUND)
property->GetValue() = lbox->GetStringSelection();
}
/*
{
wxRadioBox *rbox = (wxRadioBox *)m_propertyWindow;
int n = 0;
- if ((n = rbox->GetSelection()) > -1)
+ if ((n = rbox->GetSelection()) != wxNOT_FOUND)
property->GetValue() = rbox->GetString(n);
}
*/
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxChoice)))
{
wxChoice *choice = (wxChoice *)m_propertyWindow;
- if (choice->GetSelection() > -1)
+ if (choice->GetSelection() != wxNOT_FOUND)
property->GetValue() = choice->GetStringSelection();
}
else
- return FALSE;
- return TRUE;
+ return false;
+ return true;
}
bool wxStringFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
// 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;
choice->SetStringSelection(property->GetValue().StringValue());
}
else
- return FALSE;
- return TRUE;
+ return false;
+ return true;
}
#endif // wxUSE_PROPSHEET