]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/helpext.h
Better fix for modal/modeless wizards.
[wxWidgets.git] / include / wx / generic / helpext.h
1 /*-*- c++ -*-********************************************************
2 * helpext.h - an external help controller for wxWidgets *
3 * *
4 * (C) 1998 by Karsten Ballüder (Ballueder@usa.net) *
5 * License: wxWindows licence *
6 * *
7 * $Id$
8 *******************************************************************/
9
10 #ifndef __WX_HELPEXT_H_
11 #define __WX_HELPEXT_H_
12
13 #if wxUSE_HELP
14
15 #include "wx/helpbase.h"
16
17 /// Path separator.
18 #ifdef __WXMSW__
19 #define WXEXTHELP_SEPARATOR _T('\\')
20 #elif defined(__WXMAC__)
21 #define WXEXTHELP_SEPARATOR _T(':')
22 #else
23 #define WXEXTHELP_SEPARATOR _T('/')
24 #endif
25
26 class WXDLLIMPEXP_ADV wxExtHelpMapList;
27
28 #ifndef WXEXTHELP_DEFAULTBROWSER
29 /// Default browser name.
30 # define WXEXTHELP_DEFAULTBROWSER _T("netscape")
31 /// Is default browse a variant of netscape?
32 # define WXEXTHELP_DEFAULTBROWSER_IS_NETSCAPE true
33 #endif
34
35 /**
36 This class implements help via an external browser.
37 It requires the name of a directory containing the documentation
38 and a file mapping numerical Section numbers to relative URLS.
39
40 The map file contains two or three fields per line:
41 numeric_id relative_URL [; comment/documentation]
42
43 The numeric_id is the id used to look up the entry in
44 DisplaySection()/DisplayBlock(). The relative_URL is a filename of
45 an html file, relative to the help directory. The optional
46 comment/documentation field (after a ';') is used for keyword
47 searches, so some meaningful text here does not hurt.
48 If the documentation itself contains a ';', only the part before
49 that will be displayed in the listbox, but all of it used for search.
50
51 Lines starting with ';' will be ignored.
52 */
53
54 class WXDLLIMPEXP_ADV wxExtHelpController : public wxHelpControllerBase
55 {
56 DECLARE_CLASS(wxExtHelpController)
57 public:
58 wxExtHelpController();
59 ~wxExtHelpController();
60
61 /** Tell it which browser to use.
62 The Netscape support will check whether Netscape is already
63 running (by looking at the .netscape/lock file in the user's
64 home directory) and tell it to load the page into the existing
65 window.
66 @param browsername The command to call a browser/html viewer.
67 @param isNetscape Set this to true if the browser is some variant of Netscape.
68 */
69 // Obsolete form
70 void SetBrowser(const wxString & browsername = WXEXTHELP_DEFAULTBROWSER,
71 bool isNetscape = WXEXTHELP_DEFAULTBROWSER_IS_NETSCAPE);
72
73 // Set viewer: new name for SetBrowser
74 virtual void SetViewer(const wxString& viewer = WXEXTHELP_DEFAULTBROWSER, long flags = wxHELP_NETSCAPE);
75
76 /** This must be called to tell the controller where to find the
77 documentation.
78 If a locale is set, look in file/localename, i.e.
79 If passed "/usr/local/myapp/help" and the current wxLocale is
80 set to be "de", then look in "/usr/local/myapp/help/de/"
81 first and fall back to "/usr/local/myapp/help" if that
82 doesn't exist.
83
84 @param file - NOT a filename, but a directory name.
85 @return true on success
86 */
87 virtual bool Initialize(const wxString& dir, int WXUNUSED(server))
88 { return Initialize(dir); }
89
90 /** This must be called to tell the controller where to find the
91 documentation.
92 If a locale is set, look in file/localename, i.e.
93 If passed "/usr/local/myapp/help" and the current wxLocale is
94 set to be "de", then look in "/usr/local/myapp/help/de/"
95 first and fall back to "/usr/local/myapp/help" if that
96 doesn't exist.
97 @param dir - directory name where to fine the help files
98 @return true on success
99 */
100 virtual bool Initialize(const wxString& dir);
101
102 /** If file is "", reloads file given in Initialize.
103 @file Name of help directory.
104 @return true on success
105 */
106 virtual bool LoadFile(const wxString& file = wxEmptyString);
107
108 /** Display list of all help entries.
109 @return true on success
110 */
111 virtual bool DisplayContents(void);
112 /** Display help for id sectionNo.
113 @return true on success
114 */
115 virtual bool DisplaySection(int sectionNo);
116 /** Display help for id sectionNo -- identical with DisplaySection().
117 @return true on success
118 */
119 virtual bool DisplaySection(const wxString& section);
120 /** Display help for URL (using DisplayHelp) or keyword (using KeywordSearch)
121 @return true on success
122 */
123 virtual bool DisplayBlock(long blockNo);
124 /** Search comment/documentation fields in map file and present a
125 list to chose from.
126 @key k string to search for, empty string will list all entries
127 @return true on success
128 */
129 virtual bool KeywordSearch(const wxString& k,
130 wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
131
132 /// does nothing
133 virtual bool Quit(void);
134 /// does nothing
135 virtual void OnQuit(void);
136
137 /// Call the browser using a relative URL.
138 virtual bool DisplayHelp(const wxString &) ;
139
140 /// Allows one to override the default settings for the help frame.
141 virtual void SetFrameParameters(const wxString& WXUNUSED(title),
142 const wxSize& WXUNUSED(size),
143 const wxPoint& WXUNUSED(pos) = wxDefaultPosition,
144 bool WXUNUSED(newFrameEachTime) = false)
145 {
146 // does nothing by default
147 }
148 /// Obtains the latest settings used by the help frame and the help
149 /// frame.
150 virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL,
151 wxPoint *WXUNUSED(pos) = NULL,
152 bool *WXUNUSED(newFrameEachTime) = NULL)
153 {
154 return (wxFrame*) NULL;// does nothing by default
155 }
156
157 protected:
158 /// Filename of currently active map file.
159 wxString m_MapFile;
160 /// How many entries do we have in the map file?
161 int m_NumOfEntries;
162 /// A list containing all id,url,documentation triples.
163 wxList *m_MapList;
164 /// Deletes the list and all objects.
165 void DeleteList(void);
166
167 private:
168 /// How to call the html viewer.
169 wxString m_BrowserName;
170 /// Is the viewer a variant of netscape?
171 bool m_BrowserIsNetscape;
172 };
173
174 #endif // wxUSE_HELP
175
176 #endif // __WX_HELPEXT_H_