]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/helpxlp.h
fixed a canonical example of Stupid Bug(tm)
[wxWidgets.git] / include / wx / generic / helpxlp.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: helpxlp.h
3 // Purpose: Help system: wxHelp implementation
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __HELPXLPH__
13 #define __HELPXLPH__
14
15 #ifdef __GNUG__
16 #pragma interface "helpxlp.h"
17 #endif
18
19 #include "wx/defs.h"
20
21 #if wxUSE_HELP
22
23 #include "wx/helpbase.h"
24
25 #ifdef __WXMSW__
26 #include "wx/dde.h"
27 #else
28 #include "wx/sckipc.h"
29 #endif
30
31 class WXDLLEXPORT wxXLPHelpController;
32
33 // Connection class for implementing the connection between the
34 // wxHelp process and the application
35 class WXDLLEXPORT wxXLPHelpConnection: public
36
37 #ifdef __WXMSW__
38 wxDDEConnection
39 #else
40 wxTCPConnection
41 #endif
42
43 {
44 friend class wxXLPHelpController;
45
46 DECLARE_DYNAMIC_CLASS(wxXLPHelpConnection)
47
48 public:
49
50 wxXLPHelpConnection(wxXLPHelpController *instance);
51 bool OnDisconnect(void);
52
53 private:
54 wxXLPHelpController *helpInstance;
55 };
56
57 // Connection class for implementing the client process
58 // controlling the wxHelp process
59 class WXDLLEXPORT wxXLPHelpClient: public
60
61 #ifdef __WXMSW__
62 wxDDEClient
63 #else
64 wxTCPClient
65 #endif
66
67 {
68 DECLARE_CLASS(wxXLPHelpClient)
69
70 friend class WXDLLEXPORT wxXLPHelpController;
71 public:
72 wxXLPHelpClient(wxXLPHelpController* c) { m_controller = c; }
73
74 wxConnectionBase *OnMakeConnection(void)
75 { return new wxXLPHelpConnection(m_controller);
76 }
77 protected:
78 wxXLPHelpController* m_controller;
79 };
80
81 // An application can have one or more instances of wxHelp,
82 // represented by an object of this class.
83 // Nothing happens on initial creation; the application
84 // must call a member function to display help.
85 // If the instance of wxHelp is already active, that instance
86 // will be used for subsequent help.
87
88 class WXDLLEXPORT wxXLPHelpController: public wxHelpControllerBase
89 {
90 friend class WXDLLEXPORT wxXLPHelpConnection;
91 DECLARE_CLASS(wxXLPHelpController)
92
93 public:
94 wxXLPHelpController(void);
95 ~wxXLPHelpController(void);
96
97 // Must call this to set the filename and server name
98 virtual bool Initialize(const wxString& file, int server = -1);
99 // If file is "", reloads file given in Initialize
100 virtual bool LoadFile(const wxString& file = "");
101 virtual bool DisplayContents(void);
102 virtual bool DisplaySection(int sectionNo);
103 virtual bool DisplayBlock(long blockNo);
104 virtual bool KeywordSearch(const wxString& k);
105
106 virtual bool DisplaySection(const wxString& section)
107 {
108 return wxHelpControllerBase::DisplaySection(section);
109 }
110
111 virtual bool Quit(void);
112 virtual void OnQuit(void);
113
114 // Private
115 bool Run(void);
116
117 protected:
118 wxString helpFile;
119 wxString helpHost;
120 int helpServer;
121 bool helpRunning;
122 wxXLPHelpConnection* helpConnection;
123 wxXLPHelpClient helpClient;
124 private:
125 virtual bool Initialize(const wxString& file) { return(wxHelpControllerBase::Initialize(file)); };
126 };
127
128 #endif // wxUSE_HELP
129 #endif
130 // __HELPXLPH__