]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/sockets/server.cpp
simplify the code for extended flags handling fixing a rare bug with wxSTAY_ON_TOP...
[wxWidgets.git] / samples / sockets / server.cpp
index b90dc2643c5259895ee85a1a562ecc982d06ebbb..0e2be5b7dce110cb55169c3e68ce799dcaa09c83 100644 (file)
 // headers
 // --------------------------------------------------------------------------
 
-#if defined(__GNUG__) && !defined(__APPLE__)
-#  pragma implementation "server.cpp"
-#  pragma interface "server.cpp"
-#endif
-
 // For compilers that support precompilation, includes "wx/wx.h".
 #include "wx/wxprec.h"
 
@@ -96,11 +91,11 @@ private:
 enum
 {
   // menu items
-  SERVER_QUIT = 1000,
-  SERVER_ABOUT,
+  SERVER_QUIT = wxID_EXIT,
+  SERVER_ABOUT = wxID_ABOUT,
 
   // id for sockets
-  SERVER_ID,
+  SERVER_ID = 100,
   SOCKET_ID
 };
 
@@ -128,6 +123,9 @@ IMPLEMENT_APP(MyApp)
 
 bool MyApp::OnInit()
 {
+  if ( !wxApp::OnInit() )
+      return false;
+
   // Create the main application window
   MyFrame *frame = new MyFrame();
 
@@ -163,8 +161,10 @@ MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, wxID_ANY,
   m_menuBar->Append(m_menuFile, _("&File"));
   SetMenuBar(m_menuBar);
 
+#if wxUSE_STATUSBAR
   // Status bar
   CreateStatusBar(2);
+#endif // wxUSE_STATUSBAR
 
   // Make a textctrl for logging
   m_text  = new wxTextCtrl(this, wxID_ANY,
@@ -412,7 +412,9 @@ void MyFrame::OnSocketEvent(wxSocketEvent& event)
 
 void MyFrame::UpdateStatusBar()
 {
+#if wxUSE_STATUSBAR
   wxString s;
   s.Printf(_("%d clients connected"), m_numClients);
   SetStatusText(s, 1);
+#endif // wxUSE_STATUSBAR
 }