\membersection{wxHelpController::KeywordSearch}\label{wxhelpcontrollerkeywordsearch}
-\func{virtual bool}{KeywordSearch}{\param{const wxString\& }{keyWord}}
+\func{virtual bool}{KeywordSearch}{\param{const wxString\& }{keyWord}, \param{wxHelpSearchMode }{mode = wxHELP\_SEARCH\_ALL}}
-If the help viewer is not running, runs it, and searches for sections matching the given keyword. If one
-match is found, the file is displayed at this section.
+If the help viewer is not running, runs it, and searches for sections matching
+the given keyword. If one match is found, the file is displayed at this
+section. The optional parameter allows the search the index
+(wxHELP\_SEARCH\_INDEX) but this currently only supported by the
+wxHtmlHelpController.
{\it WinHelp, MS HTML Help:} If more than one match is found,
the first topic is displayed.
\membersection{wxHtmlHelpController::KeywordSearch}\label{wxhtmlhelpcontrollerkeywordsearch}
-\func{bool}{KeywordSearch}{\param{const wxString\& }{keyword}}
+\func{bool}{KeywordSearch}{\param{const wxString\& }{keyword}, \param{wxHelpSearchMode }{mode = wxHELP\_SEARCH\_ALL}}
-Displays help window, focuses search panel and starts searching.
-Returns true if the keyword was found.
+Displays help window, focuses search panel and starts searching. Returns true
+if the keyword was found. Optionally it searches through the index (mode =
+wxHELP\_SEARCH\_INDEX), default the content (mode = wxHELP\_SEARCH\_ALL).
{\bf Important:} KeywordSearch searches only pages listed in .hhc file(s).
You should list all pages in the contents file.
\membersection{wxHtmlHelpFrame::KeywordSearch}\label{wxhtmlhelpframekeywordsearch}
-\func{bool}{KeywordSearch}{\param{const wxString\& }{keyword}}
+\func{bool}{KeywordSearch}{\param{const wxString\& }{keyword}, \param{wxHelpSearchMode }{mode = wxHELP\_SEARCH\_ALL}}
-Search for given keyword.
+Search for given keyword. Optionally it searches through the index (mode =
+wxHELP\_SEARCH\_INDEX), default the content (mode = wxHELP\_SEARCH\_ALL).
\membersection{wxHtmlHelpFrame::ReadCustomization}\label{wxhtmlhelpframereadcustomization}
// Flags for SetViewer
#define wxHELP_NETSCAPE 1
+// Search modes:
+enum wxHelpSearchMode
+{
+ wxHELP_SEARCH_INDEX,
+ wxHELP_SEARCH_ALL
+};
+
// Defines the API for help controllers
class WXDLLEXPORT wxHelpControllerBase: public wxObject
{
// may override this for more specific behaviour.
virtual bool DisplaySection(const wxString& section) { return KeywordSearch(section); }
virtual bool DisplayBlock(long blockNo) = 0;
- virtual bool KeywordSearch(const wxString& k) = 0;
+ virtual bool KeywordSearch(const wxString& k,
+ wxHelpSearchMode mode = wxHELP_SEARCH_ALL) = 0;
/// Allows one to override the default settings for the help frame.
virtual void SetFrameParameters(const wxString& WXUNUSED(title),
const wxSize& WXUNUSED(size),
#if wxUSE_WXHTML_HELP
-#include "wx/html/helpfrm.h"
#include "wx/helpbase.h"
+#include "wx/html/helpfrm.h"
#define wxID_HTML_HELPFRAME (wxID_HIGHEST + 1)
bool Display(int id);
bool DisplayContents();
bool DisplayIndex();
- bool KeywordSearch(const wxString& keyword);
+ bool KeywordSearch(const wxString& keyword,
+ wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
wxHtmlHelpFrame* GetFrame() { return m_helpFrame; }
void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString);
#if wxUSE_WXHTML_HELP
+#include "wx/helpbase.h"
#include "wx/html/helpdata.h"
#include "wx/window.h"
#include "wx/frame.h"
// * word may be pretended by + or -
// (+ : page must contain the word ; - : page can't contain the word)
// * if there is no + or - before the word, + is default
- bool KeywordSearch(const wxString& keyword);
+ bool KeywordSearch(const wxString& keyword,
+ wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString)
{
virtual bool DisplayContents();
virtual bool DisplaySection(int sectionNo);
virtual bool DisplayBlock(long blockNo);
- virtual bool KeywordSearch(const wxString& k);
+ virtual bool KeywordSearch(const wxString& k,
+ wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
virtual bool Quit();
virtual void OnQuit();
return m_helpController->DisplayTextPopup( text, pos );
}
- virtual bool KeywordSearch(const wxString& k)
+ virtual bool KeywordSearch(const wxString& k,
+ wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
{
- return m_helpController->KeywordSearch( k );
+ return m_helpController->KeywordSearch( k, mode );
}
virtual bool Quit()
virtual bool DisplayBlock(long blockNo);
virtual bool DisplayContextPopup(int contextId);
virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos);
- virtual bool KeywordSearch(const wxString& k);
+ virtual bool KeywordSearch(const wxString& k,
+ wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
virtual bool Quit();
wxString GetHelpFile() const { return m_helpFile; }
virtual bool DisplaySection(int sectionNo);
virtual bool DisplayBlock(long blockNo);
virtual bool DisplayContextPopup(int contextId);
- virtual bool KeywordSearch(const wxString& k);
+ virtual bool KeywordSearch(const wxString& k,
+ wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
virtual bool Quit();
inline wxString GetHelpFile() const { return m_helpFile; }
virtual bool DisplayContents();
virtual bool DisplaySection(int sectionNo);
virtual bool DisplayBlock(long blockNo);
- virtual bool KeywordSearch(const wxString& k);
+ virtual bool KeywordSearch(const wxString& k,
+ wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
virtual bool Quit();
virtual void OnQuit();
return success;
}
-bool wxHtmlHelpController::KeywordSearch(const wxString& keyword)
+bool wxHtmlHelpController::KeywordSearch(const wxString& keyword,
+ wxHelpSearchMode mode)
{
CreateHelpWindow();
- bool success = m_helpFrame->KeywordSearch(keyword);
+ bool success = m_helpFrame->KeywordSearch(keyword, mode);
AddGrabIfNeeded();
return success;
}
-bool wxHtmlHelpFrame::KeywordSearch(const wxString& keyword)
+bool wxHtmlHelpFrame::KeywordSearch(const wxString& keyword,
+ wxHelpSearchMode mode)
{
- if (! (m_SearchList && m_SearchButton && m_SearchText && m_SearchChoice))
- return FALSE;
+ if (mode == wxHELP_SEARCH_ALL)
+ {
+ if ( !(m_SearchList &&
+ m_SearchButton && m_SearchText && m_SearchChoice) )
+ return false;
+ }
+ else if (mode == wxHELP_SEARCH_INDEX)
+ {
+ if ( !(m_IndexList &&
+ m_IndexButton && m_IndexButtonAll && m_IndexText) )
+ return false;
+ }
- int foundcnt = 0, curi;
+ int foundcnt = 0;
wxString foundstr;
wxString book = wxEmptyString;
m_HtmlWin->Show(TRUE);
m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
}
- m_NavigNotebook->SetSelection(m_SearchPage);
- m_SearchList->Clear();
- m_SearchText->SetValue(keyword);
- m_SearchButton->Enable(FALSE);
-
- if (m_SearchChoice->GetSelection() != 0)
- book = m_SearchChoice->GetStringSelection();
-
- wxHtmlSearchStatus status(m_Data, keyword,
- m_SearchCaseSensitive->GetValue(), m_SearchWholeWords->GetValue(),
- book);
- wxProgressDialog progress(_("Searching..."), _("No matching page found yet"),
- status.GetMaxIndex(), this,
- wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_AUTO_HIDE);
-
- while (status.IsActive())
+ if (mode == wxHELP_SEARCH_ALL)
{
- curi = status.GetCurIndex();
- if (curi % 32 == 0 && progress.Update(curi) == FALSE)
- break;
- if (status.Search())
+ m_NavigNotebook->SetSelection(m_SearchPage);
+ m_SearchList->Clear();
+ m_SearchText->SetValue(keyword);
+ m_SearchButton->Enable(false);
+
+ if (m_SearchChoice->GetSelection() != 0)
+ book = m_SearchChoice->GetStringSelection();
+
+ wxHtmlSearchStatus status(m_Data, keyword,
+ m_SearchCaseSensitive->GetValue(),
+ m_SearchWholeWords->GetValue(),
+ book);
+
+ wxProgressDialog progress(_("Searching..."),
+ _("No matching page found yet"),
+ status.GetMaxIndex(), this,
+ wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_AUTO_HIDE);
+
+ int curi;
+ while (status.IsActive())
{
- foundstr.Printf(_("Found %i matches"), ++foundcnt);
- progress.Update(status.GetCurIndex(), foundstr);
- m_SearchList->Append(status.GetName(), status.GetContentsItem());
+ curi = status.GetCurIndex();
+ if (curi % 32 == 0 && progress.Update(curi) == FALSE)
+ break;
+ if (status.Search())
+ {
+ foundstr.Printf(_("Found %i matches"), ++foundcnt);
+ progress.Update(status.GetCurIndex(), foundstr);
+ m_SearchList->Append(status.GetName(), status.GetContentsItem());
+ }
}
+
+ m_SearchButton->Enable(TRUE);
+ m_SearchText->SetSelection(0, keyword.Length());
+ m_SearchText->SetFocus();
+ }
+ else if (mode == wxHELP_SEARCH_INDEX)
+ {
+ m_NavigNotebook->SetSelection(m_IndexPage);
+ m_IndexList->Clear();
+ m_IndexButton->Enable(false);
+ m_IndexButtonAll->Enable(false);
+ m_IndexText->SetValue(keyword);
+
+ wxCommandEvent dummy;
+ OnIndexFind(dummy); // what a hack...
+ m_IndexButton->Enable(true);
+ m_IndexButtonAll->Enable(true);
+ foundcnt = m_IndexList->GetCount();
}
- m_SearchButton->Enable(TRUE);
- m_SearchText->SetSelection(0, keyword.Length());
- m_SearchText->SetFocus();
if (foundcnt)
{
- wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_SearchList->GetClientData(0);
+ wxHtmlContentsItem *it;
+ if (mode == wxHELP_SEARCH_ALL)
+ {
+ it = (wxHtmlContentsItem*) m_SearchList->GetClientData(0);
+ }
+ else if (mode == wxHELP_SEARCH_INDEX)
+ {
+ it = (wxHtmlContentsItem*) m_IndexList->GetClientData(0);
+ }
if (it)
{
m_HtmlWin->LoadPage(it->GetFullPath());
{
wxString sr = m_SearchText->GetLineText(0);
- if (sr != wxEmptyString) KeywordSearch(sr);
+ if (!sr.empty())
+ KeywordSearch(sr, wxHELP_SEARCH_ALL);
}
void wxHtmlHelpFrame::OnBookmarksSel(wxCommandEvent& WXUNUSED(event))
return FALSE;
}
-bool wxXXXXHelpController::KeywordSearch(const wxString& k)
+bool wxXXXXHelpController::KeywordSearch(const wxString& k,
+ wxHelpSearchMode WXUNUSED(mode))
{
if (m_helpFile == "") return FALSE;
return FALSE;
}
-bool wxXXXXHelpController::KeywordSearch(const wxString& k)
+bool wxXXXXHelpController::KeywordSearch(const wxString& k,
+ wxHelpSearchMode WXUNUSED(mode))
{
if (m_helpFile == "") return FALSE;
return DisplaySection(block);
}
-bool wxCHMHelpController::KeywordSearch(const wxString& k)
+bool wxCHMHelpController::KeywordSearch(const wxString& k,
+ wxHelpSearchMode WXUNUSED(mode))
{
if (m_helpFile.IsEmpty()) return FALSE;
return TRUE;
}
-bool wxWinHelpController::KeywordSearch(const wxString& k)
+bool wxWinHelpController::KeywordSearch(const wxString& k,
+ wxHelpSearchMode WXUNUSED(mode))
{
if (m_helpFile.IsEmpty()) return FALSE;
return FALSE;
}
-bool wxWinHelpController::KeywordSearch(const wxString& k)
+bool wxWinHelpController::KeywordSearch(const wxString& k,
+ wxHelpSearchMode WXUNUSED(mode))
{
if (m_helpFile == "") return FALSE;