]> git.saurik.com Git - wxWidgets.git/blame - include/wx/ipcbase.h
Unicode fix.
[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
c801d85f
KB
45class WXDLLEXPORT wxDDEServerBase;
46class WXDLLEXPORT wxDDEClientBase;
47
48class WXDLLEXPORT wxConnectionBase: public wxObject
49{
50 DECLARE_CLASS(wxConnectionBase)
51 public:
52 inline wxConnectionBase(void) {}
53 inline ~wxConnectionBase(void) {}
54
55 // Calls that CLIENT can make
9d2f3c71
OK
56 virtual bool Execute(wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT ) = 0;
57 virtual bool Execute(const wxString& str) { return Execute(WXSTRINGCAST str, -1, wxIPC_TEXT); }
0d2a2b60 58 virtual char *Request(const wxString& item, int *size = (int *) NULL, wxIPCFormat format = wxIPC_TEXT) = 0;
9d2f3c71 59 virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT) = 0;
c801d85f
KB
60 virtual bool StartAdvise(const wxString& item) = 0;
61 virtual bool StopAdvise(const wxString& item) = 0;
62
63 // Calls that SERVER can make
9d2f3c71 64 virtual bool Advise(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT) = 0;
c801d85f
KB
65
66 // Calls that both can make
67 virtual bool Disconnect(void) = 0;
68
69 // Callbacks to SERVER - override at will
70 virtual bool OnExecute( const wxString& WXUNUSED(topic), char *WXUNUSED(data), int WXUNUSED(size),
71 int WXUNUSED(format) ) { return FALSE; };
2ed57eb7
OK
72 virtual char *OnRequest( const wxString& WXUNUSED(topic), const wxString& WXUNUSED(item),
73 int *WXUNUSED(size), int WXUNUSED(format) ) { return (char *) NULL; };
9d2f3c71 74 virtual bool OnPoke( const wxString& WXUNUSED(topic), const wxString& WXUNUSED(item), wxChar *WXUNUSED(data),
c801d85f
KB
75 int WXUNUSED(size), int WXUNUSED(format) ) { return FALSE; };
76 virtual bool OnStartAdvise( const wxString& WXUNUSED(topic), const wxString& WXUNUSED(item) )
77 { return FALSE; };
78 virtual bool OnStopAdvise( const wxString& WXUNUSED(topic), const wxString& WXUNUSED(item) )
79 { return FALSE; };
80
81 // Callbacks to CLIENT - override at will
2ed57eb7 82 virtual bool OnAdvise( const wxString& WXUNUSED(topic), const wxString& WXUNUSED(item), char *WXUNUSED(data),
c801d85f
KB
83 int WXUNUSED(size), int WXUNUSED(format) ) { return FALSE; };
84
85 // Callbacks to BOTH
86
87 // Default behaviour is to delete connection and return TRUE
88 virtual bool OnDisconnect(void) = 0;
89};
90
91class WXDLLEXPORT wxServerBase: public wxObject
92{
93 DECLARE_CLASS(wxServerBase)
94 public:
95
96 inline wxServerBase(void) {}
97 inline ~wxServerBase(void) {};
98 virtual bool Create(const wxString& serverName) = 0; // Returns FALSE if can't create server (e.g. port
99 // number is already in use)
100 virtual wxConnectionBase *OnAcceptConnection(const wxString& topic) = 0;
101
102};
103
104class WXDLLEXPORT wxClientBase: public wxObject
105{
106 DECLARE_CLASS(wxClientBase)
107 public:
108 inline wxClientBase(void) {};
109 inline ~wxClientBase(void) {};
110 virtual bool ValidHost(const wxString& host) = 0;
111 virtual wxConnectionBase *MakeConnection(const wxString& host, const wxString& server, const wxString& topic) = 0;
112 // Call this to make a connection.
113 // Returns NULL if cannot.
114 virtual wxConnectionBase *OnMakeConnection(void) = 0; // Tailor this to return own connection.
115
116};
117
118#endif
34138703 119 // _WX_IPCBASEH__