]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/helphtml.h
headers are now installed by automake too
[wxWidgets.git] / include / wx / generic / helphtml.h
1 /*-*- c++ -*-********************************************************
2 * helphtml.h - base class for html based help controllers *
3 * *
4 * (C) 1999 by Karsten Ballüder (Ballueder@usa.net) *
5 * *
6 * $Id$
7 *******************************************************************/
8
9 #ifndef __WX_HELPHTML_H_
10 #define __WX_HELPHTML_H_
11
12 #if wxUSE_HELP
13
14 #ifdef __GNUG__
15 # pragma interface "helphtml.h"
16 #endif
17
18 #include "wx/helpbase.h"
19
20 /// Name for map file.
21 #define WXEXTHELP_MAPFILE "wxhelp.map"
22 /// Path separator.
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 ';'
28
29 class WXDLLEXPORT wxExtHelpMapList;
30
31
32 /**
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.
36
37 The map file contains two or three fields per line:
38 numeric_id relative_URL [; comment/documentation]
39
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.
47
48 Lines starting with ';' will be ignored.
49 */
50
51 class WXDLLEXPORT wxHTMLHelpControllerBase : public wxHelpControllerBase
52 {
53 DECLARE_ABSTRACT_CLASS(wxHTMLHelpControllerBase)
54 public:
55 wxHTMLHelpControllerBase(void);
56 virtual ~wxHTMLHelpControllerBase(void);
57
58 /** This must be called to tell the controller where to find the
59 documentation.
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
64 doesn't exist.
65
66 @param file - NOT a filename, but a directory name.
67 @return true on success
68 */
69 virtual bool Initialize(const wxString& dir, int WXUNUSED(server))
70 { return Initialize(dir); }
71
72 /** This must be called to tell the controller where to find the
73 documentation.
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
78 doesn't exist.
79 @param dir - directory name where to fine the help files
80 @return true on success
81 */
82 virtual bool Initialize(const wxString& dir);
83
84 /** If file is "", reloads file given in Initialize.
85 @file Name of help directory.
86 @return true on success
87 */
88 virtual bool LoadFile(const wxString& file = "");
89
90 /** Display list of all help entries.
91 @return true on success
92 */
93 virtual bool DisplayContents(void);
94 /** Display help for id sectionNo.
95 @return true on success
96 */
97 virtual bool DisplaySection(int sectionNo);
98 /** Display help for id sectionNo -- identical with DisplaySection().
99 @return true on success
100 */
101 virtual bool DisplayBlock(long blockNo);
102 /** Search comment/documentation fields in map file and present a
103 list to chose from.
104 @key k string to search for, empty string will list all entries
105 @return true on success
106 */
107 virtual bool KeywordSearch(const wxString& k);
108
109 /// does nothing
110 virtual bool Quit(void);
111 /// does nothing
112 virtual void OnQuit(void);
113
114 /// Call the browser using a relative URL.
115 virtual bool DisplayHelp(wxString const &) = 0;
116
117 protected:
118 /// Filename of currently active map file.
119 wxString m_MapFile;
120 /// How many entries do we have in the map file?
121 int m_NumOfEntries;
122 /// A list containing all id,url,documentation triples.
123 wxList *m_MapList;
124 /// Deletes the list and all objects.
125 void DeleteList(void);
126 };
127
128 #endif // wxUSE_HELP
129
130 #endif // __WX_HELPHTML_H_