]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/helphtml.h
Unicode compilation fixes, also moved private constants into the .cpp
[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 #include "wx/frame.h"
20
21 class WXDLLEXPORT wxExtHelpMapList;
22
23
24 /**
25 This class is the base class for all html help implementations.
26 It requires the name of a directory containing the documentation
27 and a file mapping numerical Section numbers to relative URLS.
28
29 The map file contains two or three fields per line:
30 numeric_id relative_URL [; comment/documentation]
31
32 The numeric_id is the id used to look up the entry in
33 DisplaySection()/DisplayBlock(). The relative_URL is a filename of
34 an html file, relative to the help directory. The optional
35 comment/documentation field (after a ';') is used for keyword
36 searches, so some meaningful text here does not hurt.
37 If the documentation itself contains a ';', only the part before
38 that will be displayed in the listbox, but all of it used for search.
39
40 Lines starting with ';' will be ignored.
41 */
42
43 class WXDLLEXPORT wxHTMLHelpControllerBase : public wxHelpControllerBase
44 {
45 DECLARE_ABSTRACT_CLASS(wxHTMLHelpControllerBase)
46 public:
47 wxHTMLHelpControllerBase(void);
48 virtual ~wxHTMLHelpControllerBase(void);
49
50 /** This must be called to tell the controller where to find the
51 documentation.
52 If a locale is set, look in file/localename, i.e.
53 If passed "/usr/local/myapp/help" and the current wxLocale is
54 set to be "de", then look in "/usr/local/myapp/help/de/"
55 first and fall back to "/usr/local/myapp/help" if that
56 doesn't exist.
57
58 @param file - NOT a filename, but a directory name.
59 @return true on success
60 */
61 virtual bool Initialize(const wxString& dir, int WXUNUSED(server))
62 { return Initialize(dir); }
63
64 /** This must be called to tell the controller where to find the
65 documentation.
66 If a locale is set, look in file/localename, i.e.
67 If passed "/usr/local/myapp/help" and the current wxLocale is
68 set to be "de", then look in "/usr/local/myapp/help/de/"
69 first and fall back to "/usr/local/myapp/help" if that
70 doesn't exist.
71 @param dir - directory name where to fine the help files
72 @return true on success
73 */
74 virtual bool Initialize(const wxString& dir);
75
76 /** If file is "", reloads file given in Initialize.
77 @file Name of help directory.
78 @return true on success
79 */
80 virtual bool LoadFile(const wxString& file = "");
81
82 /** Display list of all help entries.
83 @return true on success
84 */
85 virtual bool DisplayContents(void);
86 /** Display help for id sectionNo.
87 @return true on success
88 */
89 virtual bool DisplaySection(int sectionNo);
90 /** Display help for id sectionNo -- identical with DisplaySection().
91 @return true on success
92 */
93 virtual bool DisplaySection(const wxString& section);
94 /** Display help for URL (using DisplayHelp) or keyword (using KeywordSearch)
95 @return true on success
96 */
97 virtual bool DisplayBlock(long blockNo);
98 /** Search comment/documentation fields in map file and present a
99 list to chose from.
100 @key k string to search for, empty string will list all entries
101 @return true on success
102 */
103 virtual bool KeywordSearch(const wxString& k);
104
105 /// does nothing
106 virtual bool Quit(void);
107 /// does nothing
108 virtual void OnQuit(void);
109
110 /// Call the browser using a relative URL.
111 virtual bool DisplayHelp(const wxString &) = 0;
112
113 /// Allows one to override the default settings for the help frame.
114 virtual void SetFrameParameters(const wxString& WXUNUSED(title),
115 const wxSize& WXUNUSED(size),
116 const wxPoint& WXUNUSED(pos) = wxDefaultPosition,
117 bool WXUNUSED(newFrameEachTime) = FALSE)
118 {
119 // does nothing by default
120 }
121 /// Obtains the latest settings used by the help frame and the help
122 /// frame.
123 virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL,
124 wxPoint *WXUNUSED(pos) = NULL,
125 bool *WXUNUSED(newFrameEachTime) = NULL)
126 {
127 return (wxFrame*) NULL;// does nothing by default
128 }
129
130 protected:
131 /// Filename of currently active map file.
132 wxString m_MapFile;
133 /// How many entries do we have in the map file?
134 int m_NumOfEntries;
135 /// A list containing all id,url,documentation triples.
136 wxList *m_MapList;
137 /// Deletes the list and all objects.
138 void DeleteList(void);
139 };
140
141 #endif // wxUSE_HELP
142
143 #endif // __WX_HELPHTML_H_