Don't send dummy wxCommandEvent.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37863 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba 2006-03-07 18:41:27 +00:00
parent 73de5077ce
commit 548b537752
2 changed files with 21 additions and 11 deletions

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: helpwnd.h // Name: wx/html/helpwnd.h
// Purpose: wxHtmlHelpWindow // Purpose: wxHtmlHelpWindow
// Notes: Based on htmlhelp.cpp, implementing a monolithic // Notes: Based on htmlhelp.cpp, implementing a monolithic
// HTML Help controller class, by Vaclav Slavik // HTML Help controller class, by Vaclav Slavik
@ -252,6 +252,8 @@ protected:
int m_hfStyle; int m_hfStyle;
private: private:
void DoIndexFind();
void DoIndexAll();
void DisplayIndexItem(const wxHtmlHelpMergedIndexItem *it); void DisplayIndexItem(const wxHtmlHelpMergedIndexItem *it);
wxHtmlHelpMergedIndex *m_mergedIndex; wxHtmlHelpMergedIndex *m_mergedIndex;
@ -327,4 +329,3 @@ END_DECLARE_EVENT_TYPES()
#endif // wxUSE_WXHTML_HELP #endif // wxUSE_WXHTML_HELP
#endif #endif

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: helpwnd.cpp // Name: src/html/helpwnd.cpp
// Purpose: wxHtmlHelpWindow // Purpose: wxHtmlHelpWindow
// Notes: Based on htmlhelp.cpp, implementing a monolithic // Notes: Based on htmlhelp.cpp, implementing a monolithic
// HTML Help controller class, by Vaclav Slavik // 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. // The sizer for the whole top-level window.
wxSizer *topWindowSizer = new wxBoxSizer(wxVERTICAL); wxSizer *topWindowSizer = new wxBoxSizer(wxVERTICAL);
SetSizer(topWindowSizer); SetSizer(topWindowSizer);
SetAutoLayout(TRUE); SetAutoLayout(true);
#if wxUSE_TOOLBAR #if wxUSE_TOOLBAR
// toolbar? // toolbar?
if (helpStyle & (wxHF_TOOLBAR | wxHF_FLAT_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 | wxNO_BORDER | wxTB_HORIZONTAL |
wxTB_DOCKABLE | wxTB_NODIVIDER | wxTB_DOCKABLE | wxTB_NODIVIDER |
(helpStyle & wxHF_FLAT_TOOLBAR ? wxTB_FLAT : 0)); (helpStyle & wxHF_FLAT_TOOLBAR ? wxTB_FLAT : 0));
@ -874,7 +874,7 @@ bool wxHtmlHelpWindow::KeywordSearch(const wxString& keyword,
} }
m_SearchButton->Enable(); m_SearchButton->Enable();
m_SearchText->SetSelection(0, keyword.Length()); m_SearchText->SetSelection(0, keyword.length());
m_SearchText->SetFocus(); m_SearchText->SetFocus();
} }
else if (mode == wxHELP_SEARCH_INDEX) else if (mode == wxHELP_SEARCH_INDEX)
@ -885,8 +885,7 @@ bool wxHtmlHelpWindow::KeywordSearch(const wxString& keyword,
m_IndexButtonAll->Disable(); m_IndexButtonAll->Disable();
m_IndexText->SetValue(keyword); m_IndexText->SetValue(keyword);
wxCommandEvent dummy; DoIndexFind();
OnIndexFind(dummy); // what a hack...
m_IndexButton->Enable(); m_IndexButton->Enable();
m_IndexButtonAll->Enable(); m_IndexButtonAll->Enable();
foundcnt = m_IndexList->GetCount(); foundcnt = m_IndexList->GetCount();
@ -1584,13 +1583,18 @@ void wxHtmlHelpWindow::OnIndexSel(wxCommandEvent& WXUNUSED(event))
DisplayIndexItem(it); DisplayIndexItem(it);
} }
void wxHtmlHelpWindow::OnIndexFind(wxCommandEvent& event) void wxHtmlHelpWindow::OnIndexFind(wxCommandEvent& WXUNUSED(event))
{
DoIndexFind();
}
void wxHtmlHelpWindow::DoIndexFind()
{ {
wxString sr = m_IndexText->GetLineText(0); wxString sr = m_IndexText->GetLineText(0);
sr.MakeLower(); sr.MakeLower();
if (sr == wxEmptyString) if (sr == wxEmptyString)
{ {
OnIndexAll(event); DoIndexAll();
} }
else else
{ {
@ -1654,12 +1658,17 @@ void wxHtmlHelpWindow::OnIndexFind(wxCommandEvent& event)
cnttext.Printf(_("%i of %i"), displ, cnt); cnttext.Printf(_("%i of %i"), displ, cnt);
m_IndexCountInfo->SetLabel(cnttext); m_IndexCountInfo->SetLabel(cnttext);
m_IndexText->SetSelection(0, sr.Length()); m_IndexText->SetSelection(0, sr.length());
m_IndexText->SetFocus(); m_IndexText->SetFocus();
} }
} }
void wxHtmlHelpWindow::OnIndexAll(wxCommandEvent& WXUNUSED(event)) void wxHtmlHelpWindow::OnIndexAll(wxCommandEvent& WXUNUSED(event))
{
DoIndexAll();
}
void wxHtmlHelpWindow::DoIndexAll()
{ {
wxBusyCursor bcur; wxBusyCursor bcur;