From 206d3a16caa7a4e626395ae52cc8f7e0225e202d Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Thu, 11 Dec 2003 10:32:15 +0000 Subject: [PATCH] Applied patch [ 829144 ] Compilation error fixes for samples git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24755 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/typetest/typetest.cpp | 46 ++++++++++++++++++----------------- samples/widgets/button.cpp | 21 ++++++++-------- samples/widgets/combobox.cpp | 22 ++++++++--------- samples/widgets/gauge.cpp | 16 ++++++------ samples/widgets/listbox.cpp | 25 ++++++++++--------- samples/widgets/notebook.cpp | 31 ++++++++++++----------- samples/widgets/radiobox.cpp | 25 +++++++++---------- samples/widgets/slider.cpp | 23 +++++++++--------- samples/widgets/spinbtn.cpp | 19 ++++++++------- samples/widgets/static.cpp | 27 ++++++++++---------- samples/widgets/textctrl.cpp | 37 ++++++++++++++-------------- samples/widgets/widgets.cpp | 34 ++++++++++++++------------ samples/widgets/widgets.h | 8 +++--- 13 files changed, 167 insertions(+), 167 deletions(-) diff --git a/samples/typetest/typetest.cpp b/samples/typetest/typetest.cpp index e9102078d4..8ee42c8455 100644 --- a/samples/typetest/typetest.cpp +++ b/samples/typetest/typetest.cpp @@ -108,14 +108,15 @@ bool MyApp::OnInit() menu_bar->Append(test_menu, _T("&Tests")); frame->SetMenuBar(menu_bar); - m_textCtrl = new wxTextCtrl(frame, -1, _T(""), wxPoint(0, 0), wxDefaultSize, wxTE_MULTILINE); + m_textCtrl = new wxTextCtrl(frame, wxID_ANY, wxEmptyString, + wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE); // Show the frame - frame->Show(TRUE); + frame->Show(true); SetTopWindow(frame); - return TRUE; + return true; } void MyApp::DoStreamDemo(wxCommandEvent& WXUNUSED(event)) @@ -958,7 +959,7 @@ void MyApp::DoMIMEDemo(wxCommandEvent& WXUNUSED(event)) textCtrl << _T("MIME information about extension '") << ext << _T("'\n") << _T("\tMIME type: ") << ( !type ? wxT("unknown") : type.c_str() ) << '\n' - << _T("\tDescription: ") << ( !desc ? wxT("") : desc.c_str() ) + << _T("\tDescription: ") << ( !desc ? wxEmptyString : desc.c_str() ) << '\n' << _T("\tCommand to open: ") << ( !open ? wxT("no") : open.c_str() ) << '\n'; @@ -984,19 +985,19 @@ void MyApp::DoByteOrderDemo(wxCommandEvent& WXUNUSED(event)) wxString text; wxInt32 var = 0xF1F2F3F4; - text = _T(""); + text = wxEmptyString; text.Printf( _T("Value of wxInt32 is now: %#x.\n\n"), var ); textCtrl.WriteText( text ); - text = _T(""); + text = wxEmptyString; text.Printf( _T("Value of swapped wxInt32 is: %#x.\n\n"), wxINT32_SWAP_ALWAYS( var ) ); textCtrl.WriteText( text ); - text = _T(""); + text = wxEmptyString; text.Printf( _T("Value of wxInt32 swapped on little endian is: %#x.\n\n"), wxINT32_SWAP_ON_LE( var ) ); textCtrl.WriteText( text ); - text = _T(""); + text = wxEmptyString; text.Printf( _T("Value of wxInt32 swapped on big endian is: %#x.\n\n"), wxINT32_SWAP_ON_BE( var ) ); textCtrl.WriteText( text ); } @@ -1024,10 +1025,8 @@ void MyApp::DoVariantDemo(wxCommandEvent& WXUNUSED(event) ) long l = var1; // suppress compile warnings about unused variables - if ( l < v ) - { - ; - } + wxUnusedVar(l); + wxUnusedVar(v); wxStringList stringList; stringList.Add(_T("one")); stringList.Add(_T("two")); stringList.Add(_T("three")); @@ -1051,10 +1050,13 @@ void MyApp::DoVariantDemo(wxCommandEvent& WXUNUSED(event) ) var1 = wxVariant(new wxFont(wxSystemSettings::GetFont(wxSYS_OEM_FIXED_FONT))); textCtrl << _T("var1 = (wxfont)\""); wxFont* font = wxGetVariantCast(var1,wxFont); - if (font) { - textCtrl << font->GetNativeFontInfoDesc() << _T("\"\n"); - } else { - textCtrl << _T("(null)\"\n"); + if (font) + { + textCtrl << font->GetNativeFontInfoDesc() << _T("\"\n"); + } + else + { + textCtrl << _T("(null)\"\n"); } } @@ -1065,21 +1067,21 @@ END_EVENT_TABLE() // My frame constructor MyFrame::MyFrame(wxFrame *parent, const wxString& title, - const wxPoint& pos, const wxSize& size): - wxFrame(parent, -1, title, pos, size) + const wxPoint& pos, const wxSize& size) + : wxFrame(parent, wxID_ANY, title, pos, size) {} void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event) ) { - Close(TRUE); + Close(true); } void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) ) { - wxMessageDialog dialog(this, _T("Tests various wxWindows types"), - _T("About Types"), wxYES_NO|wxCANCEL); + wxMessageDialog dialog(this, _T("Tests various wxWindows types"), + _T("About Types"), wxYES_NO|wxCANCEL); - dialog.ShowModal(); + dialog.ShowModal(); } diff --git a/samples/widgets/button.cpp b/samples/widgets/button.cpp index d4c000977d..2f1b3c721a 100644 --- a/samples/widgets/button.cpp +++ b/samples/widgets/button.cpp @@ -127,8 +127,8 @@ BEGIN_EVENT_TABLE(ButtonWidgetsPage, WidgetsPage) EVT_BUTTON(ButtonPage_Reset, ButtonWidgetsPage::OnButtonReset) EVT_BUTTON(ButtonPage_ChangeLabel, ButtonWidgetsPage::OnButtonChangeLabel) - EVT_CHECKBOX(-1, ButtonWidgetsPage::OnCheckOrRadioBox) - EVT_RADIOBOX(-1, ButtonWidgetsPage::OnCheckOrRadioBox) + EVT_CHECKBOX(wxID_ANY, ButtonWidgetsPage::OnCheckOrRadioBox) + EVT_RADIOBOX(wxID_ANY, ButtonWidgetsPage::OnCheckOrRadioBox) END_EVENT_TABLE() // ============================================================================ @@ -159,7 +159,7 @@ ButtonWidgetsPage::ButtonWidgetsPage(wxNotebook *notebook, wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane - wxStaticBox *box = new wxStaticBox(this, -1, _T("&Set style")); + wxStaticBox *box = new wxStaticBox(this, wxID_ANY, _T("&Set style")); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); @@ -189,10 +189,10 @@ ButtonWidgetsPage::ButtonWidgetsPage(wxNotebook *notebook, _T("bottom"), }; - m_radioHAlign = new wxRadioBox(this, -1, _T("&Horz alignment"), + m_radioHAlign = new wxRadioBox(this, wxID_ANY, _T("&Horz alignment"), wxDefaultPosition, wxDefaultSize, WXSIZEOF(halign), halign); - m_radioVAlign = new wxRadioBox(this, -1, _T("&Vert alignment"), + m_radioVAlign = new wxRadioBox(this, wxID_ANY, _T("&Vert alignment"), wxDefaultPosition, wxDefaultSize, WXSIZEOF(valign), valign); @@ -205,12 +205,12 @@ ButtonWidgetsPage::ButtonWidgetsPage(wxNotebook *notebook, sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // middle pane - wxStaticBox *box2 = new wxStaticBox(this, -1, _T("&Operations")); + wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, _T("&Operations")); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxSizer *sizerRow = CreateSizerWithTextAndButton(ButtonPage_ChangeLabel, _T("Change label"), - -1, + wxID_ANY, &m_textLabel); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); @@ -232,7 +232,6 @@ ButtonWidgetsPage::ButtonWidgetsPage(wxNotebook *notebook, // final initializations Reset(); - SetAutoLayout(TRUE); SetSizer(sizerTop); sizerTop->Fit(this); @@ -248,9 +247,9 @@ ButtonWidgetsPage::~ButtonWidgetsPage() void ButtonWidgetsPage::Reset() { - m_chkFit->SetValue(TRUE); - m_chkImage->SetValue(FALSE); - m_chkDefault->SetValue(FALSE); + m_chkFit->SetValue(true); + m_chkImage->SetValue(false); + m_chkDefault->SetValue(false); m_radioHAlign->SetSelection(ButtonHAlign_Centre); m_radioVAlign->SetSelection(ButtonVAlign_Centre); diff --git a/samples/widgets/combobox.cpp b/samples/widgets/combobox.cpp index 4fe53e9572..09547692bd 100644 --- a/samples/widgets/combobox.cpp +++ b/samples/widgets/combobox.cpp @@ -178,8 +178,8 @@ BEGIN_EVENT_TABLE(ComboboxWidgetsPage, WidgetsPage) EVT_TEXT(ComboPage_Combo, ComboboxWidgetsPage::OnComboText) EVT_TEXT_ENTER(ComboPage_Combo, ComboboxWidgetsPage::OnComboText) - EVT_CHECKBOX(-1, ComboboxWidgetsPage::OnCheckOrRadioBox) - EVT_RADIOBOX(-1, ComboboxWidgetsPage::OnCheckOrRadioBox) + EVT_CHECKBOX(wxID_ANY, ComboboxWidgetsPage::OnCheckOrRadioBox) + EVT_RADIOBOX(wxID_ANY, ComboboxWidgetsPage::OnCheckOrRadioBox) END_EVENT_TABLE() // ============================================================================ @@ -210,7 +210,7 @@ ComboboxWidgetsPage::ComboboxWidgetsPage(wxNotebook *notebook, wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane - wxStaticBox *box = new wxStaticBox(this, -1, _T("&Set style")); + wxStaticBox *box = new wxStaticBox(this, wxID_ANY, _T("&Set style")); // should be in sync with ComboKind_XXX values static const wxString kinds[] = @@ -220,7 +220,7 @@ ComboboxWidgetsPage::ComboboxWidgetsPage(wxNotebook *notebook, _T("drop down"), }; - m_radioKind = new wxRadioBox(this, -1, _T("Combobox &kind:"), + m_radioKind = new wxRadioBox(this, wxID_ANY, _T("Combobox &kind:"), wxDefaultPosition, wxDefaultSize, WXSIZEOF(kinds), kinds, 1, wxRA_SPECIFY_COLS); @@ -237,7 +237,8 @@ ComboboxWidgetsPage::ComboboxWidgetsPage(wxNotebook *notebook, sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // middle pane - wxStaticBox *box2 = new wxStaticBox(this, -1, _T("&Change combobox contents")); + wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, + _T("&Change combobox contents")); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxSizer *sizerRow; @@ -246,7 +247,7 @@ ComboboxWidgetsPage::ComboboxWidgetsPage(wxNotebook *notebook, sizerRow = CreateSizerWithTextAndLabel(_T("Current selection"), ComboPage_CurText, &text); - text->SetEditable(FALSE); + text->SetEditable(false); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); @@ -288,7 +289,7 @@ ComboboxWidgetsPage::ComboboxWidgetsPage(wxNotebook *notebook, // right pane wxSizer *sizerRight = new wxBoxSizer(wxVERTICAL); - m_combobox = new wxComboBox(this, ComboPage_Combo, _T(""), + m_combobox = new wxComboBox(this, ComboPage_Combo, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0); @@ -304,7 +305,6 @@ ComboboxWidgetsPage::ComboboxWidgetsPage(wxNotebook *notebook, // final initializations Reset(); - SetAutoLayout(TRUE); SetSizer(sizerTop); sizerTop->Fit(this); @@ -316,8 +316,8 @@ ComboboxWidgetsPage::ComboboxWidgetsPage(wxNotebook *notebook, void ComboboxWidgetsPage::Reset() { - m_chkSort->SetValue(FALSE); - m_chkReadonly->SetValue(FALSE); + m_chkSort->SetValue(false); + m_chkReadonly->SetValue(false); } void ComboboxWidgetsPage::CreateCombo() @@ -360,7 +360,7 @@ void ComboboxWidgetsPage::CreateCombo() delete m_combobox; } - m_combobox = new wxComboBox(this, ComboPage_Combo, _T(""), + m_combobox = new wxComboBox(this, ComboPage_Combo, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, flags); diff --git a/samples/widgets/gauge.cpp b/samples/widgets/gauge.cpp index 477f8d429b..c1a7f62d67 100644 --- a/samples/widgets/gauge.cpp +++ b/samples/widgets/gauge.cpp @@ -144,8 +144,8 @@ BEGIN_EVENT_TABLE(GaugeWidgetsPage, WidgetsPage) EVT_UPDATE_UI(GaugePage_CurValueText, GaugeWidgetsPage::OnUpdateUICurValueText) - EVT_CHECKBOX(-1, GaugeWidgetsPage::OnCheckOrRadioBox) - EVT_RADIOBOX(-1, GaugeWidgetsPage::OnCheckOrRadioBox) + EVT_CHECKBOX(wxID_ANY, GaugeWidgetsPage::OnCheckOrRadioBox) + EVT_RADIOBOX(wxID_ANY, GaugeWidgetsPage::OnCheckOrRadioBox) EVT_TIMER(GaugePage_Timer, GaugeWidgetsPage::OnProgressTimer) END_EVENT_TABLE() @@ -176,7 +176,7 @@ GaugeWidgetsPage::GaugeWidgetsPage(wxNotebook *notebook, wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane - wxStaticBox *box = new wxStaticBox(this, -1, _T("&Set style")); + wxStaticBox *box = new wxStaticBox(this, wxID_ANY, _T("&Set style")); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); @@ -189,14 +189,15 @@ GaugeWidgetsPage::GaugeWidgetsPage(wxNotebook *notebook, sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // middle pane - wxStaticBox *box2 = new wxStaticBox(this, -1, _T("&Change gauge value")); + wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, + _T("&Change gauge value")); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxTextCtrl *text; wxSizer *sizerRow = CreateSizerWithTextAndLabel(_T("Current value"), GaugePage_CurValueText, &text); - text->SetEditable(FALSE); + text->SetEditable(false); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); @@ -234,7 +235,6 @@ GaugeWidgetsPage::GaugeWidgetsPage(wxNotebook *notebook, // final initializations Reset(); - SetAutoLayout(TRUE); SetSizer(sizerTop); sizerTop->Fit(this); @@ -251,8 +251,8 @@ GaugeWidgetsPage::~GaugeWidgetsPage() void GaugeWidgetsPage::Reset() { - m_chkVert->SetValue(FALSE); - m_chkSmooth->SetValue(FALSE); + m_chkVert->SetValue(false); + m_chkSmooth->SetValue(false); } void GaugeWidgetsPage::CreateGauge() diff --git a/samples/widgets/listbox.cpp b/samples/widgets/listbox.cpp index dc87d04c5b..fa37386532 100644 --- a/samples/widgets/listbox.cpp +++ b/samples/widgets/listbox.cpp @@ -179,8 +179,8 @@ BEGIN_EVENT_TABLE(ListboxWidgetsPage, WidgetsPage) EVT_LISTBOX_DCLICK(ListboxPage_Listbox, ListboxWidgetsPage::OnListboxDClick) EVT_CHECKLISTBOX(ListboxPage_Listbox, ListboxWidgetsPage::OnCheckListbox) - EVT_CHECKBOX(-1, ListboxWidgetsPage::OnCheckOrRadioBox) - EVT_RADIOBOX(-1, ListboxWidgetsPage::OnCheckOrRadioBox) + EVT_CHECKBOX(wxID_ANY, ListboxWidgetsPage::OnCheckOrRadioBox) + EVT_RADIOBOX(wxID_ANY, ListboxWidgetsPage::OnCheckOrRadioBox) END_EVENT_TABLE() // ============================================================================ @@ -215,7 +215,8 @@ ListboxWidgetsPage::ListboxWidgetsPage(wxNotebook *notebook, wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane - wxStaticBox *box = new wxStaticBox(this, -1, _T("&Set listbox parameters")); + wxStaticBox *box = new wxStaticBox(this, wxID_ANY, + _T("&Set listbox parameters")); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); static const wxString modes[] = @@ -225,7 +226,7 @@ ListboxWidgetsPage::ListboxWidgetsPage(wxNotebook *notebook, _T("multiple"), }; - m_radioSelMode = new wxRadioBox(this, -1, _T("Selection &mode:"), + m_radioSelMode = new wxRadioBox(this, wxID_ANY, _T("Selection &mode:"), wxDefaultPosition, wxDefaultSize, WXSIZEOF(modes), modes, 1, wxRA_SPECIFY_COLS); @@ -250,7 +251,8 @@ ListboxWidgetsPage::ListboxWidgetsPage(wxNotebook *notebook, sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // middle pane - wxStaticBox *box2 = new wxStaticBox(this, -1, _T("&Change listbox contents")); + wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, + _T("&Change listbox contents")); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL); @@ -268,14 +270,14 @@ ListboxWidgetsPage::ListboxWidgetsPage(wxNotebook *notebook, sizerRow = new wxBoxSizer(wxHORIZONTAL); btn = new wxButton(this, ListboxPage_Change, _T("C&hange current")); - m_textChange = new wxTextCtrl(this, ListboxPage_ChangeText, _T("")); + m_textChange = new wxTextCtrl(this, ListboxPage_ChangeText, wxEmptyString); sizerRow->Add(btn, 0, wxRIGHT, 5); sizerRow->Add(m_textChange, 1, wxLEFT, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerRow = new wxBoxSizer(wxHORIZONTAL); btn = new wxButton(this, ListboxPage_Delete, _T("&Delete this item")); - m_textDelete = new wxTextCtrl(this, ListboxPage_DeleteText, _T("")); + m_textDelete = new wxTextCtrl(this, ListboxPage_DeleteText, wxEmptyString); sizerRow->Add(btn, 0, wxRIGHT, 5); sizerRow->Add(m_textDelete, 1, wxLEFT, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); @@ -304,7 +306,6 @@ ListboxWidgetsPage::ListboxWidgetsPage(wxNotebook *notebook, // final initializations Reset(); - SetAutoLayout(TRUE); SetSizer(sizerTop); sizerTop->Fit(this); @@ -317,10 +318,10 @@ ListboxWidgetsPage::ListboxWidgetsPage(wxNotebook *notebook, void ListboxWidgetsPage::Reset() { m_radioSelMode->SetSelection(LboxSel_Single); - m_chkSort->SetValue(FALSE); - m_chkCheck->SetValue(FALSE); - m_chkHScroll->SetValue(TRUE); - m_chkVScroll->SetValue(FALSE); + m_chkSort->SetValue(false); + m_chkCheck->SetValue(false); + m_chkHScroll->SetValue(true); + m_chkVScroll->SetValue(false); } void ListboxWidgetsPage::CreateLbox() diff --git a/samples/widgets/notebook.cpp b/samples/widgets/notebook.cpp index 967cb19b5b..5c6d1bac04 100644 --- a/samples/widgets/notebook.cpp +++ b/samples/widgets/notebook.cpp @@ -181,11 +181,11 @@ BEGIN_EVENT_TABLE(NotebookWidgetsPage, WidgetsPage) EVT_UPDATE_UI(NotebookPage_InsertPage, NotebookWidgetsPage::OnUpdateUIInsertButton) EVT_UPDATE_UI(NotebookPage_RemovePage, NotebookWidgetsPage::OnUpdateUIRemoveButton) - EVT_NOTEBOOK_PAGE_CHANGING(-1, NotebookWidgetsPage::OnPageChanging) - EVT_NOTEBOOK_PAGE_CHANGED(-1, NotebookWidgetsPage::OnPageChanged) + EVT_NOTEBOOK_PAGE_CHANGING(wxID_ANY, NotebookWidgetsPage::OnPageChanging) + EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, NotebookWidgetsPage::OnPageChanged) - EVT_CHECKBOX(-1, NotebookWidgetsPage::OnCheckOrRadioBox) - EVT_RADIOBOX(-1, NotebookWidgetsPage::OnCheckOrRadioBox) + EVT_CHECKBOX(wxID_ANY, NotebookWidgetsPage::OnCheckOrRadioBox) + EVT_RADIOBOX(wxID_ANY, NotebookWidgetsPage::OnCheckOrRadioBox) END_EVENT_TABLE() // ============================================================================ @@ -210,7 +210,7 @@ NotebookWidgetsPage::NotebookWidgetsPage(wxNotebook *notebook, wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane - wxStaticBox *box = new wxStaticBox(this, -1, _T("&Set style")); + wxStaticBox *box = new wxStaticBox(this, wxID_ANY, _T("&Set style")); // must be in sync with Orient enum wxString orientations[] = @@ -224,8 +224,8 @@ NotebookWidgetsPage::NotebookWidgetsPage(wxNotebook *notebook, wxASSERT_MSG( WXSIZEOF(orientations) == Orient_Max, _T("forgot to update something") ); - m_chkImages = new wxCheckBox(this, -1, _T("Show &images")); - m_radioOrient = new wxRadioBox(this, -1, _T("&Tab orientation"), + m_chkImages = new wxCheckBox(this, wxID_ANY, _T("Show &images")); + m_radioOrient = new wxRadioBox(this, wxID_ANY, _T("&Tab orientation"), wxDefaultPosition, wxDefaultSize, WXSIZEOF(orientations), orientations, 1, wxRA_SPECIFY_COLS); @@ -240,20 +240,20 @@ NotebookWidgetsPage::NotebookWidgetsPage(wxNotebook *notebook, sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // middle pane - wxStaticBox *box2 = new wxStaticBox(this, -1, _T("&Contents")); + wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, _T("&Contents")); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxTextCtrl *text; wxSizer *sizerRow = CreateSizerWithTextAndLabel(_T("Number of pages: "), NotebookPage_NumPagesText, &text); - text->SetEditable(FALSE); + text->SetEditable(false); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndLabel(_T("Current selection: "), NotebookPage_CurSelectText, &text); - text->SetEditable(FALSE); + text->SetEditable(false); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndButton(NotebookPage_SelectPage, @@ -296,7 +296,6 @@ NotebookWidgetsPage::NotebookWidgetsPage(wxNotebook *notebook, Reset(); CreateImageList(); - SetAutoLayout(TRUE); SetSizer(sizerTop); sizerTop->Fit(this); @@ -313,7 +312,7 @@ NotebookWidgetsPage::~NotebookWidgetsPage() void NotebookWidgetsPage::Reset() { - m_chkImages->SetValue(TRUE); + m_chkImages->SetValue(true); m_radioOrient->SetSelection(Orient_Top); } @@ -393,7 +392,7 @@ void NotebookWidgetsPage::CreateNotebook() { m_notebook->AddPage(CreateNewPage(), notebook->GetPageText(n), - FALSE, + false, notebook->GetPageImage(n)); } @@ -440,7 +439,7 @@ int NotebookWidgetsPage::GetIconIndex() const wxWindow *NotebookWidgetsPage::CreateNewPage() { - return new wxTextCtrl(m_notebook, -1, _T("I'm a notebook page")); + return new wxTextCtrl(m_notebook, wxID_ANY, _T("I'm a notebook page")); } // ---------------------------------------------------------------------------- @@ -469,7 +468,7 @@ void NotebookWidgetsPage::OnButtonSelectPage(wxCommandEvent& WXUNUSED(event)) void NotebookWidgetsPage::OnButtonAddPage(wxCommandEvent& WXUNUSED(event)) { - m_notebook->AddPage(CreateNewPage(), _T("Added page"), FALSE, + m_notebook->AddPage(CreateNewPage(), _T("Added page"), false, GetIconIndex()); } @@ -478,7 +477,7 @@ void NotebookWidgetsPage::OnButtonInsertPage(wxCommandEvent& WXUNUSED(event)) int pos = GetTextValue(m_textInsert); wxCHECK_RET( IsValidValue(pos), _T("button should be disabled") ); - m_notebook->InsertPage(pos, CreateNewPage(), _T("Inserted page"), FALSE, + m_notebook->InsertPage(pos, CreateNewPage(), _T("Inserted page"), false, GetIconIndex()); } diff --git a/samples/widgets/radiobox.cpp b/samples/widgets/radiobox.cpp index 3a23989e52..612c3fe515 100644 --- a/samples/widgets/radiobox.cpp +++ b/samples/widgets/radiobox.cpp @@ -142,8 +142,8 @@ BEGIN_EVENT_TABLE(RadioWidgetsPage, WidgetsPage) EVT_RADIOBOX(RadioPage_Radio, RadioWidgetsPage::OnRadioBox) - EVT_CHECKBOX(-1, RadioWidgetsPage::OnCheckOrRadioBox) - EVT_RADIOBOX(-1, RadioWidgetsPage::OnCheckOrRadioBox) + EVT_CHECKBOX(wxID_ANY, RadioWidgetsPage::OnCheckOrRadioBox) + EVT_RADIOBOX(wxID_ANY, RadioWidgetsPage::OnCheckOrRadioBox) END_EVENT_TABLE() // ============================================================================ @@ -172,7 +172,7 @@ RadioWidgetsPage::RadioWidgetsPage(wxNotebook *notebook, wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane - wxStaticBox *box = new wxStaticBox(this, -1, _T("&Set style")); + wxStaticBox *box = new wxStaticBox(this, wxID_ANY, _T("&Set style")); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); @@ -185,7 +185,7 @@ RadioWidgetsPage::RadioWidgetsPage(wxNotebook *notebook, _T("top to bottom") }; - m_radioDir = new wxRadioBox(this, -1, _T("Numbering:"), + m_radioDir = new wxRadioBox(this, wxID_ANY, _T("Numbering:"), wxDefaultPosition, wxDefaultSize, WXSIZEOF(layoutDir), layoutDir, 1, wxRA_SPECIFY_COLS); @@ -198,12 +198,12 @@ RadioWidgetsPage::RadioWidgetsPage(wxNotebook *notebook, wxSizer *sizerRow; sizerRow = CreateSizerWithTextAndLabel(_T("&Major dimension:"), - -1, + wxID_ANY, &m_textMajorDim); sizerLeft->Add(sizerRow, 0, wxGROW | wxALL, 5); sizerRow = CreateSizerWithTextAndLabel(_T("&Number of buttons:"), - -1, + wxID_ANY, &m_textNumBtns); sizerLeft->Add(sizerRow, 0, wxGROW | wxALL, 5); @@ -217,29 +217,29 @@ RadioWidgetsPage::RadioWidgetsPage(wxNotebook *notebook, sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // middle pane - wxStaticBox *box2 = new wxStaticBox(this, -1, _T("&Change parameters")); + wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, _T("&Change parameters")); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); sizerRow = CreateSizerWithTextAndLabel(_T("Current selection:"), - -1, + wxID_ANY, &m_textCurSel); sizerMiddle->Add(sizerRow, 0, wxGROW | wxALL, 5); sizerRow = CreateSizerWithTextAndButton(RadioPage_Selection, _T("&Change selection:"), - -1, + wxID_ANY, &m_textSel); sizerMiddle->Add(sizerRow, 0, wxGROW | wxALL, 5); sizerRow = CreateSizerWithTextAndButton(RadioPage_Label, _T("&Label for box:"), - -1, + wxID_ANY, &m_textLabel); sizerMiddle->Add(sizerRow, 0, wxGROW | wxALL, 5); sizerRow = CreateSizerWithTextAndButton(RadioPage_LabelBtn, _T("&Label for buttons:"), - -1, + wxID_ANY, &m_textLabelBtns); sizerMiddle->Add(sizerRow, 0, wxGROW | wxALL, 5); @@ -257,7 +257,6 @@ RadioWidgetsPage::RadioWidgetsPage(wxNotebook *notebook, sizerTop->Add(sizerRight, 0, wxGROW | (wxALL & ~wxRIGHT), 10); // final initializations - SetAutoLayout(TRUE); SetSizer(sizerTop); sizerTop->Fit(this); @@ -278,7 +277,7 @@ void RadioWidgetsPage::Reset() m_textLabel->SetValue(_T("I'm a radiobox")); m_textLabelBtns->SetValue(_T("item")); - m_chkVert->SetValue(FALSE); + m_chkVert->SetValue(false); m_radioDir->SetSelection(RadioDir_Default); } diff --git a/samples/widgets/slider.cpp b/samples/widgets/slider.cpp index 45f1bed255..b1ee9b4005 100644 --- a/samples/widgets/slider.cpp +++ b/samples/widgets/slider.cpp @@ -185,8 +185,8 @@ BEGIN_EVENT_TABLE(SliderWidgetsPage, WidgetsPage) EVT_COMMAND_SCROLL(SliderPage_Slider, SliderWidgetsPage::OnSlider) - EVT_CHECKBOX(-1, SliderWidgetsPage::OnCheckOrRadioBox) - EVT_RADIOBOX(-1, SliderWidgetsPage::OnCheckOrRadioBox) + EVT_CHECKBOX(wxID_ANY, SliderWidgetsPage::OnCheckOrRadioBox) + EVT_RADIOBOX(wxID_ANY, SliderWidgetsPage::OnCheckOrRadioBox) END_EVENT_TABLE() // ============================================================================ @@ -218,7 +218,7 @@ SliderWidgetsPage::SliderWidgetsPage(wxNotebook *notebook, wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane - wxStaticBox *box = new wxStaticBox(this, -1, _T("&Set style")); + wxStaticBox *box = new wxStaticBox(this, wxID_ANY, _T("&Set style")); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); m_chkVert = CreateCheckBoxAndAddToSizer(sizerLeft, _T("&Vertical")); @@ -248,14 +248,14 @@ SliderWidgetsPage::SliderWidgetsPage(wxNotebook *notebook, sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // middle pane - wxStaticBox *box2 = new wxStaticBox(this, -1, _T("&Change slider value")); + wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, _T("&Change slider value")); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxTextCtrl *text; wxSizer *sizerRow = CreateSizerWithTextAndLabel(_T("Current value"), SliderPage_CurValueText, &text); - text->SetEditable(FALSE); + text->SetEditable(false); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); @@ -270,7 +270,7 @@ SliderWidgetsPage::SliderWidgetsPage(wxNotebook *notebook, SliderPage_MinText, &m_textMin); - m_textMax = new wxTextCtrl(this, SliderPage_MaxText, _T("")); + m_textMax = new wxTextCtrl(this, SliderPage_MaxText, wxEmptyString); sizerRow->Add(m_textMax, 1, wxLEFT | wxALIGN_CENTRE_VERTICAL, 5); m_textMin->SetValue( wxString::Format(_T("%d"), m_min) ); @@ -308,7 +308,6 @@ SliderWidgetsPage::SliderWidgetsPage(wxNotebook *notebook, sizerTop->Add(sizerRight, 1, wxGROW | (wxALL & ~wxRIGHT), 10); // final initializations - SetAutoLayout(TRUE); SetSizer(sizerTop); sizerTop->Fit(this); @@ -324,10 +323,10 @@ SliderWidgetsPage::~SliderWidgetsPage() void SliderWidgetsPage::Reset() { - m_chkVert->SetValue(FALSE); - m_chkTicks->SetValue(TRUE); - m_chkLabels->SetValue(TRUE); - m_chkBothSides->SetValue(FALSE); + m_chkVert->SetValue(false); + m_chkTicks->SetValue(true); + m_chkLabels->SetValue(true); + m_chkBothSides->SetValue(false); m_radioSides->SetSelection(StaticSides_Top); } @@ -556,7 +555,7 @@ void SliderWidgetsPage::OnUpdateUIBothSides(wxUpdateUIEvent& event) #if defined(__WIN95__) || defined(__WXUNIVERSAL__) event.Enable( m_chkTicks->GetValue() ); #else - event.Enable( FALSE ); + event.Enable( false ); #endif // defined(__WIN95__) || defined(__WXUNIVERSAL__) } diff --git a/samples/widgets/spinbtn.cpp b/samples/widgets/spinbtn.cpp index 1082559a93..0b886d7c88 100644 --- a/samples/widgets/spinbtn.cpp +++ b/samples/widgets/spinbtn.cpp @@ -152,8 +152,8 @@ BEGIN_EVENT_TABLE(SpinBtnWidgetsPage, WidgetsPage) EVT_SPIN_DOWN(SpinBtnPage_SpinBtn, SpinBtnWidgetsPage::OnSpinBtnDown) EVT_SPINCTRL(SpinBtnPage_SpinCtrl, SpinBtnWidgetsPage::OnSpinCtrl) - EVT_CHECKBOX(-1, SpinBtnWidgetsPage::OnCheckOrRadioBox) - EVT_RADIOBOX(-1, SpinBtnWidgetsPage::OnCheckOrRadioBox) + EVT_CHECKBOX(wxID_ANY, SpinBtnWidgetsPage::OnCheckOrRadioBox) + EVT_RADIOBOX(wxID_ANY, SpinBtnWidgetsPage::OnCheckOrRadioBox) END_EVENT_TABLE() // ============================================================================ @@ -188,7 +188,7 @@ SpinBtnWidgetsPage::SpinBtnWidgetsPage(wxNotebook *notebook, wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane - wxStaticBox *box = new wxStaticBox(this, -1, _T("&Set style")); + wxStaticBox *box = new wxStaticBox(this, wxID_ANY, _T("&Set style")); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); m_chkVert = CreateCheckBoxAndAddToSizer(sizerLeft, _T("&Vertical")); @@ -200,14 +200,16 @@ SpinBtnWidgetsPage::SpinBtnWidgetsPage(wxNotebook *notebook, sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // middle pane - wxStaticBox *box2 = new wxStaticBox(this, -1, _T("&Change spinbtn value")); + wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, + _T("&Change spinbtn value")); + wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxTextCtrl *text; wxSizer *sizerRow = CreateSizerWithTextAndLabel(_T("Current value"), SpinBtnPage_CurValueText, &text); - text->SetEditable(FALSE); + text->SetEditable(false); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); @@ -222,7 +224,7 @@ SpinBtnWidgetsPage::SpinBtnWidgetsPage(wxNotebook *notebook, SpinBtnPage_MinText, &m_textMin); - m_textMax = new wxTextCtrl(this, SpinBtnPage_MaxText, _T("")); + m_textMax = new wxTextCtrl(this, SpinBtnPage_MaxText, wxEmptyString); sizerRow->Add(m_textMax, 1, wxLEFT | wxALIGN_CENTRE_VERTICAL, 5); m_textMin->SetValue( wxString::Format(_T("%d"), m_min) ); @@ -244,7 +246,6 @@ SpinBtnWidgetsPage::SpinBtnWidgetsPage(wxNotebook *notebook, sizerTop->Add(sizerRight, 1, wxGROW | (wxALL & ~wxRIGHT), 10); // final initializations - SetAutoLayout(TRUE); SetSizer(sizerTop); sizerTop->Fit(this); @@ -260,8 +261,8 @@ SpinBtnWidgetsPage::~SpinBtnWidgetsPage() void SpinBtnWidgetsPage::Reset() { - m_chkVert->SetValue(TRUE); - m_chkWrap->SetValue(FALSE); + m_chkVert->SetValue(true); + m_chkWrap->SetValue(false); } void SpinBtnWidgetsPage::CreateSpin() diff --git a/samples/widgets/static.cpp b/samples/widgets/static.cpp index 531041b2dc..b841ed19f8 100644 --- a/samples/widgets/static.cpp +++ b/samples/widgets/static.cpp @@ -191,8 +191,8 @@ BEGIN_EVENT_TABLE(StaticWidgetsPage, WidgetsPage) EVT_BUTTON(StaticPage_LabelText, StaticWidgetsPage::OnButtonLabelText) EVT_BUTTON(StaticPage_BoxText, StaticWidgetsPage::OnButtonBoxText) - EVT_CHECKBOX(-1, StaticWidgetsPage::OnCheckOrRadioBox) - EVT_RADIOBOX(-1, StaticWidgetsPage::OnCheckOrRadioBox) + EVT_CHECKBOX(wxID_ANY, StaticWidgetsPage::OnCheckOrRadioBox) + EVT_RADIOBOX(wxID_ANY, StaticWidgetsPage::OnCheckOrRadioBox) END_EVENT_TABLE() // ============================================================================ @@ -224,7 +224,7 @@ StaticWidgetsPage::StaticWidgetsPage(wxNotebook *notebook, wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane - wxStaticBox *box = new wxStaticBox(this, -1, _T("&Set style")); + wxStaticBox *box = new wxStaticBox(this, wxID_ANY, _T("&Set style")); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); @@ -246,10 +246,10 @@ StaticWidgetsPage::StaticWidgetsPage(wxNotebook *notebook, _T("bottom"), }; - m_radioHAlign = new wxRadioBox(this, -1, _T("&Horz alignment"), + m_radioHAlign = new wxRadioBox(this, wxID_ANY, _T("&Horz alignment"), wxDefaultPosition, wxDefaultSize, WXSIZEOF(halign), halign); - m_radioVAlign = new wxRadioBox(this, -1, _T("&Vert alignment"), + m_radioVAlign = new wxRadioBox(this, wxID_ANY, _T("&Vert alignment"), wxDefaultPosition, wxDefaultSize, WXSIZEOF(valign), valign); @@ -260,19 +260,19 @@ StaticWidgetsPage::StaticWidgetsPage(wxNotebook *notebook, sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // middle pane - wxStaticBox *box2 = new wxStaticBox(this, -1, _T("&Change labels")); + wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, _T("&Change labels")); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxSizer *sizerRow; sizerRow = CreateSizerWithTextAndButton(StaticPage_BoxText, _T("Change &box label"), - -1, &m_textBox); + wxID_ANY, &m_textBox); sizerMiddle->Add(sizerRow, 0, wxGROW | wxALL, 5); sizerRow = CreateSizerWithTextAndButton(StaticPage_LabelText, _T("Change &text label"), - -1, &m_textLabel); + wxID_ANY, &m_textLabel); sizerMiddle->Add(sizerRow, 0, wxGROW | wxALL, 5); m_textBox->SetValue(_T("This is a box")); @@ -293,7 +293,6 @@ StaticWidgetsPage::StaticWidgetsPage(wxNotebook *notebook, // final initializations Reset(); - SetAutoLayout(TRUE); SetSizer(sizerTop); sizerTop->Fit(this); @@ -309,8 +308,8 @@ StaticWidgetsPage::~StaticWidgetsPage() void StaticWidgetsPage::Reset() { - m_chkVert->SetValue(FALSE); - m_chkAutoResize->SetValue(TRUE); + m_chkVert->SetValue(false); + m_chkAutoResize->SetValue(true); m_radioHAlign->SetSelection(StaticHAlign_Left); m_radioVAlign->SetSelection(StaticVAlign_Top); @@ -379,17 +378,17 @@ void StaticWidgetsPage::CreateStatic() flagsText |= align; flagsBox |= align; - m_staticBox = new MyStaticBox(this, -1, m_textBox->GetValue(), + m_staticBox = new MyStaticBox(this, wxID_ANY, m_textBox->GetValue(), wxDefaultPosition, wxDefaultSize, flagsBox); m_sizerStatBox = new wxStaticBoxSizer(m_staticBox, isVert ? wxHORIZONTAL : wxVERTICAL); - m_statText = new MyStaticText(this, -1, m_textLabel->GetValue(), + m_statText = new MyStaticText(this, wxID_ANY, m_textLabel->GetValue(), wxDefaultPosition, wxDefaultSize, flagsText); - m_statLine = new wxStaticLine(this, -1, + m_statLine = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, isVert ? wxLI_VERTICAL : wxLI_HORIZONTAL); diff --git a/samples/widgets/textctrl.cpp b/samples/widgets/textctrl.cpp index e744691027..f20eaf5cb7 100644 --- a/samples/widgets/textctrl.cpp +++ b/samples/widgets/textctrl.cpp @@ -96,9 +96,9 @@ static const struct ControlValues } DEFAULTS = { TextLines_Multi, // multiline - FALSE, // not password - TRUE, // do wrap lines - FALSE, // not readonly + false, // not password + true, // do wrap lines + false, // not readonly #ifdef __WXMSW__ TextKind_Plain // plain EDIT control #endif // __WXMSW__ @@ -233,8 +233,8 @@ BEGIN_EVENT_TABLE(TextWidgetsPage, WidgetsPage) EVT_TEXT(TextPage_Textctrl, TextWidgetsPage::OnText) EVT_TEXT_ENTER(TextPage_Textctrl, TextWidgetsPage::OnTextEnter) - EVT_CHECKBOX(-1, TextWidgetsPage::OnCheckOrRadioBox) - EVT_RADIOBOX(-1, TextWidgetsPage::OnCheckOrRadioBox) + EVT_CHECKBOX(wxID_ANY, TextWidgetsPage::OnCheckOrRadioBox) + EVT_RADIOBOX(wxID_ANY, TextWidgetsPage::OnCheckOrRadioBox) END_EVENT_TABLE() // ============================================================================ @@ -286,8 +286,8 @@ TextWidgetsPage::TextWidgetsPage(wxNotebook *notebook, wxImageList *imaglist) _T("multi line"), }; - wxStaticBox *box = new wxStaticBox(this, -1, _T("&Set textctrl parameters")); - m_radioTextLines = new wxRadioBox(this, -1, _T("&Number of lines:"), + wxStaticBox *box = new wxStaticBox(this, wxID_ANY, _T("&Set textctrl parameters")); + m_radioTextLines = new wxRadioBox(this, wxID_ANY, _T("&Number of lines:"), wxDefaultPosition, wxDefaultSize, WXSIZEOF(modes), modes, 1, wxRA_SPECIFY_COLS); @@ -315,7 +315,7 @@ TextWidgetsPage::TextWidgetsPage(wxNotebook *notebook, wxImageList *imaglist) _T("rich edit 2.0"), }; - m_radioKind = new wxRadioBox(this, -1, _T("Control &kind"), + m_radioKind = new wxRadioBox(this, wxID_ANY, _T("Control &kind"), wxDefaultPosition, wxDefaultSize, WXSIZEOF(kinds), kinds, 1, wxRA_SPECIFY_COLS); @@ -329,7 +329,7 @@ TextWidgetsPage::TextWidgetsPage(wxNotebook *notebook, wxImageList *imaglist) sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // middle pane - wxStaticBox *box2 = new wxStaticBox(this, -1, _T("&Change contents:")); + wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, _T("&Change contents:")); wxSizer *sizerMiddleUp = new wxStaticBoxSizer(box2, wxVERTICAL); btn = new wxButton(this, TextPage_Set, _T("&Set text value")); @@ -347,7 +347,7 @@ TextWidgetsPage::TextWidgetsPage(wxNotebook *notebook, wxImageList *imaglist) btn = new wxButton(this, TextPage_Clear, _T("&Clear")); sizerMiddleUp->Add(btn, 0, wxALL | wxGROW, 1); - wxStaticBox *box4 = new wxStaticBox(this, -1, _T("&Info:")); + wxStaticBox *box4 = new wxStaticBox(this, wxID_ANY, _T("&Info:")); wxSizer *sizerMiddleDown = new wxStaticBoxSizer(box4, wxVERTICAL); m_textPosCur = CreateInfoText(); @@ -403,7 +403,7 @@ TextWidgetsPage::TextWidgetsPage(wxNotebook *notebook, wxImageList *imaglist) 0, wxALL, 5 ); - m_textRange = new wxTextCtrl(this, -1, _T(""), + m_textRange = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY); sizerMiddleDown->Add @@ -421,7 +421,7 @@ TextWidgetsPage::TextWidgetsPage(wxNotebook *notebook, wxImageList *imaglist) sizerMiddle->Add(sizerMiddleDown, 1, wxGROW | wxTOP, 5); // right pane - wxStaticBox *box3 = new wxStaticBox(this, -1, _T("&Text:")); + wxStaticBox *box3 = new wxStaticBox(this, wxID_ANY, _T("&Text:")); m_sizerText = new wxStaticBoxSizer(box3, wxHORIZONTAL); Reset(); CreateText(); @@ -433,7 +433,6 @@ TextWidgetsPage::TextWidgetsPage(wxNotebook *notebook, wxImageList *imaglist) sizerTop->Add(sizerMiddle, 0, wxGROW | wxALL, 10); sizerTop->Add(m_sizerText, 1, wxGROW | (wxALL & ~wxRIGHT), 10); - SetAutoLayout(TRUE); SetSizer(sizerTop); sizerTop->Fit(this); @@ -456,7 +455,7 @@ wxTextCtrl *TextWidgetsPage::CreateInfoText() GetTextExtent(_T("9999999"), &s_maxWidth, NULL); } - wxTextCtrl *text = new wxTextCtrl(this, -1, _T(""), + wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(s_maxWidth, -1), wxTE_READONLY); @@ -469,12 +468,12 @@ wxSizer *TextWidgetsPage::CreateTextWithLabelSizer(const wxString& label, wxTextCtrl *text2) { wxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL); - sizerRow->Add(new wxStaticText(this, -1, label), 0, + sizerRow->Add(new wxStaticText(this, wxID_ANY, label), 0, wxALIGN_CENTRE_VERTICAL | wxRIGHT, 5); sizerRow->Add(text, 0, wxALIGN_CENTRE_VERTICAL); if ( text2 ) { - sizerRow->Add(new wxStaticText(this, -1, label2), 0, + sizerRow->Add(new wxStaticText(this, wxID_ANY, label2), 0, wxALIGN_CENTRE_VERTICAL | wxLEFT | wxRIGHT, 5); sizerRow->Add(text2, 0, wxALIGN_CENTRE_VERTICAL); } @@ -510,7 +509,7 @@ void TextWidgetsPage::CreateText() case TextLines_Multi: flags |= wxTE_MULTILINE; - m_chkPassword->SetValue(FALSE); + m_chkPassword->SetValue(false); break; } @@ -747,10 +746,10 @@ void TextWidgetsPage::OnText(wxCommandEvent& WXUNUSED(event)) // small hack to suppress the very first message: by then the logging is // not yet redirected and so initial setting of the text value results in // an annoying message box - static bool s_firstTime = TRUE; + static bool s_firstTime = true; if ( s_firstTime ) { - s_firstTime = FALSE; + s_firstTime = false; return; } diff --git a/samples/widgets/widgets.cpp b/samples/widgets/widgets.cpp index 3be3895905..40d24365aa 100644 --- a/samples/widgets/widgets.cpp +++ b/samples/widgets/widgets.cpp @@ -192,7 +192,7 @@ END_EVENT_TABLE() bool WidgetsApp::OnInit() { if ( !wxApp::OnInit() ) - return FALSE; + return false; // the reason for having these ifdef's is that I often run two copies of // this sample side by side and it is useful to see which one is which @@ -220,7 +220,7 @@ bool WidgetsApp::OnInit() //wxLog::AddTraceMask(_T("scrollbar")); //wxLog::AddTraceMask(_T("focus")); - return TRUE; + return true; } // ---------------------------------------------------------------------------- @@ -228,7 +228,7 @@ bool WidgetsApp::OnInit() // ---------------------------------------------------------------------------- WidgetsFrame::WidgetsFrame(const wxString& title) - : wxFrame(NULL, -1, title, + : wxFrame(NULL, wxID_ANY, title, wxPoint(0, 50), wxDefaultSize, wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE | @@ -242,24 +242,25 @@ WidgetsFrame::WidgetsFrame(const wxString& title) m_imaglist = (wxImageList *)NULL; // create controls - m_panel = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN); + m_panel = new wxPanel(this, wxID_ANY, + wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN); wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL); // we have 2 panes: notebook which pages demonstrating the controls in the // upper one and the log window with some buttons in the lower - m_notebook = new wxNotebook(m_panel, -1, wxDefaultPosition, wxDefaultSize, wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN); + m_notebook = new wxNotebook(m_panel, wxID_ANY, wxDefaultPosition, + wxDefaultSize, wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN); InitNotebook(); wxSizer *sizerUp = new wxNotebookSizer(m_notebook); // the lower one only has the log listbox and a button to clear it - wxSizer *sizerDown = new wxStaticBoxSizer - ( - new wxStaticBox(m_panel, -1, _T("&Log window")), - wxVERTICAL - ); - m_lboxLog = new wxListBox(m_panel, -1); + wxSizer *sizerDown = new wxStaticBoxSizer( + new wxStaticBox( m_panel, wxID_ANY, _T("&Log window") ), + wxVERTICAL); + + m_lboxLog = new wxListBox(m_panel, wxID_ANY); sizerDown->Add(m_lboxLog, 1, wxGROW | wxALL, 5); sizerDown->SetMinSize(100, 150); @@ -276,7 +277,6 @@ WidgetsFrame::WidgetsFrame(const wxString& title) sizerTop->Add(0, 5, 0, wxGROW); // spacer in between sizerTop->Add(sizerDown, 0, wxGROW | (wxALL & ~wxTOP), 10); - m_panel->SetAutoLayout(TRUE); m_panel->SetSizer(sizerTop); sizerTop->Fit(this); @@ -317,7 +317,7 @@ void WidgetsFrame::InitNotebook() m_notebook->AddPage( pages[n], labels[n], - FALSE, // don't select + false, // don't select n // image id ); } @@ -363,7 +363,7 @@ WidgetsPageInfo::WidgetsPageInfo(Constructor ctor, const wxChar *label) // ---------------------------------------------------------------------------- WidgetsPage::WidgetsPage(wxNotebook *notebook) - : wxPanel(notebook, -1, + : wxPanel(notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_FULL_REPAINT_ON_RESIZE | wxCLIP_CHILDREN | @@ -376,7 +376,8 @@ wxSizer *WidgetsPage::CreateSizerWithText(wxControl *control, wxTextCtrl **ppText) { wxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL); - wxTextCtrl *text = new wxTextCtrl(this, id, _T(""), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER); + wxTextCtrl *text = new wxTextCtrl(this, id, wxEmptyString, + wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER); sizerRow->Add(control, 0, wxRIGHT | wxALIGN_CENTRE_VERTICAL, 5); sizerRow->Add(text, 1, wxLEFT | wxALIGN_CENTRE_VERTICAL, 5); @@ -392,7 +393,8 @@ wxSizer *WidgetsPage::CreateSizerWithTextAndLabel(const wxString& label, wxWindowID id, wxTextCtrl **ppText) { - return CreateSizerWithText(new wxStaticText(this, -1, label), id, ppText); + return CreateSizerWithText(new wxStaticText(this, wxID_ANY, label), + id, ppText); } // create a sizer containing a button and a text ctrl diff --git a/samples/widgets/widgets.h b/samples/widgets/widgets.h index 7f36a57134..d05402ecd2 100644 --- a/samples/widgets/widgets.h +++ b/samples/widgets/widgets.h @@ -40,24 +40,24 @@ protected: // (pointer to which will be saved in the provided variable if not NULL) // with the specified id wxSizer *CreateSizerWithText(wxControl *control, - wxWindowID id = -1, + wxWindowID id = wxID_ANY, wxTextCtrl **ppText = NULL); // create a sizer containing a label and a text ctrl wxSizer *CreateSizerWithTextAndLabel(const wxString& label, - wxWindowID id = -1, + wxWindowID id = wxID_ANY, wxTextCtrl **ppText = NULL); // create a sizer containing a button and a text ctrl wxSizer *CreateSizerWithTextAndButton(wxWindowID idBtn, const wxString& labelBtn, - wxWindowID id = -1, + wxWindowID id = wxID_ANY, wxTextCtrl **ppText = NULL); // create a checkbox and add it to the sizer wxCheckBox *CreateCheckBoxAndAddToSizer(wxSizer *sizer, const wxString& label, - wxWindowID id = -1); + wxWindowID id = wxID_ANY); public: // the head of the linked list containinginfo about all pages -- 2.47.2