1 /*-*- c++ -*-********************************************************
2 * helpext.h - an external help controller for wxWindows *
4 * (C) 1998 by Karsten Ballüder (Ballueder@usa.net) *
7 *******************************************************************/
9 #ifndef __WX_HELPEXT_H_
10 #define __WX_HELPEXT_H_
14 #if defined(__GNUG__) && !defined(__APPLE__)
15 # pragma interface "wxexthlp.h"
18 #include "wx/helpbase.h"
22 #define WXEXTHELP_SEPARATOR _T('\\')
23 #elif defined(__WXMAC__)
24 #define WXEXTHELP_SEPARATOR _T(':')
26 #define WXEXTHELP_SEPARATOR _T('/')
29 class WXDLLEXPORT wxExtHelpMapList
;
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
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.
43 The map file contains two or three fields per line:
44 numeric_id relative_URL [; comment/documentation]
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.
54 Lines starting with ';' will be ignored.
57 class WXDLLEXPORT wxExtHelpController
: public wxHelpControllerBase
59 DECLARE_CLASS(wxExtHelpController
)
61 wxExtHelpController();
62 ~wxExtHelpController();
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
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.
73 void SetBrowser(const wxString
& browsername
= WXEXTHELP_DEFAULTBROWSER
,
74 bool isNetscape
= WXEXTHELP_DEFAULTBROWSER_IS_NETSCAPE
);
76 // Set viewer: new name for SetBrowser
77 virtual void SetViewer(const wxString
& viewer
= WXEXTHELP_DEFAULTBROWSER
, long flags
= wxHELP_NETSCAPE
);
79 /** This must be called to tell the controller where to find the
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
87 @param file - NOT a filename, but a directory name.
88 @return true on success
90 virtual bool Initialize(const wxString
& dir
, int WXUNUSED(server
))
91 { return Initialize(dir
); }
93 /** This must be called to tell the controller where to find the
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
100 @param dir - directory name where to fine the help files
101 @return true on success
103 virtual bool Initialize(const wxString
& dir
);
105 /** If file is "", reloads file given in Initialize.
106 @file Name of help directory.
107 @return true on success
109 virtual bool LoadFile(const wxString
& file
= wxT(""));
111 /** Display list of all help entries.
112 @return true on success
114 virtual bool DisplayContents(void);
115 /** Display help for id sectionNo.
116 @return true on success
118 virtual bool DisplaySection(int sectionNo
);
119 /** Display help for id sectionNo -- identical with DisplaySection().
120 @return true on success
122 virtual bool DisplaySection(const wxString
& section
);
123 /** Display help for URL (using DisplayHelp) or keyword (using KeywordSearch)
124 @return true on success
126 virtual bool DisplayBlock(long blockNo
);
127 /** Search comment/documentation fields in map file and present a
129 @key k string to search for, empty string will list all entries
130 @return true on success
132 virtual bool KeywordSearch(const wxString
& k
);
135 virtual bool Quit(void);
137 virtual void OnQuit(void);
139 /// Call the browser using a relative URL.
140 virtual bool DisplayHelp(const wxString
&) ;
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
)
148 // does nothing by default
150 /// Obtains the latest settings used by the help frame and the help
152 virtual wxFrame
*GetFrameParameters(wxSize
*WXUNUSED(size
) = NULL
,
153 wxPoint
*WXUNUSED(pos
) = NULL
,
154 bool *WXUNUSED(newFrameEachTime
) = NULL
)
156 return (wxFrame
*) NULL
;// does nothing by default
160 /// Filename of currently active map file.
162 /// How many entries do we have in the map file?
164 /// A list containing all id,url,documentation triples.
166 /// Deletes the list and all objects.
167 void DeleteList(void);
170 /// How to call the html viewer.
171 wxString m_BrowserName
;
172 /// Is the viewer a variant of netscape?
173 bool m_BrowserIsNetscape
;
178 #endif // __WX_HELPEXT_H_