]> git.saurik.com Git - wxWidgets.git/commitdiff
-1->wxID_ANY, TRUE->true and FALSE->false replacements.
authorWłodzimierz Skiba <abx@abx.art.pl>
Wed, 2 Jun 2004 17:03:20 +0000 (17:03 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Wed, 2 Jun 2004 17:03:20 +0000 (17:03 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27585 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/ipc/client.cpp
samples/ipc/server.cpp
samples/propsize/propsize.cpp
samples/rotate/rotate.cpp
samples/scroll/scroll.cpp
samples/scrollsub/scrollsub.cpp
samples/shaped/shaped.cpp
samples/sockets/client.cpp
samples/sockets/server.cpp

index f4ad6551f2d4db953ed1ff69f1127e59fa7352c8..5bc4aeb62f5e4d5888a6e0c64302156fca21ab53 100644 (file)
@@ -99,7 +99,7 @@ bool MyApp::OnInit()
                               wxICON_ERROR | wxYES_NO | wxCANCEL ) != wxYES )
             {
                 // no server
-                return FALSE;
+                return false;
             }
 
             the_connection = (MyConnection *)my_client->MakeConnection(hostName, service, _T("IPC TEST"));
@@ -110,9 +110,9 @@ bool MyApp::OnInit()
         wxMessageBox(_T("StartAdvise failed"), _T("Client Demo Error"));
 
     // Create the main frame window
-    (new MyFrame(NULL, _T("Client")))->Show(TRUE);
+    (new MyFrame(NULL, _T("Client")))->Show(true);
 
-    return TRUE;
+    return true;
 }
 
 int MyApp::OnExit()
@@ -131,7 +131,7 @@ int MyApp::OnExit()
 
 // Define my frame constructor
 MyFrame::MyFrame(wxFrame *frame, const wxString& title)
-        : wxFrame(frame, -1, title, wxDefaultPosition, wxSize(300, 200))
+        : wxFrame(frame, wxID_ANY, title, wxDefaultPosition, wxSize(300, 200))
 {
     // Give it an icon
     SetIcon(wxICON(mondrian));
@@ -201,10 +201,10 @@ bool MyConnection::OnAdvise(const wxString& WXUNUSED(topic), const wxString& WXU
     if (the_list)
     {
         int n = the_list->FindString(data);
-        if (n > -1)
+        if (n > wxNOT_FOUND)
             the_list->SetSelection(n);
     }
-    return TRUE;
+    return true;
 }
 
 bool MyConnection::OnDisconnect()
index 18ca3e07d9986e254c6711edeb04f1ed29ba0fb7..44401f971848951913181d638a1536e6b0cdd041 100644 (file)
@@ -70,7 +70,7 @@ MyConnection *the_connection = NULL;
 bool MyApp::OnInit()
 {
     // Create the main frame window
-    (new MyFrame(NULL, _T("Server")))->Show(TRUE);
+    (new MyFrame(NULL, _T("Server")))->Show(true);
 
     // service name (DDE classes) or port number (TCP/IP based classes)
     wxString service = IPC_SERVICE;
@@ -82,7 +82,7 @@ bool MyApp::OnInit()
     m_server = new MyServer;
     m_server->Create(service);
 
-    return TRUE;
+    return true;
 }
 
 int MyApp::OnExit()
@@ -98,7 +98,7 @@ int MyApp::OnExit()
 
 // Define my frame constructor
 MyFrame::MyFrame(wxFrame *frame, const wxString& title)
-       : wxFrame(frame, -1, title, wxDefaultPosition, wxSize(350, 250))
+       : wxFrame(frame, wxID_ANY, title, wxDefaultPosition, wxSize(350, 250))
 {
     CreateStatusBar();
 
@@ -145,7 +145,7 @@ void MyFrame::OnListBoxClick(wxCommandEvent& WXUNUSED(event))
 
 void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event))
 {
-    Close(TRUE);
+    Close(true);
 }
 
 // ----------------------------------------------------------------------------
@@ -155,7 +155,7 @@ void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event))
 IPCDialogBox::IPCDialogBox(wxWindow *parent, const wxString& title,
                            const wxPoint& pos, const wxSize& size,
                            MyConnection *connection)
-            : wxDialog(parent, -1, title, pos, size)
+            : wxDialog(parent, wxID_ANY, title, pos, size)
 {
     m_connection = connection;
     (void)new wxButton(this, SERVER_QUIT_BUTTON, _T("Quit this connection"),
@@ -199,7 +199,7 @@ MyConnection::MyConnection()
 {
     dialog = new IPCDialogBox(wxTheApp->GetTopWindow(), _T("Connection"),
                               wxPoint(100, 100), wxSize(500, 500), this);
-    dialog->Show(TRUE);
+    dialog->Show(true);
     the_connection = this;
 }
 
@@ -222,7 +222,7 @@ bool MyConnection::OnExecute(const wxString& WXUNUSED(topic),
                              wxIPCFormat WXUNUSED(format))
 {
     wxLogStatus(wxT("Execute command: %s"), data);
-    return TRUE;
+    return true;
 }
 
 bool MyConnection::OnPoke(const wxString& WXUNUSED(topic),
@@ -232,7 +232,7 @@ bool MyConnection::OnPoke(const wxString& WXUNUSED(topic),
                           wxIPCFormat WXUNUSED(format))
 {
     wxLogStatus(wxT("Poke command: %s = %s"), item.c_str(), data);
-    return TRUE;
+    return true;
 }
 
 wxChar *MyConnection::OnRequest(const wxString& WXUNUSED(topic),
@@ -246,6 +246,6 @@ wxChar *MyConnection::OnRequest(const wxString& WXUNUSED(topic),
 bool MyConnection::OnStartAdvise(const wxString& WXUNUSED(topic),
                                  const wxString& WXUNUSED(item))
 {
-    return TRUE;
+    return true;
 }
 
index 8d514444ca2f88b159a865886ccc5b5adc3afad6..17680e7f076c1198cfe14a3faab874e647b694e8 100644 (file)
@@ -124,13 +124,13 @@ bool MyApp::OnInit()
 
     // Show it and tell the application that it's our main window
     // @@@ what does it do exactly, in fact? is it necessary here?
-    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;
 }
 
 // ----------------------------------------------------------------------------
@@ -139,7 +139,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));
@@ -165,11 +165,11 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
 #endif // wxUSE_STATUSBAR
 
 #define AddLine(orient) \
-    Add( new wxStaticLine( this, -1, wxDefaultPosition, wxSize(2,2), orient), \
+    Add( new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxSize(2,2), orient), \
     0, wxEXPAND)
 
 #define AddButton(label,align) Add( \
-    new wxButton( this, -1, label, wxDefaultPosition, wxSize(100,50)), \
+    new wxButton( this, wxID_ANY, label, wxDefaultPosition, wxSize(100,50)), \
     1, wxSHAPED | align)
 
     wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
@@ -190,11 +190,11 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
     // sizer that preserves it's shape
     wxBoxSizer *vsizer = new wxBoxSizer( wxVERTICAL );
     vsizer->Add(
-        new wxButton( this, -1, _T("up"), wxDefaultPosition, wxSize(100,25) ),
+        new wxButton( this, wxID_ANY, _T("up"), wxDefaultPosition, wxSize(100,25) ),
         1, wxEXPAND);
 
     vsizer->Add(
-        new wxButton( this, -1, _T("down"), wxDefaultPosition, wxSize(100,25) ),
+        new wxButton( this, wxID_ANY, _T("down"), wxDefaultPosition, wxSize(100,25) ),
         1, wxEXPAND);
 
     hsizer2->Add(vsizer, 1, wxSHAPED | wxALIGN_CENTER);
@@ -228,8 +228,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))
index 7322687973224791e75ae5205afb07bd1a0507b9..c5409832397180c53427b6bceccf3a3daa648da4 100644 (file)
@@ -99,19 +99,19 @@ bool MyApp::OnInit()
     {
         wxLogError(wxT("Can't load the test image, please copy it to the ")
                    wxT("program directory"));
-        return FALSE;
+        return false;
     }
 
     MyFrame *frame = new MyFrame (_T("wxWidgets rotate sample"),
                                   wxPoint(20,20), wxSize(600,450));
 
-    frame->Show (TRUE);
+    frame->Show (true);
     SetTopWindow (frame);
-    return TRUE;
+    return true;
 }
 
 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_angle = 0.1;
 
@@ -143,11 +143,11 @@ void MyFrame::OnAngle (wxCommandEvent &)
 
 void MyFrame::OnQuit (wxCommandEvent &)
 {
-    Close (TRUE);
+    Close (true);
 }
 
 MyCanvas::MyCanvas(wxWindow* parent):
-  wxScrolledWindow(parent, -1)
+  wxScrolledWindow(parent, wxID_ANY)
 {
     SetBackgroundColour (wxColour (0,80,60));
     ClearBackground();
@@ -160,12 +160,12 @@ void MyCanvas::OnMouseLeftUp (wxMouseEvent & event)
 
     wxPoint offset;
     const wxImage& img = wxGetApp().GetImage();
-    wxImage img2 = img.Rotate(frame->m_angle, wxPoint(img.GetWidth()/2, img.GetHeight()/2), TRUE, &offset);
+    wxImage img2 = img.Rotate(frame->m_angle, wxPoint(img.GetWidth()/2, img.GetHeight()/2), true, &offset);
 
     wxBitmap bmp(img2);
 
     wxClientDC dc (this);
-    dc.DrawBitmap (bmp, event.m_x + offset.x, event.m_y + offset.y, TRUE);
+    dc.DrawBitmap (bmp, event.m_x + offset.x, event.m_y + offset.y, true);
 }
 
 // without interpolation, and without offset correction
@@ -174,10 +174,10 @@ void MyCanvas::OnMouseRightUp (wxMouseEvent & event)
     MyFrame* frame = (MyFrame*) GetParent();
 
     const wxImage& img = wxGetApp().GetImage();
-    wxImage img2 = img.Rotate(frame->m_angle, wxPoint(img.GetWidth()/2, img.GetHeight()/2), FALSE);
+    wxImage img2 = img.Rotate(frame->m_angle, wxPoint(img.GetWidth()/2, img.GetHeight()/2), false);
 
     wxBitmap bmp(img2);
 
     wxClientDC dc (this);
-    dc.DrawBitmap (bmp, event.m_x, event.m_y, TRUE);
+    dc.DrawBitmap (bmp, event.m_x, event.m_y, true);
 }
index 0d439109626fc9449c37184174009c7fabc5ab76..f0725ee57d8a8260c90d34243e4fa875daa62421 100644 (file)
@@ -109,7 +109,7 @@ public:
     MyScrolledWindowDumb(wxWindow *parent) : MyScrolledWindowBase(parent)
     {
         // no horz scrolling
-        SetScrollbars(0, m_hLine, 0, m_nLines + 1, 0, 0, TRUE /* no refresh */);
+        SetScrollbars(0, m_hLine, 0, m_nLines + 1, 0, 0, true /* no refresh */);
     }
 
     virtual void OnDraw(wxDC& dc);
@@ -217,18 +217,18 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
 
     m_button = new wxButton( this, ID_QUERYPOS, "Query position", wxPoint(10,110) );
 
-    (void) new wxTextCtrl( this, -1, "wxTextCtrl", wxPoint(10,150), wxSize(80,-1) );
+    (void) new wxTextCtrl( this, wxID_ANY, "wxTextCtrl", wxPoint(10,150), wxSize(80,wxDefaultSize.y) );
 
-    (void) new wxRadioButton( this, -1, "Disable", wxPoint(10,190) );
+    (void) new wxRadioButton( this, wxID_ANY, "Disable", wxPoint(10,190) );
 
-    (void) new wxComboBox( this, -1, "This", wxPoint(10,230), wxDefaultSize, 5, choices );
+    (void) new wxComboBox( this, wxID_ANY, "This", wxPoint(10,230), wxDefaultSize, 5, choices );
 
-    (void) new wxRadioBox( this, -1, "This", wxPoint(10,310), wxDefaultSize, 5, choices, 2, wxRA_SPECIFY_COLS );
+    (void) new wxRadioBox( this, wxID_ANY, "This", wxPoint(10,310), wxDefaultSize, 5, choices, 2, wxRA_SPECIFY_COLS );
 
-    (void) new wxRadioBox( this, -1, "This", wxPoint(10,440), wxDefaultSize, 5, choices, 2, wxRA_SPECIFY_ROWS );
+    (void) new wxRadioBox( this, wxID_ANY, "This", wxPoint(10,440), wxDefaultSize, 5, choices, 2, wxRA_SPECIFY_ROWS );
 
     wxListCtrl *m_listCtrl = new wxListCtrl(
-            this, -1, wxPoint(200, 110), wxSize(180, 120),
+            this, wxID_ANY, wxPoint(200, 110), wxSize(180, 120),
             wxLC_REPORT | wxSIMPLE_BORDER | wxLC_SINGLE_SEL );
 
     m_listCtrl->InsertColumn(0, "First", wxLIST_FORMAT_LEFT, 90);
@@ -242,27 +242,27 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
     }
     m_listCtrl->SetItemState( 3, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
 
-    (void) new wxListBox( this, -1, wxPoint(260,280), wxSize(120,120), 5, choices, wxLB_ALWAYS_SB );
+    (void) new wxListBox( this, wxID_ANY, wxPoint(260,280), wxSize(120,120), 5, choices, wxLB_ALWAYS_SB );
 
 #endif
 
-    wxPanel *test = new wxPanel( this, -1, wxPoint(10, 110), wxSize(130,50), wxSIMPLE_BORDER | wxTAB_TRAVERSAL );
+    wxPanel *test = new wxPanel( this, wxID_ANY, wxPoint(10, 110), wxSize(130,50), wxSIMPLE_BORDER | wxTAB_TRAVERSAL );
     test->SetBackgroundColour( wxT("WHEAT") );
 
 #if 0
 
-    wxButton *test2 = new wxButton( test, -1, "Hallo", wxPoint(10,10) );
+    wxButton *test2 = new wxButton( test, wxID_ANY, "Hallo", wxPoint(10,10) );
 
-    test = new wxPanel( this, -1, wxPoint(160, 530), wxSize(130,120), wxSUNKEN_BORDER | wxTAB_TRAVERSAL );
+    test = new wxPanel( this, wxID_ANY, wxPoint(160, 530), wxSize(130,120), wxSUNKEN_BORDER | wxTAB_TRAVERSAL );
     test->SetBackgroundColour( wxT("WHEAT") );
     test->SetCursor( wxCursor( wxCURSOR_NO_ENTRY ) );
-    test2 = new wxButton( test, -1, "Hallo", wxPoint(10,10) );
+    test2 = new wxButton( test, wxID_ANY, "Hallo", wxPoint(10,10) );
     test2->SetCursor( wxCursor( wxCURSOR_PENCIL ) );
 
-    test = new wxPanel( this, -1, wxPoint(310, 530), wxSize(130,120), wxRAISED_BORDER | wxTAB_TRAVERSAL );
+    test = new wxPanel( this, wxID_ANY, wxPoint(310, 530), wxSize(130,120), wxRAISED_BORDER | wxTAB_TRAVERSAL );
     test->SetBackgroundColour( wxT("WHEAT") );
     test->SetCursor( wxCursor( wxCURSOR_PENCIL ) );
-    test2 = new wxButton( test, -1, "Hallo", wxPoint(10,10) );
+    test2 = new wxButton( test, wxID_ANY, "Hallo", wxPoint(10,10) );
     test2->SetCursor( wxCursor( wxCURSOR_NO_ENTRY ) );
 
 #endif
@@ -286,7 +286,7 @@ void MyCanvas::OnMouseDown( wxMouseEvent &event )
         wxLogMessage( wxT("Mouse down event at: %d %d, scrolled: %d %d"), pt.x, pt.y, x, y );
 
         if ( !event.LeftIsDown() )
-            wxLogMessage( wxT("Error: LeftIsDown() should be TRUE if for LeftDown()") );
+            wxLogMessage( wxT("Error: LeftIsDown() should be true if for LeftDown()") );
     }
 }
 
@@ -334,7 +334,7 @@ void MyCanvas::OnMoveButton( wxCommandEvent &event )
     wxWindow *win = FindWindow( event.GetId() );
     wxPoint pt( win->GetPosition() );
     wxLogMessage( wxT("-> Position before move is %d %d"), pt.x, pt.y );
-    win->Move( -1, pt.y + 10 );
+    win->Move( wxDefaultPosition.x, pt.y + 10 );
     pt = win->GetPosition();
     wxLogMessage( wxT("-> Position after move is %d %d"), pt.x, pt.y );
 }
@@ -389,15 +389,15 @@ MyAutoScrollWindow::MyAutoScrollWindow( wxWindow *parent )
                      wxALIGN_CENTER | wxALL | wxADJUST_MINSIZE,
                      20 );
 
-    innersizer->Add( new wxStaticText( this, -1, _T("This is just") ),
+    innersizer->Add( new wxStaticText( this, wxID_ANY, _T("This is just") ),
                     0,
                     wxALIGN_CENTER );
 
-    innersizer->Add( new wxStaticText( this, -1, _T("some decoration") ),
+    innersizer->Add( new wxStaticText( this, wxID_ANY, _T("some decoration") ),
                     0,
                     wxALIGN_CENTER );
 
-    innersizer->Add( new wxStaticText( this, -1, _T("for you to scroll...") ),
+    innersizer->Add( new wxStaticText( this, wxID_ANY, _T("for you to scroll...") ),
                     0,
                     wxALIGN_CENTER );
 
@@ -439,7 +439,7 @@ BEGIN_EVENT_TABLE(MyFrame,wxFrame)
 END_EVENT_TABLE()
 
 MyFrame::MyFrame()
-       : wxFrame( (wxFrame *)NULL, -1, _T("wxScrolledWindow sample"),
+       : wxFrame( (wxFrame *)NULL, wxID_ANY, _T("wxScrolledWindow sample"),
                   wxPoint(20,20), wxSize(470,500) )
 {
     wxMenu *file_menu = new wxMenu();
@@ -461,7 +461,7 @@ MyFrame::MyFrame()
 
     // Setting an explicit size here is superfluous, it will be overridden
     // by the sizer in any case.
-    m_canvas = new MyCanvas( this, -1, wxPoint(0,0), wxSize(100,100) );
+    m_canvas = new MyCanvas( this, wxID_ANY, wxPoint(0,0), wxSize(100,100) );
 
     // This is done with ScrollRate/VirtualSize in MyCanvas ctor now,
     // both should produce identical results.
@@ -485,20 +485,20 @@ void MyFrame::OnDeleteAll( wxCommandEvent &WXUNUSED(event) )
 
 void MyFrame::OnInsertNew( wxCommandEvent &WXUNUSED(event) )
 {
-    (void)new wxButton( m_canvas, -1, _T("Hello"), wxPoint(100,100) );
+    (void)new wxButton( m_canvas, wxID_ANY, _T("Hello"), wxPoint(100,100) );
 }
 
 void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) )
 {
-  Close( TRUE );
+  Close( true );
 }
 
 void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
 {
-  (void)wxMessageBox( _T("wxScroll demo\n"
-                         "Robert Roebling (c) 1998\n"
-                         "Autoscrolling examples\n"
-                         "Ron Lee (c) 2002"),
+  (void)wxMessageBox( _T("wxScroll demo\n")
+                      _T("Robert Roebling (c) 1998\n")
+                      _T("Autoscrolling examples\n")
+                      _T("Ron Lee (c) 2002"),
                       _T("About wxScroll Demo"),
                       wxICON_INFORMATION | wxOK );
 }
@@ -510,9 +510,9 @@ void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
 bool MyApp::OnInit()
 {
   wxFrame *frame = new MyFrame();
-  frame->Show( TRUE );
+  frame->Show( true );
 
-  return TRUE;
+  return true;
 }
 
 // ----------------------------------------------------------------------------
index a56b9d8a111be3d1d220fd36922289f88e665c38..fc9864f45c56faa483166e7b526ef4cb83f9cdba 100644 (file)
@@ -146,10 +146,10 @@ MyScrolledWindow::MyScrolledWindow( wxWindow *parent, wxWindowID id,
                     const wxPoint &pos, const wxSize &size )
         : wxScrolledWindow( parent, id, pos, size, wxSUNKEN_BORDER, _T("test canvas") )
 {
-    MyTopLabels *top = new MyTopLabels( this, -1, wxDefaultPosition, wxSize(-1,25) );
-    MyRightLabels *right = new MyRightLabels( this, -1, wxDefaultPosition, wxSize(60,-1) );
+    MyTopLabels *top = new MyTopLabels( this, wxID_ANY, wxDefaultPosition, wxSize(wxDefaultSize.x,25) );
+    MyRightLabels *right = new MyRightLabels( this, wxID_ANY, wxDefaultPosition, wxSize(60,wxDefaultSize.y) );
 
-    m_canvas = new MyCanvas( this, top, right, -1, wxDefaultPosition, wxDefaultSize );
+    m_canvas = new MyCanvas( this, top, right, wxID_ANY, wxDefaultPosition, wxDefaultSize );
 
     SetTargetWindow( m_canvas );
 
@@ -171,7 +171,7 @@ MyScrolledWindow::MyScrolledWindow( wxWindow *parent, wxWindowID id,
 
     mainsizer->Add( middlesizer, 1, wxEXPAND );
 
-    SetAutoLayout( TRUE );
+    SetAutoLayout( true );
     SetSizer( mainsizer );
 }
 
@@ -280,14 +280,14 @@ MyCanvas::MyCanvas( wxScrolledWindow *parent, MyTopLabels *top, MyRightLabels *r
     m_topLabels = top;
     m_rightLabels = right;
 
-    (void)new wxButton( this, -1, _T("Hallo I"), wxPoint(0,50), wxSize(100,25) );
-    (void)new wxButton( this, -1, _T("Hallo II"), wxPoint(200,50), wxSize(100,25) );
+    (void)new wxButton( this, wxID_ANY, _T("Hallo I"), wxPoint(0,50), wxSize(100,25) );
+    (void)new wxButton( this, wxID_ANY, _T("Hallo II"), wxPoint(200,50), wxSize(100,25) );
 
-    (void)new wxTextCtrl( this, -1, _T("Text I"), wxPoint(0,100), wxSize(100,25) );
-    (void)new wxTextCtrl( this, -1, _T("Text II"), wxPoint(200,100), wxSize(100,25) );
+    (void)new wxTextCtrl( this, wxID_ANY, _T("Text I"), wxPoint(0,100), wxSize(100,25) );
+    (void)new wxTextCtrl( this, wxID_ANY, _T("Text II"), wxPoint(200,100), wxSize(100,25) );
 
-    (void)new wxComboBox( this, -1, _T("ComboBox I"), wxPoint(0,150), wxSize(100,25));
-    (void)new wxComboBox( this, -1, _T("ComboBox II"), wxPoint(200,150), wxSize(100,25));
+    (void)new wxComboBox( this, wxID_ANY, _T("ComboBox I"), wxPoint(0,150), wxSize(100,25));
+    (void)new wxComboBox( this, wxID_ANY, _T("ComboBox II"), wxPoint(200,150), wxSize(100,25));
 
     SetBackgroundColour( wxT("WHEAT") );
 
@@ -378,7 +378,7 @@ BEGIN_EVENT_TABLE(MyFrame,wxFrame)
 END_EVENT_TABLE()
 
 MyFrame::MyFrame()
-       : wxFrame( (wxFrame *)NULL, -1, _T("wxScrolledWindow sample"),
+       : wxFrame( (wxFrame *)NULL, wxID_ANY, _T("wxScrolledWindow sample"),
                   wxPoint(20,20), wxSize(470,500) )
 {
     wxMenu *file_menu = new wxMenu();
@@ -395,10 +395,10 @@ MyFrame::MyFrame()
     int widths[] = { -1, 100 };
     SetStatusWidths( 2, widths );
 
-    m_scrolled = new MyScrolledWindow( this, -1, wxDefaultPosition, wxSize(100,100) );
+    m_scrolled = new MyScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxSize(100,100) );
     m_scrolled->SetScrollbars( 10, 10, 50, 50 );
 
-    m_log = new wxTextCtrl( this, -1, _T("This is the log window.\n"), wxPoint(0,0), wxSize(100,100), wxTE_MULTILINE );
+    m_log = new wxTextCtrl( this, wxID_ANY, _T("This is the log window.\n"), wxPoint(0,0), wxSize(100,100), wxTE_MULTILINE );
     wxLog *old_log = wxLog::SetActiveTarget( new wxLogTextCtrl( m_log ) );
     delete old_log;
 
@@ -406,13 +406,13 @@ MyFrame::MyFrame()
     topsizer->Add( m_scrolled, 1, wxEXPAND );
     topsizer->Add( m_log, 0, wxEXPAND );
 
-    SetAutoLayout( TRUE );
+    SetAutoLayout( true );
     SetSizer( topsizer );
 }
 
 void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) )
 {
-  Close( TRUE );
+  Close( true );
 }
 
 void MyFrame::OnFullScreen( wxCommandEvent &WXUNUSED(event) )
@@ -434,8 +434,8 @@ void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
 bool MyApp::OnInit()
 {
     wxFrame *frame = new MyFrame();
-    frame->Show( TRUE );
+    frame->Show( true );
 
-    return TRUE;
+    return true;
 }
 
index ceebc8c6f02e5af7126f0da963f44bddebd1d632..5ade1330a7328642c77024c8c69b1c3f54180e18 100644 (file)
@@ -134,13 +134,13 @@ bool MyApp::OnInit()
 
     // Create the main application window
     ShapedFrame *frame = new ShapedFrame();
-    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;
 }
 
 // ----------------------------------------------------------------------------
@@ -149,7 +149,7 @@ bool MyApp::OnInit()
 
 // frame constructor
 ShapedFrame::ShapedFrame()
-       : wxFrame((wxFrame *)NULL, -1, wxEmptyString,
+       : wxFrame((wxFrame *)NULL, wxID_ANY, wxEmptyString,
                   wxDefaultPosition, wxSize(100, 100), //wxDefaultSize,
                   0
                   | wxFRAME_SHAPED
@@ -158,7 +158,7 @@ ShapedFrame::ShapedFrame()
                   | wxSTAY_ON_TOP
             )
 {
-    m_hasShape = FALSE;
+    m_hasShape = false;
     m_bmp = wxBitmap(_T("star.png"), wxBITMAP_TYPE_PNG);
     SetSize(wxSize(m_bmp.GetWidth(), m_bmp.GetHeight()));
 #ifndef __WXMAC__
@@ -188,7 +188,7 @@ void ShapedFrame::OnDoubleClick(wxMouseEvent& WXUNUSED(evt))
     {
         wxRegion region;
         SetShape(region);
-        m_hasShape = FALSE;
+        m_hasShape = false;
     }
     else
         SetWindowShape();
@@ -233,7 +233,7 @@ void ShapedFrame::OnExit(wxMouseEvent& WXUNUSED(evt))
 void ShapedFrame::OnPaint(wxPaintEvent& WXUNUSED(evt))
 {
     wxPaintDC dc(this);
-    dc.DrawBitmap(m_bmp, 0, 0, TRUE);
+    dc.DrawBitmap(m_bmp, 0, 0, true);
 }
 
 void ShapedFrame::OnWindowCreate(wxWindowCreateEvent& WXUNUSED(evt))
index e450f4fd9d339de6c89eb74a98cf93253214b560..9ca5518df842ae4c3479b28a98887c897b447088 100644 (file)
@@ -157,11 +157,11 @@ bool MyApp::OnInit()
   MyFrame *frame = new MyFrame();
 
   // Show it and tell the application that it's our main window
-  frame->Show(TRUE);
+  frame->Show(true);
   SetTopWindow(frame);
 
   // success
-  return TRUE;
+  return true;
 }
 
 // --------------------------------------------------------------------------
@@ -169,7 +169,7 @@ bool MyApp::OnInit()
 // --------------------------------------------------------------------------
 
 // frame constructor
-MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, -1,
+MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, wxID_ANY,
                              _("wxSocket demo: Client"),
                              wxDefaultPosition, wxSize(300, 200))
 {
@@ -209,7 +209,7 @@ MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, -1,
   CreateStatusBar(2);
 
   // Make a textctrl for logging
-  m_text  = new wxTextCtrl(this, -1,
+  m_text  = new wxTextCtrl(this, wxID_ANY,
                            _("Welcome to wxSocket demo: Client\nClient ready\n"),
                            wxDefaultPosition, wxDefaultSize,
                            wxTE_MULTILINE | wxTE_READONLY);
@@ -222,9 +222,9 @@ MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, -1,
   m_sock->SetNotify(wxSOCKET_CONNECTION_FLAG |
                     wxSOCKET_INPUT_FLAG |
                     wxSOCKET_LOST_FLAG);
-  m_sock->Notify(TRUE);
+  m_sock->Notify(true);
 
-  m_busy = FALSE;
+  m_busy = false;
   UpdateStatusBar();
 }
 
@@ -238,8 +238,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))
@@ -253,8 +253,8 @@ void MyFrame::OnOpenConnection(wxCommandEvent& WXUNUSED(event))
 {
   wxIPV4address addr;
 
-  m_menuSocket->Enable(CLIENT_OPEN, FALSE);
-  m_menuSocket->Enable(CLIENT_CLOSE, FALSE);
+  m_menuSocket->Enable(CLIENT_OPEN, false);
+  m_menuSocket->Enable(CLIENT_CLOSE, false);
 
   // Ask user for server address
   wxString hostname = wxGetTextFromUser(
@@ -271,21 +271,21 @@ void MyFrame::OnOpenConnection(wxCommandEvent& WXUNUSED(event))
   // There are two ways to use Connect(): blocking and non-blocking,
   // depending on the value passed as the 'wait' (2nd) parameter.
   //
-  // Connect(addr, TRUE) will wait until the connection completes,
-  // returning TRUE on success and FALSE on failure. This call blocks
+  // Connect(addr, true) will wait until the connection completes,
+  // returning true on success and false on failure. This call blocks
   // the GUI (this might be changed in future releases to honour the
   // wxSOCKET_BLOCK flag).
   //
-  // Connect(addr, FALSE) will issue a nonblocking connection request
-  // and return immediately. If the return value is TRUE, then the
+  // Connect(addr, false) will issue a nonblocking connection request
+  // and return immediately. If the return value is true, then the
   // connection has been already succesfully established. If it is
-  // FALSE, you must wait for the request to complete, either with
+  // false, you must wait for the request to complete, either with
   // WaitOnConnect() or by watching wxSOCKET_CONNECTION / LOST
   // events (please read the documentation).
   //
   // WaitOnConnect() itself never blocks the GUI (this might change
   // in the future to honour the wxSOCKET_BLOCK flag). This call will
-  // return FALSE on timeout, or TRUE if the connection request
+  // return false on timeout, or true if the connection request
   // completes, which in turn might mean:
   //
   //   a) That the connection was successfully established
@@ -298,13 +298,13 @@ void MyFrame::OnOpenConnection(wxCommandEvent& WXUNUSED(event))
   //
   // For blocking Connect:
   //
-  //   bool success = client->Connect(addr, TRUE);
+  //   bool success = client->Connect(addr, true);
   //
   // For nonblocking Connect:
   //
-  //   client->Connect(addr, FALSE);
+  //   client->Connect(addr, false);
   //
-  //   bool waitmore = TRUE;
+  //   bool waitmore = true;
   //   while (! client->WaitOnConnect(seconds, millis) && waitmore )
   //   {
   //     // possibly give some feedback to the user,
@@ -315,7 +315,7 @@ void MyFrame::OnOpenConnection(wxCommandEvent& WXUNUSED(event))
   // And that's all :-)
 
   m_text->AppendText(_("\nTrying to connect (timeout = 10 sec) ...\n"));
-  m_sock->Connect(addr, FALSE);
+  m_sock->Connect(addr, false);
   m_sock->WaitOnConnect(10);
 
   if (m_sock->IsConnected())
@@ -337,7 +337,7 @@ void MyFrame::OnTest1(wxCommandEvent& WXUNUSED(event))
   unsigned char len;
 
   // Disable socket menu entries (exception: Close Session)
-  m_busy = TRUE;
+  m_busy = true;
   UpdateStatusBar();
 
   m_text->AppendText(_("\n=== Test 1 begins ===\n"));
@@ -387,7 +387,7 @@ void MyFrame::OnTest1(wxCommandEvent& WXUNUSED(event))
   m_text->AppendText(_("=== Test 1 ends ===\n"));
 
   delete[] buf2;
-  m_busy = FALSE;
+  m_busy = false;
   UpdateStatusBar();
 }
 
@@ -398,7 +398,7 @@ void MyFrame::OnTest2(wxCommandEvent& WXUNUSED(event))
   size_t len;
 
   // Disable socket menu entries (exception: Close Session)
-  m_busy = TRUE;
+  m_busy = true;
   UpdateStatusBar();
 
   m_text->AppendText(_("\n=== Test 2 begins ===\n"));
@@ -456,7 +456,7 @@ void MyFrame::OnTest2(wxCommandEvent& WXUNUSED(event))
   m_text->AppendText(_("=== Test 2 ends ===\n"));
 
   delete[] msg2;
-  m_busy = FALSE;
+  m_busy = false;
   UpdateStatusBar();
 }
 
@@ -467,7 +467,7 @@ void MyFrame::OnTest3(wxCommandEvent& WXUNUSED(event))
   unsigned char len;
 
   // Disable socket menu entries (exception: Close Session)
-  m_busy = TRUE;
+  m_busy = true;
   UpdateStatusBar();
 
   m_text->AppendText(_("\n=== Test 3 begins ===\n"));
@@ -514,7 +514,7 @@ void MyFrame::OnTest3(wxCommandEvent& WXUNUSED(event))
   m_text->AppendText(_("=== Test 3 ends ===\n"));
 
   delete[] buf2;
-  m_busy = FALSE;
+  m_busy = false;
   UpdateStatusBar();
 }
 
index 39245c3e6db9727fafd1c7a37a97f6069c12b587..b90dc2643c5259895ee85a1a562ecc982d06ebbb 100644 (file)
@@ -132,11 +132,11 @@ bool MyApp::OnInit()
   MyFrame *frame = new MyFrame();
 
   // Show it and tell the application that it's our main window
-  frame->Show(TRUE);
+  frame->Show(true);
   SetTopWindow(frame);
 
   // Success
-  return TRUE;
+  return true;
 }
 
 // --------------------------------------------------------------------------
@@ -145,7 +145,7 @@ bool MyApp::OnInit()
 
 // frame constructor
 
-MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, -1,
+MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, wxID_ANY,
                              _("wxSocket demo: Server"),
                              wxDefaultPosition, wxSize(300, 200))
 {
@@ -167,7 +167,7 @@ MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, -1,
   CreateStatusBar(2);
 
   // Make a textctrl for logging
-  m_text  = new wxTextCtrl(this, -1,
+  m_text  = new wxTextCtrl(this, wxID_ANY,
                            _("Welcome to wxSocket demo: Server\n"),
                            wxDefaultPosition, wxDefaultSize,
                            wxTE_MULTILINE | wxTE_READONLY);
@@ -193,9 +193,9 @@ MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, -1,
   // Setup the event handler and subscribe to connection events
   m_server->SetEventHandler(*this, SERVER_ID);
   m_server->SetNotify(wxSOCKET_CONNECTION_FLAG);
-  m_server->Notify(TRUE);
+  m_server->Notify(true);
 
-  m_busy = FALSE;
+  m_busy = false;
   m_numClients = 0;
   UpdateStatusBar();
 }
@@ -210,8 +210,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))
@@ -320,11 +320,11 @@ void MyFrame::OnServerEvent(wxSocketEvent& event)
   m_text->AppendText(s);
 
   // Accept new connection if there is one in the pending
-  // connections queue, else exit. We use Accept(FALSE) for
+  // connections queue, else exit. We use Accept(false) for
   // non-blocking accept (although if we got here, there
   // should ALWAYS be a pending connection).
 
-  sock = m_server->Accept(FALSE);
+  sock = m_server->Accept(false);
 
   if (sock)
   {
@@ -338,7 +338,7 @@ void MyFrame::OnServerEvent(wxSocketEvent& event)
 
   sock->SetEventHandler(*this, SOCKET_ID);
   sock->SetNotify(wxSOCKET_INPUT_FLAG | wxSOCKET_LOST_FLAG);
-  sock->Notify(TRUE);
+  sock->Notify(true);
 
   m_numClients++;
   UpdateStatusBar();