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