]> git.saurik.com Git - wxWidgets.git/blob - include/wx/ipcbase.h
Fixed Fontdialog
[wxWidgets.git] / include / wx / ipcbase.h
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
12 #ifndef __IPCBASEH__
13 #define __IPCBASEH__
14
15 #ifdef __GNUG__
16 #pragma interface "ipcbase.h"
17 #endif
18
19 #include "wx/defs.h"
20 #include "wx/object.h"
21 #include "wx/string.h"
22
23 class WXDLLEXPORT wxDDEServerBase;
24 class WXDLLEXPORT wxDDEClientBase;
25
26 class WXDLLEXPORT wxConnectionBase: public wxObject
27 {
28 DECLARE_CLASS(wxConnectionBase)
29 public:
30 inline wxConnectionBase(void) {}
31 inline ~wxConnectionBase(void) {}
32
33 // Calls that CLIENT can make
34 virtual bool Execute(char *data, int size = -1, wxDataFormat format = wxDF_TEXT ) = 0;
35 virtual bool Execute(const wxString& str) { return Execute((char *)(const char *)str, -1, wxDF_TEXT); }
36 virtual char *Request(const wxString& item, int *size = NULL, wxDataFormat format = wxDF_TEXT) = 0;
37 virtual bool Poke(const wxString& item, char *data, int size = -1, wxDataFormat format = wxDF_TEXT) = 0;
38 virtual bool StartAdvise(const wxString& item) = 0;
39 virtual bool StopAdvise(const wxString& item) = 0;
40
41 // Calls that SERVER can make
42 virtual bool Advise(const wxString& item, char *data, int size = -1, wxDataFormat format = wxDF_TEXT) = 0;
43
44 // Calls that both can make
45 virtual bool Disconnect(void) = 0;
46
47 // Callbacks to SERVER - override at will
48 virtual bool OnExecute( const wxString& WXUNUSED(topic), char *WXUNUSED(data), int WXUNUSED(size),
49 int WXUNUSED(format) ) { return FALSE; };
50 virtual char *OnRequest( const wxString& WXUNUSED(topic), const wxString& WXUNUSED(item),
51 int *WXUNUSED(size), int WXUNUSED(format) ) { return NULL; };
52 virtual bool OnPoke( const wxString& WXUNUSED(topic), const wxString& WXUNUSED(item), char *WXUNUSED(data),
53 int WXUNUSED(size), int WXUNUSED(format) ) { return FALSE; };
54 virtual bool OnStartAdvise( const wxString& WXUNUSED(topic), const wxString& WXUNUSED(item) )
55 { return FALSE; };
56 virtual bool OnStopAdvise( const wxString& WXUNUSED(topic), const wxString& WXUNUSED(item) )
57 { return FALSE; };
58
59 // Callbacks to CLIENT - override at will
60 virtual bool OnAdvise( const wxString& WXUNUSED(topic), const wxString& WXUNUSED(item), char *WXUNUSED(data),
61 int WXUNUSED(size), int WXUNUSED(format) ) { return FALSE; };
62
63 // Callbacks to BOTH
64
65 // Default behaviour is to delete connection and return TRUE
66 virtual bool OnDisconnect(void) = 0;
67 };
68
69 class WXDLLEXPORT wxServerBase: public wxObject
70 {
71 DECLARE_CLASS(wxServerBase)
72 public:
73
74 inline wxServerBase(void) {}
75 inline ~wxServerBase(void) {};
76 virtual bool Create(const wxString& serverName) = 0; // Returns FALSE if can't create server (e.g. port
77 // number is already in use)
78 virtual wxConnectionBase *OnAcceptConnection(const wxString& topic) = 0;
79
80 };
81
82 class WXDLLEXPORT wxClientBase: public wxObject
83 {
84 DECLARE_CLASS(wxClientBase)
85 public:
86 inline wxClientBase(void) {};
87 inline ~wxClientBase(void) {};
88 virtual bool ValidHost(const wxString& host) = 0;
89 virtual wxConnectionBase *MakeConnection(const wxString& host, const wxString& server, const wxString& topic) = 0;
90 // Call this to make a connection.
91 // Returns NULL if cannot.
92 virtual wxConnectionBase *OnMakeConnection(void) = 0; // Tailor this to return own connection.
93
94 };
95
96 #endif
97 // __IPCBASEH__