]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/helphtml.h
char handling fixed again
[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 #ifndef WXXHELPHTML_H
9 #define WXXHELPHTML_H
10
11 #if wxUSE_HELP
12
13 #ifdef __GNUG__
14 # pragma interface "helphtml.h"
15 #endif
16
17 #include "wx/helpbase.h"
18
19 /// Name for map file.
20 #define WXEXTHELP_MAPFILE "wxhelp.map"
21 /// Path separator.
22 #define WXEXTHELP_SEPARATOR '/'
23 /// Maximum line length in map file.
24 #define WXEXTHELP_BUFLEN 512
25 /// Character introducing comments/documentation field in map file.
26 #define WXEXTHELP_COMMENTCHAR ';'
27
28 class wxExtHelpMapList;
29
30
31 /**
32 This class is the base class for all html help implementations.
33 It requires the name of a directory containing the documentation
34 and a file mapping numerical Section numbers to relative URLS.
35
36 The map file contains two or three fields per line:
37 numeric_id relative_URL [; comment/documentation]
38
39 The numeric_id is the id used to look up the entry in
40 DisplaySection()/DisplayBlock(). The relative_URL is a filename of
41 an html file, relative to the help directory. The optional
42 comment/documentation field (after a ';') is used for keyword
43 searches, so some meaningful text here does not hurt.
44 If the documentation itself contains a ';', only the part before
45 that will be displayed in the listbox, but all of it used for search.
46
47 Lines starting with ';' will be ignored.
48 */
49
50 class wxHTMLHelpControllerBase : public wxHelpControllerBase
51 {
52 DECLARE_ABSTRACT_CLASS(wxHTMLHelpControllerBase)
53 public:
54 wxHTMLHelpControllerBase(void);
55 virtual ~wxHTMLHelpControllerBase(void);
56
57 /** This must be called to tell the controller where to find the
58 documentation.
59 If a locale is set, look in file/localename, i.e.
60 If passed "/usr/local/myapp/help" and the current wxLocale is
61 set to be "de", then look in "/usr/local/myapp/help/de/"
62 first and fall back to "/usr/local/myapp/help" if that
63 doesn't exist.
64
65 @param file - NOT a filename, but a directory name.
66 @return true on success
67 */
68 virtual bool Initialize(const wxString& dir, int WXUNUSED(server))
69 { return Initialize(dir); }
70
71 /** This must be called to tell the controller where to find the
72 documentation.
73 If a locale is set, look in file/localename, i.e.
74 If passed "/usr/local/myapp/help" and the current wxLocale is
75 set to be "de", then look in "/usr/local/myapp/help/de/"
76 first and fall back to "/usr/local/myapp/help" if that
77 doesn't exist.
78 @param dir - directory name where to fine the help files
79 @return true on success
80 */
81 virtual bool Initialize(const wxString& dir);
82
83 /** If file is "", reloads file given in Initialize.
84 @file Name of help directory.
85 @return true on success
86 */
87 virtual bool LoadFile(const wxString& file = "");
88
89 /** Display list of all help entries.
90 @return true on success
91 */
92 virtual bool DisplayContents(void);
93 /** Display help for id sectionNo.
94 @return true on success
95 */
96 virtual bool DisplaySection(int sectionNo);
97 /** Display help for id sectionNo -- identical with DisplaySection().
98 @return true on success
99 */
100 virtual bool DisplayBlock(long blockNo);
101 /** Search comment/documentation fields in map file and present a
102 list to chose from.
103 @key k string to search for, empty string will list all entries
104 @return true on success
105 */
106 virtual bool KeywordSearch(const wxString& k);
107
108 /// does nothing
109 virtual bool Quit(void);
110 /// does nothing
111 virtual void OnQuit(void);
112
113 /// Call the browser using a relative URL.
114 virtual bool DisplayHelp(wxString const &) = 0;
115
116 protected:
117 /// Filename of currently active map file.
118 wxString m_MapFile;
119 /// How many entries do we have in the map file?
120 int m_NumOfEntries;
121 /// A list containing all id,url,documentation triples.
122 wxList *m_MapList;
123 /// Deletes the list and all objects.
124 void DeleteList(void);
125 };
126
127 #endif
128 #endif