Remove all lines containing cvs/svn "$Id$" keyword.
[wxWidgets.git] / interface / wx / html / helpwnd.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: html/helpwnd.h
3 // Purpose: interface of wxHtmlHelpWindow
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
7
8 /*!
9 * Command IDs
10 */
11 enum
12 {
13 //wxID_HTML_HELPFRAME = wxID_HIGHEST + 1,
14 wxID_HTML_PANEL = wxID_HIGHEST + 10,
15 wxID_HTML_BACK,
16 wxID_HTML_FORWARD,
17 wxID_HTML_UPNODE,
18 wxID_HTML_UP,
19 wxID_HTML_DOWN,
20 wxID_HTML_PRINT,
21 wxID_HTML_OPENFILE,
22 wxID_HTML_OPTIONS,
23 wxID_HTML_BOOKMARKSLIST,
24 wxID_HTML_BOOKMARKSADD,
25 wxID_HTML_BOOKMARKSREMOVE,
26 wxID_HTML_TREECTRL,
27 wxID_HTML_INDEXPAGE,
28 wxID_HTML_INDEXLIST,
29 wxID_HTML_INDEXTEXT,
30 wxID_HTML_INDEXBUTTON,
31 wxID_HTML_INDEXBUTTONALL,
32 wxID_HTML_NOTEBOOK,
33 wxID_HTML_SEARCHPAGE,
34 wxID_HTML_SEARCHTEXT,
35 wxID_HTML_SEARCHLIST,
36 wxID_HTML_SEARCHBUTTON,
37 wxID_HTML_SEARCHCHOICE,
38 wxID_HTML_COUNTINFO
39 };
40
41
42 /**
43 @class wxHtmlHelpWindow
44
45 This class is used by wxHtmlHelpController to display help within a frame or
46 dialog, but you can use it yourself to create an embedded HTML help window.
47
48 For example:
49 @code
50 // m_embeddedHelpWindow is a wxHtmlHelpWindow
51 // m_embeddedHtmlHelp is a wxHtmlHelpController
52
53 // Create embedded HTML Help window
54 m_embeddedHelpWindow = new wxHtmlHelpWindow;
55 m_embeddedHtmlHelp.UseConfig(config, rootPath); // Set your own config object here
56 m_embeddedHtmlHelp.SetHelpWindow(m_embeddedHelpWindow);
57 m_embeddedHelpWindow->Create(this, wxID_ANY, wxDefaultPosition, GetClientSize(),
58 wxTAB_TRAVERSAL|wxBORDER_NONE, wxHF_DEFAULT_STYLE);
59 m_embeddedHtmlHelp.AddBook(wxFileName(wxT("doc.zip")));
60 @endcode
61
62 You should pass the style wxHF_EMBEDDED to the style parameter of
63 wxHtmlHelpController to allow the embedded window to be destroyed
64 independently of the help controller.
65
66 @library{wxhtml}
67 @category{help,html}
68 */
69 class wxHtmlHelpWindow : public wxWindow
70 {
71 public:
72 wxHtmlHelpWindow(wxHtmlHelpData* data = NULL);
73
74 /**
75 Constructor.
76
77 For the values of @a helpStyle, please see the documentation for
78 wxHtmlHelpController.
79 */
80 wxHtmlHelpWindow(wxWindow* parent, int wxWindowID,
81 const wxPoint& pos = wxDefaultPosition,
82 const wxSize& size = wxDefaultSize,
83 int style = wxTAB_TRAVERSAL|wxBORDER_NONE,
84 int helpStyle = wxHF_DEFAULT_STYLE,
85 wxHtmlHelpData* data = NULL);
86
87 /**
88 Creates the help window. See @ref wxHtmlHelpWindow() "the constructor"
89 for a description of the parameters.
90 */
91 bool Create(wxWindow* parent, wxWindowID id,
92 const wxPoint& pos = wxDefaultPosition,
93 const wxSize& size = wxDefaultSize, int style = wxTAB_TRAVERSAL|wxBORDER_NONE,
94 int helpStyle = wxHF_DEFAULT_STYLE);
95
96 /**
97 Displays page x.
98 If not found it will give the user the choice of searching books.
99 Looking for the page runs in these steps:
100 -# try to locate file named x (if x is for example "doc/howto.htm")
101 -# try to open starting page of book x
102 -# try to find x in contents (if x is for example "How To ...")
103 -# try to find x in index (if x is for example "How To ...")
104 */
105 bool Display(const wxString& x);
106
107 /**
108 @overload
109
110 This form takes numeric ID as the parameter (uses an extension to MS format,
111 param name="ID" value=id).
112 */
113 bool Display(const int id);
114
115 /**
116 Displays contents panel.
117 */
118 bool DisplayContents();
119
120 /**
121 Displays index panel.
122 */
123 bool DisplayIndex();
124
125 /**
126 Returns the wxHtmlHelpData object, which is usually a pointer to the
127 controller's data.
128 */
129 wxHtmlHelpData* GetData();
130
131 /**
132 Search for given keyword. Optionally it searches through the index
133 (mode = @c wxHELP_SEARCH_INDEX), default the content (mode = @c wxHELP_SEARCH_ALL).
134 */
135 bool KeywordSearch(const wxString& keyword,
136 wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
137
138 /**
139 Reads the user's settings for this window.
140
141 @see wxHtmlHelpController::ReadCustomization
142 */
143 void ReadCustomization(wxConfigBase* cfg,
144 const wxString& path = wxEmptyString);
145
146 /**
147 Associates a wxConfig object with the help window. It is recommended that you
148 use wxHtmlHelpController::UseConfig instead.
149 */
150 void UseConfig(wxConfigBase* config,
151 const wxString& rootpath = wxEmptyString);
152
153 /**
154 Saves the user's settings for this window.
155
156 @see wxHtmlHelpController::WriteCustomization
157 */
158 void WriteCustomization(wxConfigBase* cfg,
159 const wxString& path = wxEmptyString);
160
161 /**
162 Refresh all panels. This is necessary if a new book was added.
163 */
164 void RefreshLists();
165
166
167 wxHtmlHelpController* GetController() const;
168 void SetController(wxHtmlHelpController* controller);
169
170 protected:
171
172 /**
173 Creates search panel.
174 */
175 void CreateSearch();
176
177 /**
178 You may override this virtual method to add more buttons to the help window's
179 toolbar. @a toolBar is a pointer to the toolbar and @a style is the style
180 flag as passed to the Create() method.
181
182 wxToolBar::Realize is called immediately after returning from this function.
183 See @c samples/html/helpview for an example.
184 */
185 virtual void AddToolbarButtons(wxToolBar* toolBar, int style);
186
187 /**
188 Creates contents panel. (May take some time.)
189 */
190 void CreateContents();
191
192 /**
193 Creates index panel. (May take some time.)
194 */
195 void CreateIndex();
196 };
197