]> git.saurik.com Git - wxWidgets.git/blame - include/wx/sckipc.h
Added getters/setters for cell and grid-default editors
[wxWidgets.git] / include / wx / sckipc.h
CommitLineData
f4ada568
GL
1/////////////////////////////////////////////////////////////////////////////
2// Name: sckipc.h
0834112f
GRG
3// Purpose: Interprocess communication implementation (wxSocket version)
4// Author: Julian Smart
5// Modified by: Guilhem Lavaux (big rewrite) May 1997, 1998
6// Guillermo Rodriguez (updated for wxSocket v2) Jan 2000
f4ada568
GL
7// Created: 1993
8// RCS-ID: $Id$
0834112f
GRG
9// Copyright: (c) Julian Smart 1993
10// (c) Guilhem Lavaux 1997, 1998
11// (c) 2000 Guillermo Rodriguez <guille@iies.es>
f4ada568
GL
12// Licence: wxWindows license
13/////////////////////////////////////////////////////////////////////////////
07e829dc 14
f4ada568
GL
15#ifndef _WX_SCKIPC_H
16#define _WX_SCKIPC_H
17
18#ifdef __GNUG__
07e829dc 19#pragma interface "sckipc.h"
f4ada568
GL
20#endif
21
22#include "wx/defs.h"
26dfedc4
VZ
23
24#if wxUSE_SOCKETS
25
f4ada568
GL
26#include "wx/ipcbase.h"
27#include "wx/socket.h"
28#include "wx/sckstrm.h"
29#include "wx/datstrm.h"
30
31/*
32 * Mini-DDE implementation
33
34 Most transactions involve a topic name and an item name (choose these
35 as befits your application).
36
37 A client can:
38
39 - ask the server to execute commands (data) associated with a topic
40 - request data from server by topic and item
41 - poke data into the server
42 - ask the server to start an advice loop on topic/item
43 - ask the server to stop an advice loop
44
45 A server can:
46
47 - respond to execute, request, poke and advice start/stop
48 - send advise data to client
49
50 Note that this limits the server in the ways it can send data to the
51 client, i.e. it can't send unsolicited information.
52 *
53 */
54
07e829dc
GRG
55class WXDLLEXPORT wxTCPServer;
56class WXDLLEXPORT wxTCPClient;
57
58class WXDLLEXPORT wxTCPConnection: public wxConnectionBase
f4ada568
GL
59{
60 DECLARE_DYNAMIC_CLASS(wxTCPConnection)
f4ada568 61public:
f4ada568
GL
62 wxTCPConnection(char *buffer, int size);
63 wxTCPConnection();
64 virtual ~wxTCPConnection();
65
66 // Calls that CLIENT can make
0834112f 67 virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
0834112f
GRG
68 virtual char *Request(const wxString& item, int *size = NULL, wxIPCFormat format = wxIPC_TEXT);
69 virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
70 virtual bool StartAdvise(const wxString& item);
71 virtual bool StopAdvise(const wxString& item);
f4ada568
GL
72
73 // Calls that SERVER can make
0834112f 74 virtual bool Advise(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
f4ada568
GL
75
76 // Calls that both can make
0834112f 77 virtual bool Disconnect(void);
f4ada568 78
0834112f
GRG
79 // Default behaviour is to delete connection and return TRUE
80 virtual bool OnDisconnect(void) { delete this; return TRUE; }
f4ada568
GL
81
82 // To enable the compressor
83 void Compress(bool on);
0834112f 84
07e829dc
GRG
85protected:
86 wxSocketBase *m_sock;
87 wxSocketStream *m_sockstrm;
88 wxDataInputStream *m_codeci;
89 wxDataOutputStream *m_codeco;
90 wxString m_topic;
91
92 friend class wxTCPServer;
93 friend class wxTCPClient;
94 friend void Client_OnRequest(wxSocketBase&,
95 wxSocketNotify, char *);
96 friend void Server_OnRequest(wxSocketServer&,
97 wxSocketNotify, char *);
98
54da4255 99private:
4ca0f293
DW
100 //
101 // We're hiding an Execute method in ConnectionBase
102 //s
103 virtual bool Execute(const wxString& str)
104 { return Execute(str, -1, wxIPC_TEXT); }
f4ada568
GL
105};
106
107class wxTCPServer: public wxServerBase
108{
109 DECLARE_DYNAMIC_CLASS(wxTCPServer)
110
111public:
112 wxTCPConnection *topLevelConnection;
113
114 wxTCPServer();
115 virtual ~wxTCPServer();
54da4255 116
f4ada568 117 // Returns FALSE if can't create server (e.g. port number is already in use)
54da4255 118 virtual bool Create(const wxString& server_name);
f4ada568
GL
119 virtual wxConnectionBase *OnAcceptConnection(const wxString& topic);
120};
121
122class wxTCPClient: public wxClientBase
123{
124 DECLARE_DYNAMIC_CLASS(wxTCPClient)
125
54da4255 126public:
f4ada568
GL
127 wxTCPClient();
128 virtual ~wxTCPClient();
129
130 virtual bool ValidHost(const wxString& host);
0834112f
GRG
131 // Call this to make a connection.
132 // Returns NULL if cannot.
f4ada568
GL
133 virtual wxConnectionBase *MakeConnection(const wxString& host,
134 const wxString& server,
135 const wxString& topic);
54da4255 136
f4ada568
GL
137 // Tailor this to return own connection.
138 virtual wxConnectionBase *OnMakeConnection();
139};
140
26dfedc4
VZ
141#endif // wxUSE_SOCKETS
142
f4ada568 143#endif // ipcsock.h