| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: server.h |
| 3 | // Purpose: DDE sample: server |
| 4 | // Author: Julian Smart |
| 5 | // Modified by: |
| 6 | // Created: 25/01/99 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) Julian Smart |
| 9 | // Licence: wxWindows licence |
| 10 | ///////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | // Define a new application |
| 13 | class MyServer; |
| 14 | class MyApp : public wxApp |
| 15 | { |
| 16 | public: |
| 17 | virtual bool OnInit(); |
| 18 | virtual int OnExit(); |
| 19 | |
| 20 | private: |
| 21 | MyServer *m_server; |
| 22 | }; |
| 23 | |
| 24 | DECLARE_APP(MyApp) |
| 25 | |
| 26 | // Define a new frame |
| 27 | class MyFrame : public wxFrame |
| 28 | { |
| 29 | public: |
| 30 | MyFrame(wxFrame *frame, const wxString& title); |
| 31 | |
| 32 | void OnListBoxClick(wxCommandEvent& event); |
| 33 | void OnExit(wxCommandEvent& event); |
| 34 | |
| 35 | private: |
| 36 | wxPanel *panel; |
| 37 | |
| 38 | DECLARE_EVENT_TABLE() |
| 39 | }; |
| 40 | |
| 41 | class IPCDialogBox; |
| 42 | class MyConnection : public wxConnection |
| 43 | { |
| 44 | public: |
| 45 | MyConnection(char *buf, int size); |
| 46 | ~MyConnection(); |
| 47 | |
| 48 | bool OnExecute(const wxString& topic, char *data, int size, wxIPCFormat format); |
| 49 | char *OnRequest(const wxString& topic, const wxString& item, int *size, wxIPCFormat format); |
| 50 | bool OnPoke(const wxString& topic, const wxString& item, char *data, int size, wxIPCFormat format); |
| 51 | bool OnStartAdvise(const wxString& topic, const wxString& item); |
| 52 | |
| 53 | private: |
| 54 | IPCDialogBox *dialog; |
| 55 | }; |
| 56 | |
| 57 | class MyServer: public wxServer |
| 58 | { |
| 59 | public: |
| 60 | wxConnectionBase *OnAcceptConnection(const wxString& topic); |
| 61 | }; |
| 62 | |
| 63 | class IPCDialogBox: public wxDialog |
| 64 | { |
| 65 | public: |
| 66 | IPCDialogBox(wxWindow *parent, |
| 67 | const wxString& title, |
| 68 | const wxPoint& pos, |
| 69 | const wxSize& size, |
| 70 | MyConnection *the_connection); |
| 71 | |
| 72 | void OnQuit(wxCommandEvent& event); |
| 73 | |
| 74 | private: |
| 75 | MyConnection *m_connection; |
| 76 | |
| 77 | DECLARE_EVENT_TABLE() |
| 78 | }; |
| 79 | |
| 80 | #define SERVER_EXIT wxID_EXIT |
| 81 | #define SERVER_LISTBOX 500 |
| 82 | #define SERVER_QUIT_BUTTON 501 |