-1->wxID_ANY, TRUE->true and FALSE->false replacements.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27585 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-06-02 17:03:20 +00:00
parent ba44343285
commit b62ca03d6f
9 changed files with 125 additions and 125 deletions

View File

@@ -99,7 +99,7 @@ bool MyApp::OnInit()
wxICON_ERROR | wxYES_NO | wxCANCEL ) != wxYES ) wxICON_ERROR | wxYES_NO | wxCANCEL ) != wxYES )
{ {
// no server // no server
return FALSE; return false;
} }
the_connection = (MyConnection *)my_client->MakeConnection(hostName, service, _T("IPC TEST")); 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")); wxMessageBox(_T("StartAdvise failed"), _T("Client Demo Error"));
// Create the main frame window // 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() int MyApp::OnExit()
@@ -131,7 +131,7 @@ int MyApp::OnExit()
// Define my frame constructor // Define my frame constructor
MyFrame::MyFrame(wxFrame *frame, const wxString& title) 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 // Give it an icon
SetIcon(wxICON(mondrian)); SetIcon(wxICON(mondrian));
@@ -201,10 +201,10 @@ bool MyConnection::OnAdvise(const wxString& WXUNUSED(topic), const wxString& WXU
if (the_list) if (the_list)
{ {
int n = the_list->FindString(data); int n = the_list->FindString(data);
if (n > -1) if (n > wxNOT_FOUND)
the_list->SetSelection(n); the_list->SetSelection(n);
} }
return TRUE; return true;
} }
bool MyConnection::OnDisconnect() bool MyConnection::OnDisconnect()

View File

@@ -70,7 +70,7 @@ MyConnection *the_connection = NULL;
bool MyApp::OnInit() bool MyApp::OnInit()
{ {
// Create the main frame window // 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) // service name (DDE classes) or port number (TCP/IP based classes)
wxString service = IPC_SERVICE; wxString service = IPC_SERVICE;
@@ -82,7 +82,7 @@ bool MyApp::OnInit()
m_server = new MyServer; m_server = new MyServer;
m_server->Create(service); m_server->Create(service);
return TRUE; return true;
} }
int MyApp::OnExit() int MyApp::OnExit()
@@ -98,7 +98,7 @@ int MyApp::OnExit()
// Define my frame constructor // Define my frame constructor
MyFrame::MyFrame(wxFrame *frame, const wxString& title) 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(); CreateStatusBar();
@@ -145,7 +145,7 @@ void MyFrame::OnListBoxClick(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnExit(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, IPCDialogBox::IPCDialogBox(wxWindow *parent, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
MyConnection *connection) MyConnection *connection)
: wxDialog(parent, -1, title, pos, size) : wxDialog(parent, wxID_ANY, title, pos, size)
{ {
m_connection = connection; m_connection = connection;
(void)new wxButton(this, SERVER_QUIT_BUTTON, _T("Quit this 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"), dialog = new IPCDialogBox(wxTheApp->GetTopWindow(), _T("Connection"),
wxPoint(100, 100), wxSize(500, 500), this); wxPoint(100, 100), wxSize(500, 500), this);
dialog->Show(TRUE); dialog->Show(true);
the_connection = this; the_connection = this;
} }
@@ -222,7 +222,7 @@ bool MyConnection::OnExecute(const wxString& WXUNUSED(topic),
wxIPCFormat WXUNUSED(format)) wxIPCFormat WXUNUSED(format))
{ {
wxLogStatus(wxT("Execute command: %s"), data); wxLogStatus(wxT("Execute command: %s"), data);
return TRUE; return true;
} }
bool MyConnection::OnPoke(const wxString& WXUNUSED(topic), bool MyConnection::OnPoke(const wxString& WXUNUSED(topic),
@@ -232,7 +232,7 @@ bool MyConnection::OnPoke(const wxString& WXUNUSED(topic),
wxIPCFormat WXUNUSED(format)) wxIPCFormat WXUNUSED(format))
{ {
wxLogStatus(wxT("Poke command: %s = %s"), item.c_str(), data); wxLogStatus(wxT("Poke command: %s = %s"), item.c_str(), data);
return TRUE; return true;
} }
wxChar *MyConnection::OnRequest(const wxString& WXUNUSED(topic), 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), bool MyConnection::OnStartAdvise(const wxString& WXUNUSED(topic),
const wxString& WXUNUSED(item)) const wxString& WXUNUSED(item))
{ {
return TRUE; return true;
} }

View File

@@ -124,13 +124,13 @@ bool MyApp::OnInit()
// Show it and tell the application that it's our main window // Show it and tell the application that it's our main window
// @@@ what does it do exactly, in fact? is it necessary here? // @@@ what does it do exactly, in fact? is it necessary here?
frame->Show(TRUE); frame->Show(true);
SetTopWindow(frame); SetTopWindow(frame);
// success: wxApp::OnRun() will be called which will enter the main message // 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. // application would exit immediately.
return TRUE; return true;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -139,7 +139,7 @@ bool MyApp::OnInit()
// frame constructor // frame constructor
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) 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 // set the frame icon
SetIcon(wxICON(mondrian)); SetIcon(wxICON(mondrian));
@@ -165,11 +165,11 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
#define AddLine(orient) \ #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) 0, wxEXPAND)
#define AddButton(label,align) Add( \ #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) 1, wxSHAPED | align)
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); 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 // sizer that preserves it's shape
wxBoxSizer *vsizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer *vsizer = new wxBoxSizer( wxVERTICAL );
vsizer->Add( 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); 1, wxEXPAND);
vsizer->Add( 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); 1, wxEXPAND);
hsizer2->Add(vsizer, 1, wxSHAPED | wxALIGN_CENTER); 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)) void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{ {
// TRUE is to force the frame to close // true is to force the frame to close
Close(TRUE); Close(true);
} }
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))

View File

@@ -99,19 +99,19 @@ bool MyApp::OnInit()
{ {
wxLogError(wxT("Can't load the test image, please copy it to the ") wxLogError(wxT("Can't load the test image, please copy it to the ")
wxT("program directory")); wxT("program directory"));
return FALSE; return false;
} }
MyFrame *frame = new MyFrame (_T("wxWidgets rotate sample"), MyFrame *frame = new MyFrame (_T("wxWidgets rotate sample"),
wxPoint(20,20), wxSize(600,450)); wxPoint(20,20), wxSize(600,450));
frame->Show (TRUE); frame->Show (true);
SetTopWindow (frame); SetTopWindow (frame);
return TRUE; return true;
} }
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) 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; m_angle = 0.1;
@@ -143,11 +143,11 @@ void MyFrame::OnAngle (wxCommandEvent &)
void MyFrame::OnQuit (wxCommandEvent &) void MyFrame::OnQuit (wxCommandEvent &)
{ {
Close (TRUE); Close (true);
} }
MyCanvas::MyCanvas(wxWindow* parent): MyCanvas::MyCanvas(wxWindow* parent):
wxScrolledWindow(parent, -1) wxScrolledWindow(parent, wxID_ANY)
{ {
SetBackgroundColour (wxColour (0,80,60)); SetBackgroundColour (wxColour (0,80,60));
ClearBackground(); ClearBackground();
@@ -160,12 +160,12 @@ void MyCanvas::OnMouseLeftUp (wxMouseEvent & event)
wxPoint offset; wxPoint offset;
const wxImage& img = wxGetApp().GetImage(); 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); wxBitmap bmp(img2);
wxClientDC dc (this); 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 // without interpolation, and without offset correction
@@ -174,10 +174,10 @@ void MyCanvas::OnMouseRightUp (wxMouseEvent & event)
MyFrame* frame = (MyFrame*) GetParent(); MyFrame* frame = (MyFrame*) GetParent();
const wxImage& img = wxGetApp().GetImage(); 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); wxBitmap bmp(img2);
wxClientDC dc (this); wxClientDC dc (this);
dc.DrawBitmap (bmp, event.m_x, event.m_y, TRUE); dc.DrawBitmap (bmp, event.m_x, event.m_y, true);
} }

View File

@@ -109,7 +109,7 @@ public:
MyScrolledWindowDumb(wxWindow *parent) : MyScrolledWindowBase(parent) MyScrolledWindowDumb(wxWindow *parent) : MyScrolledWindowBase(parent)
{ {
// no horz scrolling // 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); 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) ); 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( 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 ); wxLC_REPORT | wxSIMPLE_BORDER | wxLC_SINGLE_SEL );
m_listCtrl->InsertColumn(0, "First", wxLIST_FORMAT_LEFT, 90); 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 ); 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 #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") ); test->SetBackgroundColour( wxT("WHEAT") );
#if 0 #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->SetBackgroundColour( wxT("WHEAT") );
test->SetCursor( wxCursor( wxCURSOR_NO_ENTRY ) ); 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 ) ); 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->SetBackgroundColour( wxT("WHEAT") );
test->SetCursor( wxCursor( wxCURSOR_PENCIL ) ); 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 ) ); test2->SetCursor( wxCursor( wxCURSOR_NO_ENTRY ) );
#endif #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 ); wxLogMessage( wxT("Mouse down event at: %d %d, scrolled: %d %d"), pt.x, pt.y, x, y );
if ( !event.LeftIsDown() ) 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() ); wxWindow *win = FindWindow( event.GetId() );
wxPoint pt( win->GetPosition() ); wxPoint pt( win->GetPosition() );
wxLogMessage( wxT("-> Position before move is %d %d"), pt.x, pt.y ); 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(); pt = win->GetPosition();
wxLogMessage( wxT("-> Position after move is %d %d"), pt.x, pt.y ); 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, wxALIGN_CENTER | wxALL | wxADJUST_MINSIZE,
20 ); 20 );
innersizer->Add( new wxStaticText( this, -1, _T("This is just") ), innersizer->Add( new wxStaticText( this, wxID_ANY, _T("This is just") ),
0, 0,
wxALIGN_CENTER ); wxALIGN_CENTER );
innersizer->Add( new wxStaticText( this, -1, _T("some decoration") ), innersizer->Add( new wxStaticText( this, wxID_ANY, _T("some decoration") ),
0, 0,
wxALIGN_CENTER ); 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, 0,
wxALIGN_CENTER ); wxALIGN_CENTER );
@@ -439,7 +439,7 @@ BEGIN_EVENT_TABLE(MyFrame,wxFrame)
END_EVENT_TABLE() END_EVENT_TABLE()
MyFrame::MyFrame() MyFrame::MyFrame()
: wxFrame( (wxFrame *)NULL, -1, _T("wxScrolledWindow sample"), : wxFrame( (wxFrame *)NULL, wxID_ANY, _T("wxScrolledWindow sample"),
wxPoint(20,20), wxSize(470,500) ) wxPoint(20,20), wxSize(470,500) )
{ {
wxMenu *file_menu = new wxMenu(); wxMenu *file_menu = new wxMenu();
@@ -461,7 +461,7 @@ MyFrame::MyFrame()
// Setting an explicit size here is superfluous, it will be overridden // Setting an explicit size here is superfluous, it will be overridden
// by the sizer in any case. // 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, // This is done with ScrollRate/VirtualSize in MyCanvas ctor now,
// both should produce identical results. // both should produce identical results.
@@ -485,20 +485,20 @@ void MyFrame::OnDeleteAll( wxCommandEvent &WXUNUSED(event) )
void MyFrame::OnInsertNew( 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) ) void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) )
{ {
Close( TRUE ); Close( true );
} }
void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) ) void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
{ {
(void)wxMessageBox( _T("wxScroll demo\n" (void)wxMessageBox( _T("wxScroll demo\n")
"Robert Roebling (c) 1998\n" _T("Robert Roebling (c) 1998\n")
"Autoscrolling examples\n" _T("Autoscrolling examples\n")
"Ron Lee (c) 2002"), _T("Ron Lee (c) 2002"),
_T("About wxScroll Demo"), _T("About wxScroll Demo"),
wxICON_INFORMATION | wxOK ); wxICON_INFORMATION | wxOK );
} }
@@ -510,9 +510,9 @@ void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
bool MyApp::OnInit() bool MyApp::OnInit()
{ {
wxFrame *frame = new MyFrame(); wxFrame *frame = new MyFrame();
frame->Show( TRUE ); frame->Show( true );
return TRUE; return true;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -146,10 +146,10 @@ MyScrolledWindow::MyScrolledWindow( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size ) const wxPoint &pos, const wxSize &size )
: wxScrolledWindow( parent, id, pos, size, wxSUNKEN_BORDER, _T("test canvas") ) : wxScrolledWindow( parent, id, pos, size, wxSUNKEN_BORDER, _T("test canvas") )
{ {
MyTopLabels *top = new MyTopLabels( this, -1, wxDefaultPosition, wxSize(-1,25) ); MyTopLabels *top = new MyTopLabels( this, wxID_ANY, wxDefaultPosition, wxSize(wxDefaultSize.x,25) );
MyRightLabels *right = new MyRightLabels( this, -1, wxDefaultPosition, wxSize(60,-1) ); 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 ); SetTargetWindow( m_canvas );
@@ -171,7 +171,7 @@ MyScrolledWindow::MyScrolledWindow( wxWindow *parent, wxWindowID id,
mainsizer->Add( middlesizer, 1, wxEXPAND ); mainsizer->Add( middlesizer, 1, wxEXPAND );
SetAutoLayout( TRUE ); SetAutoLayout( true );
SetSizer( mainsizer ); SetSizer( mainsizer );
} }
@@ -280,14 +280,14 @@ MyCanvas::MyCanvas( wxScrolledWindow *parent, MyTopLabels *top, MyRightLabels *r
m_topLabels = top; m_topLabels = top;
m_rightLabels = right; m_rightLabels = right;
(void)new wxButton( this, -1, _T("Hallo I"), wxPoint(0,50), wxSize(100,25) ); (void)new wxButton( this, wxID_ANY, _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 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, wxID_ANY, _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 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, wxID_ANY, _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 II"), wxPoint(200,150), wxSize(100,25));
SetBackgroundColour( wxT("WHEAT") ); SetBackgroundColour( wxT("WHEAT") );
@@ -378,7 +378,7 @@ BEGIN_EVENT_TABLE(MyFrame,wxFrame)
END_EVENT_TABLE() END_EVENT_TABLE()
MyFrame::MyFrame() MyFrame::MyFrame()
: wxFrame( (wxFrame *)NULL, -1, _T("wxScrolledWindow sample"), : wxFrame( (wxFrame *)NULL, wxID_ANY, _T("wxScrolledWindow sample"),
wxPoint(20,20), wxSize(470,500) ) wxPoint(20,20), wxSize(470,500) )
{ {
wxMenu *file_menu = new wxMenu(); wxMenu *file_menu = new wxMenu();
@@ -395,10 +395,10 @@ MyFrame::MyFrame()
int widths[] = { -1, 100 }; int widths[] = { -1, 100 };
SetStatusWidths( 2, widths ); 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_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 ) ); wxLog *old_log = wxLog::SetActiveTarget( new wxLogTextCtrl( m_log ) );
delete old_log; delete old_log;
@@ -406,13 +406,13 @@ MyFrame::MyFrame()
topsizer->Add( m_scrolled, 1, wxEXPAND ); topsizer->Add( m_scrolled, 1, wxEXPAND );
topsizer->Add( m_log, 0, wxEXPAND ); topsizer->Add( m_log, 0, wxEXPAND );
SetAutoLayout( TRUE ); SetAutoLayout( true );
SetSizer( topsizer ); SetSizer( topsizer );
} }
void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) ) void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) )
{ {
Close( TRUE ); Close( true );
} }
void MyFrame::OnFullScreen( wxCommandEvent &WXUNUSED(event) ) void MyFrame::OnFullScreen( wxCommandEvent &WXUNUSED(event) )
@@ -434,8 +434,8 @@ void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
bool MyApp::OnInit() bool MyApp::OnInit()
{ {
wxFrame *frame = new MyFrame(); wxFrame *frame = new MyFrame();
frame->Show( TRUE ); frame->Show( true );
return TRUE; return true;
} }

View File

@@ -134,13 +134,13 @@ bool MyApp::OnInit()
// Create the main application window // Create the main application window
ShapedFrame *frame = new ShapedFrame(); ShapedFrame *frame = new ShapedFrame();
frame->Show(TRUE); frame->Show(true);
SetTopWindow(frame); SetTopWindow(frame);
// success: wxApp::OnRun() will be called which will enter the main message // 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. // application would exit immediately.
return TRUE; return true;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -149,7 +149,7 @@ bool MyApp::OnInit()
// frame constructor // frame constructor
ShapedFrame::ShapedFrame() ShapedFrame::ShapedFrame()
: wxFrame((wxFrame *)NULL, -1, wxEmptyString, : wxFrame((wxFrame *)NULL, wxID_ANY, wxEmptyString,
wxDefaultPosition, wxSize(100, 100), //wxDefaultSize, wxDefaultPosition, wxSize(100, 100), //wxDefaultSize,
0 0
| wxFRAME_SHAPED | wxFRAME_SHAPED
@@ -158,7 +158,7 @@ ShapedFrame::ShapedFrame()
| wxSTAY_ON_TOP | wxSTAY_ON_TOP
) )
{ {
m_hasShape = FALSE; m_hasShape = false;
m_bmp = wxBitmap(_T("star.png"), wxBITMAP_TYPE_PNG); m_bmp = wxBitmap(_T("star.png"), wxBITMAP_TYPE_PNG);
SetSize(wxSize(m_bmp.GetWidth(), m_bmp.GetHeight())); SetSize(wxSize(m_bmp.GetWidth(), m_bmp.GetHeight()));
#ifndef __WXMAC__ #ifndef __WXMAC__
@@ -188,7 +188,7 @@ void ShapedFrame::OnDoubleClick(wxMouseEvent& WXUNUSED(evt))
{ {
wxRegion region; wxRegion region;
SetShape(region); SetShape(region);
m_hasShape = FALSE; m_hasShape = false;
} }
else else
SetWindowShape(); SetWindowShape();
@@ -233,7 +233,7 @@ void ShapedFrame::OnExit(wxMouseEvent& WXUNUSED(evt))
void ShapedFrame::OnPaint(wxPaintEvent& WXUNUSED(evt)) void ShapedFrame::OnPaint(wxPaintEvent& WXUNUSED(evt))
{ {
wxPaintDC dc(this); wxPaintDC dc(this);
dc.DrawBitmap(m_bmp, 0, 0, TRUE); dc.DrawBitmap(m_bmp, 0, 0, true);
} }
void ShapedFrame::OnWindowCreate(wxWindowCreateEvent& WXUNUSED(evt)) void ShapedFrame::OnWindowCreate(wxWindowCreateEvent& WXUNUSED(evt))

View File

@@ -157,11 +157,11 @@ bool MyApp::OnInit()
MyFrame *frame = new MyFrame(); MyFrame *frame = new MyFrame();
// Show it and tell the application that it's our main window // Show it and tell the application that it's our main window
frame->Show(TRUE); frame->Show(true);
SetTopWindow(frame); SetTopWindow(frame);
// success // success
return TRUE; return true;
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -169,7 +169,7 @@ bool MyApp::OnInit()
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// frame constructor // frame constructor
MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, -1, MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, wxID_ANY,
_("wxSocket demo: Client"), _("wxSocket demo: Client"),
wxDefaultPosition, wxSize(300, 200)) wxDefaultPosition, wxSize(300, 200))
{ {
@@ -209,7 +209,7 @@ MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, -1,
CreateStatusBar(2); CreateStatusBar(2);
// Make a textctrl for logging // 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"), _("Welcome to wxSocket demo: Client\nClient ready\n"),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE | wxTE_READONLY); wxTE_MULTILINE | wxTE_READONLY);
@@ -222,9 +222,9 @@ MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, -1,
m_sock->SetNotify(wxSOCKET_CONNECTION_FLAG | m_sock->SetNotify(wxSOCKET_CONNECTION_FLAG |
wxSOCKET_INPUT_FLAG | wxSOCKET_INPUT_FLAG |
wxSOCKET_LOST_FLAG); wxSOCKET_LOST_FLAG);
m_sock->Notify(TRUE); m_sock->Notify(true);
m_busy = FALSE; m_busy = false;
UpdateStatusBar(); UpdateStatusBar();
} }
@@ -238,8 +238,8 @@ MyFrame::~MyFrame()
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{ {
// TRUE is to force the frame to close // true is to force the frame to close
Close(TRUE); Close(true);
} }
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
@@ -253,8 +253,8 @@ void MyFrame::OnOpenConnection(wxCommandEvent& WXUNUSED(event))
{ {
wxIPV4address addr; wxIPV4address addr;
m_menuSocket->Enable(CLIENT_OPEN, FALSE); m_menuSocket->Enable(CLIENT_OPEN, false);
m_menuSocket->Enable(CLIENT_CLOSE, FALSE); m_menuSocket->Enable(CLIENT_CLOSE, false);
// Ask user for server address // Ask user for server address
wxString hostname = wxGetTextFromUser( wxString hostname = wxGetTextFromUser(
@@ -271,21 +271,21 @@ void MyFrame::OnOpenConnection(wxCommandEvent& WXUNUSED(event))
// There are two ways to use Connect(): blocking and non-blocking, // There are two ways to use Connect(): blocking and non-blocking,
// depending on the value passed as the 'wait' (2nd) parameter. // depending on the value passed as the 'wait' (2nd) parameter.
// //
// Connect(addr, TRUE) will wait until the connection completes, // Connect(addr, true) will wait until the connection completes,
// returning TRUE on success and FALSE on failure. This call blocks // returning true on success and false on failure. This call blocks
// the GUI (this might be changed in future releases to honour the // the GUI (this might be changed in future releases to honour the
// wxSOCKET_BLOCK flag). // wxSOCKET_BLOCK flag).
// //
// Connect(addr, FALSE) will issue a nonblocking connection request // Connect(addr, false) will issue a nonblocking connection request
// and return immediately. If the return value is TRUE, then the // and return immediately. If the return value is true, then the
// connection has been already succesfully established. If it is // 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 // WaitOnConnect() or by watching wxSOCKET_CONNECTION / LOST
// events (please read the documentation). // events (please read the documentation).
// //
// WaitOnConnect() itself never blocks the GUI (this might change // WaitOnConnect() itself never blocks the GUI (this might change
// in the future to honour the wxSOCKET_BLOCK flag). This call will // 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: // completes, which in turn might mean:
// //
// a) That the connection was successfully established // a) That the connection was successfully established
@@ -298,13 +298,13 @@ void MyFrame::OnOpenConnection(wxCommandEvent& WXUNUSED(event))
// //
// For blocking Connect: // For blocking Connect:
// //
// bool success = client->Connect(addr, TRUE); // bool success = client->Connect(addr, true);
// //
// For nonblocking Connect: // For nonblocking Connect:
// //
// client->Connect(addr, FALSE); // client->Connect(addr, false);
// //
// bool waitmore = TRUE; // bool waitmore = true;
// while (! client->WaitOnConnect(seconds, millis) && waitmore ) // while (! client->WaitOnConnect(seconds, millis) && waitmore )
// { // {
// // possibly give some feedback to the user, // // possibly give some feedback to the user,
@@ -315,7 +315,7 @@ void MyFrame::OnOpenConnection(wxCommandEvent& WXUNUSED(event))
// And that's all :-) // And that's all :-)
m_text->AppendText(_("\nTrying to connect (timeout = 10 sec) ...\n")); m_text->AppendText(_("\nTrying to connect (timeout = 10 sec) ...\n"));
m_sock->Connect(addr, FALSE); m_sock->Connect(addr, false);
m_sock->WaitOnConnect(10); m_sock->WaitOnConnect(10);
if (m_sock->IsConnected()) if (m_sock->IsConnected())
@@ -337,7 +337,7 @@ void MyFrame::OnTest1(wxCommandEvent& WXUNUSED(event))
unsigned char len; unsigned char len;
// Disable socket menu entries (exception: Close Session) // Disable socket menu entries (exception: Close Session)
m_busy = TRUE; m_busy = true;
UpdateStatusBar(); UpdateStatusBar();
m_text->AppendText(_("\n=== Test 1 begins ===\n")); 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")); m_text->AppendText(_("=== Test 1 ends ===\n"));
delete[] buf2; delete[] buf2;
m_busy = FALSE; m_busy = false;
UpdateStatusBar(); UpdateStatusBar();
} }
@@ -398,7 +398,7 @@ void MyFrame::OnTest2(wxCommandEvent& WXUNUSED(event))
size_t len; size_t len;
// Disable socket menu entries (exception: Close Session) // Disable socket menu entries (exception: Close Session)
m_busy = TRUE; m_busy = true;
UpdateStatusBar(); UpdateStatusBar();
m_text->AppendText(_("\n=== Test 2 begins ===\n")); 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")); m_text->AppendText(_("=== Test 2 ends ===\n"));
delete[] msg2; delete[] msg2;
m_busy = FALSE; m_busy = false;
UpdateStatusBar(); UpdateStatusBar();
} }
@@ -467,7 +467,7 @@ void MyFrame::OnTest3(wxCommandEvent& WXUNUSED(event))
unsigned char len; unsigned char len;
// Disable socket menu entries (exception: Close Session) // Disable socket menu entries (exception: Close Session)
m_busy = TRUE; m_busy = true;
UpdateStatusBar(); UpdateStatusBar();
m_text->AppendText(_("\n=== Test 3 begins ===\n")); 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")); m_text->AppendText(_("=== Test 3 ends ===\n"));
delete[] buf2; delete[] buf2;
m_busy = FALSE; m_busy = false;
UpdateStatusBar(); UpdateStatusBar();
} }

View File

@@ -132,11 +132,11 @@ bool MyApp::OnInit()
MyFrame *frame = new MyFrame(); MyFrame *frame = new MyFrame();
// Show it and tell the application that it's our main window // Show it and tell the application that it's our main window
frame->Show(TRUE); frame->Show(true);
SetTopWindow(frame); SetTopWindow(frame);
// Success // Success
return TRUE; return true;
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -145,7 +145,7 @@ bool MyApp::OnInit()
// frame constructor // frame constructor
MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, -1, MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, wxID_ANY,
_("wxSocket demo: Server"), _("wxSocket demo: Server"),
wxDefaultPosition, wxSize(300, 200)) wxDefaultPosition, wxSize(300, 200))
{ {
@@ -167,7 +167,7 @@ MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, -1,
CreateStatusBar(2); CreateStatusBar(2);
// Make a textctrl for logging // Make a textctrl for logging
m_text = new wxTextCtrl(this, -1, m_text = new wxTextCtrl(this, wxID_ANY,
_("Welcome to wxSocket demo: Server\n"), _("Welcome to wxSocket demo: Server\n"),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE | wxTE_READONLY); wxTE_MULTILINE | wxTE_READONLY);
@@ -193,9 +193,9 @@ MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, -1,
// Setup the event handler and subscribe to connection events // Setup the event handler and subscribe to connection events
m_server->SetEventHandler(*this, SERVER_ID); m_server->SetEventHandler(*this, SERVER_ID);
m_server->SetNotify(wxSOCKET_CONNECTION_FLAG); m_server->SetNotify(wxSOCKET_CONNECTION_FLAG);
m_server->Notify(TRUE); m_server->Notify(true);
m_busy = FALSE; m_busy = false;
m_numClients = 0; m_numClients = 0;
UpdateStatusBar(); UpdateStatusBar();
} }
@@ -210,8 +210,8 @@ MyFrame::~MyFrame()
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{ {
// TRUE is to force the frame to close // true is to force the frame to close
Close(TRUE); Close(true);
} }
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
@@ -320,11 +320,11 @@ void MyFrame::OnServerEvent(wxSocketEvent& event)
m_text->AppendText(s); m_text->AppendText(s);
// Accept new connection if there is one in the pending // 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 // non-blocking accept (although if we got here, there
// should ALWAYS be a pending connection). // should ALWAYS be a pending connection).
sock = m_server->Accept(FALSE); sock = m_server->Accept(false);
if (sock) if (sock)
{ {
@@ -338,7 +338,7 @@ void MyFrame::OnServerEvent(wxSocketEvent& event)
sock->SetEventHandler(*this, SOCKET_ID); sock->SetEventHandler(*this, SOCKET_ID);
sock->SetNotify(wxSOCKET_INPUT_FLAG | wxSOCKET_LOST_FLAG); sock->SetNotify(wxSOCKET_INPUT_FLAG | wxSOCKET_LOST_FLAG);
sock->Notify(TRUE); sock->Notify(true);
m_numClients++; m_numClients++;
UpdateStatusBar(); UpdateStatusBar();