]> git.saurik.com Git - wxWidgets.git/blame - include/wx/ipcbase.h
Removed helpwxht.h/cpp (old wxHelpControllerHtml class)
[wxWidgets.git] / include / wx / ipcbase.h
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: ipcbase.h
3// Purpose: Base classes for IPC
4// Author: Julian Smart
5// Modified by:
6// Created: 4/1/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart and Markus Holzem
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
34138703
JS
12#ifndef _WX_IPCBASEH__
13#define _WX_IPCBASEH__
c801d85f 14
0d3820b3
JS
15#ifdef __GNUG__
16#pragma interface "ipcbase.h"
17#endif
18
c801d85f
KB
19#include "wx/defs.h"
20#include "wx/object.h"
21#include "wx/string.h"
22
0d2a2b60
RR
23enum wxIPCFormat
24{
25 wxIPC_INVALID = 0,
26 wxIPC_TEXT = 1, /* CF_TEXT */
27 wxIPC_BITMAP = 2, /* CF_BITMAP */
28 wxIPC_METAFILE = 3, /* CF_METAFILEPICT */
29 wxIPC_SYLK = 4,
30 wxIPC_DIF = 5,
31 wxIPC_TIFF = 6,
32 wxIPC_OEMTEXT = 7, /* CF_OEMTEXT */
33 wxIPC_DIB = 8, /* CF_DIB */
34 wxIPC_PALETTE = 9,
35 wxIPC_PENDATA = 10,
36 wxIPC_RIFF = 11,
37 wxIPC_WAVE = 12,
38 wxIPC_UNICODETEXT = 13,
39 wxIPC_ENHMETAFILE = 14,
40 wxIPC_FILENAME = 15, /* CF_HDROP */
41 wxIPC_LOCALE = 16,
42 wxIPC_PRIVATE = 20
43};
44
07e829dc
GRG
45class WXDLLEXPORT wxServerBase;
46class WXDLLEXPORT wxClientBase;
c801d85f
KB
47
48class WXDLLEXPORT wxConnectionBase: public wxObject
49{
50 DECLARE_CLASS(wxConnectionBase)
f6bcfd97
BP
51
52public:
c801d85f
KB
53 inline wxConnectionBase(void) {}
54 inline ~wxConnectionBase(void) {}
55
56 // Calls that CLIENT can make
e90c1d2a
VZ
57 virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT ) = 0;
58 virtual bool Execute(const wxString& str) { return Execute(str, -1, wxIPC_TEXT); }
0d2a2b60 59 virtual char *Request(const wxString& item, int *size = (int *) NULL, wxIPCFormat format = wxIPC_TEXT) = 0;
9d2f3c71 60 virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT) = 0;
c801d85f
KB
61 virtual bool StartAdvise(const wxString& item) = 0;
62 virtual bool StopAdvise(const wxString& item) = 0;
63
64 // Calls that SERVER can make
9d2f3c71 65 virtual bool Advise(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT) = 0;
c801d85f
KB
66
67 // Calls that both can make
68 virtual bool Disconnect(void) = 0;
69
70 // Callbacks to SERVER - override at will
85ac091e
GRG
71 virtual bool OnExecute ( const wxString& WXUNUSED(topic),
72 char *WXUNUSED(data),
73 int WXUNUSED(size),
74 wxIPCFormat WXUNUSED(format) )
75 { return FALSE; };
76
77 virtual char *OnRequest ( const wxString& WXUNUSED(topic),
78 const wxString& WXUNUSED(item),
79 int *WXUNUSED(size),
80 wxIPCFormat WXUNUSED(format) )
81 { return (char *) NULL; };
82
83 virtual bool OnPoke ( const wxString& WXUNUSED(topic),
84 const wxString& WXUNUSED(item),
85 wxChar *WXUNUSED(data),
86 int WXUNUSED(size),
87 wxIPCFormat WXUNUSED(format) )
88 { return FALSE; };
89
90 virtual bool OnStartAdvise ( const wxString& WXUNUSED(topic),
91 const wxString& WXUNUSED(item) )
92 { return FALSE; };
93
94 virtual bool OnStopAdvise ( const wxString& WXUNUSED(topic),
95 const wxString& WXUNUSED(item) )
c801d85f
KB
96 { return FALSE; };
97
98 // Callbacks to CLIENT - override at will
85ac091e
GRG
99 virtual bool OnAdvise ( const wxString& WXUNUSED(topic),
100 const wxString& WXUNUSED(item),
101 char *WXUNUSED(data),
102 int WXUNUSED(size),
103 wxIPCFormat WXUNUSED(format) )
104 { return FALSE; };
c801d85f 105
f6bcfd97 106 // Callbacks to BOTH - override at will
c801d85f
KB
107 // Default behaviour is to delete connection and return TRUE
108 virtual bool OnDisconnect(void) = 0;
109};
110
111class WXDLLEXPORT wxServerBase: public wxObject
112{
113 DECLARE_CLASS(wxServerBase)
c801d85f 114
f6bcfd97 115public:
c801d85f
KB
116 inline wxServerBase(void) {}
117 inline ~wxServerBase(void) {};
c801d85f 118
f6bcfd97
BP
119 // Returns FALSE on error (e.g. port number is already in use)
120 virtual bool Create(const wxString& serverName) = 0;
121
122 // Callbacks to SERVER - override at will
123 virtual wxConnectionBase *OnAcceptConnection(const wxString& topic) = 0;
c801d85f
KB
124};
125
126class WXDLLEXPORT wxClientBase: public wxObject
127{
128 DECLARE_CLASS(wxClientBase)
f6bcfd97
BP
129
130public:
c801d85f
KB
131 inline wxClientBase(void) {};
132 inline ~wxClientBase(void) {};
f6bcfd97 133
c801d85f 134 virtual bool ValidHost(const wxString& host) = 0;
c801d85f 135
f6bcfd97
BP
136 // Call this to make a connection. Returns NULL if cannot.
137 virtual wxConnectionBase *MakeConnection(const wxString& host,
138 const wxString& server,
139 const wxString& topic) = 0;
140
141 // Callbacks to CLIENT - override at will
142 virtual wxConnectionBase *OnMakeConnection(void) = 0;
c801d85f
KB
143};
144
145#endif
34138703 146 // _WX_IPCBASEH__