]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/dde.h
Add wxDEPRECATED_MSG() and use it in a couple of places.
[wxWidgets.git] / include / wx / msw / dde.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/dde.h
3 // Purpose: DDE class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_DDE_H_
12 #define _WX_DDE_H_
13
14 #include "wx/ipcbase.h"
15
16 /*
17 * Mini-DDE implementation
18
19 Most transactions involve a topic name and an item name (choose these
20 as befits your application).
21
22 A client can:
23
24 - ask the server to execute commands (data) associated with a topic
25 - request data from server by topic and item
26 - poke data into the server
27 - ask the server to start an advice loop on topic/item
28 - ask the server to stop an advice loop
29
30 A server can:
31
32 - respond to execute, request, poke and advice start/stop
33 - send advise data to client
34
35 Note that this limits the server in the ways it can send data to the
36 client, i.e. it can't send unsolicited information.
37 *
38 */
39
40 class WXDLLIMPEXP_FWD_BASE wxDDEServer;
41 class WXDLLIMPEXP_FWD_BASE wxDDEClient;
42
43 class WXDLLIMPEXP_BASE wxDDEConnection : public wxConnectionBase
44 {
45 public:
46 wxDDEConnection(void *buffer, size_t size); // use external buffer
47 wxDDEConnection(); // use internal buffer
48 virtual ~wxDDEConnection();
49
50 // implement base class pure virtual methods
51 virtual const void *Request(const wxString& item,
52 size_t *size = NULL,
53 wxIPCFormat format = wxIPC_TEXT);
54 virtual bool StartAdvise(const wxString& item);
55 virtual bool StopAdvise(const wxString& item);
56 virtual bool Disconnect();
57
58 protected:
59 virtual bool DoExecute(const void *data, size_t size, wxIPCFormat format);
60 virtual bool DoPoke(const wxString& item, const void *data, size_t size,
61 wxIPCFormat format);
62 virtual bool DoAdvise(const wxString& item, const void *data, size_t size,
63 wxIPCFormat format);
64
65 public:
66 wxString m_topicName;
67 wxDDEServer* m_server;
68 wxDDEClient* m_client;
69
70 WXHCONV m_hConv;
71 const void* m_sendingData;
72 int m_dataSize;
73 wxIPCFormat m_dataType;
74
75 wxDECLARE_NO_COPY_CLASS(wxDDEConnection);
76 DECLARE_DYNAMIC_CLASS(wxDDEConnection)
77 };
78
79 class WXDLLIMPEXP_BASE wxDDEServer : public wxServerBase
80 {
81 public:
82 wxDDEServer();
83 bool Create(const wxString& server_name);
84 virtual ~wxDDEServer();
85
86 virtual wxConnectionBase *OnAcceptConnection(const wxString& topic);
87
88 // Find/delete wxDDEConnection corresponding to the HCONV
89 wxDDEConnection *FindConnection(WXHCONV conv);
90 bool DeleteConnection(WXHCONV conv);
91 wxString& GetServiceName() const { return (wxString&) m_serviceName; }
92
93 wxDDEConnectionList& GetConnections() const
94 { return (wxDDEConnectionList&) m_connections; }
95
96 protected:
97 int m_lastError;
98 wxString m_serviceName;
99 wxDDEConnectionList m_connections;
100
101 DECLARE_DYNAMIC_CLASS(wxDDEServer)
102 };
103
104 class WXDLLIMPEXP_BASE wxDDEClient: public wxClientBase
105 {
106 public:
107 wxDDEClient();
108 virtual ~wxDDEClient();
109
110 bool ValidHost(const wxString& host);
111
112 // Call this to make a connection. Returns NULL if cannot.
113 virtual wxConnectionBase *MakeConnection(const wxString& host,
114 const wxString& server,
115 const wxString& topic);
116
117 // Tailor this to return own connection.
118 virtual wxConnectionBase *OnMakeConnection();
119
120 // Find/delete wxDDEConnection corresponding to the HCONV
121 wxDDEConnection *FindConnection(WXHCONV conv);
122 bool DeleteConnection(WXHCONV conv);
123
124 wxDDEConnectionList& GetConnections() const
125 { return (wxDDEConnectionList&) m_connections; }
126
127 protected:
128 int m_lastError;
129 wxDDEConnectionList m_connections;
130
131 DECLARE_DYNAMIC_CLASS(wxDDEClient)
132 };
133
134 void WXDLLIMPEXP_BASE wxDDEInitialize();
135 void WXDLLIMPEXP_BASE wxDDECleanUp();
136
137 #endif // _WX_DDE_H_