]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: html/helpwnd.h | |
3 | // Purpose: interface of wxHtmlHelpWindow | |
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 | |
12 | ||
13 | This class is used by wxHtmlHelpController | |
14 | to display help within a frame or dialog, but you can use it yourself to create | |
15 | an embedded HTML help window. | |
16 | ||
17 | For example: | |
18 | ||
19 | @code | |
20 | // m_embeddedHelpWindow is a wxHtmlHelpWindow | |
21 | // m_embeddedHtmlHelp is a wxHtmlHelpController | |
22 | ||
23 | // Create embedded HTML Help window | |
24 | m_embeddedHelpWindow = new wxHtmlHelpWindow; | |
25 | m_embeddedHtmlHelp.UseConfig(config, rootPath); // Set your own config | |
26 | object here | |
27 | m_embeddedHtmlHelp.SetHelpWindow(m_embeddedHelpWindow); | |
28 | m_embeddedHelpWindow-Create(this, | |
29 | wxID_ANY, wxDefaultPosition, GetClientSize(), | |
30 | wxTAB_TRAVERSAL|wxBORDER_NONE, wxHF_DEFAULT_STYLE); | |
31 | m_embeddedHtmlHelp.AddBook(wxFileName(_T("doc.zip"))); | |
32 | @endcode | |
33 | ||
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. | |
37 | ||
38 | @library{wxhtml} | |
39 | @category{FIXME} | |
40 | */ | |
41 | class wxHtmlHelpWindow : public wxWindow | |
42 | { | |
43 | public: | |
44 | //@{ | |
45 | /** | |
46 | Constructor. | |
47 | Constructor. For the values of @e helpStyle, please see the documentation for | |
48 | wxHtmlHelpController. | |
49 | */ | |
50 | wxHtmlHelpWindow(wxHtmlHelpData* data = NULL); | |
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, | |
56 | wxHtmlHelpData* data = NULL); | |
57 | //@} | |
58 | ||
59 | /** | |
60 | You may override this virtual method to add more buttons to the help window's | |
61 | toolbar. @a toolBar is a pointer to the toolbar and @a style is the style | |
62 | flag as passed to the Create method. | |
63 | wxToolBar::Realize is called immediately after returning from this function. | |
64 | See @e samples/html/helpview for an example. | |
65 | */ | |
66 | virtual void AddToolbarButtons(wxToolBar* toolBar, int style); | |
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, | |
77 | wxHtmlHelpData* data = NULL); | |
78 | ||
79 | /** | |
80 | Creates contents panel. (May take some time.) | |
81 | Protected. | |
82 | */ | |
83 | void CreateContents(); | |
84 | ||
85 | /** | |
86 | Creates index panel. (May take some time.) | |
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: | |
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 ...") | |
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); | |
109 | bool Display(const int id); | |
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. | |
144 | Protected. | |
145 | */ | |
146 | void RefreshLists(); | |
147 | ||
148 | /** | |
149 | Sets the frame's title format. @a format must contain exactly one "%s" | |
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 | }; | |
168 |