]> git.saurik.com Git - wxWidgets.git/blob - src/html/helpfrm.cpp
*** empty log message ***
[wxWidgets.git] / src / html / helpfrm.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: helpfrm.cpp
3 // Purpose: wxHtmlHelpFrame
4 // Notes: Based on htmlhelp.cpp, implementing a monolithic
5 // HTML Help controller class, by Vaclav Slavik
6 // Author: Harm van der Heijden and Vaclav Slavik
7 // RCS-ID: $Id$
8 // Copyright: (c) Harm van der Heijden and Vaclav Slavik
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation
14 #endif
15
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
18
19 #ifdef __BORLANDC__
20 #pragma hdrstop
21 #endif
22
23 #include "wx/defs.h"
24
25 #if wxUSE_HTML
26
27 #ifndef WXPRECOMP
28 #include <wx/wx.h>
29 #endif
30
31 #include "wx/html/helpfrm.h"
32 #include "wx/notebook.h"
33 #include "wx/imaglist.h"
34 #include "wx/treectrl.h"
35 #include "wx/tokenzr.h"
36 #include "wx/wfstream.h"
37 #include "wx/html/htmlwin.h"
38 #include "wx/busyinfo.h"
39 #include "wx/progdlg.h"
40 #include "wx/toolbar.h"
41
42 // Bitmaps:
43
44 #ifndef __WXMSW__
45 #include "bitmaps/panel.xpm"
46 #include "bitmaps/back.xpm"
47 #include "bitmaps/forward.xpm"
48 #include "bitmaps/book.xpm"
49 #include "bitmaps/folder.xpm"
50 #include "bitmaps/page.xpm"
51 #endif
52
53 #include "wx/stream.h"
54
55 // number of times that the contents/index creation progress dialog
56 // is updated.
57 #define PROGRESS_STEP 40
58
59 //--------------------------------------------------------------------------
60 // wxHtmlHelpTreeItemData
61 //--------------------------------------------------------------------------
62
63 class wxHtmlHelpTreeItemData : public wxTreeItemData
64 {
65 private:
66 wxString m_Page;
67
68 public:
69 wxHtmlHelpTreeItemData(wxHtmlContentsItem *it) : wxTreeItemData()
70 {
71 m_Page = it -> m_Book -> GetBasePath() + it -> m_Page;
72 }
73 const wxString& GetPage() { return m_Page; }
74 };
75
76 //---------------------------------------------------------------------------
77 // wxHtmlHelpFrame
78 //---------------------------------------------------------------------------
79
80 IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpFrame, wxFrame)
81
82 wxHtmlHelpFrame::wxHtmlHelpFrame(wxWindow* parent, wxWindowID id, const wxString& title,
83 int style, wxHtmlHelpData* data)
84 {
85 Init(data);
86 Create(parent, id, title, style);
87 }
88
89 void wxHtmlHelpFrame::Init(wxHtmlHelpData* data)
90 {
91 if (data) {
92 m_Data = data;
93 m_DataCreated = FALSE;
94 } else {
95 m_Data = new wxHtmlHelpData();
96 m_DataCreated = TRUE;
97 }
98
99 m_ContentsImageList = new wxImageList(12, 12);
100 m_ContentsImageList -> Add(wxICON(book));
101 m_ContentsImageList -> Add(wxICON(folder));
102 m_ContentsImageList -> Add(wxICON(page));
103
104 m_ContentsBox = NULL;
105 m_IndexBox = NULL;
106 m_SearchList = NULL;
107 m_SearchButton = NULL;
108 m_SearchText = NULL;
109 m_SearchChoice = NULL;
110 m_Splitter = NULL;
111 m_NavigPan = NULL;
112 m_HtmlWin = NULL;
113 m_Config = NULL;
114 m_ConfigRoot = wxEmptyString;
115
116 m_Cfg.x = m_Cfg.y = 0;
117 m_Cfg.w = 700;
118 m_Cfg.h = 480;
119 m_Cfg.sashpos = 240;
120 m_Cfg.navig_on = TRUE;
121 }
122
123 // Create: builds the GUI components.
124 // with the style flag it's possible to toggle the toolbar, contents, index and search
125 // controls.
126 // m_HtmlWin will *always* be created, but it's important to realize that
127 // m_ContentsBox, m_IndexBox, m_SearchList, m_SearchButton, m_SearchText and
128 // m_SearchButton may be NULL.
129 // moreover, if no contents, index or searchpage is needed, m_Splitter and
130 // m_NavigPan will be NULL too (with m_HtmlWin directly connected to the frame)
131
132 bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& title,
133 int style)
134 {
135 // Do the config in two steps. We read the HtmlWindow customization after we
136 // create the window.
137 if (m_Config)
138 ReadCustomization(m_Config, m_ConfigRoot);
139
140 wxFrame::Create(parent, id, "", wxPoint(m_Cfg.x, m_Cfg.y), wxSize(m_Cfg.w, m_Cfg.h));
141
142 int notebook_page = 0;
143
144 CreateStatusBar();
145
146 // toolbar?
147 if (style & wxHF_TOOLBAR) {
148 wxToolBar *toolBar = CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL | /*wxTB_FLAT | */
149 wxTB_DOCKABLE);
150 toolBar -> SetMargins(2, 2);
151 wxBitmap* toolBarBitmaps[3];
152
153 #ifdef __WXMSW__
154 toolBarBitmaps[0] = new wxBitmap("panel");
155 toolBarBitmaps[1] = new wxBitmap("back");
156 toolBarBitmaps[2] = new wxBitmap("forward");
157 int width = 24;
158 #else
159 toolBarBitmaps[0] = new wxBitmap(panel_xpm);
160 toolBarBitmaps[1] = new wxBitmap(back_xpm);
161 toolBarBitmaps[2] = new wxBitmap(forward_xpm);
162 int width = 16;
163 #endif
164
165 int currentX = 5;
166
167 toolBar -> AddTool(wxID_HTML_PANEL, *(toolBarBitmaps[0]), wxNullBitmap,
168 FALSE, currentX, -1, (wxObject *) NULL,
169 _("Show/hide navigation panel"));
170 currentX += width + 5;
171 toolBar -> AddSeparator();
172 toolBar -> AddTool(wxID_HTML_BACK, *(toolBarBitmaps[1]), wxNullBitmap,
173 FALSE, currentX, -1, (wxObject *) NULL,
174 _("Go back to the previous HTML page"));
175 currentX += width + 5;
176 toolBar -> AddTool(wxID_HTML_FORWARD, *(toolBarBitmaps[2]), wxNullBitmap,
177 FALSE, currentX, -1, (wxObject *) NULL,
178 _("Go forward to the next HTML page"));
179 currentX += width + 5;
180
181 toolBar -> Realize();
182
183 // Can delete the bitmaps since they're reference counted
184 for (int i = 0; i < 3; i++)
185 delete toolBarBitmaps[i];
186 }
187
188 if (style & (wxHF_CONTENTS | wxHF_INDEX | wxHF_SEARCH)) {
189 // traditional help controller; splitter window with html page on the
190 // right and a notebook containing various pages on the left
191 m_Splitter = new wxSplitterWindow(this);
192
193 m_HtmlWin = new wxHtmlWindow(m_Splitter);
194 m_NavigPan = new wxNotebook(m_Splitter, wxID_HTML_NOTEBOOK,
195 wxDefaultPosition, wxDefaultSize);
196 } else { // only html window, no notebook with index,contents etc
197 m_HtmlWin = new wxHtmlWindow(this);
198 }
199
200 m_HtmlWin -> SetRelatedFrame(this, m_TitleFormat);
201 m_HtmlWin -> SetRelatedStatusBar(0);
202 if (m_Config)
203 m_HtmlWin -> ReadCustomization(m_Config, m_ConfigRoot);
204
205 // contents tree panel?
206 if (style & wxHF_CONTENTS) {
207 m_ContentsBox = new wxTreeCtrl(m_NavigPan, wxID_HTML_TREECTRL,
208 wxDefaultPosition, wxDefaultSize,
209 wxTR_HAS_BUTTONS | wxSUNKEN_BORDER);
210 m_ContentsBox -> SetImageList(m_ContentsImageList);
211 m_NavigPan -> AddPage(m_ContentsBox, _("Contents"));
212 m_ContentsPage = notebook_page++;
213 }
214
215 // index listbox panel?
216 if (style & wxHF_INDEX) {
217 wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_INDEXPAGE);
218 wxLayoutConstraints *b1 = new wxLayoutConstraints;
219 b1 -> top.SameAs (dummy, wxTop, 0);
220 b1 -> left.SameAs (dummy, wxLeft, 0);
221 b1 -> width.PercentOf (dummy, wxWidth, 100);
222 b1 -> bottom.SameAs (dummy, wxBottom, 0);
223 m_IndexBox = new wxListBox(dummy, wxID_HTML_INDEXLIST, wxDefaultPosition,
224 wxDefaultSize, 0, NULL, wxLB_SINGLE | wxLB_ALWAYS_SB);
225 m_IndexBox -> SetConstraints(b1);
226 dummy -> SetAutoLayout(TRUE);
227 m_NavigPan -> AddPage(dummy, _("Index"));
228 m_IndexPage = notebook_page++;
229 }
230
231 // search list panel?
232 if (style & wxHF_SEARCH) {
233 wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_SEARCHPAGE);
234
235 wxLayoutConstraints *b1 = new wxLayoutConstraints;
236 m_SearchText = new wxTextCtrl(dummy, wxID_HTML_SEARCHTEXT);
237 b1 -> top.SameAs (dummy, wxTop, 10);
238 b1 -> left.SameAs (dummy, wxLeft, 10);
239 b1 -> right.SameAs (dummy, wxRight, 10);
240 b1 -> height.AsIs();
241 m_SearchText -> SetConstraints(b1);
242
243 wxLayoutConstraints *b2 = new wxLayoutConstraints;
244 m_SearchButton = new wxButton(dummy, wxID_HTML_SEARCHBUTTON, _("Search"));
245 b2 -> top.Below (m_SearchText, 10);
246 b2 -> left.SameAs (dummy, wxLeft, 10);
247 b2 -> width.AsIs();
248 b2 -> height.AsIs();
249 m_SearchButton -> SetConstraints(b2);
250
251 wxLayoutConstraints *b3 = new wxLayoutConstraints;
252 m_SearchList = new wxListBox(dummy, wxID_HTML_SEARCHLIST, wxDefaultPosition, wxDefaultSize, 0);
253 b3 -> top.Below (m_SearchButton, 10);
254 b3 -> left.SameAs (dummy, wxLeft, 0);
255 b3 -> right.SameAs (dummy, wxRight, 0);
256 b3 -> bottom.SameAs (dummy, wxBottom, 0);
257 m_SearchList -> SetConstraints(b3);
258
259 wxLayoutConstraints *b4 = new wxLayoutConstraints;
260 m_SearchChoice = new wxChoice(dummy, wxID_HTML_SEARCHCHOICE, wxDefaultPosition,
261 wxDefaultSize);
262 b4 -> top.Below (m_SearchText, 10);
263 b4 -> left.SameAs (m_SearchButton, wxRight, 10);
264 b4 -> right.SameAs (dummy, wxRight, 10);
265 b4 -> height.AsIs();
266 m_SearchChoice -> SetConstraints(b4);
267
268 dummy -> SetAutoLayout(TRUE);
269 dummy -> Layout();
270 m_NavigPan -> AddPage(dummy, _("Search"));
271 m_SearchPage = notebook_page++;
272 }
273
274 //RefreshLists();
275
276 // showtime
277 if (m_NavigPan && m_Splitter) {
278 m_NavigPan -> Show(TRUE);
279 m_Splitter -> SetMinimumPaneSize(20);
280 if (m_Cfg.navig_on)
281 m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
282 }
283 m_HtmlWin -> Show(TRUE);
284 return TRUE;
285 }
286
287 wxHtmlHelpFrame::~wxHtmlHelpFrame()
288 {
289 delete m_ContentsImageList;
290 if (m_DataCreated)
291 delete m_Data;
292 }
293
294 bool wxHtmlHelpFrame::Display(const wxString& x)
295 {
296 wxString url = m_Data->FindPageByName(x);
297 if (! url.IsEmpty()) {
298 m_HtmlWin->LoadPage(url);
299 return TRUE;
300 }
301 return FALSE;
302 }
303
304 bool wxHtmlHelpFrame::Display(const int id)
305 {
306 wxString url = m_Data->FindPageById(id);
307 if (! url.IsEmpty()) {
308 m_HtmlWin->LoadPage(url);
309 return TRUE;
310 }
311 return FALSE;
312 }
313
314
315
316 bool wxHtmlHelpFrame::DisplayContents()
317 {
318 if (! m_ContentsBox)
319 return FALSE;
320 if (!m_Splitter -> IsSplit()) {
321 m_NavigPan -> Show(TRUE);
322 m_HtmlWin -> Show(TRUE);
323 m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
324 }
325 m_NavigPan -> SetSelection(0);
326 return TRUE;
327 }
328
329
330
331 bool wxHtmlHelpFrame::DisplayIndex()
332 {
333 if (! m_IndexBox)
334 return FALSE;
335 if (!m_Splitter -> IsSplit()) {
336 m_NavigPan -> Show(TRUE);
337 m_HtmlWin -> Show(TRUE);
338 m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
339 }
340 m_NavigPan -> SetSelection(1);
341 return TRUE;
342 }
343
344 bool wxHtmlHelpFrame::KeywordSearch(const wxString& keyword)
345 {
346 if (! (m_SearchList && m_SearchButton && m_SearchText && m_SearchChoice))
347 return FALSE;
348
349 int foundcnt = 0;
350 wxString foundstr;
351 wxString book = wxEmptyString;
352
353 if (!m_Splitter -> IsSplit()) {
354 m_NavigPan -> Show(TRUE);
355 m_HtmlWin -> Show(TRUE);
356 m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
357 }
358 m_NavigPan -> SetSelection(m_SearchPage);
359 m_SearchList -> Clear();
360 m_SearchText -> SetValue(keyword);
361 m_SearchButton -> Enable(FALSE);
362
363 if (m_SearchChoice->GetSelection() != 0)
364 book = m_SearchChoice->GetStringSelection();
365
366 wxHtmlSearchStatus status(m_Data, keyword, book);
367
368 wxProgressDialog progress(_("Searching..."), _("No matching page found yet"),
369 status.GetMaxIndex(), this,
370 wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_AUTO_HIDE);
371
372 while (status.IsActive()) {
373 if (progress.Update(status.GetCurIndex()) == FALSE)
374 break;
375 if (status.Search()) {
376 foundstr.Printf(_("Found %i matches"), ++foundcnt);
377 progress.Update(status.GetCurIndex(), foundstr);
378 m_SearchList -> Append(status.GetName(), status.GetContentsItem());
379 }
380 wxYield();
381 }
382
383 m_SearchButton -> Enable(TRUE);
384 m_SearchText -> SetSelection(0, keyword.Length());
385 m_SearchText -> SetFocus();
386 if (foundcnt) {
387 wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_SearchList -> GetClientData(0);
388 if (it) m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page);
389 }
390 return (foundcnt > 0);
391 }
392
393 #define MAX_ROOTS 64
394
395 void wxHtmlHelpFrame::CreateContents(bool show_progress)
396 {
397 if (! m_ContentsBox)
398 return ;
399
400 wxProgressDialog *progress;
401 wxString proginfo;
402
403 m_ContentsBox->Clear();
404
405 int cnt = m_Data->GetContentsCnt();
406 int div = (cnt / PROGRESS_STEP) + 1;
407 int i;
408
409 wxHtmlContentsItem *it = m_Data->GetContents();
410
411 if (show_progress)
412 progress = new wxProgressDialog(_("Building contents tree..."), wxEmptyString,
413 cnt, this, wxPD_APP_MODAL | wxPD_CAN_ABORT |
414 wxPD_AUTO_HIDE);
415
416 wxTreeItemId roots[MAX_ROOTS];
417 bool imaged[MAX_ROOTS];
418
419 m_ContentsBox -> DeleteAllItems();
420 roots[0] = m_ContentsBox -> AddRoot(_("(Help)"));
421 imaged[0] = TRUE;
422
423 for (i = 0; i < cnt; i++, it++) {
424 if (show_progress && ((i % div) == 0)) {
425 proginfo.Printf(_("Added %d/%d items"), i, cnt);
426 if (! progress->Update(i, proginfo))
427 break;
428 wxYield();
429 }
430 roots[it -> m_Level + 1] = m_ContentsBox -> AppendItem(
431 roots[it -> m_Level], it -> m_Name, IMG_Page, -1,
432 new wxHtmlHelpTreeItemData(it));
433
434 if (it -> m_Level == 0) {
435 m_ContentsBox -> SetItemBold(roots[1], TRUE);
436 m_ContentsBox -> SetItemImage(roots[1], IMG_Book);
437 m_ContentsBox -> SetItemSelectedImage(roots[1], IMG_Book);
438 imaged[1] = TRUE;
439 } else imaged[it -> m_Level + 1] = FALSE;
440
441 if (!imaged[it -> m_Level]) {
442 m_ContentsBox -> SetItemImage(roots[it -> m_Level], IMG_Folder);
443 m_ContentsBox -> SetItemSelectedImage(roots[it -> m_Level], IMG_Folder);
444 imaged[it -> m_Level] = TRUE;
445 }
446 }
447 if (show_progress)
448 delete progress;
449 m_ContentsBox -> Expand(roots[0]);
450 }
451
452
453 void wxHtmlHelpFrame::CreateIndex(bool show_progress)
454 {
455 if (! m_IndexBox)
456 return ;
457
458 wxProgressDialog *progress;
459 wxString proginfo;
460
461 m_IndexBox->Clear();
462
463 int cnt = m_Data->GetIndexCnt();
464 int div = (cnt / PROGRESS_STEP) + 1;
465
466 wxHtmlContentsItem* index = m_Data->GetIndex();
467
468 if (show_progress)
469 progress = new wxProgressDialog(_("Building index list..."), wxEmptyString,
470 cnt, this, wxPD_APP_MODAL | wxPD_CAN_ABORT |
471 wxPD_AUTO_HIDE);
472 for (int i = 0; i < cnt; i++) {
473 if (show_progress && ((i % div) == 0)) {
474 proginfo.Printf(_("Added %d/%d items"), i, cnt);
475 if (! progress->Update(i, proginfo))
476 break;
477 wxYield();
478 }
479 m_IndexBox -> Append(index[i].m_Name, (char*)(index + i));
480 }
481
482 if (show_progress)
483 delete progress;
484 }
485
486 void wxHtmlHelpFrame::CreateSearch()
487 {
488 if (! (m_SearchList && m_SearchChoice))
489 return ;
490 m_SearchList -> Clear();
491 m_SearchChoice -> Clear();
492 m_SearchChoice -> Append(_("all books"));
493 const wxHtmlBookRecArray& bookrec = m_Data->GetBookRecArray();
494 int i, cnt = bookrec.GetCount();
495 for (i = 0; i < cnt; i++)
496 m_SearchChoice->Append(bookrec[i].GetTitle());
497 m_SearchChoice->SetSelection(0);
498 }
499
500
501 void wxHtmlHelpFrame::RefreshLists(bool show_progress)
502 {
503 CreateContents(show_progress);
504 CreateIndex(show_progress);
505 CreateSearch();
506 }
507
508 void wxHtmlHelpFrame::ReadCustomization(wxConfigBase *cfg, const wxString& path)
509 {
510 wxString oldpath;
511 wxString tmp;
512
513 if (path != wxEmptyString) {
514 oldpath = cfg -> GetPath();
515 cfg -> SetPath(path);
516 }
517
518 m_Cfg.navig_on = cfg -> Read("hcNavigPanel", m_Cfg.navig_on) != 0;
519 m_Cfg.sashpos = cfg -> Read("hcSashPos", m_Cfg.sashpos);
520 m_Cfg.x = cfg -> Read("hcX", m_Cfg.x);
521 m_Cfg.y = cfg -> Read("hcY", m_Cfg.y);
522 m_Cfg.w = cfg -> Read("hcW", m_Cfg.w);
523 m_Cfg.h = cfg -> Read("hcH", m_Cfg.h);
524
525 if (m_HtmlWin)
526 m_HtmlWin->ReadCustomization(cfg, path);
527
528 if (path != wxEmptyString)
529 cfg -> SetPath(oldpath);
530 }
531
532 void wxHtmlHelpFrame::WriteCustomization(wxConfigBase *cfg, const wxString& path)
533 {
534 wxString oldpath;
535 wxString tmp;
536
537 if (path != wxEmptyString) {
538 oldpath = cfg -> GetPath();
539 cfg -> SetPath(path);
540 }
541
542 cfg -> Write("hcNavigPanel", m_Cfg.navig_on);
543 cfg -> Write("hcSashPos", (long)m_Cfg.sashpos);
544 cfg -> Write("hcX", (long)m_Cfg.x);
545 cfg -> Write("hcY", (long)m_Cfg.y);
546 cfg -> Write("hcW", (long)m_Cfg.w);
547 cfg -> Write("hcH", (long)m_Cfg.h);
548
549 if (m_HtmlWin)
550 m_HtmlWin->WriteCustomization(cfg, path);
551
552 if (path != wxEmptyString)
553 cfg -> SetPath(oldpath);
554 }
555
556
557 /*
558 EVENT HANDLING :
559 */
560
561
562 void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event)
563 {
564 switch (event.GetId()) {
565 case wxID_HTML_BACK :
566 m_HtmlWin -> HistoryBack();
567 break;
568 case wxID_HTML_FORWARD :
569 m_HtmlWin -> HistoryForward();
570 break;
571 case wxID_HTML_PANEL :
572 if (! (m_Splitter && m_NavigPan))
573 return ;
574 if (m_Splitter -> IsSplit()) {
575 m_Cfg.sashpos = m_Splitter -> GetSashPosition();
576 m_Splitter -> Unsplit(m_NavigPan);
577 } else {
578 m_NavigPan -> Show(TRUE);
579 m_HtmlWin -> Show(TRUE);
580 m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
581 }
582 break;
583 }
584 }
585
586
587
588 void wxHtmlHelpFrame::OnContentsSel(wxTreeEvent& event)
589 {
590 wxHtmlHelpTreeItemData *pg;
591
592 pg = (wxHtmlHelpTreeItemData*) m_ContentsBox -> GetItemData(event.GetItem());
593 if (pg) m_HtmlWin -> LoadPage(pg -> GetPage());
594 }
595
596
597
598 void wxHtmlHelpFrame::OnIndexSel(wxCommandEvent& WXUNUSED(event))
599 {
600 wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_IndexBox -> GetClientData(m_IndexBox -> GetSelection());
601 if (it) m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page);
602 }
603
604
605
606 void wxHtmlHelpFrame::OnSearchSel(wxCommandEvent& WXUNUSED(event))
607 {
608 wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_SearchList -> GetClientData(m_SearchList -> GetSelection());
609 if (it) m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page);
610 }
611
612 void wxHtmlHelpFrame::OnSearch(wxCommandEvent& WXUNUSED(event))
613 {
614 wxString sr = m_SearchText -> GetLineText(0);
615
616 if (sr != wxEmptyString) KeywordSearch(sr);
617 }
618
619 void wxHtmlHelpFrame::OnCloseWindow(wxCloseEvent& evt)
620 {
621 if (m_Config)
622 WriteCustomization(m_Config, m_ConfigRoot);
623 evt.Skip();
624 }
625
626 BEGIN_EVENT_TABLE(wxHtmlHelpFrame, wxFrame)
627 EVT_TOOL_RANGE(wxID_HTML_PANEL, wxID_HTML_FORWARD, wxHtmlHelpFrame::OnToolbar)
628 EVT_TREE_SEL_CHANGED(wxID_HTML_TREECTRL, wxHtmlHelpFrame::OnContentsSel)
629 EVT_LISTBOX(wxID_HTML_INDEXLIST, wxHtmlHelpFrame::OnIndexSel)
630 EVT_LISTBOX(wxID_HTML_SEARCHLIST, wxHtmlHelpFrame::OnSearchSel)
631 EVT_BUTTON(wxID_HTML_SEARCHBUTTON, wxHtmlHelpFrame::OnSearch)
632 EVT_TEXT_ENTER(wxID_HTML_SEARCHTEXT, wxHtmlHelpFrame::OnSearch)
633 EVT_CLOSE(wxHtmlHelpFrame::OnCloseWindow)
634 END_EVENT_TABLE()
635
636 #endif