X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6bcfd974ef26faf6f91a62cac09827e09463fd1..a51fb6427c1036779a67b92ff0976c0a735ab0c3:/src/html/helpctrl.cpp diff --git a/src/html/helpctrl.cpp b/src/html/helpctrl.cpp index c8287af50e..0d36aed6e4 100644 --- a/src/html/helpctrl.cpp +++ b/src/html/helpctrl.cpp @@ -28,6 +28,10 @@ #include "wx/wx.h" #include "wx/busyinfo.h" +#if wxUSE_HELP +#include "wx/tipwin.h" +#endif + IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpController, wxHelpControllerBase) wxHtmlHelpController::wxHtmlHelpController(int style) @@ -79,7 +83,8 @@ bool wxHtmlHelpController::AddBook(const wxString& book, bool show_wait_msg) #if wxUSE_BUSYINFO wxBusyInfo* busy = NULL; wxString info; - if (show_wait_msg) { + if (show_wait_msg) + { info.Printf(_("Adding book %s"), book.c_str()); busy = new wxBusyInfo(info); } @@ -102,7 +107,8 @@ wxHtmlHelpFrame *wxHtmlHelpController::CreateHelpFrame(wxHtmlHelpData *data) void wxHtmlHelpController::CreateHelpWindow() { - if (m_helpFrame) { + if (m_helpFrame) + { m_helpFrame->Raise(); return ; } @@ -144,7 +150,7 @@ void wxHtmlHelpController::UseConfig(wxConfigBase *config, const wxString& rootp { m_Config = config; m_ConfigRoot = rootpath; - if (m_helpFrame) m_helpFrame -> UseConfig(config, rootpath); + if (m_helpFrame) m_helpFrame->UseConfig(config, rootpath); ReadCustomization(config, rootpath); } @@ -185,6 +191,33 @@ bool wxHtmlHelpController::DisplaySection(int sectionNo) return Display(sectionNo); } +bool wxHtmlHelpController::DisplayTextPopup(const wxString& text, const wxPoint& WXUNUSED(pos)) +{ +#if wxUSE_HELP + static wxTipWindow* s_tipWindow = NULL; + + if (s_tipWindow) + { + // Prevent s_tipWindow being nulled in OnIdle, + // thereby removing the chance for the window to be closed by ShowHelp + s_tipWindow->SetTipWindowPtr(NULL); + s_tipWindow->Close(); + } + s_tipWindow = NULL; + + if ( !text.empty() ) + { + s_tipWindow = new wxTipWindow(wxTheApp->GetTopWindow(), text, 100, & s_tipWindow); + + return TRUE; + } + + return FALSE; +#else + return FALSE; +#endif +} + void wxHtmlHelpController::SetFrameParameters(const wxString& title, const wxSize& size, const wxPoint& pos, @@ -216,5 +249,20 @@ bool wxHtmlHelpController::Quit() return TRUE; } +// Sets the specified book or all books to have the given base path +void wxHtmlHelpController::SetBookBasePath(const wxString& basePath, int which) +{ + size_t i; + for (i = 0; i < m_helpData.GetBookRecArray().Count(); i++ ) + { + if (i == (size_t) which || which == -1) + { + wxHtmlBookRecord& book = m_helpData.GetBookRecArray()[i]; + book.SetBasePath(basePath); + } + if (i == (size_t) which) + return; + } +} #endif