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