]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
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 | /* sccsid[] = "@(#)wx_help.h 1.2 5/9/94" */ | |
13 | ||
14 | #ifndef __HELPXLPH__ | |
15 | #define __HELPXLPH__ | |
16 | ||
17 | #ifdef __GNUG__ | |
18 | #pragma interface "helpxlp.h" | |
19 | #endif | |
20 | ||
21 | #include <stdio.h> | |
22 | #include "wx/wx.h" | |
23 | ||
24 | #if USE_HELP | |
25 | ||
26 | #include "wx/helpbase.h" | |
27 | ||
28 | #ifdef __WINDOWS__ | |
29 | #include "wx/dde.h" | |
30 | #else | |
31 | // Or whatever it'll be called | |
32 | #include "wx/ipctcp.h" | |
33 | #endif | |
34 | ||
35 | class WXDLLEXPORT wxXLPHelpController; | |
36 | ||
37 | // Connection class for implementing the connection between the | |
38 | // wxHelp process and the application | |
39 | class WXDLLEXPORT wxXLPHelpConnection: public | |
40 | ||
41 | #ifdef __WINDOWS__ | |
42 | wxDDEConnection | |
43 | #else | |
44 | wxTCPConnection | |
45 | #endif | |
46 | ||
47 | { | |
48 | friend class wxXLPHelpController; | |
49 | ||
50 | DECLARE_DYNAMIC_CLASS(wxXLPHelpConnection) | |
51 | ||
52 | public: | |
53 | ||
54 | wxXLPHelpConnection(wxXLPHelpController *instance); | |
55 | bool OnDisconnect(void); | |
56 | ||
57 | private: | |
58 | wxXLPHelpController *helpInstance; | |
59 | }; | |
60 | ||
61 | // Connection class for implementing the client process | |
62 | // controlling the wxHelp process | |
63 | class WXDLLEXPORT wxXLPHelpClient: public | |
64 | ||
65 | #ifdef __WINDOWS__ | |
66 | wxDDEClient | |
67 | #else | |
68 | wxTCPClient | |
69 | #endif | |
70 | ||
71 | { | |
72 | DECLARE_CLASS(wxXLPHelpClient) | |
73 | ||
74 | friend class WXDLLEXPORT wxXLPHelpController; | |
75 | public: | |
76 | wxXLPHelpClient(wxXLPHelpController* c) { m_controller = c; } | |
77 | ||
78 | wxConnectionBase *OnMakeConnection(void) | |
79 | { return new wxXLPHelpConnection(m_controller); | |
80 | } | |
81 | protected: | |
82 | wxXLPHelpController* m_controller; | |
83 | }; | |
84 | ||
85 | // An application can have one or more instances of wxHelp, | |
86 | // represented by an object of this class. | |
87 | // Nothing happens on initial creation; the application | |
88 | // must call a member function to display help. | |
89 | // If the instance of wxHelp is already active, that instance | |
90 | // will be used for subsequent help. | |
91 | ||
92 | class WXDLLEXPORT wxXLPHelpController: public wxHelpControllerBase | |
93 | { | |
94 | friend class WXDLLEXPORT wxXLPHelpConnection; | |
95 | DECLARE_CLASS(wxXLPHelpController) | |
96 | ||
97 | public: | |
98 | wxXLPHelpController(void); | |
99 | ~wxXLPHelpController(void); | |
100 | ||
101 | // Must call this to set the filename and server name | |
102 | virtual bool Initialize(const wxString& file, int server = -1); | |
103 | // If file is "", reloads file given in Initialize | |
104 | virtual bool LoadFile(const wxString& file = ""); | |
105 | virtual bool DisplayContents(void); | |
106 | virtual bool DisplaySection(int sectionNo); | |
107 | virtual bool DisplayBlock(long blockNo); | |
108 | virtual bool KeywordSearch(const wxString& k); | |
109 | ||
110 | virtual bool Quit(void); | |
111 | virtual void OnQuit(void); | |
112 | ||
113 | // Private | |
114 | bool Run(void); | |
115 | ||
116 | protected: | |
117 | wxString helpFile; | |
118 | wxString helpHost; | |
119 | int helpServer; | |
120 | bool helpRunning; | |
121 | wxXLPHelpConnection* helpConnection; | |
122 | wxXLPHelpClient helpClient; | |
123 | }; | |
124 | ||
125 | #endif // USE_HELP | |
126 | #endif | |
127 | // __HELPXLPH__ |