+ return false;
+ }
+ }
+ }
+ return AddBook(wxFileName(actualFilename));
+}
+
+bool wxHtmlHelpController::LoadFile(const wxString& WXUNUSED(file))
+{
+ // Don't reload the file or we'll have it appear again, presumably.
+ return true;
+}
+
+bool wxHtmlHelpController::DisplaySection(int sectionNo)
+{
+ return Display(sectionNo);
+}
+
+bool wxHtmlHelpController::DisplayTextPopup(const wxString& text, const wxPoint& WXUNUSED(pos))
+{
+#if wxUSE_TIPWINDOW
+ 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;
+ }
+#endif // wxUSE_TIPWINDOW
+
+ return false;
+}
+
+void wxHtmlHelpController::SetFrameParameters(const wxString& title,
+ const wxSize& size,
+ const wxPoint& pos,
+ bool WXUNUSED(newFrameEachTime))
+{
+ SetTitleFormat(title);
+ if (m_helpFrame)
+ {
+ m_helpFrame->SetSize(pos.x, pos.y, size.x, size.y);
+ }
+}
+
+wxFrame* wxHtmlHelpController::GetFrameParameters(wxSize *size,
+ wxPoint *pos,
+ bool *newFrameEachTime)
+{
+ if (newFrameEachTime)
+ (* newFrameEachTime) = false;
+ if (size && m_helpFrame)
+ (* size) = m_helpFrame->GetSize();
+ if (pos && m_helpFrame)
+ (* pos) = m_helpFrame->GetPosition();
+ return m_helpFrame;
+}
+
+bool wxHtmlHelpController::Quit()
+{
+ DestroyHelpWindow();
+ return true;
+}
+
+// Make the help controller's frame 'modal' if
+// needed
+void wxHtmlHelpController::AddGrabIfNeeded()
+{
+ // So far, wxGTK only
+#ifdef __WXGTK__
+ bool needGrab = false;
+
+ // Check if there are any modal windows present,
+ // in which case we need to add a grab.
+ for ( wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
+ node;
+ node = node->GetNext() )
+ {
+ wxWindow *win = node->GetData();
+ wxDialog *dialog = wxDynamicCast(win, wxDialog);
+
+ if (dialog && dialog->IsModal())
+ needGrab = true;
+ }
+
+ if (needGrab && m_helpFrame)
+ m_helpFrame->AddGrab();
+#endif // __WXGTK__
+}
+
+bool wxHtmlHelpController::Display(const wxString& x)
+{
+ CreateHelpWindow();
+ bool success = m_helpFrame->Display(x);
+ AddGrabIfNeeded();
+ return success;
+}
+
+bool wxHtmlHelpController::Display(int id)
+{
+ CreateHelpWindow();
+ bool success = m_helpFrame->Display(id);
+ AddGrabIfNeeded();
+ return success;
+}
+
+bool wxHtmlHelpController::DisplayContents()
+{
+ CreateHelpWindow();
+ bool success = m_helpFrame->DisplayContents();
+ AddGrabIfNeeded();
+ return success;
+}
+
+bool wxHtmlHelpController::DisplayIndex()
+{
+ CreateHelpWindow();
+ bool success = m_helpFrame->DisplayIndex();
+ AddGrabIfNeeded();
+ return success;
+}
+
+bool wxHtmlHelpController::KeywordSearch(const wxString& keyword,
+ wxHelpSearchMode mode)
+{
+ CreateHelpWindow();
+ bool success = m_helpFrame->KeywordSearch(keyword, mode);
+ AddGrabIfNeeded();
+ return success;
+}
+
+#endif // wxUSE_WXHTML_HELP
+