From 5014bb3a2f07747a69c486ff3e3732a8cabd37fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?W=C5=82odzimierz=20Skiba?= Date: Thu, 27 May 2004 17:50:54 +0000 Subject: [PATCH] -1->wxID_ANY, TRUE->true, FALSE->false, wxDefaultPosition & wxDefaultSize replacements git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27472 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/access/accesstest.cpp | 36 +++++++++++++++++------------------ samples/artprov/artbrows.cpp | 16 ++++++++-------- samples/artprov/arttest.cpp | 10 +++++----- samples/calendar/calendar.cpp | 4 ++-- samples/caret/caret.cpp | 14 +++++++------- samples/config/conftest.cpp | 14 +++++++------- samples/controls/controls.cpp | 23 +++++++++++----------- 7 files changed, 58 insertions(+), 59 deletions(-) diff --git a/samples/access/accesstest.cpp b/samples/access/accesstest.cpp index 22dfabad93..4daa8672ac 100644 --- a/samples/access/accesstest.cpp +++ b/samples/access/accesstest.cpp @@ -177,15 +177,15 @@ bool MyApp::OnInit() // and show it (the frames, unlike simple controls, are not shown when // created initially) - frame->Show(TRUE); + frame->Show(true); // success: wxApp::OnRun() will be called which will enter the main message - // loop and the application will run. If we returned FALSE here, the + // loop and the application will run. If we returned false here, the // application would exit immediately. - return TRUE; + return true; #else wxMessageBox( _T("This sample has to be compiled with wxUSE_ACCESSIBILITY"), _T("Building error"), wxOK); - return FALSE; + return false; #endif // wxUSE_ACCESSIBILITY } @@ -304,7 +304,7 @@ public: // Gets a variant representing the selected children // of this object. // Acceptable values: - // - a null variant (IsNull() returns TRUE) + // - a null variant (IsNull() returns true) // - a list variant (GetType() == wxT("list")) // - an integer representing the selected child element, // or 0 if this object is selected (GetType() == wxT("long")) @@ -319,7 +319,7 @@ public: // frame constructor MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, long style) - : wxFrame(NULL, -1, title, pos, size, style) + : wxFrame(NULL, wxID_ANY, title, pos, size, style) { m_textCtrl = NULL; @@ -356,10 +356,10 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, #endif // wxUSE_STATUSBAR - wxSplitterWindow* splitter = new wxSplitterWindow(this, -1); + wxSplitterWindow* splitter = new wxSplitterWindow(this, wxID_ANY); splitter->SetAccessible(new SplitterWindowAccessible(splitter)); - wxListBox* listBox = new wxListBox(splitter, -1); + wxListBox* listBox = new wxListBox(splitter, wxID_ANY); listBox->Append(wxT("Cabbages")); listBox->Append(wxT("Kings")); listBox->Append(wxT("Sealing wax")); @@ -367,7 +367,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, listBox->CreateAccessible(); listBox->SetHelpText(wxT("This is a sample wxWidgets listbox, with a number of items in it.")); - m_textCtrl = new wxTextCtrl(splitter, -1, wxT(""), wxDefaultPosition, + m_textCtrl = new wxTextCtrl(splitter, wxID_ANY, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE); m_textCtrl->CreateAccessible(); m_textCtrl->SetHelpText(wxT("This is a sample wxWidgets multiline text control.")); @@ -375,7 +375,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, splitter->SplitHorizontally(listBox, m_textCtrl, 150); #if 0 - wxScrolledWindow* scrolledWindow = new wxScrolledWindow(this, -1); + wxScrolledWindow* scrolledWindow = new wxScrolledWindow(this, wxID_ANY); scrolledWindow->SetAccessible(new ScrolledWindowAccessible(scrolledWindow)); #endif } @@ -385,8 +385,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) { - // TRUE is to force the frame to close - Close(TRUE); + // true is to force the frame to close + Close(true); } void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) @@ -498,7 +498,7 @@ void MyFrame::LogObject(int indent, IAccessible* obj) wxString str; str.Printf(wxT("Name = %s; Role = %s"), name.c_str(), role.c_str()); - str.Pad(indent, wxT(' '), FALSE); + str.Pad(indent, wxT(' '), false); Log(str); } @@ -507,7 +507,7 @@ void MyFrame::LogObject(int indent, IAccessible* obj) { wxString str; str.Printf(wxT("There are %d children."), (int) childCount); - str.Pad(indent, wxT(' '), FALSE); + str.Pad(indent, wxT(' '), false); Log(str); Log(wxT("")); } @@ -519,7 +519,7 @@ void MyFrame::LogObject(int indent, IAccessible* obj) wxString str; str.Printf(wxT("%d) Name = %s; Role = %s"), i, name.c_str(), role.c_str()); - str.Pad(indent, wxT(' '), FALSE); + str.Pad(indent, wxT(' '), false); Log(str); VARIANT var; @@ -533,7 +533,7 @@ void MyFrame::LogObject(int indent, IAccessible* obj) { wxString str; str.Printf(wxT("This is a real object.")); - str.Pad(indent+4, wxT(' '), FALSE); + str.Pad(indent+4, wxT(' '), false); Log(str); if (pDisp->QueryInterface(IID_IAccessible, (LPVOID*) & childObject) == S_OK) @@ -547,7 +547,7 @@ void MyFrame::LogObject(int indent, IAccessible* obj) { wxString str; str.Printf(wxT("This is an element.")); - str.Pad(indent+4, wxT(' '), FALSE); + str.Pad(indent+4, wxT(' '), false); Log(str); } // Log(wxT("")); @@ -1100,7 +1100,7 @@ wxAccStatus SplitterWindowAccessible::GetFocus(int* WXUNUSED(childId), wxAccessi // Gets a variant representing the selected children // of this object. // Acceptable values: -// - a null variant (IsNull() returns TRUE) +// - a null variant (IsNull() returns true) // - a list variant (GetType() == wxT("list")) // - an integer representing the selected child element, // or 0 if this object is selected (GetType() == wxT("long")) diff --git a/samples/artprov/artbrows.cpp b/samples/artprov/artbrows.cpp index 8215ad5560..8b90ba5814 100644 --- a/samples/artprov/artbrows.cpp +++ b/samples/artprov/artbrows.cpp @@ -107,35 +107,35 @@ static void FillBitmaps(wxImageList *images, wxListCtrl *list, #include "null.xpm" BEGIN_EVENT_TABLE(wxArtBrowserDialog, wxDialog) - EVT_LIST_ITEM_SELECTED(-1, wxArtBrowserDialog::OnSelectItem) - EVT_CHOICE(-1, wxArtBrowserDialog::OnChooseClient) + EVT_LIST_ITEM_SELECTED(wxID_ANY, wxArtBrowserDialog::OnSelectItem) + EVT_CHOICE(wxID_ANY, wxArtBrowserDialog::OnChooseClient) END_EVENT_TABLE() wxArtBrowserDialog::wxArtBrowserDialog(wxWindow *parent) - : wxDialog(parent, -1, _T("Art resources browser"), + : wxDialog(parent, wxID_ANY, _T("Art resources browser"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) { wxSizer *sizer = new wxBoxSizer(wxVERTICAL); wxSizer *subsizer; - wxChoice *choice = new wxChoice(this, -1); + wxChoice *choice = new wxChoice(this, wxID_ANY); FillClients(choice); subsizer = new wxBoxSizer(wxHORIZONTAL); - subsizer->Add(new wxStaticText(this, -1, _T("Client:")), 0, wxALIGN_CENTER_VERTICAL); + subsizer->Add(new wxStaticText(this, wxID_ANY, _T("Client:")), 0, wxALIGN_CENTER_VERTICAL); subsizer->Add(choice, 1, wxLEFT, 5); sizer->Add(subsizer, 0, wxALL | wxEXPAND, 10); subsizer = new wxBoxSizer(wxHORIZONTAL); - m_list = new wxListCtrl(this, -1, wxDefaultPosition, wxSize(250, 300), + m_list = new wxListCtrl(this, wxID_ANY, wxDefaultPosition, wxSize(250, 300), wxLC_REPORT | wxSUNKEN_BORDER); m_list->InsertColumn(0, _T("wxArtID")); subsizer->Add(m_list, 1, wxEXPAND | wxRIGHT, 10); wxSizer *subsub = new wxBoxSizer(wxVERTICAL); - m_canvas = new wxStaticBitmap(this, -1, wxBitmap(null_xpm)); + m_canvas = new wxStaticBitmap(this, wxID_ANY, wxBitmap(null_xpm)); subsub->Add(m_canvas); subsub->Add(100, 100); subsizer->Add(subsub); @@ -147,7 +147,7 @@ wxArtBrowserDialog::wxArtBrowserDialog(wxWindow *parent) sizer->Add(ok, 0, wxALIGN_RIGHT | wxALL, 10); SetSizer(sizer); - SetAutoLayout(TRUE); + SetAutoLayout(true); sizer->Fit(this); choice->SetSelection(6/*wxART_MESSAGE_BOX*/); diff --git a/samples/artprov/arttest.cpp b/samples/artprov/arttest.cpp index f30d42c691..4c991b0258 100644 --- a/samples/artprov/arttest.cpp +++ b/samples/artprov/arttest.cpp @@ -95,8 +95,8 @@ bool MyApp::OnInit() // create the main application window MyFrame *frame = new MyFrame(_T("wxArtProvider sample"), wxPoint(50, 50), wxSize(450, 340)); - frame->Show(TRUE); - return TRUE; + frame->Show(true); + return true; } // ---------------------------------------------------------------------------- @@ -141,7 +141,7 @@ wxBitmap MyArtProvider::CreateBitmap(const wxArtID& id, // frame constructor MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, long style) - : wxFrame(NULL, -1, title, pos, size, style) + : wxFrame(NULL, wxID_ANY, title, pos, size, style) { SetIcon(wxICON(mondrian)); @@ -175,8 +175,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) { - // TRUE is to force the frame to close - Close(TRUE); + // true is to force the frame to close + Close(true); } void MyFrame::OnLogs(wxCommandEvent& WXUNUSED(event)) diff --git a/samples/calendar/calendar.cpp b/samples/calendar/calendar.cpp index 4d66af136c..8a3cabd8f6 100644 --- a/samples/calendar/calendar.cpp +++ b/samples/calendar/calendar.cpp @@ -205,7 +205,7 @@ bool MyApp::OnInit() frame->Show(true); // success: wxApp::OnRun() will be called which will enter the main message - // loop and the application will run. If we returned FALSE here, the + // loop and the application will run. If we returned false here, the // application would exit immediately. return true; } @@ -279,7 +279,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) { - // TRUE is to force the frame to close + // true is to force the frame to close Close(true); } diff --git a/samples/caret/caret.cpp b/samples/caret/caret.cpp index 5dbfe74c9d..2908746b32 100644 --- a/samples/caret/caret.cpp +++ b/samples/caret/caret.cpp @@ -186,12 +186,12 @@ bool MyApp::OnInit() MyFrame *frame = new MyFrame(_T("Caret wxWidgets sample"), wxPoint(50, 50), wxSize(450, 340)); - frame->Show(TRUE); + frame->Show(true); // success: wxApp::OnRun() will be called which will enter the main message - // loop and the application will run. If we returned FALSE here, the + // loop and the application will run. If we returned false here, the // application would exit immediately. - return TRUE; + return true; } // ---------------------------------------------------------------------------- @@ -200,7 +200,7 @@ bool MyApp::OnInit() // frame constructor MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) - : wxFrame((wxFrame *)NULL, -1, title, pos, size) + : wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size) { // set the frame icon SetIcon(wxICON(mondrian)); @@ -235,8 +235,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) { - // TRUE is to force the frame to close - Close(TRUE); + // true is to force the frame to close + Close(true); } void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) @@ -298,7 +298,7 @@ BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow) END_EVENT_TABLE() MyCanvas::MyCanvas( wxWindow *parent ) - : wxScrolledWindow( parent, -1, + : wxScrolledWindow( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER ) { diff --git a/samples/config/conftest.cpp b/samples/config/conftest.cpp index 3a8f0ae114..40fd36a672 100644 --- a/samples/config/conftest.cpp +++ b/samples/config/conftest.cpp @@ -114,7 +114,7 @@ bool MyApp::OnInit() // create the main program window MyFrame *frame = new MyFrame; - frame->Show(TRUE); + frame->Show(true); SetTopWindow(frame); // use our config object... @@ -126,7 +126,7 @@ bool MyApp::OnInit() wxICON_INFORMATION | wxOK); } - return TRUE; + return true; } int MyApp::OnExit() @@ -145,7 +145,7 @@ int MyApp::OnExit() // main frame ctor MyFrame::MyFrame() - : wxFrame((wxFrame *) NULL, -1, _T("wxConfig Demo")) + : wxFrame((wxFrame *) NULL, wxID_ANY, _T("wxConfig Demo")) { // menu wxMenu *file_menu = new wxMenu; @@ -163,10 +163,10 @@ MyFrame::MyFrame() // child controls wxPanel *panel = new wxPanel(this); - (void)new wxStaticText(panel, -1, _T("These controls remember their values!"), + (void)new wxStaticText(panel, wxID_ANY, _T("These controls remember their values!"), wxPoint(10, 10), wxSize(300, 20)); - m_text = new wxTextCtrl(panel, -1, _T(""), wxPoint(10, 40), wxSize(300, 20)); - m_check = new wxCheckBox(panel, -1, _T("show welcome message box at startup"), + m_text = new wxTextCtrl(panel, wxID_ANY, _T(""), wxPoint(10, 40), wxSize(300, 20)); + m_check = new wxCheckBox(panel, wxID_ANY, _T("show welcome message box at startup"), wxPoint(10, 70), wxSize(300, 20)); // restore the control's values from the config @@ -209,7 +209,7 @@ MyFrame::MyFrame() void MyFrame::OnQuit(wxCommandEvent&) { - Close(TRUE); + Close(true); } void MyFrame::OnAbout(wxCommandEvent&) diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index 54f732373c..886edf79dc 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -658,8 +658,8 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) #if wxUSE_CHOICE panel = new wxPanel(m_notebook); - m_choice = new wxChoice( panel, ID_CHOICE, wxPoint(10,10), wxSize(120,-1), 5, choices ); - m_choiceSorted = new wxChoice( panel, ID_CHOICE_SORTED, wxPoint(10,70), wxSize(120,-1), + m_choice = new wxChoice( panel, ID_CHOICE, wxPoint(10,10), wxSize(120,wxDefaultSize.y), 5, choices ); + m_choiceSorted = new wxChoice( panel, ID_CHOICE_SORTED, wxPoint(10,70), wxSize(120,wxDefaultSize.y), 5, choices, wxCB_SORT ); SetChoiceClientData(wxT("choice"), m_choice); @@ -682,7 +682,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) (void)new wxStaticBox( panel, wxID_ANY, _T("&Box around combobox"), wxPoint(5, 5), wxSize(150, 100)); m_combo = new MyComboBox( panel, ID_COMBO, _T("This"), - wxPoint(20,25), wxSize(120, -1), + wxPoint(20,25), wxSize(120, wxDefaultSize.y), 5, choices, wxCB_READONLY | wxPROCESS_ENTER); m_combo->SetBackgroundColour(*wxBLUE); @@ -732,7 +732,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) m_gaugeVert = new wxGauge( panel, wxID_ANY, 100, wxPoint(195,35), wxSize(30, 90), wxGA_VERTICAL | wxGA_SMOOTH | wxNO_BORDER ); - m_slider = new wxSlider( panel, ID_SLIDER, 0, 0, 200, wxPoint(18,90), wxSize(155,-1), + m_slider = new wxSlider( panel, ID_SLIDER, 0, 0, 200, wxPoint(18,90), wxSize(155,wxDefaultSize.y), wxSL_AUTOTICKS | wxSL_LABELS ); m_slider->SetTickFreq(40, 0); #if wxUSE_TOOLTIPS @@ -748,7 +748,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) (void)new wxStaticText( panel, wxID_ANY, _T("Drag the slider!"), wxPoint(250,30), - wxSize(240, -1) + wxSize(240, wxDefaultSize.y) ); #else (void)new wxStaticText( panel, wxID_ANY, @@ -765,9 +765,9 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) int initialSpinValue = -5; wxString s; s << initialSpinValue; - m_spintext = new wxTextCtrl( panel, wxID_ANY, s, wxPoint(20,160), wxSize(80,-1) ); + m_spintext = new wxTextCtrl( panel, wxID_ANY, s, wxPoint(20,160), wxSize(80,wxDefaultSize.y) ); #if wxUSE_SPINBTN - m_spinbutton = new wxSpinButton( panel, ID_SPIN, wxPoint(103,160), wxSize(80, -1) ); + m_spinbutton = new wxSpinButton( panel, ID_SPIN, wxPoint(103,160), wxSize(80, wxDefaultSize.y) ); m_spinbutton->SetRange(-40,30); m_spinbutton->SetValue(initialSpinValue); @@ -776,7 +776,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) #endif // wxUSE_SPINBTN #if wxUSE_SPINCTRL - m_spinctrl = new wxSpinCtrl( panel, ID_SPINCTRL, _T(""), wxPoint(200, 160), wxSize(80, -1) ); + m_spinctrl = new wxSpinCtrl( panel, ID_SPINCTRL, _T(""), wxPoint(200, 160), wxSize(80, wxDefaultSize.y) ); m_spinctrl->SetRange(10,30); m_spinctrl->SetValue(15); #endif // wxUSE_SPINCTRL @@ -852,8 +852,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL ); wxStaticBoxSizer *csizer = - new wxStaticBoxSizer (new wxStaticBox (panel, wxID_ANY, _T("Show Buttons")), - wxHORIZONTAL ); + new wxStaticBoxSizer (new wxStaticBox (panel, wxID_ANY, _T("Show Buttons")), wxHORIZONTAL ); wxCheckBox *check1, *check2, *check3, *check4, *check14, *checkBig; check1 = new wxCheckBox (panel, ID_SIZER_CHECK1, _T("1")); @@ -1055,9 +1054,9 @@ void MyPanel::OnListBoxButtons( wxCommandEvent &event ) } case ID_LISTBOX_SEL_STR: { - if (m_listbox->FindString(_T("This")) > -1) + if (m_listbox->FindString(_T("This")) != wxNOT_FOUND) m_listbox->SetStringSelection( _T("This") ); - if (m_listboxSorted->FindString(_T("This")) > -1) + if (m_listboxSorted->FindString(_T("This")) != wxNOT_FOUND) m_listboxSorted->SetStringSelection( _T("This") ); m_lbSelectNum->WarpPointer( 40, 14 ); break;