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