From 548b53775242a8be5746a455ac74d6d1f1040146 Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Tue, 7 Mar 2006 18:41:27 +0000 Subject: [PATCH] Don't send dummy wxCommandEvent. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37863 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/html/helpwnd.h | 5 +++-- src/html/helpwnd.cpp | 27 ++++++++++++++++++--------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/include/wx/html/helpwnd.h b/include/wx/html/helpwnd.h index 5d299a7159..be0bc67cd5 100644 --- a/include/wx/html/helpwnd.h +++ b/include/wx/html/helpwnd.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: helpwnd.h +// Name: wx/html/helpwnd.h // Purpose: wxHtmlHelpWindow // Notes: Based on htmlhelp.cpp, implementing a monolithic // HTML Help controller class, by Vaclav Slavik @@ -252,6 +252,8 @@ protected: int m_hfStyle; private: + void DoIndexFind(); + void DoIndexAll(); void DisplayIndexItem(const wxHtmlHelpMergedIndexItem *it); wxHtmlHelpMergedIndex *m_mergedIndex; @@ -327,4 +329,3 @@ END_DECLARE_EVENT_TYPES() #endif // wxUSE_WXHTML_HELP #endif - diff --git a/src/html/helpwnd.cpp b/src/html/helpwnd.cpp index 5686f0bab5..83c06c71c6 100644 --- a/src/html/helpwnd.cpp +++ b/src/html/helpwnd.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: helpwnd.cpp +// Name: src/html/helpwnd.cpp // Purpose: wxHtmlHelpWindow // Notes: Based on htmlhelp.cpp, implementing a monolithic // HTML Help controller class, by Vaclav Slavik @@ -342,13 +342,13 @@ bool wxHtmlHelpWindow::Create(wxWindow* parent, wxWindowID id, // The sizer for the whole top-level window. wxSizer *topWindowSizer = new wxBoxSizer(wxVERTICAL); SetSizer(topWindowSizer); - SetAutoLayout(TRUE); + SetAutoLayout(true); #if wxUSE_TOOLBAR // toolbar? if (helpStyle & (wxHF_TOOLBAR | wxHF_FLAT_TOOLBAR)) { - wxToolBar *toolBar = new wxToolBar(this, -1, wxDefaultPosition, wxDefaultSize, + wxToolBar *toolBar = new wxToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER | wxTB_HORIZONTAL | wxTB_DOCKABLE | wxTB_NODIVIDER | (helpStyle & wxHF_FLAT_TOOLBAR ? wxTB_FLAT : 0)); @@ -874,7 +874,7 @@ bool wxHtmlHelpWindow::KeywordSearch(const wxString& keyword, } m_SearchButton->Enable(); - m_SearchText->SetSelection(0, keyword.Length()); + m_SearchText->SetSelection(0, keyword.length()); m_SearchText->SetFocus(); } else if (mode == wxHELP_SEARCH_INDEX) @@ -885,8 +885,7 @@ bool wxHtmlHelpWindow::KeywordSearch(const wxString& keyword, m_IndexButtonAll->Disable(); m_IndexText->SetValue(keyword); - wxCommandEvent dummy; - OnIndexFind(dummy); // what a hack... + DoIndexFind(); m_IndexButton->Enable(); m_IndexButtonAll->Enable(); foundcnt = m_IndexList->GetCount(); @@ -1584,13 +1583,18 @@ void wxHtmlHelpWindow::OnIndexSel(wxCommandEvent& WXUNUSED(event)) DisplayIndexItem(it); } -void wxHtmlHelpWindow::OnIndexFind(wxCommandEvent& event) +void wxHtmlHelpWindow::OnIndexFind(wxCommandEvent& WXUNUSED(event)) +{ + DoIndexFind(); +} + +void wxHtmlHelpWindow::DoIndexFind() { wxString sr = m_IndexText->GetLineText(0); sr.MakeLower(); if (sr == wxEmptyString) { - OnIndexAll(event); + DoIndexAll(); } else { @@ -1654,12 +1658,17 @@ void wxHtmlHelpWindow::OnIndexFind(wxCommandEvent& event) cnttext.Printf(_("%i of %i"), displ, cnt); m_IndexCountInfo->SetLabel(cnttext); - m_IndexText->SetSelection(0, sr.Length()); + m_IndexText->SetSelection(0, sr.length()); m_IndexText->SetFocus(); } } void wxHtmlHelpWindow::OnIndexAll(wxCommandEvent& WXUNUSED(event)) +{ + DoIndexAll(); +} + +void wxHtmlHelpWindow::DoIndexAll() { wxBusyCursor bcur; -- 2.45.2