From af870ed80f7cbfe49a0900c35310dedf82b06f63 Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Tue, 25 May 2004 19:25:01 +0000 Subject: [PATCH] -1->wxID_ANY, TRUE->true and FALSE->false replacements. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27435 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/grid/griddemo.cpp | 85 ++++++++++++++++---------------- samples/grid/griddemo.h | 2 +- samples/mobile/wxedit/wxedit.cpp | 28 +++++------ 3 files changed, 58 insertions(+), 57 deletions(-) diff --git a/samples/grid/griddemo.cpp b/samples/grid/griddemo.cpp index fd656d15fb..ff9f0c0841 100644 --- a/samples/grid/griddemo.cpp +++ b/samples/grid/griddemo.cpp @@ -34,6 +34,7 @@ #include "wx/colordlg.h" #include "wx/fontdlg.h" +#include "wx/numdlg.h" #include "wx/grid.h" #include "wx/generic/gridctrl.h" @@ -57,9 +58,9 @@ IMPLEMENT_APP( GridApp ) bool GridApp::OnInit() { GridFrame *frame = new GridFrame; - frame->Show( TRUE ); + frame->Show(true); - return TRUE; + return true; } // ---------------------------------------------------------------------------- @@ -130,7 +131,7 @@ END_EVENT_TABLE() GridFrame::GridFrame() - : wxFrame( (wxFrame *)NULL, -1, _T("wxWidgets grid class demo"), + : wxFrame( (wxFrame *)NULL, wxID_ANY, _T("wxWidgets grid class demo"), wxDefaultPosition, wxDefaultSize ) { @@ -226,15 +227,15 @@ GridFrame::GridFrame() SetMenuBar( menuBar ); - m_addToSel = FALSE; + m_addToSel = false; grid = new wxGrid( this, - -1, + wxID_ANY, wxPoint( 0, 0 ), wxSize( 400, 300 ) ); logWin = new wxTextCtrl( this, - -1, + wxID_ANY, wxEmptyString, wxPoint( 0, gridH + 20 ), wxSize( logW, logH ), @@ -328,7 +329,7 @@ GridFrame::GridFrame() grid->SetCellEditor(4, 0, new wxGridCellChoiceEditor(WXSIZEOF(choices), choices)); grid->SetCellSize(4, 0, 1, 2); grid->SetCellValue(4, 0, choices[0]); - grid->SetCellOverflow(4, 0, FALSE); + grid->SetCellOverflow(4, 0, false); grid->SetCellSize(7, 1, 3, 4); grid->SetCellAlignment(7, 1, wxALIGN_CENTRE, wxALIGN_CENTRE); @@ -343,7 +344,7 @@ GridFrame::GridFrame() 0, wxEXPAND ); - SetAutoLayout( TRUE ); + SetAutoLayout(true); SetSizer( topSizer ); topSizer->Fit( this ); @@ -362,14 +363,14 @@ GridFrame::~GridFrame() void GridFrame::SetDefaults() { - GetMenuBar()->Check( ID_TOGGLEROWLABELS, TRUE ); - GetMenuBar()->Check( ID_TOGGLECOLLABELS, TRUE ); - GetMenuBar()->Check( ID_TOGGLEEDIT, TRUE ); - GetMenuBar()->Check( ID_TOGGLEROWSIZING, TRUE ); - GetMenuBar()->Check( ID_TOGGLECOLSIZING, TRUE ); - GetMenuBar()->Check( ID_TOGGLEGRIDSIZING, TRUE ); - GetMenuBar()->Check( ID_TOGGLEGRIDLINES, TRUE ); - GetMenuBar()->Check( ID_CELLOVERFLOW, TRUE ); + GetMenuBar()->Check( ID_TOGGLEROWLABELS, true ); + GetMenuBar()->Check( ID_TOGGLECOLLABELS, true ); + GetMenuBar()->Check( ID_TOGGLEEDIT, true ); + GetMenuBar()->Check( ID_TOGGLEROWSIZING, true ); + GetMenuBar()->Check( ID_TOGGLECOLSIZING, true ); + GetMenuBar()->Check( ID_TOGGLEGRIDSIZING, true ); + GetMenuBar()->Check( ID_TOGGLEGRIDLINES, true ); + GetMenuBar()->Check( ID_CELLOVERFLOW, true ); } @@ -539,7 +540,7 @@ void GridFrame::SetRowLabelHorizAlignment( wxCommandEvent& WXUNUSED(ev) ) break; } - grid->SetRowLabelAlignment( horiz, -1 ); + grid->SetRowLabelAlignment( horiz, vert ); } void GridFrame::SetRowLabelVertAlignment( wxCommandEvent& WXUNUSED(ev) ) @@ -562,7 +563,7 @@ void GridFrame::SetRowLabelVertAlignment( wxCommandEvent& WXUNUSED(ev) ) break; } - grid->SetRowLabelAlignment( -1, vert ); + grid->SetRowLabelAlignment( horiz, vert ); } @@ -586,7 +587,7 @@ void GridFrame::SetColLabelHorizAlignment( wxCommandEvent& WXUNUSED(ev) ) break; } - grid->SetColLabelAlignment( horiz, -1 ); + grid->SetColLabelAlignment( horiz, vert ); } @@ -610,7 +611,7 @@ void GridFrame::SetColLabelVertAlignment( wxCommandEvent& WXUNUSED(ev) ) break; } - grid->SetColLabelAlignment( -1, vert ); + grid->SetColLabelAlignment( horiz, vert ); } @@ -709,7 +710,7 @@ void GridFrame::SetCellBgColour( wxCommandEvent& WXUNUSED(ev) ) // which exactly fits the grid. wxRect r(wxPoint(0, 0), grid->GetSize()); grid->SetDefaultCellBackgroundColour(col); - grid->Refresh(TRUE, &r); + grid->Refresh(true, &r); } } @@ -916,24 +917,24 @@ void GridFrame::About( wxCommandEvent& WXUNUSED(ev) ) void GridFrame::OnQuit( wxCommandEvent& WXUNUSED(ev) ) { - Close( TRUE ); + Close( true ); } void GridFrame::OnBugsTable(wxCommandEvent& ) { BugsGridFrame *frame = new BugsGridFrame; - frame->Show(TRUE); + frame->Show(true); } void GridFrame::OnSmallGrid(wxCommandEvent& ) { - wxFrame* frame = new wxFrame(NULL, -1, _T("A Small Grid"), + wxFrame* frame = new wxFrame(NULL, wxID_ANY, _T("A Small Grid"), wxDefaultPosition, wxSize(640, 480)); - wxPanel* panel = new wxPanel(frame, -1); - wxGrid* grid = new wxGrid(panel, -1, wxPoint(10,10), wxSize(400,400), + wxPanel* panel = new wxPanel(frame, wxID_ANY); + wxGrid* grid = new wxGrid(panel, wxID_ANY, wxPoint(10,10), wxSize(400,400), wxWANTS_CHARS | wxSIMPLE_BORDER); grid->CreateGrid(3,3); - frame->Show(TRUE); + frame->Show(true); } void GridFrame::OnVTable(wxCommandEvent& ) @@ -961,7 +962,7 @@ void GridFrame::OnVTable(wxCommandEvent& ) if ( s_sizeGrid != -1 ) { BigGridFrame* win = new BigGridFrame(s_sizeGrid); - win->Show(TRUE); + win->Show(true); } } @@ -1033,17 +1034,17 @@ wxGridCellAttr *MyGridCellAttrProvider::GetAttr(int row, int col, // ============================================================================ BigGridFrame::BigGridFrame(long sizeGrid) - : wxFrame(NULL, -1, _T("Plugin Virtual Table"), + : wxFrame(NULL, wxID_ANY, _T("Plugin Virtual Table"), wxDefaultPosition, wxSize(500, 450)) { - m_grid = new wxGrid(this, -1, wxDefaultPosition, wxDefaultSize); + m_grid = new wxGrid(this, wxID_ANY, wxDefaultPosition, wxDefaultSize); m_table = new BigGridTable(sizeGrid); // VZ: I don't understand why this slows down the display that much, // must profile it... //m_table->SetAttrProvider(new MyGridCellAttrProvider); - m_grid->SetTable(m_table, TRUE); + m_grid->SetTable(m_table, true); #if defined __WXMOTIF__ // MB: the grid isn't getting a sensible default size under wxMotif @@ -1101,10 +1102,10 @@ static struct BugsGridData bool opened; } gs_dataBugsGrid [] = { - { 18, _T("foo doesn't work"), Sev_Major, 1, _T("wxMSW"), TRUE }, - { 27, _T("bar crashes"), Sev_Critical, 1, _T("all"), FALSE }, - { 45, _T("printing is slow"), Sev_Minor, 3, _T("wxMSW"), TRUE }, - { 68, _T("Rectangle() fails"), Sev_Normal, 1, _T("wxMSW"), FALSE }, + { 18, _T("foo doesn't work"), Sev_Major, 1, _T("wxMSW"), true }, + { 27, _T("bar crashes"), Sev_Critical, 1, _T("all"), false }, + { 45, _T("printing is slow"), Sev_Minor, 3, _T("wxMSW"), true }, + { 68, _T("Rectangle() fails"), Sev_Normal, 1, _T("wxMSW"), false }, }; static const wxChar *headers[Col_Max] = @@ -1159,7 +1160,7 @@ int BugsGridTable::GetNumberCols() bool BugsGridTable::IsEmptyCell( int WXUNUSED(row), int WXUNUSED(col) ) { - return FALSE; + return false; } wxString BugsGridTable::GetValue( int row, int col ) @@ -1234,7 +1235,7 @@ bool BugsGridTable::CanGetValueAs( int WXUNUSED(row), int col, const wxString& t { if ( typeName == wxGRID_VALUE_STRING ) { - return TRUE; + return true; } else if ( typeName == wxGRID_VALUE_BOOL ) { @@ -1246,7 +1247,7 @@ bool BugsGridTable::CanGetValueAs( int WXUNUSED(row), int col, const wxString& t } else { - return FALSE; + return false; } } @@ -1286,7 +1287,7 @@ bool BugsGridTable::GetValueAsBool( int row, int col ) { wxFAIL_MSG(_T("unexpected column")); - return FALSE; + return false; } } @@ -1331,13 +1332,13 @@ BugsGridTable::BugsGridTable() // ---------------------------------------------------------------------------- BugsGridFrame::BugsGridFrame() - : wxFrame(NULL, -1, _T("Bugs table"), + : wxFrame(NULL, wxID_ANY, _T("Bugs table"), wxDefaultPosition, wxSize(500, 300)) { - wxGrid *grid = new wxGrid(this, -1, wxDefaultPosition); + wxGrid *grid = new wxGrid(this, wxID_ANY, wxDefaultPosition); wxGridTableBase *table = new BugsGridTable(); table->SetAttrProvider(new MyGridCellAttrProvider); - grid->SetTable(table, TRUE); + grid->SetTable(table, true); wxGridCellAttr *attrRO = new wxGridCellAttr, *attrRangeEditor = new wxGridCellAttr, diff --git a/samples/grid/griddemo.h b/samples/grid/griddemo.h index a06464e232..b10c0b0956 100644 --- a/samples/grid/griddemo.h +++ b/samples/grid/griddemo.h @@ -185,7 +185,7 @@ public: } void SetValue( int , int , const wxString& ) { /* ignore */ } - bool IsEmptyCell( int , int ) { return FALSE; } + bool IsEmptyCell( int , int ) { return false; } private: long m_sizeGrid; diff --git a/samples/mobile/wxedit/wxedit.cpp b/samples/mobile/wxedit/wxedit.cpp index 5798973d77..fa4a2d3ee3 100644 --- a/samples/mobile/wxedit/wxedit.cpp +++ b/samples/mobile/wxedit/wxedit.cpp @@ -49,7 +49,7 @@ BEGIN_EVENT_TABLE(MyFrame,wxFrame) EVT_MENU_RANGE(ID_LAST_1, ID_LAST_3, MyFrame::OnLastFiles) EVT_CLOSE(MyFrame::OnCloseWindow) - EVT_UPDATE_UI(-1,MyFrame::OnUpdateUI) + EVT_UPDATE_UI(wxID_ANY,MyFrame::OnUpdateUI) END_EVENT_TABLE() MyFrame::MyFrame( wxWindow *parent, wxWindowID id, const wxString &title, @@ -64,7 +64,7 @@ MyFrame::MyFrame( wxWindow *parent, wxWindowID id, const wxString &title, // Create edit control. Since it is the only // control in the frame, it will be resized // to file it out. - m_text = new wxTextCtrl( this, -1, _T(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE ); + m_text = new wxTextCtrl( this, wxID_ANY, _T(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE ); // Read .ini file for file history etc. wxConfig *conf = (wxConfig*) wxConfig::Get(); @@ -112,7 +112,7 @@ void MyFrame::AddToHistory( const wxString &fname ) int index = m_history.Index( fname ); if (index != wxNOT_FOUND) - m_history.Remove( (size_t) index ); + m_history.RemoveAt( (size_t) index ); m_history.Insert( fname, 0 ); @@ -284,7 +284,7 @@ void MyFrame::OnAbout( wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnQuit( wxCommandEvent& WXUNUSED(event) ) { - Close( TRUE ); + Close( true ); } bool MyFrame::Save() @@ -296,7 +296,7 @@ bool MyFrame::Save() else m_text->SaveFile( m_filename ); - return TRUE; + return true; } bool MyFrame::Discard() @@ -309,16 +309,16 @@ bool MyFrame::Discard() int ret = dialog.ShowModal(); if (ret == wxID_CANCEL) - return FALSE; + return false; if (ret == wxID_YES) { if (!Save()) - return FALSE; + return false; } } - return TRUE; + return true; } void MyFrame::OnUpdateUI( wxUpdateUIEvent &event ) @@ -326,13 +326,13 @@ void MyFrame::OnUpdateUI( wxUpdateUIEvent &event ) switch (event.GetId()) { case ID_COPY: - event.Enable( FALSE ); + event.Enable( false ); break; case ID_CUT: - event.Enable( FALSE ); + event.Enable( false ); break; case ID_PASTE: - event.Enable( FALSE ); + event.Enable( false ); break; case ID_DELETE: #ifdef __WXUNIVERSAL__ @@ -398,10 +398,10 @@ bool MyApp::OnInit() SetVendorName(_T("Free world")); SetAppName(_T("wxEdit")); - MyFrame *frame = new MyFrame( NULL, -1, _T("wxEdit"), wxPoint(20,20), wxSize(500,340) ); - frame->Show( TRUE ); + MyFrame *frame = new MyFrame( NULL, wxID_ANY, _T("wxEdit"), wxPoint(20,20), wxSize(500,340) ); + frame->Show( true ); - return TRUE; + return true; } int MyApp::OnExit() -- 2.45.2