1 /*-*- c++ -*-********************************************************
2 * helphtml.h - base class for html based help controllers *
4 * (C) 1999 by Karsten Ballüder (Ballueder@usa.net) *
7 *******************************************************************/
9 #ifndef __WX_HELPHTML_H_
10 #define __WX_HELPHTML_H_
15 # pragma interface "helphtml.h"
18 #include "wx/helpbase.h"
23 #define WXEXTHELP_SEPARATOR _T('\\')
25 #define WXEXTHELP_SEPARATOR _T('/')
28 class WXDLLEXPORT wxExtHelpMapList
;
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.
36 The map file contains two or three fields per line:
37 numeric_id relative_URL [; comment/documentation]
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.
47 Lines starting with ';' will be ignored.
50 class WXDLLEXPORT wxHTMLHelpControllerBase
: public wxHelpControllerBase
52 DECLARE_ABSTRACT_CLASS(wxHTMLHelpControllerBase
)
54 wxHTMLHelpControllerBase(void);
55 virtual ~wxHTMLHelpControllerBase(void);
57 /** This must be called to tell the controller where to find the
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
65 @param file - NOT a filename, but a directory name.
66 @return true on success
68 virtual bool Initialize(const wxString
& dir
, int WXUNUSED(server
))
69 { return Initialize(dir
); }
71 /** This must be called to tell the controller where to find the
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
78 @param dir - directory name where to fine the help files
79 @return true on success
81 virtual bool Initialize(const wxString
& dir
);
83 /** If file is "", reloads file given in Initialize.
84 @file Name of help directory.
85 @return true on success
87 virtual bool LoadFile(const wxString
& file
= "");
89 /** Display list of all help entries.
90 @return true on success
92 virtual bool DisplayContents(void);
93 /** Display help for id sectionNo.
94 @return true on success
96 virtual bool DisplaySection(int sectionNo
);
97 /** Display help for id sectionNo -- identical with DisplaySection().
98 @return true on success
100 virtual bool DisplaySection(const wxString
& section
);
101 /** Display help for URL (using DisplayHelp) or keyword (using KeywordSearch)
102 @return true on success
104 virtual bool DisplayBlock(long blockNo
);
105 /** Search comment/documentation fields in map file and present a
107 @key k string to search for, empty string will list all entries
108 @return true on success
110 virtual bool KeywordSearch(const wxString
& k
);
113 virtual bool Quit(void);
115 virtual void OnQuit(void);
117 /// Call the browser using a relative URL.
118 virtual bool DisplayHelp(const wxString
&) = 0;
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
)
126 // does nothing by default
128 /// Obtains the latest settings used by the help frame and the help
130 virtual wxFrame
*GetFrameParameters(wxSize
*WXUNUSED(size
) = NULL
,
131 wxPoint
*WXUNUSED(pos
) = NULL
,
132 bool *WXUNUSED(newFrameEachTime
) = NULL
)
134 return (wxFrame
*) NULL
;// does nothing by default
138 /// Filename of currently active map file.
140 /// How many entries do we have in the map file?
142 /// A list containing all id,url,documentation triples.
144 /// Deletes the list and all objects.
145 void DeleteList(void);
150 #endif // __WX_HELPHTML_H_