Statistics
| Revision:

root / trunk / install / launcher / izpack-launcher-1.3_linux / src / wx / include / wx / msw / dde.h @ 6834

History | View | Annotate | Download (4.12 KB)

1
/////////////////////////////////////////////////////////////////////////////
2
// Name:        dde.h
3
// Purpose:     DDE class
4
// Author:      Julian Smart
5
// Modified by:
6
// Created:     01/02/97
7
// RCS-ID:      $Id: dde.h 6834 2006-08-24 08:23:24Z jmvivo $
8
// Copyright:   (c) Julian Smart
9
// Licence:     wxWindows licence
10
/////////////////////////////////////////////////////////////////////////////
11

    
12
#ifndef _WX_DDE_H_
13
#define _WX_DDE_H_
14

    
15
#include "wx/ipcbase.h"
16

    
17
/*
18
 * Mini-DDE implementation
19

20
   Most transactions involve a topic name and an item name (choose these
21
   as befits your application).
22

23
   A client can:
24

25
   - ask the server to execute commands (data) associated with a topic
26
   - request data from server by topic and item
27
   - poke data into the server
28
   - ask the server to start an advice loop on topic/item
29
   - ask the server to stop an advice loop
30

31
   A server can:
32

33
   - respond to execute, request, poke and advice start/stop
34
   - send advise data to client
35

36
   Note that this limits the server in the ways it can send data to the
37
   client, i.e. it can't send unsolicited information.
38
 *
39
 */
40

    
41
class WXDLLEXPORT wxDDEServer;
42
class WXDLLEXPORT wxDDEClient;
43

    
44
class WXDLLEXPORT wxDDEConnection: public wxConnectionBase
45
{
46
  DECLARE_DYNAMIC_CLASS(wxDDEConnection)
47
public:
48
  wxDDEConnection(wxChar *buffer, int size); // use external buffer
49
  wxDDEConnection(); // use internal buffer
50
  ~wxDDEConnection(void);
51

    
52
  // Calls that CLIENT can make
53
  virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
54
  virtual wxChar *Request(const wxString& item, int *size = NULL, wxIPCFormat format = wxIPC_TEXT);
55
  virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
56
  virtual bool StartAdvise(const wxString& item);
57
  virtual bool StopAdvise(const wxString& item);
58

    
59
  // Calls that SERVER can make
60
  virtual bool Advise(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
61

    
62
  // Calls that both can make
63
  virtual bool Disconnect(void);
64

    
65
  // Default behaviour is to delete connection and return TRUE
66
  virtual bool OnDisconnect(void);
67

    
68
 public:
69
  wxString      m_topicName;
70
  wxDDEServer*  m_server;
71
  wxDDEClient*  m_client;
72

    
73
  WXHCONV       m_hConv;
74
  wxChar*       m_sendingData;
75
  int           m_dataSize;
76
  wxIPCFormat  m_dataType;
77
};
78

    
79
class WXDLLEXPORT wxDDEServer: public wxServerBase
80
{
81
  DECLARE_DYNAMIC_CLASS(wxDDEServer)
82
 public:
83

    
84
  wxDDEServer(void);
85
  ~wxDDEServer(void);
86
  bool Create(const wxString& server_name); // Returns FALSE if can't create server (e.g. port
87
                                  // number is already in use)
88
  virtual wxConnectionBase *OnAcceptConnection(const wxString& topic);
89

    
90
  ////////////////////////////////////////////////////////////
91
  // Implementation
92

    
93
  // Find/delete wxDDEConnection corresponding to the HCONV
94
  wxDDEConnection *FindConnection(WXHCONV conv);
95
  bool DeleteConnection(WXHCONV conv);
96
  inline wxString& GetServiceName(void) const { return (wxString&) m_serviceName; }
97
  inline wxList& GetConnections(void) const { return (wxList&) m_connections; }
98

    
99
 protected:
100
  int       m_lastError;
101
  wxString  m_serviceName;
102
  wxList    m_connections;
103
};
104

    
105
class WXDLLEXPORT wxDDEClient: public wxClientBase
106
{
107
  DECLARE_DYNAMIC_CLASS(wxDDEClient)
108
 public:
109
  wxDDEClient(void);
110
  ~wxDDEClient(void);
111
  bool ValidHost(const wxString& host);
112
  virtual wxConnectionBase *MakeConnection(const wxString& host, const wxString& server, const wxString& topic);
113
                                                // Call this to make a connection.
114
                                                // Returns NULL if cannot.
115
  virtual wxConnectionBase *OnMakeConnection(void); // Tailor this to return own connection.
116

    
117
  ////////////////////////////////////////////////////////////
118
  // Implementation
119

    
120
  // Find/delete wxDDEConnection corresponding to the HCONV
121
  wxDDEConnection *FindConnection(WXHCONV conv);
122
  bool DeleteConnection(WXHCONV conv);
123
  inline wxList& GetConnections(void) const { return (wxList&) m_connections; }
124

    
125
 protected:
126
  int       m_lastError;
127
  wxList    m_connections;
128
};
129

    
130
void WXDLLEXPORT wxDDEInitialize();
131
void WXDLLEXPORT wxDDECleanUp();
132

    
133
#endif
134
    // _WX_DDE_H_