From: Włodzimierz Skiba Date: Fri, 28 May 2004 10:43:39 +0000 (+0000) Subject: -1->wxID_ANY, TRUE->true, FALSE->false replacements X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/07850a495081697fe2825eafb656926c676aa279 -1->wxID_ANY, TRUE->true, FALSE->false replacements git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27479 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/samples/dragimag/dragimag.cpp b/samples/dragimag/dragimag.cpp index 398a53d634..dba6484896 100644 --- a/samples/dragimag/dragimag.cpp +++ b/samples/dragimag/dragimag.cpp @@ -143,7 +143,7 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event) { m_currentlyHighlighted->Draw(dc); } - m_draggedShape->SetShow(TRUE); + m_draggedShape->SetShow(true); m_draggedShape->Draw(dc); m_currentlyHighlighted = (DragShape*) NULL; @@ -169,7 +169,7 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event) delete m_dragImage; // Erase the dragged shape from the canvas - m_draggedShape->SetShow(FALSE); + m_draggedShape->SetShow(false); wxClientDC dc(this); EraseShape(m_draggedShape, dc); DrawShapes(dc); @@ -229,17 +229,17 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event) // We're currently dragging. See if we're over another shape. DragShape* onShape = FindShape(event.GetPosition()); - bool mustUnhighlightOld = FALSE; - bool mustHighlightNew = FALSE; + bool mustUnhighlightOld = false; + bool mustHighlightNew = false; if (m_currentlyHighlighted) { if ((onShape == (DragShape*) NULL) || (m_currentlyHighlighted != onShape)) - mustUnhighlightOld = TRUE; + mustUnhighlightOld = true; } if (onShape && (onShape != m_currentlyHighlighted) && onShape->IsShown()) - mustHighlightNew = TRUE; + mustHighlightNew = true; if (mustUnhighlightOld || mustHighlightNew) m_dragImage->Hide(); @@ -327,12 +327,12 @@ BEGIN_EVENT_TABLE(MyFrame,wxFrame) END_EVENT_TABLE() MyFrame::MyFrame() -: wxFrame( (wxFrame *)NULL, -1, _T("wxDragImage sample"), +: wxFrame( (wxFrame *)NULL, wxID_ANY, _T("wxDragImage sample"), wxPoint(20,20), wxSize(470,360) ) { wxMenu *file_menu = new wxMenu(); file_menu->Append( wxID_ABOUT, _T("&About...")); - file_menu->Append( TEST_USE_SCREEN, _T("&Use whole screen for dragging"), _T("Use whole screen"), TRUE); + file_menu->Append( TEST_USE_SCREEN, _T("&Use whole screen for dragging"), _T("Use whole screen"), true); file_menu->Append( wxID_EXIT, _T("E&xit")); wxMenuBar *menu_bar = new wxMenuBar(); @@ -345,12 +345,12 @@ MyFrame::MyFrame() int widths[] = { -1, 100 }; SetStatusWidths( 2, widths ); - m_canvas = new MyCanvas( this, -1, wxPoint(0,0), wxSize(10,10) ); + m_canvas = new MyCanvas( this, wxID_ANY, wxPoint(0,0), wxSize(10,10) ); } void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) ) { - Close( TRUE ); + Close( true ); } void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) ) @@ -372,7 +372,7 @@ END_EVENT_TABLE() MyApp::MyApp() { // Drag across whole screen - m_useScreen = FALSE; + m_useScreen = false; } bool MyApp::OnInit() @@ -431,9 +431,9 @@ bool MyApp::OnInit() m_background = bitmap; #endif - frame->Show( TRUE ); + frame->Show( true ); - return TRUE; + return true; } int MyApp::OnExit() @@ -452,7 +452,7 @@ bool MyApp::TileBitmap(const wxRect& rect, wxDC& dc, wxBitmap& bitmap) for (j = rect.y; j < rect.y + rect.height; j+= h) dc.DrawBitmap(bitmap, i, j); } - return TRUE; + return true; } void MyApp::OnUseScreen(wxCommandEvent& WXUNUSED(event)) @@ -468,7 +468,7 @@ DragShape::DragShape(const wxBitmap& bitmap) m_pos.x = 0; m_pos.y = 0; m_dragMethod = SHAPE_DRAG_BITMAP; - m_show = TRUE; + m_show = true; } DragShape::~DragShape() @@ -489,11 +489,11 @@ bool DragShape::Draw(wxDC& dc, int op) memDC.SelectObject(m_bitmap); dc.Blit(m_pos.x, m_pos.y, m_bitmap.GetWidth(), m_bitmap.GetHeight(), - & memDC, 0, 0, op, TRUE); + & memDC, 0, 0, op, true); - return TRUE; + return true; } else - return FALSE; + return false; } diff --git a/samples/dynamic/dynamic.cpp b/samples/dynamic/dynamic.cpp index a3a6dbdd52..378f6e1882 100644 --- a/samples/dynamic/dynamic.cpp +++ b/samples/dynamic/dynamic.cpp @@ -59,10 +59,10 @@ bool MyApp::OnInit(void) // Create the main frame window MyFrame *frame = new MyFrame(NULL, _T("Dynamic wxWidgets App"), 50, 50, 450, 340); - frame->Connect( DYNAMIC_QUIT, -1, wxEVT_COMMAND_MENU_SELECTED, + frame->Connect( DYNAMIC_QUIT, wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) &MyFrame::OnQuit ); - frame->Connect( DYNAMIC_ABOUT, -1, wxEVT_COMMAND_MENU_SELECTED, + frame->Connect( DYNAMIC_ABOUT, wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) &MyFrame::OnAbout ); @@ -83,26 +83,26 @@ bool MyApp::OnInit(void) frame->SetMenuBar(menu_bar); // Make a panel with a message - wxPanel *panel = new wxPanel(frame, -1, wxPoint(0, 0), wxSize(400, 200), wxTAB_TRAVERSAL); + wxPanel *panel = new wxPanel(frame, wxID_ANY, wxPoint(0, 0), wxSize(400, 200), wxTAB_TRAVERSAL); - (void)new wxStaticText(panel, 311, _T("Hello!"), wxPoint(10, 10), wxSize(-1, -1), 0); + (void)new wxStaticText(panel, 311, _T("Hello!"), wxPoint(10, 10), wxDefaultSize, 0); // Show the frame - frame->Show(TRUE); + frame->Show(true); SetTopWindow(frame); - return TRUE; + return true; } // My frame constructor MyFrame::MyFrame(wxFrame *frame, wxChar *title, int x, int y, int w, int h): - wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h)) + wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h)) {} void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event) ) { - Close(TRUE); + Close(true); } void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) ) diff --git a/samples/erase/erase.cpp b/samples/erase/erase.cpp index 9a36be354b..166f7e1008 100644 --- a/samples/erase/erase.cpp +++ b/samples/erase/erase.cpp @@ -105,9 +105,9 @@ bool MyApp::OnInit() MyFrame *frame = new MyFrame(_T("Erase sample"), wxPoint(50, 50), wxSize(450, 340)); - frame->Show(TRUE); + frame->Show(true); - return TRUE; + return true; } // ---------------------------------------------------------------------------- @@ -121,7 +121,7 @@ END_EVENT_TABLE() // 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) { SetIcon(wxICON(mondrian)); @@ -150,7 +150,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) { - Close(TRUE); + Close(true); } void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) @@ -167,7 +167,7 @@ BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow) END_EVENT_TABLE() MyCanvas::MyCanvas( MyFrame *parent ) - : wxScrolledWindow( parent, -1, wxDefaultPosition, wxDefaultSize, + : wxScrolledWindow( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxScrolledWindowStyle | wxNO_FULL_REPAINT_ON_RESIZE| wxSUNKEN_BORDER ) @@ -176,7 +176,7 @@ MyCanvas::MyCanvas( MyFrame *parent ) m_bitmap = wxBitmap( wxICON(mondrian) ); - new wxStaticBitmap( this, -1, m_bitmap, wxPoint(80,20) ); + new wxStaticBitmap( this, wxID_ANY, m_bitmap, wxPoint(80,20) ); } void MyCanvas::OnChar( wxKeyEvent &event ) @@ -211,7 +211,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) dc.SetBrush( *wxBLACK_BRUSH ); dc.DrawRectangle( 0,0,200,50 ); - dc.DrawBitmap( m_bitmap, 10, 20, TRUE ); + dc.DrawBitmap( m_bitmap, 10, 20, true ); dc.SetTextForeground(*wxBLUE); dc.DrawText(_T("This text is drawn from OnPaint"), 65, 65); diff --git a/samples/event/event.cpp b/samples/event/event.cpp index 3604d6e296..ee1b87c5e7 100644 --- a/samples/event/event.cpp +++ b/samples/event/event.cpp @@ -59,7 +59,7 @@ DEFINE_EVENT_TYPE(wxEVT_MY_CUSTOM_COMMAND) // it may also be convenient to define an event table macro for this event type #define EVT_MY_CUSTOM_COMMAND(id, fn) \ DECLARE_EVENT_TABLE_ENTRY( \ - wxEVT_MY_CUSTOM_COMMAND, id, -1, \ + wxEVT_MY_CUSTOM_COMMAND, id, wxID_ANY, \ (wxObjectEventFunction)(wxEventFunction) wxStaticCastEvent( wxCommandEventFunction, &fn ), \ (wxObject *) NULL \ ), @@ -178,10 +178,10 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_UPDATE_UI(Event_Pop, MyFrame::OnUpdateUIPop) - EVT_MY_CUSTOM_COMMAND(-1, MyFrame::OnProcessCustom) + EVT_MY_CUSTOM_COMMAND(wxID_ANY, MyFrame::OnProcessCustom) // this would also work: - //EVT_CUSTOM(wxEVT_MY_CUSTOM_COMMAND, -1, MyFrame::OnProcessCustom) + //EVT_CUSTOM(wxEVT_MY_CUSTOM_COMMAND, wxID_ANY, MyFrame::OnProcessCustom) END_EVENT_TABLE() BEGIN_EVENT_TABLE(MyEvtHandler, wxEvtHandler) @@ -212,12 +212,12 @@ 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; } // ---------------------------------------------------------------------------- @@ -226,7 +226,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) { // init members m_nPush = 0; @@ -241,7 +241,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) wxMenu *menuEvent = new wxMenu; menuEvent->Append(Event_Connect, _T("&Connect\tCtrl-C"), _T("Connect or disconnect the dynamic event handler"), - TRUE /* checkable */); + true /* checkable */); menuEvent->Append(Event_Dynamic, _T("&Dynamic event\tCtrl-D"), _T("Dynamic event sample - only works after Connect")); menuEvent->AppendSeparator(); @@ -277,7 +277,7 @@ MyFrame::~MyFrame() // crashes! while ( m_nPush-- != 0 ) { - PopEventHandler(TRUE /* delete handler */); + PopEventHandler(true /* delete handler */); } } @@ -287,8 +287,8 @@ MyFrame::~MyFrame() 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)) @@ -317,7 +317,7 @@ void MyFrame::OnConnect(wxCommandEvent& event) if ( event.IsChecked() ) { // disconnect - Connect(Event_Dynamic, -1, wxEVT_COMMAND_MENU_SELECTED, + Connect(Event_Dynamic, wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction)&MyFrame::OnDynamic); @@ -327,7 +327,7 @@ void MyFrame::OnConnect(wxCommandEvent& event) } else // connect { - Disconnect(Event_Dynamic, -1, wxEVT_COMMAND_MENU_SELECTED); + Disconnect(Event_Dynamic, wxID_ANY, wxEVT_COMMAND_MENU_SELECTED); SetStatusText(_T("You can no more use \"Dynamic\" item in the menu")); SetStatusText(_T("Dynamic: off"), Status_Dynamic); @@ -349,7 +349,7 @@ void MyFrame::OnPopEventHandler(wxCommandEvent& WXUNUSED(event)) { wxCHECK_RET( m_nPush, _T("this command should be disabled!") ); - PopEventHandler(TRUE /* delete handler */); + PopEventHandler(true /* delete handler */); m_nPush--; SetStatusText(wxString::Format(_T("Push count: %u"), m_nPush), Status_Push); diff --git a/samples/exec/exec.cpp b/samples/exec/exec.cpp index eaeb0b15b9..ab5d6a9acc 100644 --- a/samples/exec/exec.cpp +++ b/samples/exec/exec.cpp @@ -338,18 +338,18 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_IDLE(MyFrame::OnIdle) - EVT_TIMER(-1, MyFrame::OnTimer) + EVT_TIMER(wxID_ANY, MyFrame::OnTimer) END_EVENT_TABLE() BEGIN_EVENT_TABLE(MyPipeFrame, wxFrame) EVT_BUTTON(Exec_Btn_Send, MyPipeFrame::OnBtnSend) EVT_BUTTON(Exec_Btn_Get, MyPipeFrame::OnBtnGet) - EVT_TEXT_ENTER(-1, MyPipeFrame::OnTextEnter) + EVT_TEXT_ENTER(wxID_ANY, MyPipeFrame::OnTextEnter) EVT_CLOSE(MyPipeFrame::OnClose) - EVT_END_PROCESS(-1, MyPipeFrame::OnProcessTerm) + EVT_END_PROCESS(wxID_ANY, MyPipeFrame::OnProcessTerm) END_EVENT_TABLE() // Create a new application object: this macro will allow wxWidgets to create @@ -375,13 +375,13 @@ bool MyApp::OnInit() wxDefaultPosition, wxSize(500, 140)); // Show it and tell the application that it's our main window - frame->Show(TRUE); + frame->Show(true); SetTopWindow(frame); // 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; } // ---------------------------------------------------------------------------- @@ -394,7 +394,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), m_timerIdleWakeUp(this) { m_pidLast = 0; @@ -452,7 +452,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) SetMenuBar(menuBar); // create the listbox in which we will show misc messages as they come - m_lbox = new wxListBox(this, -1); + m_lbox = new wxListBox(this, wxID_ANY); wxFont font(12, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); if ( font.Ok() ) @@ -471,8 +471,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::OnClear(wxCommandEvent& WXUNUSED(event)) @@ -669,11 +669,11 @@ void MyFrame::OnExecWithRedirect(wxCommandEvent& WXUNUSED(event)) wxYES_NO | wxCANCEL | wxICON_QUESTION, this) ) { case wxYES: - sync = TRUE; + sync = true; break; case wxNO: - sync = FALSE; + sync = false; break; default: @@ -823,23 +823,23 @@ bool MyFrame::GetDDEServer() wxString server = wxGetTextFromUser(_T("Server to connect to:"), DIALOG_TITLE, m_server); if ( !server ) - return FALSE; + return false; m_server = server; wxString topic = wxGetTextFromUser(_T("DDE topic:"), DIALOG_TITLE, m_topic); if ( !topic ) - return FALSE; + return false; m_topic = topic; wxString cmd = wxGetTextFromUser(_T("DDE command:"), DIALOG_TITLE, m_cmdDde); if ( !cmd ) - return FALSE; + return false; m_cmdDde = cmd; - return TRUE; + return true; } void MyFrame::OnDDEExec(wxCommandEvent& WXUNUSED(event)) @@ -963,7 +963,7 @@ void MyProcess::OnTerminate(int pid, int status) bool MyPipedProcess::HasInput() { - bool hasInput = FALSE; + bool hasInput = false; if ( IsInputAvailable() ) { @@ -975,7 +975,7 @@ bool MyPipedProcess::HasInput() m_parent->GetLogListBox()->Append(msg); - hasInput = TRUE; + hasInput = true; } if ( IsErrorAvailable() ) @@ -988,7 +988,7 @@ bool MyPipedProcess::HasInput() m_parent->GetLogListBox()->Append(msg); - hasInput = TRUE; + hasInput = true; } return hasInput; @@ -1020,7 +1020,7 @@ bool MyPipedProcess2::HasInput() m_input.clear(); // call us once again - may be we'll have output - return TRUE; + return true; } return MyPipedProcess::HasInput(); @@ -1033,7 +1033,7 @@ bool MyPipedProcess2::HasInput() MyPipeFrame::MyPipeFrame(wxFrame *parent, const wxString& cmd, wxProcess *process) - : wxFrame(parent, -1, cmd), + : wxFrame(parent, wxID_ANY, cmd), m_process(process), // in a real program we'd check that the streams are !NULL here m_in(*process->GetInputStream()), @@ -1041,13 +1041,13 @@ MyPipeFrame::MyPipeFrame(wxFrame *parent, { m_process->SetNextHandler(this); - wxPanel *panel = new wxPanel(this, -1); + wxPanel *panel = new wxPanel(this, wxID_ANY); - m_textIn = new wxTextCtrl(panel, -1, _T(""), + m_textIn = new wxTextCtrl(panel, wxID_ANY, _T(""), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER); - m_textOut = new wxTextCtrl(panel, -1, _T("")); - m_textOut->SetEditable(FALSE); + m_textOut = new wxTextCtrl(panel, wxID_ANY, _T("")); + m_textOut->SetEditable(false); wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL); sizerTop->Add(m_textIn, 0, wxGROW | wxALL, 5); diff --git a/samples/htlbox/htlbox.cpp b/samples/htlbox/htlbox.cpp index 162fce3ef2..aa0f22e7f6 100644 --- a/samples/htlbox/htlbox.cpp +++ b/samples/htlbox/htlbox.cpp @@ -127,7 +127,7 @@ private: class MyApp : public wxApp { public: - virtual bool OnInit() { (new MyFrame())->Show(); return TRUE; } + virtual bool OnInit() { (new MyFrame())->Show(); return true; } }; // ---------------------------------------------------------------------------- @@ -192,7 +192,7 @@ IMPLEMENT_APP(MyApp) // frame constructor MyFrame::MyFrame() - : wxFrame(NULL, -1, _T("HtmlLbox wxWidgets Sample"), + : wxFrame(NULL, wxID_ANY, _T("HtmlLbox wxWidgets Sample"), wxDefaultPosition, wxSize(400, 500)) { // set the frame icon @@ -248,7 +248,7 @@ MyFrame::MyFrame() // create the child controls m_hlbox = new MyHtmlListBox(this); - wxTextCtrl *text = new wxTextCtrl(this, -1, _T(""), + wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY, _T(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE); delete wxLog::SetActiveTarget(new wxLogTextCtrl(text)); @@ -272,8 +272,8 @@ MyFrame::~MyFrame() 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)) @@ -398,7 +398,7 @@ void MyFrame::OnLboxSelect(wxCommandEvent& event) // ============================================================================ MyHtmlListBox::MyHtmlListBox(wxWindow *parent, bool multi) - : wxHtmlListBox(parent, -1, wxDefaultPosition, wxDefaultSize, + : wxHtmlListBox(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, multi ? wxLB_MULTIPLE : 0) { m_change = true;