1 /*-*- c++ -*-********************************************************
2 * helpext.h - an external help controller for wxWidgets *
4 * (C) 1998 by Karsten Ballüder (Ballueder@usa.net) *
5 * License: wxWindows licence *
8 *******************************************************************/
10 #ifndef __WX_HELPEXT_H_
11 #define __WX_HELPEXT_H_
15 #include "wx/helpbase.h"
19 #define WXEXTHELP_SEPARATOR _T('\\')
20 #elif defined(__WXMAC__)
21 #define WXEXTHELP_SEPARATOR _T(':')
23 #define WXEXTHELP_SEPARATOR _T('/')
26 class WXDLLIMPEXP_ADV wxExtHelpMapList
;
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
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.
40 The map file contains two or three fields per line:
41 numeric_id relative_URL [; comment/documentation]
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.
51 Lines starting with ';' will be ignored.
54 class WXDLLIMPEXP_ADV wxExtHelpController
: public wxHelpControllerBase
56 DECLARE_CLASS(wxExtHelpController
)
58 wxExtHelpController();
59 ~wxExtHelpController();
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
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.
70 void SetBrowser(const wxString
& browsername
= WXEXTHELP_DEFAULTBROWSER
,
71 bool isNetscape
= WXEXTHELP_DEFAULTBROWSER_IS_NETSCAPE
);
73 // Set viewer: new name for SetBrowser
74 virtual void SetViewer(const wxString
& viewer
= WXEXTHELP_DEFAULTBROWSER
, long flags
= wxHELP_NETSCAPE
);
76 /** This must be called to tell the controller where to find the
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
84 @param file - NOT a filename, but a directory name.
85 @return true on success
87 virtual bool Initialize(const wxString
& dir
, int WXUNUSED(server
))
88 { return Initialize(dir
); }
90 /** This must be called to tell the controller where to find the
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
97 @param dir - directory name where to fine the help files
98 @return true on success
100 virtual bool Initialize(const wxString
& dir
);
102 /** If file is "", reloads file given in Initialize.
103 @file Name of help directory.
104 @return true on success
106 virtual bool LoadFile(const wxString
& file
= wxEmptyString
);
108 /** Display list of all help entries.
109 @return true on success
111 virtual bool DisplayContents(void);
112 /** Display help for id sectionNo.
113 @return true on success
115 virtual bool DisplaySection(int sectionNo
);
116 /** Display help for id sectionNo -- identical with DisplaySection().
117 @return true on success
119 virtual bool DisplaySection(const wxString
& section
);
120 /** Display help for URL (using DisplayHelp) or keyword (using KeywordSearch)
121 @return true on success
123 virtual bool DisplayBlock(long blockNo
);
124 /** Search comment/documentation fields in map file and present a
126 @key k string to search for, empty string will list all entries
127 @return true on success
129 virtual bool KeywordSearch(const wxString
& k
,
130 wxHelpSearchMode mode
= wxHELP_SEARCH_ALL
);
133 virtual bool Quit(void);
135 virtual void OnQuit(void);
137 /// Call the browser using a relative URL.
138 virtual bool DisplayHelp(const wxString
&) ;
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)
146 // does nothing by default
148 /// Obtains the latest settings used by the help frame and the help
150 virtual wxFrame
*GetFrameParameters(wxSize
*WXUNUSED(size
) = NULL
,
151 wxPoint
*WXUNUSED(pos
) = NULL
,
152 bool *WXUNUSED(newFrameEachTime
) = NULL
)
154 return (wxFrame
*) NULL
;// does nothing by default
158 /// Filename of currently active map file.
160 /// How many entries do we have in the map file?
162 /// A list containing all id,url,documentation triples.
164 /// Deletes the list and all objects.
165 void DeleteList(void);
168 /// How to call the html viewer.
169 wxString m_BrowserName
;
170 /// Is the viewer a variant of netscape?
171 bool m_BrowserIsNetscape
;
176 #endif // __WX_HELPEXT_H_