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