wxICON_ERROR | wxYES_NO | wxCANCEL ) != wxYES )
{
// no server
- return FALSE;
+ return false;
}
the_connection = (MyConnection *)my_client->MakeConnection(hostName, service, _T("IPC TEST"));
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()
// 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));
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()
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;
m_server = new MyServer;
m_server->Create(service);
- return TRUE;
+ return true;
}
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();
void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event))
{
- Close(TRUE);
+ Close(true);
}
// ----------------------------------------------------------------------------
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"),
{
dialog = new IPCDialogBox(wxTheApp->GetTopWindow(), _T("Connection"),
wxPoint(100, 100), wxSize(500, 500), this);
- dialog->Show(TRUE);
+ dialog->Show(true);
the_connection = this;
}
wxIPCFormat WXUNUSED(format))
{
wxLogStatus(wxT("Execute command: %s"), data);
- return TRUE;
+ return true;
}
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),
bool MyConnection::OnStartAdvise(const wxString& WXUNUSED(topic),
const wxString& WXUNUSED(item))
{
- return TRUE;
+ return true;
}
// 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;
}
// ----------------------------------------------------------------------------
// 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));
#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 );
// 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);
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))
{
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;
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();
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
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);
}
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);
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);
}
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
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()") );
}
}
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 );
}
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 );
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();
// 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.
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 );
}
bool MyApp::OnInit()
{
wxFrame *frame = new MyFrame();
- frame->Show( TRUE );
+ frame->Show( true );
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
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 );
mainsizer->Add( middlesizer, 1, wxEXPAND );
- SetAutoLayout( TRUE );
+ SetAutoLayout( true );
SetSizer( mainsizer );
}
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") );
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();
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;
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) )
bool MyApp::OnInit()
{
wxFrame *frame = new MyFrame();
- frame->Show( TRUE );
+ frame->Show( true );
- return TRUE;
+ return true;
}
// 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;
}
// ----------------------------------------------------------------------------
// frame constructor
ShapedFrame::ShapedFrame()
- : wxFrame((wxFrame *)NULL, -1, wxEmptyString,
+ : wxFrame((wxFrame *)NULL, wxID_ANY, wxEmptyString,
wxDefaultPosition, wxSize(100, 100), //wxDefaultSize,
0
| wxFRAME_SHAPED
| 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__
{
wxRegion region;
SetShape(region);
- m_hasShape = FALSE;
+ m_hasShape = false;
}
else
SetWindowShape();
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))
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;
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// frame constructor
-MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, -1,
+MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, wxID_ANY,
_("wxSocket demo: Client"),
wxDefaultPosition, wxSize(300, 200))
{
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);
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();
}
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))
{
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(
// 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
//
// 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,
// 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())
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"));
m_text->AppendText(_("=== Test 1 ends ===\n"));
delete[] buf2;
- m_busy = FALSE;
+ m_busy = false;
UpdateStatusBar();
}
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"));
m_text->AppendText(_("=== Test 2 ends ===\n"));
delete[] msg2;
- m_busy = FALSE;
+ m_busy = false;
UpdateStatusBar();
}
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"));
m_text->AppendText(_("=== Test 3 ends ===\n"));
delete[] buf2;
- m_busy = FALSE;
+ m_busy = false;
UpdateStatusBar();
}
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;
}
// --------------------------------------------------------------------------
// frame constructor
-MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, -1,
+MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, wxID_ANY,
_("wxSocket demo: Server"),
wxDefaultPosition, wxSize(300, 200))
{
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);
// 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();
}
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))
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)
{
sock->SetEventHandler(*this, SOCKET_ID);
sock->SetNotify(wxSOCKET_INPUT_FLAG | wxSOCKET_LOST_FLAG);
- sock->Notify(TRUE);
+ sock->Notify(true);
m_numClients++;
UpdateStatusBar();