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