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