1 /*-*- c++ -*-********************************************************
2 * helphtml.h - base class for html based help controllers *
4 * (C) 1999 by Karsten Ballüder (Ballueder@usa.net) *
7 *******************************************************************/
9 #ifndef __WX_HELPHTML_H_
10 #define __WX_HELPHTML_H_
15 # pragma interface "helphtml.h"
18 #include "wx/helpbase.h"
20 /// Name for map file.
21 #define WXEXTHELP_MAPFILE "wxhelp.map"
23 #define WXEXTHELP_SEPARATOR '/'
24 /// Maximum line length in map file.
25 #define WXEXTHELP_BUFLEN 512
26 /// Character introducing comments/documentation field in map file.
27 #define WXEXTHELP_COMMENTCHAR ';'
29 class WXDLLEXPORT wxExtHelpMapList
;
33 This class is the base class for all html help implementations.
34 It requires the name of a directory containing the documentation
35 and a file mapping numerical Section numbers to relative URLS.
37 The map file contains two or three fields per line:
38 numeric_id relative_URL [; comment/documentation]
40 The numeric_id is the id used to look up the entry in
41 DisplaySection()/DisplayBlock(). The relative_URL is a filename of
42 an html file, relative to the help directory. The optional
43 comment/documentation field (after a ';') is used for keyword
44 searches, so some meaningful text here does not hurt.
45 If the documentation itself contains a ';', only the part before
46 that will be displayed in the listbox, but all of it used for search.
48 Lines starting with ';' will be ignored.
51 class WXDLLEXPORT wxHTMLHelpControllerBase
: public wxHelpControllerBase
53 DECLARE_ABSTRACT_CLASS(wxHTMLHelpControllerBase
)
55 wxHTMLHelpControllerBase(void);
56 virtual ~wxHTMLHelpControllerBase(void);
58 /** This must be called to tell the controller where to find the
60 If a locale is set, look in file/localename, i.e.
61 If passed "/usr/local/myapp/help" and the current wxLocale is
62 set to be "de", then look in "/usr/local/myapp/help/de/"
63 first and fall back to "/usr/local/myapp/help" if that
66 @param file - NOT a filename, but a directory name.
67 @return true on success
69 virtual bool Initialize(const wxString
& dir
, int WXUNUSED(server
))
70 { return Initialize(dir
); }
72 /** This must be called to tell the controller where to find the
74 If a locale is set, look in file/localename, i.e.
75 If passed "/usr/local/myapp/help" and the current wxLocale is
76 set to be "de", then look in "/usr/local/myapp/help/de/"
77 first and fall back to "/usr/local/myapp/help" if that
79 @param dir - directory name where to fine the help files
80 @return true on success
82 virtual bool Initialize(const wxString
& dir
);
84 /** If file is "", reloads file given in Initialize.
85 @file Name of help directory.
86 @return true on success
88 virtual bool LoadFile(const wxString
& file
= "");
90 /** Display list of all help entries.
91 @return true on success
93 virtual bool DisplayContents(void);
94 /** Display help for id sectionNo.
95 @return true on success
97 virtual bool DisplaySection(int sectionNo
);
98 /** Display help for id sectionNo -- identical with DisplaySection().
99 @return true on success
101 virtual bool DisplayBlock(long blockNo
);
102 /** Search comment/documentation fields in map file and present a
104 @key k string to search for, empty string will list all entries
105 @return true on success
107 virtual bool KeywordSearch(const wxString
& k
);
110 virtual bool Quit(void);
112 virtual void OnQuit(void);
114 /// Call the browser using a relative URL.
115 virtual bool DisplayHelp(wxString
const &) = 0;
118 /// Filename of currently active map file.
120 /// How many entries do we have in the map file?
122 /// A list containing all id,url,documentation triples.
124 /// Deletes the list and all objects.
125 void DeleteList(void);
130 #endif // __WX_HELPHTML_H_