]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: html/helpwnd.h | |
e54c96f1 | 3 | // Purpose: interface of wxHtmlHelpWindow |
23324ae1 | 4 | // Author: wxWidgets team |
526954c5 | 5 | // Licence: wxWindows licence |
23324ae1 FM |
6 | ///////////////////////////////////////////////////////////////////////////// |
7 | ||
90f011dc RD |
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 | ||
23324ae1 FM |
42 | /** |
43 | @class wxHtmlHelpWindow | |
7c913512 | 44 | |
c87f263e FM |
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. | |
7c913512 | 47 | |
23324ae1 | 48 | For example: |
23324ae1 | 49 | @code |
c87f263e | 50 | // m_embeddedHelpWindow is a wxHtmlHelpWindow |
23324ae1 | 51 | // m_embeddedHtmlHelp is a wxHtmlHelpController |
7c913512 | 52 | |
23324ae1 FM |
53 | // Create embedded HTML Help window |
54 | m_embeddedHelpWindow = new wxHtmlHelpWindow; | |
c87f263e | 55 | m_embeddedHtmlHelp.UseConfig(config, rootPath); // Set your own config object here |
7c913512 | 56 | m_embeddedHtmlHelp.SetHelpWindow(m_embeddedHelpWindow); |
c87f263e FM |
57 | m_embeddedHelpWindow->Create(this, wxID_ANY, wxDefaultPosition, GetClientSize(), |
58 | wxTAB_TRAVERSAL|wxBORDER_NONE, wxHF_DEFAULT_STYLE); | |
9a83f860 | 59 | m_embeddedHtmlHelp.AddBook(wxFileName(wxT("doc.zip"))); |
23324ae1 | 60 | @endcode |
7c913512 | 61 | |
23324ae1 | 62 | You should pass the style wxHF_EMBEDDED to the style parameter of |
c87f263e FM |
63 | wxHtmlHelpController to allow the embedded window to be destroyed |
64 | independently of the help controller. | |
7c913512 | 65 | |
23324ae1 | 66 | @library{wxhtml} |
c87f263e | 67 | @category{help,html} |
23324ae1 FM |
68 | */ |
69 | class wxHtmlHelpWindow : public wxWindow | |
70 | { | |
71 | public: | |
c87f263e FM |
72 | wxHtmlHelpWindow(wxHtmlHelpData* data = NULL); |
73 | ||
23324ae1 FM |
74 | /** |
75 | Constructor. | |
c87f263e FM |
76 | |
77 | For the values of @a helpStyle, please see the documentation for | |
23324ae1 FM |
78 | wxHtmlHelpController. |
79 | */ | |
7c913512 FM |
80 | wxHtmlHelpWindow(wxWindow* parent, int wxWindowID, |
81 | const wxPoint& pos = wxDefaultPosition, | |
90f011dc | 82 | const wxSize& size = wxDefaultSize, |
7c913512 FM |
83 | int style = wxTAB_TRAVERSAL|wxBORDER_NONE, |
84 | int helpStyle = wxHF_DEFAULT_STYLE, | |
4cc4bfaf | 85 | wxHtmlHelpData* data = NULL); |
23324ae1 | 86 | |
23324ae1 | 87 | /** |
c87f263e | 88 | Creates the help window. See @ref wxHtmlHelpWindow() "the constructor" |
23324ae1 FM |
89 | for a description of the parameters. |
90 | */ | |
91 | bool Create(wxWindow* parent, wxWindowID id, | |
92 | const wxPoint& pos = wxDefaultPosition, | |
5267aefd FM |
93 | const wxSize& size = wxDefaultSize, int style = wxTAB_TRAVERSAL|wxBORDER_NONE, |
94 | int helpStyle = wxHF_DEFAULT_STYLE); | |
23324ae1 | 95 | |
23324ae1 | 96 | /** |
c87f263e FM |
97 | Displays page x. |
98 | If not found it will give the user the choice of searching books. | |
23324ae1 | 99 | Looking for the page runs in these steps: |
c87f263e FM |
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 ...") | |
23324ae1 FM |
104 | */ |
105 | bool Display(const wxString& x); | |
c87f263e FM |
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 | */ | |
7c913512 | 113 | bool Display(const int id); |
23324ae1 FM |
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 | /** | |
c87f263e FM |
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). | |
23324ae1 FM |
134 | */ |
135 | bool KeywordSearch(const wxString& keyword, | |
136 | wxHelpSearchMode mode = wxHELP_SEARCH_ALL); | |
137 | ||
138 | /** | |
c87f263e FM |
139 | Reads the user's settings for this window. |
140 | ||
141 | @see wxHtmlHelpController::ReadCustomization | |
23324ae1 FM |
142 | */ |
143 | void ReadCustomization(wxConfigBase* cfg, | |
144 | const wxString& path = wxEmptyString); | |
145 | ||
23324ae1 FM |
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 | /** | |
c87f263e FM |
154 | Saves the user's settings for this window. |
155 | ||
156 | @see wxHtmlHelpController::WriteCustomization | |
23324ae1 FM |
157 | */ |
158 | void WriteCustomization(wxConfigBase* cfg, | |
159 | const wxString& path = wxEmptyString); | |
c87f263e | 160 | |
5e6e278d FM |
161 | /** |
162 | Refresh all panels. This is necessary if a new book was added. | |
163 | */ | |
164 | void RefreshLists(); | |
165 | ||
90f011dc RD |
166 | |
167 | wxHtmlHelpController* GetController() const; | |
168 | void SetController(wxHtmlHelpController* controller); | |
169 | ||
c87f263e FM |
170 | protected: |
171 | ||
5e6e278d FM |
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 | ||
c87f263e FM |
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(); | |
23324ae1 | 196 | }; |
e54c96f1 | 197 |