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