X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6097c3a28a968e4acbdbee90072cc3f4ee65ab74..9cf8de4c742b21548661d5a4b3a380e9eae18080:/samples/ipc/server.cpp diff --git a/samples/ipc/server.cpp b/samples/ipc/server.cpp index 3ad14aac9a..46909bfed1 100644 --- a/samples/ipc/server.cpp +++ b/samples/ipc/server.cpp @@ -32,7 +32,7 @@ // we're using TCP/IP or real DDE. #include "ddesetup.h" -#if defined(__WXGTK__) || defined(__WXMOTIF__) +#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) #include "mondrian.xpm" #endif @@ -45,6 +45,7 @@ IMPLEMENT_APP(MyApp) BEGIN_EVENT_TABLE(MyFrame, wxFrame) + EVT_MENU (SERVER_EXIT, MyFrame::OnExit) EVT_LISTBOX(SERVER_LISTBOX, MyFrame::OnListBoxClick) END_EVENT_TABLE() @@ -70,16 +71,17 @@ MyConnection *the_connection = NULL; bool MyApp::OnInit() { // Create the main frame window - (new MyFrame(NULL, "Server"))->Show(); + (new MyFrame(NULL, "Server"))->Show(TRUE); + + // service name (DDE classes) or port number (TCP/IP based classes) + wxString service = "4242"; - // create the server object - wxString server_name = "4242"; if (argc > 1) - server_name = argv[1]; + service = argv[1]; // Create a new server m_server = new MyServer; - m_server->Create(server_name); + m_server->Create(service); return TRUE; } @@ -109,7 +111,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title) // Make a menubar wxMenu *file_menu = new wxMenu; - file_menu->Append(SERVER_QUIT, "&Exit"); + file_menu->Append(SERVER_EXIT, "&Exit"); wxMenuBar *menu_bar = new wxMenuBar; @@ -132,7 +134,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title) } // Set the client process's listbox to this item -void MyFrame::OnListBoxClick(wxCommandEvent& event) +void MyFrame::OnListBoxClick(wxCommandEvent& WXUNUSED(event)) { wxListBox* listBox = (wxListBox*) panel->FindWindow(SERVER_LISTBOX); if (listBox) @@ -145,6 +147,11 @@ void MyFrame::OnListBoxClick(wxCommandEvent& event) } } +void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event)) +{ + Close(TRUE); +} + // ---------------------------------------------------------------------------- // IPCDialogBox // ----------------------------------------------------------------------------