1999-01-27 05:01:14 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: server.h
|
|
|
|
// Purpose: DDE sample: server
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 25/01/99
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Julian Smart
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// Define a new application
|
2000-01-15 17:34:29 -05:00
|
|
|
class MyServer;
|
|
|
|
class MyApp : public wxApp
|
1999-01-27 05:01:14 -05:00
|
|
|
{
|
2000-01-15 17:34:29 -05:00
|
|
|
public:
|
|
|
|
virtual bool OnInit();
|
|
|
|
virtual int OnExit();
|
|
|
|
|
|
|
|
private:
|
|
|
|
MyServer *m_server;
|
1999-01-27 05:01:14 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
DECLARE_APP(MyApp)
|
|
|
|
|
|
|
|
// Define a new frame
|
2000-01-15 17:34:29 -05:00
|
|
|
class MyFrame : public wxFrame
|
1999-01-27 05:01:14 -05:00
|
|
|
{
|
2000-01-15 17:34:29 -05:00
|
|
|
public:
|
|
|
|
MyFrame(wxFrame *frame, const wxString& title);
|
1999-01-27 05:01:14 -05:00
|
|
|
|
|
|
|
void OnListBoxClick(wxCommandEvent& event);
|
2000-01-15 17:34:29 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
wxPanel *panel;
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
1999-01-27 05:01:14 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
class IPCDialogBox;
|
2000-01-15 17:34:29 -05:00
|
|
|
class MyConnection : public wxConnection
|
1999-01-27 05:01:14 -05:00
|
|
|
{
|
2000-01-15 17:34:29 -05:00
|
|
|
public:
|
|
|
|
MyConnection(char *buf, int size);
|
|
|
|
~MyConnection();
|
1999-01-27 05:01:14 -05:00
|
|
|
|
2000-01-15 17:34:29 -05:00
|
|
|
bool OnExecute(const wxString& topic, char *data, int size, wxIPCFormat format);
|
|
|
|
char *OnRequest(const wxString& topic, const wxString& item, int *size, wxIPCFormat format);
|
|
|
|
bool OnPoke(const wxString& topic, const wxString& item, char *data, int size, wxIPCFormat format);
|
|
|
|
bool OnStartAdvise(const wxString& topic, const wxString& item);
|
1999-01-27 05:01:14 -05:00
|
|
|
|
2000-01-15 17:34:29 -05:00
|
|
|
private:
|
|
|
|
IPCDialogBox *dialog;
|
1999-01-27 05:01:14 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
class MyServer: public wxServer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxConnectionBase *OnAcceptConnection(const wxString& topic);
|
|
|
|
};
|
|
|
|
|
|
|
|
class IPCDialogBox: public wxDialog
|
|
|
|
{
|
|
|
|
public:
|
2000-01-15 17:34:29 -05:00
|
|
|
IPCDialogBox(wxWindow *parent,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
MyConnection *the_connection);
|
1999-01-27 05:01:14 -05:00
|
|
|
|
|
|
|
void OnQuit(wxCommandEvent& event);
|
|
|
|
|
2000-01-15 17:34:29 -05:00
|
|
|
private:
|
|
|
|
MyConnection *m_connection;
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
1999-01-27 05:01:14 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#define SERVER_QUIT wxID_EXIT
|
|
|
|
#define SERVER_LISTBOX 500
|
|
|
|
#define SERVER_QUIT_BUTTON 501
|