X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c74caa095c12410bd6a555df248699cb35821a8d..3030ae493df7500fd5da7555f141c0c8a690bd8a:/contrib/src/deprecated/proplist.cpp diff --git a/contrib/src/deprecated/proplist.cpp b/contrib/src/deprecated/proplist.cpp index 14da016986..29c17d30f2 100644 --- a/contrib/src/deprecated/proplist.cpp +++ b/contrib/src/deprecated/proplist.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: proplist.cpp +// Name: contrib/src/deprecated/proplist.cpp // Purpose: Property list classes // Author: Julian Smart // Modified by: @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ - #pragma implementation "proplist.h" -#endif - // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" @@ -57,8 +53,10 @@ #include #include +#if !WXWIN_COMPATIBILITY_2_4 static inline wxChar* copystring(const wxChar* s) { return wxStrcpy(new wxChar[wxStrlen(s) + 1], s); } +#endif // ---------------------------------------------------------------------------- // Property text edit control @@ -87,7 +85,7 @@ void wxPropertyTextEdit::OnKillFocus() // Property list view // ---------------------------------------------------------------------------- -bool wxPropertyListView::sm_dialogCancelled = FALSE; +bool wxPropertyListView::sm_dialogCancelled = false; IMPLEMENT_DYNAMIC_CLASS(wxPropertyListView, wxPropertyView) @@ -120,7 +118,7 @@ wxPropertyListView::wxPropertyListView(wxPanel *propPanel, long flags):wxPropert m_windowCancelButton = NULL; m_windowHelpButton = NULL; - m_detailedEditing = FALSE; + m_detailedEditing = false; } wxPropertyListView::~wxPropertyListView() @@ -142,19 +140,19 @@ void wxPropertyListView::ShowView(wxPropertySheet *ps, wxPanel *panel) // the object itself. bool wxPropertyListView::OnUpdateView() { - return TRUE; + return true; } bool wxPropertyListView::UpdatePropertyList(bool clearEditArea) { if (!m_propertyScrollingList || !m_propertySheet) - return FALSE; + return false; m_propertyScrollingList->Clear(); if (clearEditArea) { m_valueList->Clear(); - m_valueText->SetValue( wxT("") ); + m_valueText->SetValue(wxEmptyString); } wxNode *node = m_propertySheet->GetProperties().GetFirst(); @@ -167,13 +165,13 @@ bool wxPropertyListView::UpdatePropertyList(bool clearEditArea) m_propertyScrollingList->Append(paddedString.GetData(), (void *)property); node = node->GetNext(); } - return TRUE; + return true; } bool wxPropertyListView::UpdatePropertyDisplayInList(wxProperty *property) { if (!m_propertyScrollingList || !m_propertySheet) - return FALSE; + return false; #ifdef __WXMSW__ int currentlySelected = m_propertyScrollingList->GetSelection(); @@ -192,7 +190,7 @@ bool wxPropertyListView::UpdatePropertyDisplayInList(wxProperty *property) m_propertyScrollingList->SetString(sel, paddedString.GetData()); } //#else -// UpdatePropertyList(FALSE); +// UpdatePropertyList(false); //#endif // TODO: why is this necessary? @@ -201,7 +199,7 @@ bool wxPropertyListView::UpdatePropertyDisplayInList(wxProperty *property) m_propertyScrollingList->SetSelection(currentlySelected); #endif - return TRUE; + return true; } // Find the wxListBox index corresponding to this property @@ -213,7 +211,7 @@ int wxPropertyListView::FindListIndexForProperty(wxProperty *property) if (property == (wxProperty *)m_propertyScrollingList->wxListBox::GetClientData(i)) return i; } - return -1; + return wxNOT_FOUND; } wxString wxPropertyListView::MakeNameValueString(wxString name, wxString value) @@ -221,7 +219,7 @@ wxString wxPropertyListView::MakeNameValueString(wxString name, wxString value) wxString theString(name); int nameWidth = 25; - int padWith = nameWidth - theString.Length(); + int padWith = nameWidth - theString.length(); if (padWith < 0) padWith = 0; @@ -246,7 +244,7 @@ bool wxPropertyListView::ShowProperty(wxProperty *property, bool select) } m_valueList->Clear(); - m_valueText->SetValue( wxT("") ); + m_valueText->SetValue(wxEmptyString); if (property) { @@ -256,10 +254,10 @@ bool wxPropertyListView::ShowProperty(wxProperty *property, bool select) if (select) { int sel = FindListIndexForProperty(property); - if (sel > -1) + if (sel != wxNOT_FOUND) m_propertyScrollingList->SetSelection(sel); } - return TRUE; + return true; } // Find appropriate validator and load property into value controls @@ -267,28 +265,28 @@ bool wxPropertyListView::BeginShowingProperty(wxProperty *property) { m_currentValidator = FindPropertyValidator(property); if (!m_currentValidator) - return FALSE; + return false; if (!m_currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator))) - return FALSE; + return false; wxPropertyListValidator *listValidator = (wxPropertyListValidator *)m_currentValidator; listValidator->OnPrepareControls(property, this, m_propertyWindow); DisplayProperty(property); - return TRUE; + return true; } // Find appropriate validator and unload property from value controls bool wxPropertyListView::EndShowingProperty(wxProperty *property) { if (!m_currentValidator) - return FALSE; + return false; RetrieveProperty(property); if (!m_currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator))) - return FALSE; + return false; wxPropertyListValidator *listValidator = (wxPropertyListValidator *)m_currentValidator; @@ -296,9 +294,9 @@ bool wxPropertyListView::EndShowingProperty(wxProperty *property) if (m_detailedEditing) { listValidator->OnClearDetailControls(property, this, m_propertyWindow); - m_detailedEditing = FALSE; + m_detailedEditing = false; } - return TRUE; + return true; } void wxPropertyListView::BeginDetailedEditing() @@ -317,7 +315,7 @@ void wxPropertyListView::BeginDetailedEditing() wxPropertyListValidator *listValidator = (wxPropertyListValidator *)m_currentValidator; if (listValidator->OnPrepareDetailControls(m_currentProperty, this, m_propertyWindow)) - m_detailedEditing = TRUE; + m_detailedEditing = true; } void wxPropertyListView::EndDetailedEditing() @@ -337,38 +335,38 @@ void wxPropertyListView::EndDetailedEditing() if (m_detailedEditing) { listValidator->OnClearDetailControls(m_currentProperty, this, m_propertyWindow); - m_detailedEditing = FALSE; + m_detailedEditing = false; } } bool wxPropertyListView::DisplayProperty(wxProperty *property) { if (!m_currentValidator) - return FALSE; + return false; if (((m_currentValidator->GetFlags() & wxPROP_ALLOW_TEXT_EDITING) == 0) || !property->IsEnabled()) - m_valueText->SetEditable(FALSE); + m_valueText->SetEditable(false); else - m_valueText->SetEditable(TRUE); + m_valueText->SetEditable(true); if (!m_currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator))) - return FALSE; + return false; wxPropertyListValidator *listValidator = (wxPropertyListValidator *)m_currentValidator; listValidator->OnDisplayValue(property, this, m_propertyWindow); - return TRUE; + return true; } bool wxPropertyListView::RetrieveProperty(wxProperty *property) { if (!m_currentValidator) - return FALSE; + return false; if (!property->IsEnabled()) - return FALSE; + return false; if (!m_currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator))) - return FALSE; + return false; wxPropertyListValidator *listValidator = (wxPropertyListValidator *)m_currentValidator; @@ -385,25 +383,25 @@ bool wxPropertyListView::RetrieveProperty(wxProperty *property) // Revert to old value listValidator->OnDisplayValue(property, this, m_propertyWindow); } - return TRUE; + return true; } bool wxPropertyListView::EditProperty(wxProperty *WXUNUSED(property)) { - return TRUE; + return true; } // Called by the listbox callback void wxPropertyListView::OnPropertySelect(wxCommandEvent& WXUNUSED(event)) { int sel = m_propertyScrollingList->GetSelection(); - if (sel > -1) + if (sel != wxNOT_FOUND) { wxProperty *newSel = (wxProperty *)m_propertyScrollingList->wxListBox::GetClientData(sel); if (newSel && newSel != m_currentProperty) { - ShowProperty(newSel, FALSE); + ShowProperty(newSel, false); } } } @@ -416,17 +414,17 @@ bool wxPropertyListView::CreateControls() wxSize smallButtonSize( 23, 23 ); if (m_valueText) - return TRUE; + return true; if (!panel) - return FALSE; + return false; - wxFont guiFont = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT); + wxFont guiFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); #ifdef __WXMSW__ wxFont *boringFont = wxTheFontList->FindOrCreateFont(guiFont.GetPointSize(), wxMODERN, - wxNORMAL, wxNORMAL, FALSE, _T("Courier New")); + wxNORMAL, wxNORMAL, false, _T("Courier New")); #else wxFont *boringFont = wxTheFontList->FindOrCreateFont(guiFont.GetPointSize(), wxTELETYPE, wxNORMAL, wxNORMAL); #endif @@ -449,28 +447,28 @@ bool wxPropertyListView::CreateControls() if ( tickBitmap.Ok() && crossBitmap.Ok() ) { - m_confirmButton = new wxBitmapButton(panel, wxID_PROP_CHECK, tickBitmap, wxPoint(-1, -1), smallButtonSize ); - m_cancelButton = new wxBitmapButton(panel, wxID_PROP_CROSS, crossBitmap, wxPoint(-1, -1), smallButtonSize ); + m_confirmButton = new wxBitmapButton(panel, wxID_PROP_CHECK, tickBitmap, wxDefaultPosition, smallButtonSize ); + m_cancelButton = new wxBitmapButton(panel, wxID_PROP_CROSS, crossBitmap, wxDefaultPosition, smallButtonSize ); } else { - m_confirmButton = new wxButton(panel, wxID_PROP_CHECK, _T(":-)"), wxPoint(-1, -1), smallButtonSize ); - m_cancelButton = new wxButton(panel, wxID_PROP_CROSS, _T("X"), wxPoint(-1, -1), smallButtonSize ); + m_confirmButton = new wxButton(panel, wxID_PROP_CHECK, _T(":-)"), wxDefaultPosition, smallButtonSize ); + m_cancelButton = new wxButton(panel, wxID_PROP_CROSS, _T("X"), wxDefaultPosition, smallButtonSize ); } topsizer->Add( m_confirmButton, 0, wxLEFT|wxTOP|wxBOTTOM | wxEXPAND, buttonborder ); topsizer->Add( m_cancelButton, 0, wxLEFT|wxTOP|wxBOTTOM | wxEXPAND, buttonborder ); } - m_valueText = new wxPropertyTextEdit(this, panel, wxID_PROP_TEXT, _T(""), - wxPoint(-1, -1), wxSize(-1, smallButtonSize.y), wxPROCESS_ENTER); - m_valueText->Enable(FALSE); + m_valueText = new wxPropertyTextEdit(this, panel, wxID_PROP_TEXT, wxEmptyString, + wxDefaultPosition, wxSize(wxDefaultCoord, smallButtonSize.y), wxTE_PROCESS_ENTER); + m_valueText->Disable(); topsizer->Add( m_valueText, 1, wxALL | wxEXPAND, buttonborder ); if (m_buttonFlags & wxPROP_PULLDOWN) { - m_editButton = new wxButton(panel, wxID_PROP_EDIT, _T("..."), wxPoint(-1, -1), smallButtonSize); - m_editButton->Enable(FALSE); + m_editButton = new wxButton(panel, wxID_PROP_EDIT, _T("..."), wxDefaultPosition, smallButtonSize); + m_editButton->Disable(); topsizer->Add( m_editButton, 0, wxRIGHT|wxTOP|wxBOTTOM | wxEXPAND, buttonborder ); } @@ -480,10 +478,10 @@ bool wxPropertyListView::CreateControls() m_middleSizer = new wxBoxSizer( wxVERTICAL ); - m_valueList = new wxListBox(panel, wxID_PROP_VALUE_SELECT, wxPoint(-1, -1), wxSize(-1, 60)); - m_valueList->Show(FALSE); + m_valueList = new wxListBox(panel, wxID_PROP_VALUE_SELECT, wxDefaultPosition, wxSize(wxDefaultCoord, 60)); + m_valueList->Show(false); - m_propertyScrollingList = new wxListBox(panel, wxID_PROP_SELECT, wxPoint(-1, -1), wxSize(100, 100)); + m_propertyScrollingList = new wxListBox(panel, wxID_PROP_SELECT, wxDefaultPosition, wxSize(100, 100)); m_propertyScrollingList->SetFont(* boringFont); m_middleSizer->Add( m_propertyScrollingList, 1, wxALL|wxEXPAND, buttonborder ); @@ -501,24 +499,24 @@ bool wxPropertyListView::CreateControls() if (m_buttonFlags & wxPROP_BUTTON_OK) { - m_windowCloseButton = new wxButton(panel, wxID_OK, _("OK"), wxPoint(-1, -1), largeButtonSize ); + m_windowCloseButton = new wxButton(panel, wxID_OK, _("OK"), wxDefaultPosition, largeButtonSize ); m_windowCloseButton->SetDefault(); m_windowCloseButton->SetFocus(); bottomsizer->Add( m_windowCloseButton, 0, wxALL, buttonborder ); } else if (m_buttonFlags & wxPROP_BUTTON_CLOSE) { - m_windowCloseButton = new wxButton(panel, wxID_OK, _("Close"), wxPoint(-1, -1), largeButtonSize ); + m_windowCloseButton = new wxButton(panel, wxID_OK, _("Close"), wxDefaultPosition, largeButtonSize ); bottomsizer->Add( m_windowCloseButton, 0, wxALL, buttonborder ); } if (m_buttonFlags & wxPROP_BUTTON_CANCEL) { - m_windowCancelButton = new wxButton(panel, wxID_CANCEL, _("Cancel"), wxPoint(-1, -1), largeButtonSize ); + m_windowCancelButton = new wxButton(panel, wxID_CANCEL, _("Cancel"), wxDefaultPosition, largeButtonSize ); bottomsizer->Add( m_windowCancelButton, 0, wxALL, buttonborder ); } if (m_buttonFlags & wxPROP_BUTTON_HELP) { - m_windowHelpButton = new wxButton(panel, wxID_HELP, _("Help"), wxPoint(-1, -1), largeButtonSize ); + m_windowHelpButton = new wxButton(panel, wxID_HELP, _("Help"), wxDefaultPosition, largeButtonSize ); bottomsizer->Add( m_windowHelpButton, 0, wxALL, buttonborder ); } @@ -527,7 +525,7 @@ bool wxPropertyListView::CreateControls() panel->SetSizer( mainsizer ); - return TRUE; + return true; } void wxPropertyListView::ShowTextControl(bool show) @@ -572,7 +570,7 @@ bool wxPropertyListView::OnClose() OnCheck(event); delete this; - return TRUE; + return true; } void wxPropertyListView::OnValueListSelect(wxCommandEvent& WXUNUSED(event)) @@ -593,15 +591,15 @@ void wxPropertyListView::OnOk(wxCommandEvent& event) // Retrieve the value if any OnCheck(event); - m_managedWindow->Close(TRUE); - sm_dialogCancelled = FALSE; + m_managedWindow->Close(true); + sm_dialogCancelled = false; } void wxPropertyListView::OnCancel(wxCommandEvent& WXUNUSED(event)) { // SetReturnCode(wxID_CANCEL); - m_managedWindow->Close(TRUE); - sm_dialogCancelled = TRUE; + m_managedWindow->Close(true); + sm_dialogCancelled = true; } void wxPropertyListView::OnHelp(wxCommandEvent& WXUNUSED(event)) @@ -679,12 +677,12 @@ END_EVENT_TABLE() wxPropertyListDialog::wxPropertyListDialog(wxPropertyListView *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( ((wxPanel*)this) ); m_view->SetManagedWindow(this); - SetAutoLayout(TRUE); + SetAutoLayout(true); } void wxPropertyListDialog::OnCloseWindow(wxCloseEvent& event) @@ -722,7 +720,7 @@ bool wxPropertyListDialog::ProcessEvent(wxEvent& event) if ( !m_view || ! m_view->ProcessEvent(event) ) return wxEvtHandler::ProcessEvent(event); else - return TRUE; + return true; } // ---------------------------------------------------------------------------- @@ -753,7 +751,7 @@ bool wxPropertyListPanel::ProcessEvent(wxEvent& event) if ( !m_view || ! m_view->ProcessEvent(event) ) return wxEvtHandler::ProcessEvent(event); else - return TRUE; + return true; } void wxPropertyListPanel::OnSize(wxSizeEvent& WXUNUSED(event)) @@ -799,11 +797,11 @@ bool wxPropertyListFrame::Initialize() { m_view->AssociatePanel(m_propertyPanel); m_view->SetManagedWindow(this); - m_propertyPanel->SetAutoLayout(TRUE); - return TRUE; + m_propertyPanel->SetAutoLayout(true); + return true; } else - return FALSE; + return false; } // ---------------------------------------------------------------------------- @@ -814,31 +812,31 @@ IMPLEMENT_ABSTRACT_CLASS(wxPropertyListValidator, wxPropertyValidator) bool wxPropertyListValidator::OnSelect(bool select, wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) { -// view->GetValueText()->Show(TRUE); +// view->GetValueText()->Show(true); if (select) OnDisplayValue(property, view, parentWindow); - return TRUE; + return true; } bool wxPropertyListValidator::OnValueListSelect(wxProperty *property, wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { wxString s(view->GetValueList()->GetStringSelection()); - if (s != wxT("")) + if ( !s.empty() ) { view->GetValueText()->SetValue(s); view->RetrieveProperty(property); } - return TRUE; + return true; } bool wxPropertyListValidator::OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { -// view->GetValueText()->Show(TRUE); +// view->GetValueText()->Show(true); wxString str(property->GetValue().GetStringRepresentation()); view->GetValueText()->SetValue(str); - return TRUE; + return true; } // Called when TICK is pressed or focus is lost or view wants to update @@ -847,8 +845,8 @@ bool wxPropertyListValidator::OnDisplayValue(wxProperty *property, wxPropertyLis bool wxPropertyListValidator::OnRetrieveValue(wxProperty *WXUNUSED(property), wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { if (!view->GetValueText()) - return FALSE; - return FALSE; + return false; + return false; } void wxPropertyListValidator::OnEdit(wxProperty *WXUNUSED(property), wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) @@ -862,12 +860,12 @@ void wxPropertyListValidator::OnEdit(wxProperty *WXUNUSED(property), wxPropertyL bool wxPropertyListValidator::OnClearControls(wxProperty *WXUNUSED(property), wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { if (view->GetConfirmButton()) - view->GetConfirmButton()->Enable(FALSE); + view->GetConfirmButton()->Disable(); if (view->GetCancelButton()) - view->GetCancelButton()->Enable(FALSE); + view->GetCancelButton()->Disable(); if (view->GetEditButton()) - view->GetEditButton()->Enable(FALSE); - return TRUE; + view->GetEditButton()->Disable(); + return true; } // ---------------------------------------------------------------------------- @@ -882,10 +880,10 @@ IMPLEMENT_DYNAMIC_CLASS(wxRealListValidator, wxPropertyListValidator) bool wxRealListValidator::OnCheckValue(wxProperty *WXUNUSED(property), wxPropertyListView *view, wxWindow *parentWindow) { if (m_realMin == 0.0 && m_realMax == 0.0) - return TRUE; + return true; if (!view->GetValueText()) - return FALSE; + return false; wxString value(view->GetValueText()->GetValue()); float val = 0.0; @@ -894,7 +892,7 @@ bool wxRealListValidator::OnCheckValue(wxProperty *WXUNUSED(property), wxPropert wxChar buf[200]; wxSprintf(buf, wxT("Value %s is not a valid real number!"), value.GetData()); wxMessageBox(buf, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow); - return FALSE; + return false; } if (val < m_realMin || val > m_realMax) @@ -902,9 +900,9 @@ bool wxRealListValidator::OnCheckValue(wxProperty *WXUNUSED(property), wxPropert 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; } // Called when TICK is pressed or focus is lost or view wants to update @@ -913,28 +911,28 @@ bool wxRealListValidator::OnCheckValue(wxProperty *WXUNUSED(property), wxPropert bool wxRealListValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { if (!view->GetValueText()) - return FALSE; + return false; if (wxStrlen(view->GetValueText()->GetValue()) == 0) - return FALSE; + return false; wxString value(view->GetValueText()->GetValue()); float f = (float)wxAtof(value.GetData()); property->GetValue() = f; - return TRUE; + return true; } bool wxRealListValidator::OnPrepareControls(wxProperty *WXUNUSED(property), wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { if (view->GetConfirmButton()) - view->GetConfirmButton()->Enable(TRUE); + view->GetConfirmButton()->Enable(); if (view->GetCancelButton()) - view->GetCancelButton()->Enable(TRUE); + view->GetCancelButton()->Enable(); if (view->GetEditButton()) - view->GetEditButton()->Enable(FALSE); + view->GetEditButton()->Disable(); if (view->GetValueText()) - view->GetValueText()->Enable(TRUE); - return TRUE; + view->GetValueText()->Enable(); + return true; } /// @@ -945,10 +943,10 @@ IMPLEMENT_DYNAMIC_CLASS(wxIntegerListValidator, wxPropertyListValidator) bool wxIntegerListValidator::OnCheckValue(wxProperty *WXUNUSED(property), wxPropertyListView *view, wxWindow *parentWindow) { if (m_integerMin == 0 && m_integerMax == 0) - return TRUE; + return true; if (!view->GetValueText()) - return FALSE; + return false; wxString value(view->GetValueText()->GetValue()); long val = 0; @@ -957,16 +955,16 @@ bool wxIntegerListValidator::OnCheckValue(wxProperty *WXUNUSED(property), wxProp wxChar buf[200]; wxSprintf(buf, wxT("Value %s is not a valid integer!"), value.GetData()); wxMessageBox(buf, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow); - 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; } // Called when TICK is pressed or focus is lost or view wants to update @@ -975,28 +973,28 @@ bool wxIntegerListValidator::OnCheckValue(wxProperty *WXUNUSED(property), wxProp bool wxIntegerListValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { if (!view->GetValueText()) - return FALSE; + return false; if (wxStrlen(view->GetValueText()->GetValue()) == 0) - return FALSE; + return false; wxString value(view->GetValueText()->GetValue()); long val = (long)wxAtoi(value.GetData()); property->GetValue() = (long)val; - return TRUE; + return true; } bool wxIntegerListValidator::OnPrepareControls(wxProperty *WXUNUSED(property), wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { if (view->GetConfirmButton()) - view->GetConfirmButton()->Enable(TRUE); + view->GetConfirmButton()->Enable(); if (view->GetCancelButton()) - view->GetCancelButton()->Enable(TRUE); + view->GetCancelButton()->Enable(); if (view->GetEditButton()) - view->GetEditButton()->Enable(FALSE); + view->GetEditButton()->Disable(); if (view->GetValueText()) - view->GetValueText()->Enable(TRUE); - return TRUE; + view->GetValueText()->Enable(); + return true; } /// @@ -1007,14 +1005,14 @@ IMPLEMENT_DYNAMIC_CLASS(wxBoolListValidator, wxPropertyListValidator) bool wxBoolListValidator::OnCheckValue(wxProperty *WXUNUSED(property), wxPropertyListView *view, wxWindow *parentWindow) { if (!view->GetValueText()) - return FALSE; + return false; wxString value(view->GetValueText()->GetValue()); if (value != wxT("True") && value != wxT("False")) { wxMessageBox(wxT("Value must be True or False!"), wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow); - return FALSE; + return false; } - return TRUE; + return true; } // Called when TICK is pressed or focus is lost or view wants to update @@ -1023,25 +1021,21 @@ bool wxBoolListValidator::OnCheckValue(wxProperty *WXUNUSED(property), wxPropert bool wxBoolListValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { if (!view->GetValueText()) - return FALSE; + return false; if (wxStrlen(view->GetValueText()->GetValue()) == 0) - return FALSE; + return false; wxString value(view->GetValueText()->GetValue()); - bool boolValue = FALSE; - if (value == wxT("True")) - boolValue = TRUE; - else - boolValue = FALSE; - property->GetValue() = (bool)boolValue; - return TRUE; + bool boolValue = (value == wxT("True")); + property->GetValue() = boolValue; + return true; } bool wxBoolListValidator::OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { if (!view->GetValueText()) - return FALSE; + return false; wxString str(property->GetValue().GetStringRepresentation()); view->GetValueText()->SetValue(str); @@ -1050,28 +1044,28 @@ bool wxBoolListValidator::OnDisplayValue(wxProperty *property, wxPropertyListVie { view->GetValueList()->SetStringSelection(str); } - return TRUE; + return true; } bool wxBoolListValidator::OnPrepareControls(wxProperty *WXUNUSED(property), wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { if (view->GetConfirmButton()) - view->GetConfirmButton()->Enable(FALSE); + view->GetConfirmButton()->Disable(); if (view->GetCancelButton()) - view->GetCancelButton()->Enable(FALSE); + view->GetCancelButton()->Disable(); if (view->GetEditButton()) - view->GetEditButton()->Enable(TRUE); + view->GetEditButton()->Enable(); if (view->GetValueText()) - view->GetValueText()->Enable(FALSE); - return TRUE; + view->GetValueText()->Disable(); + return true; } bool wxBoolListValidator::OnPrepareDetailControls(wxProperty *WXUNUSED(property), wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { if (view->GetValueList()) { - view->ShowListBoxControl(TRUE); - view->GetValueList()->Enable(TRUE); + view->ShowListBoxControl(true); + view->GetValueList()->Enable(); view->GetValueList()->Append(wxT("True")); view->GetValueList()->Append(wxT("False")); @@ -1079,7 +1073,7 @@ bool wxBoolListValidator::OnPrepareDetailControls(wxProperty *WXUNUSED(property) view->GetValueList()->SetStringSelection(currentString); delete[] currentString; } - return TRUE; + return true; } bool wxBoolListValidator::OnClearDetailControls(wxProperty *WXUNUSED(property), wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) @@ -1087,10 +1081,10 @@ bool wxBoolListValidator::OnClearDetailControls(wxProperty *WXUNUSED(property), if (view->GetValueList()) { view->GetValueList()->Clear(); - view->ShowListBoxControl(FALSE); - view->GetValueList()->Enable(FALSE); + view->ShowListBoxControl(false); + view->GetValueList()->Disable(); } - return TRUE; + return true; } // Called when the property is double clicked. Extra functionality can be provided, @@ -1098,15 +1092,15 @@ bool wxBoolListValidator::OnClearDetailControls(wxProperty *WXUNUSED(property), bool wxBoolListValidator::OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { if (!view->GetValueText()) - return FALSE; + return false; if (property->GetValue().BoolValue()) - property->GetValue() = (bool)FALSE; + property->GetValue() = false; else - property->GetValue() = (bool)TRUE; + property->GetValue() = true; view->DisplayProperty(property); view->UpdatePropertyDisplayInList(property); view->OnPropertyChanged(property); - return TRUE; + return true; } /// @@ -1126,10 +1120,10 @@ wxStringListValidator::wxStringListValidator(wxStringList *list, long flags): bool wxStringListValidator::OnCheckValue(wxProperty *WXUNUSED(property), wxPropertyListView *view, wxWindow *parentWindow) { if (!m_strings) - return TRUE; + return true; if (!view->GetValueText()) - return FALSE; + return false; wxString value(view->GetValueText()->GetValue()); if (!m_strings->Member(value.GetData())) @@ -1138,9 +1132,9 @@ bool wxStringListValidator::OnCheckValue(wxProperty *WXUNUSED(property), wxPrope str += value.GetData(); str += wxT(" is not valid."); wxMessageBox( str.GetData(), wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow); - return FALSE; + return false; } - return TRUE; + return true; } // Called when TICK is pressed or focus is lost or view wants to update @@ -1149,10 +1143,10 @@ bool wxStringListValidator::OnCheckValue(wxProperty *WXUNUSED(property), wxPrope bool wxStringListValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { if (!view->GetValueText()) - return FALSE; + return false; wxString value(view->GetValueText()->GetValue()); property->GetValue() = value ; - return TRUE; + return true; } // Called when TICK is pressed or focus is lost or view wants to update @@ -1161,14 +1155,14 @@ bool wxStringListValidator::OnRetrieveValue(wxProperty *property, wxPropertyList bool wxStringListValidator::OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { if (!view->GetValueText()) - return FALSE; + return false; wxString str(property->GetValue().GetStringRepresentation()); view->GetValueText()->SetValue(str); if (m_strings && view->GetValueList() && view->GetValueList()->IsShown() && view->GetValueList()->GetCount() > 0) { view->GetValueList()->SetStringSelection(str); } - return TRUE; + return true; } bool wxStringListValidator::OnPrepareControls(wxProperty *WXUNUSED(property), wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) @@ -1177,28 +1171,28 @@ bool wxStringListValidator::OnPrepareControls(wxProperty *WXUNUSED(property), wx if (!m_strings) { if (view->GetEditButton()) - view->GetEditButton()->Enable(FALSE); + view->GetEditButton()->Disable(); if (view->GetConfirmButton()) - view->GetConfirmButton()->Enable(TRUE); + view->GetConfirmButton()->Enable(); if (view->GetCancelButton()) - view->GetCancelButton()->Enable(TRUE); + view->GetCancelButton()->Enable(); if (view->GetValueText()) - view->GetValueText()->Enable(TRUE); - return TRUE; + view->GetValueText()->Enable(); + return true; } // Constrained if (view->GetValueText()) - view->GetValueText()->Enable(FALSE); + view->GetValueText()->Disable(); if (view->GetEditButton()) - view->GetEditButton()->Enable(TRUE); + view->GetEditButton()->Enable(); if (view->GetConfirmButton()) - view->GetConfirmButton()->Enable(FALSE); + view->GetConfirmButton()->Disable(); if (view->GetCancelButton()) - view->GetCancelButton()->Enable(FALSE); - return TRUE; + view->GetCancelButton()->Disable(); + return true; } bool wxStringListValidator::OnPrepareDetailControls( wxProperty *property, @@ -1207,8 +1201,8 @@ bool wxStringListValidator::OnPrepareDetailControls( wxProperty *property, { if (view->GetValueList()) { - view->ShowListBoxControl(TRUE); - view->GetValueList()->Enable(TRUE); + view->ShowListBoxControl(true); + view->GetValueList()->Enable(); wxStringList::Node *node = m_strings->GetFirst(); while (node) { @@ -1219,23 +1213,23 @@ bool wxStringListValidator::OnPrepareDetailControls( wxProperty *property, wxChar *currentString = property->GetValue().StringValue(); view->GetValueList()->SetStringSelection(currentString); } - return TRUE; + return true; } bool wxStringListValidator::OnClearDetailControls(wxProperty *WXUNUSED(property), wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { if (!m_strings) { - return TRUE; + return true; } if (view->GetValueList()) { view->GetValueList()->Clear(); - view->ShowListBoxControl(FALSE); - view->GetValueList()->Enable(FALSE); + view->ShowListBoxControl(false); + view->GetValueList()->Disable(); } - return TRUE; + return true; } // Called when the property is double clicked. Extra functionality can be provided, @@ -1245,9 +1239,9 @@ bool wxStringListValidator::OnDoubleClick( wxProperty *property, wxWindow *WXUNUSED(parentWindow) ) { if (!view->GetValueText()) - return FALSE; + return false; if (!m_strings) - return FALSE; + return false; wxStringList::Node *node = m_strings->GetFirst(); wxChar *currentString = property->GetValue().StringValue(); @@ -1256,7 +1250,7 @@ bool wxStringListValidator::OnDoubleClick( wxProperty *property, wxChar *s = node->GetData(); if (wxStrcmp(s, currentString) == 0) { - wxChar *nextString = NULL; + wxChar *nextString; if (node->GetNext()) nextString = node->GetNext()->GetData(); else @@ -1265,11 +1259,11 @@ bool wxStringListValidator::OnDoubleClick( wxProperty *property, view->DisplayProperty(property); view->UpdatePropertyDisplayInList(property); view->OnPropertyChanged(property); - return TRUE; + return true; } else node = node->GetNext(); } - return TRUE; + return true; } /// @@ -1288,7 +1282,7 @@ wxFilenameListValidator::~wxFilenameListValidator() bool wxFilenameListValidator::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 @@ -1297,10 +1291,10 @@ bool wxFilenameListValidator::OnCheckValue(wxProperty *WXUNUSED(property), wxPro bool wxFilenameListValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { if (!view->GetValueText()) - return FALSE; + return false; wxString value(view->GetValueText()->GetValue()); property->GetValue() = value ; - return TRUE; + return true; } // Called when TICK is pressed or focus is lost or view wants to update @@ -1309,10 +1303,10 @@ bool wxFilenameListValidator::OnRetrieveValue(wxProperty *property, wxPropertyLi bool wxFilenameListValidator::OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { if (!view->GetValueText()) - return FALSE; + return false; wxString str(property->GetValue().GetStringRepresentation()); view->GetValueText()->SetValue(str); - return TRUE; + return true; } // Called when the property is double clicked. Extra functionality can be provided, @@ -1320,22 +1314,22 @@ bool wxFilenameListValidator::OnDisplayValue(wxProperty *property, wxPropertyLis bool wxFilenameListValidator::OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) { if (!view->GetValueText()) - return FALSE; + return false; OnEdit(property, view, parentWindow); - return TRUE; + return true; } bool wxFilenameListValidator::OnPrepareControls(wxProperty *WXUNUSED(property), wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { if (view->GetConfirmButton()) - view->GetConfirmButton()->Enable(TRUE); + view->GetConfirmButton()->Enable(); if (view->GetCancelButton()) - view->GetCancelButton()->Enable(TRUE); + view->GetCancelButton()->Enable(); if (view->GetEditButton()) - view->GetEditButton()->Enable(TRUE); + view->GetEditButton()->Enable(); if (view->GetValueText()) view->GetValueText()->Enable((GetFlags() & wxPROP_ALLOW_TEXT_EDITING) == wxPROP_ALLOW_TEXT_EDITING); - return TRUE; + return true; } void wxFilenameListValidator::OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) @@ -1343,21 +1337,27 @@ void wxFilenameListValidator::OnEdit(wxProperty *property, wxPropertyListView *v if (!view->GetValueText()) return; - wxString s = wxFileSelector( - m_filenameMessage.GetData(), - wxPathOnly(property->GetValue().StringValue()), - wxFileNameFromPath(property->GetValue().StringValue()), - NULL, - m_filenameWildCard.GetData(), - 0, - parentWindow); - if (s != wxT("")) - { - property->GetValue() = s; - view->DisplayProperty(property); - view->UpdatePropertyDisplayInList(property); - view->OnPropertyChanged(property); - } +#if wxUSE_FILEDLG + wxString s = wxFileSelector( + m_filenameMessage.GetData(), + wxPathOnly(property->GetValue().StringValue()), + wxFileNameFromPath(property->GetValue().StringValue()), + NULL, + m_filenameWildCard.GetData(), + 0, + parentWindow); + if ( !s.empty() ) + { + property->GetValue() = s; + view->DisplayProperty(property); + view->UpdatePropertyDisplayInList(property); + view->OnPropertyChanged(property); + } +#else + wxUnusedVar(property); + wxUnusedVar(view); + wxUnusedVar(parentWindow); +#endif } /// @@ -1376,7 +1376,7 @@ wxColourListValidator::~wxColourListValidator() bool wxColourListValidator::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 @@ -1385,11 +1385,11 @@ bool wxColourListValidator::OnCheckValue(wxProperty *WXUNUSED(property), wxPrope bool wxColourListValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { if (!view->GetValueText()) - return FALSE; + return false; wxString value(view->GetValueText()->GetValue()); property->GetValue() = value ; - return TRUE; + return true; } // Called when TICK is pressed or focus is lost or view wants to update @@ -1398,10 +1398,10 @@ bool wxColourListValidator::OnRetrieveValue(wxProperty *property, wxPropertyList bool wxColourListValidator::OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { if (!view->GetValueText()) - return FALSE; + return false; wxString str(property->GetValue().GetStringRepresentation()); view->GetValueText()->SetValue(str); - return TRUE; + return true; } // Called when the property is double clicked. Extra functionality can be provided, @@ -1409,22 +1409,26 @@ bool wxColourListValidator::OnDisplayValue(wxProperty *property, wxPropertyListV bool wxColourListValidator::OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) { if (!view->GetValueText()) - return FALSE; + return false; OnEdit(property, view, parentWindow); - return TRUE; + return true; } bool wxColourListValidator::OnPrepareControls(wxProperty *WXUNUSED(property), wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { - if (view->GetConfirmButton()) - view->GetConfirmButton()->Enable(TRUE); - if (view->GetCancelButton()) - view->GetCancelButton()->Enable(TRUE); - if (view->GetEditButton()) - view->GetEditButton()->Enable(TRUE); - if (view->GetValueText()) - view->GetValueText()->Enable((GetFlags() & wxPROP_ALLOW_TEXT_EDITING) == wxPROP_ALLOW_TEXT_EDITING); - return TRUE; + if (view->GetConfirmButton()) + view->GetConfirmButton()->Enable(); + + if (view->GetCancelButton()) + view->GetCancelButton()->Enable(); + + if (view->GetEditButton()) + view->GetEditButton()->Enable(); + + if (view->GetValueText()) + view->GetValueText()->Enable((GetFlags() & wxPROP_ALLOW_TEXT_EDITING) == wxPROP_ALLOW_TEXT_EDITING); + + return true; } void wxColourListValidator::OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) @@ -1433,25 +1437,27 @@ void wxColourListValidator::OnEdit(wxProperty *property, wxPropertyListView *vie return; wxChar *s = property->GetValue().StringValue(); - int r = 0; - int g = 0; - int b = 0; + unsigned char r = 0; + unsigned char g = 0; + unsigned char b = 0; if (s) { - r = wxHexToDec(s); - g = wxHexToDec(s+2); - b = wxHexToDec(s+4); + r = (unsigned char)wxHexToDec(s); + g = (unsigned char)wxHexToDec(s+2); + b = (unsigned char)wxHexToDec(s+4); } wxColour col(r,g,b); wxColourData data; - data.SetChooseFull(TRUE); + data.SetChooseFull(true); data.SetColour(col); for (int i = 0; i < 16; i++) { - wxColour colour(i*16, i*16, i*16); + wxColour colour((unsigned char)(i*16), + (unsigned char)(i*16), + (unsigned char)(i*16)); data.SetCustomColour(i, colour); } @@ -1487,7 +1493,7 @@ wxListOfStringsListValidator::wxListOfStringsListValidator(long flags): bool wxListOfStringsListValidator::OnCheckValue(wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow)) { // No constraints for an arbitrary, user-editable list of strings. - return TRUE; + return true; } // Called when TICK is pressed or focus is lost or view wants to update @@ -1496,30 +1502,30 @@ bool wxListOfStringsListValidator::OnCheckValue(wxProperty *WXUNUSED(property), // In this case, the user cannot directly edit the string list. bool wxListOfStringsListValidator::OnRetrieveValue(wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow)) { - return TRUE; + return true; } bool wxListOfStringsListValidator::OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { if (!view->GetValueText()) - return FALSE; + return false; wxString str(property->GetValue().GetStringRepresentation()); view->GetValueText()->SetValue(str); - return TRUE; + return true; } bool wxListOfStringsListValidator::OnPrepareControls(wxProperty *WXUNUSED(property), wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { if (view->GetEditButton()) - view->GetEditButton()->Enable(TRUE); + view->GetEditButton()->Enable(); if (view->GetValueText()) - view->GetValueText()->Enable(FALSE); + view->GetValueText()->Disable(); if (view->GetConfirmButton()) - view->GetConfirmButton()->Enable(FALSE); + view->GetConfirmButton()->Disable(); if (view->GetCancelButton()) - view->GetCancelButton()->Enable(FALSE); - return TRUE; + view->GetCancelButton()->Disable(); + return true; } // Called when the property is double clicked. Extra functionality can be provided, @@ -1527,7 +1533,7 @@ bool wxListOfStringsListValidator::OnPrepareControls(wxProperty *WXUNUSED(proper bool wxListOfStringsListValidator::OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) { OnEdit(property, view, parentWindow); - return TRUE; + return true; } void wxListOfStringsListValidator::OnEdit( wxProperty *property, @@ -1571,17 +1577,17 @@ void wxListOfStringsListValidator::OnEdit( wxProperty *property, class wxPropertyStringListEditorDialog: public wxDialog { - public: +public: wxPropertyStringListEditorDialog(wxWindow *parent, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long windowStyle = wxDEFAULT_DIALOG_STYLE, const wxString& name = wxT("stringEditorDialogBox")): - wxDialog(parent, -1, title, pos, size, windowStyle, name) + wxDialog(parent, wxID_ANY, title, pos, size, windowStyle, name) { - m_stringList = NULL; - m_stringText = NULL; - m_listBox = NULL; - sm_dialogCancelled = FALSE; - m_currentSelection = -1; + m_stringList = NULL; + m_stringText = NULL; + m_listBox = NULL; + sm_dialogCancelled = false; + m_currentSelection = -1; } ~wxPropertyStringListEditorDialog(void) {} void OnCloseWindow(wxCloseEvent& event); @@ -1635,7 +1641,7 @@ class wxPropertyStringListEditorText: public wxTextCtrl } }; -bool wxPropertyStringListEditorDialog::sm_dialogCancelled = FALSE; +bool wxPropertyStringListEditorDialog::sm_dialogCancelled = false; // Edit the string list. bool wxListOfStringsListValidator::EditStringList(wxWindow *parent, wxStringList *stringList, const wxChar *title) @@ -1645,69 +1651,41 @@ bool wxListOfStringsListValidator::EditStringList(wxWindow *parent, wxStringList wxBeginBusyCursor(); wxPropertyStringListEditorDialog *dialog = new wxPropertyStringListEditorDialog(parent, - title, wxPoint(10, 10), wxSize(400, 400), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL); + title, wxPoint(10, 10), wxSize(400, 400)); dialog->m_stringList = stringList; dialog->m_listBox = new wxListBox(dialog, wxID_PROP_SL_STRINGS, - wxPoint(-1, -1), wxSize(-1, -1), 0, NULL, wxLB_SINGLE); + wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE); dialog->m_stringText = new wxPropertyStringListEditorText(dialog, - wxID_PROP_SL_TEXT, wxT(""), wxPoint(5, 240), - wxSize(300, -1), wxPROCESS_ENTER); - dialog->m_stringText->Enable(FALSE); + wxID_PROP_SL_TEXT, wxEmptyString, wxPoint(5, 240), + wxSize(300, wxDefaultCoord), wxTE_PROCESS_ENTER); + dialog->m_stringText->Disable(); - wxButton *addButton = new wxButton(dialog, wxID_PROP_SL_ADD, wxT("Add"), wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight)); - wxButton *deleteButton = new wxButton(dialog, wxID_PROP_SL_DELETE, wxT("Delete"), wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight)); - wxButton *cancelButton = new wxButton(dialog, wxID_CANCEL, wxT("Cancel"), wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight)); - wxButton *okButton = new wxButton(dialog, wxID_OK, wxT("OK"), wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight)); + wxButton *addButton = new wxButton(dialog, wxID_PROP_SL_ADD, wxT("Add"), wxDefaultPosition, wxSize(largeButtonWidth, largeButtonHeight)); + wxButton *deleteButton = new wxButton(dialog, wxID_PROP_SL_DELETE, wxT("Delete"), wxDefaultPosition, wxSize(largeButtonWidth, largeButtonHeight)); + wxButton *cancelButton = new wxButton(dialog, wxID_CANCEL, wxT("Cancel"), wxDefaultPosition, wxSize(largeButtonWidth, largeButtonHeight)); + wxButton *okButton = new wxButton(dialog, wxID_OK, wxT("OK"), wxDefaultPosition, wxSize(largeButtonWidth, largeButtonHeight)); #ifndef __WXGTK__ okButton->SetDefault(); #endif - wxLayoutConstraints *c = new wxLayoutConstraints; - - c->top.SameAs (dialog, wxTop, 2); - c->left.SameAs (dialog, wxLeft, 2); - c->right.SameAs (dialog, wxRight, 2); - c->bottom.SameAs (dialog->m_stringText, wxTop, 2); - dialog->m_listBox->SetConstraints(c); - - c = new wxLayoutConstraints; - c->left.SameAs (dialog, wxLeft, 2); - c->right.SameAs (dialog, wxRight, 2); - c->bottom.SameAs (addButton, wxTop, 2); - c->height.AsIs(); - dialog->m_stringText->SetConstraints(c); - - c = new wxLayoutConstraints; - c->bottom.SameAs (dialog, wxBottom, 2); - c->left.SameAs (dialog, wxLeft, 2); - c->width.AsIs(); - c->height.AsIs(); - addButton->SetConstraints(c); - - c = new wxLayoutConstraints; - c->bottom.SameAs (dialog, wxBottom, 2); - c->left.SameAs (addButton, wxRight, 2); - c->width.AsIs(); - c->height.AsIs(); - deleteButton->SetConstraints(c); - - c = new wxLayoutConstraints; - c->bottom.SameAs (dialog, wxBottom, 2); - c->right.SameAs (dialog, wxRight, 2); - c->width.AsIs(); - c->height.AsIs(); - cancelButton->SetConstraints(c); - - c = new wxLayoutConstraints; - c->bottom.SameAs (dialog, wxBottom, 2); - c->right.SameAs (cancelButton, wxLeft, 2); - c->width.AsIs(); - c->height.AsIs(); - okButton->SetConstraints(c); + wxBoxSizer *m_bottom_sizer = new wxBoxSizer( wxHORIZONTAL ); + m_bottom_sizer->Add(addButton, 0, wxALL | wxALIGN_LEFT, 2 ); + m_bottom_sizer->Add(deleteButton, 0, wxALL | wxALIGN_LEFT, 2 ); + m_bottom_sizer->Add(1, 1, 1, wxEXPAND | wxALL); + m_bottom_sizer->Add(cancelButton, 0, wxALL | wxALIGN_RIGHT, 2 ); + m_bottom_sizer->Add(okButton, 0, wxALL | wxALIGN_RIGHT, 2 ); + + wxBoxSizer *m_sizer = new wxBoxSizer( wxVERTICAL ); + m_sizer->Add(dialog->m_listBox, 1, wxEXPAND | wxALL, 2 ); + m_sizer->Add(dialog->m_stringText, 0, wxEXPAND | wxALL, 2 ); + m_sizer->Add(m_bottom_sizer, 0, wxEXPAND | wxALL , 0 ); + + dialog->SetSizer( m_sizer ); + m_sizer->SetSizeHints( dialog ); wxStringList::Node *node = stringList->GetFirst(); while (node) @@ -1724,9 +1702,9 @@ bool wxListOfStringsListValidator::EditStringList(wxWindow *parent, wxStringList dialog->Centre(wxBOTH); wxEndBusyCursor(); if (dialog->ShowModal() == wxID_CANCEL) - return FALSE; + return false; else - return TRUE; + return true; } /* @@ -1736,30 +1714,30 @@ bool wxListOfStringsListValidator::EditStringList(wxWindow *parent, wxStringList void wxPropertyStringListEditorDialog::OnStrings(wxCommandEvent& WXUNUSED(event)) { - int sel = m_listBox->GetSelection(); - if (sel > -1) - { - m_currentSelection = sel; + int sel = m_listBox->GetSelection(); + if (sel != wxNOT_FOUND) + { + m_currentSelection = sel; - ShowCurrentSelection(); - } + ShowCurrentSelection(); + } } void wxPropertyStringListEditorDialog::OnDelete(wxCommandEvent& WXUNUSED(event)) { - int sel = m_listBox->GetSelection(); - if (sel == -1) - return; + int sel = m_listBox->GetSelection(); + if (sel == wxNOT_FOUND) + return; - wxNode *node = (wxNode *)m_listBox->wxListBox::GetClientData(sel); - if (!node) - return; + wxNode *node = (wxNode *)m_listBox->wxListBox::GetClientData(sel); + if (!node) + return; - m_listBox->Delete(sel); - delete[] (wxChar *)node->GetData(); - delete node; - m_currentSelection = -1; - m_stringText->SetValue(_T("")); + m_listBox->Delete(sel); + delete[] (wxChar *)node->GetData(); + delete node; + m_currentSelection = -1; + m_stringText->SetValue(wxEmptyString); } void wxPropertyStringListEditorDialog::OnAdd(wxCommandEvent& WXUNUSED(event)) @@ -1777,34 +1755,34 @@ void wxPropertyStringListEditorDialog::OnAdd(wxCommandEvent& WXUNUSED(event)) void wxPropertyStringListEditorDialog::OnOK(wxCommandEvent& WXUNUSED(event)) { - SaveCurrentSelection(); - EndModal(wxID_OK); - // Close(TRUE); - this->Destroy(); + SaveCurrentSelection(); + EndModal(wxID_OK); +// Close(true); + this->Destroy(); } void wxPropertyStringListEditorDialog::OnCancel(wxCommandEvent& WXUNUSED(event)) { - sm_dialogCancelled = TRUE; - EndModal(wxID_CANCEL); -// Close(TRUE); - this->Destroy(); + sm_dialogCancelled = true; + EndModal(wxID_CANCEL); +// Close(true); + this->Destroy(); } void wxPropertyStringListEditorDialog::OnText(wxCommandEvent& event) { - if (event.GetEventType() == wxEVT_COMMAND_TEXT_ENTER) - { - SaveCurrentSelection(); - } + if (event.GetEventType() == wxEVT_COMMAND_TEXT_ENTER) + { + SaveCurrentSelection(); + } } void wxPropertyStringListEditorDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) { - SaveCurrentSelection(); + SaveCurrentSelection(); - Destroy(); + Destroy(); } void wxPropertyStringListEditorDialog::SaveCurrentSelection() @@ -1828,13 +1806,13 @@ void wxPropertyStringListEditorDialog::ShowCurrentSelection() { if (m_currentSelection == -1) { - m_stringText->SetValue(wxT("")); + m_stringText->SetValue(wxEmptyString); return; } wxNode *node = (wxNode *)m_listBox->wxListBox::GetClientData(m_currentSelection); wxChar *txt = (wxChar *)node->GetData(); m_stringText->SetValue(txt); - m_stringText->Enable(TRUE); + m_stringText->Enable(); }