]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/helphtml.h
more Unicode fixes for help files
[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 /// Path separator.
22 #ifdef __WXMSW__
23 #define WXEXTHELP_SEPARATOR _T('\\')
24 #else
25 #define WXEXTHELP_SEPARATOR _T('/')
26 #endif
27
28 class WXDLLEXPORT 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 WXDLLEXPORT 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 DisplaySection(const wxString& section);
101 /** Display help for URL (using DisplayHelp) or keyword (using KeywordSearch)
102 @return true on success
103 */
104 virtual bool DisplayBlock(long blockNo);
105 /** Search comment/documentation fields in map file and present a
106 list to chose from.
107 @key k string to search for, empty string will list all entries
108 @return true on success
109 */
110 virtual bool KeywordSearch(const wxString& k);
111
112 /// does nothing
113 virtual bool Quit(void);
114 /// does nothing
115 virtual void OnQuit(void);
116
117 /// Call the browser using a relative URL.
118 virtual bool DisplayHelp(const wxString &) = 0;
119
120 /// Allows one to override the default settings for the help frame.
121 virtual void SetFrameParameters(const wxString& WXUNUSED(title),
122 const wxSize& WXUNUSED(size),
123 const wxPoint& WXUNUSED(pos) = wxDefaultPosition,
124 bool WXUNUSED(newFrameEachTime) = FALSE)
125 {
126 // does nothing by default
127 }
128 /// Obtains the latest settings used by the help frame and the help
129 /// frame.
130 virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL,
131 wxPoint *WXUNUSED(pos) = NULL,
132 bool *WXUNUSED(newFrameEachTime) = NULL)
133 {
134 return (wxFrame*) NULL;// does nothing by default
135 }
136
137 protected:
138 /// Filename of currently active map file.
139 wxString m_MapFile;
140 /// How many entries do we have in the map file?
141 int m_NumOfEntries;
142 /// A list containing all id,url,documentation triples.
143 wxList *m_MapList;
144 /// Deletes the list and all objects.
145 void DeleteList(void);
146 };
147
148 #endif // wxUSE_HELP
149
150 #endif // __WX_HELPHTML_H_