+// ----------------------------------------------------------------------------
+// wxHelpControllerHelpProvider
+// ----------------------------------------------------------------------------
+
+wxHelpControllerHelpProvider::wxHelpControllerHelpProvider(wxHelpControllerBase* hc)
+{
+ m_helpController = hc;
+}
+
+bool wxHelpControllerHelpProvider::ShowHelp(wxWindowBase *window)
+{
+ const wxString text = GetHelpTextMaybeAtPoint(window);
+
+ if ( text.empty() )
+ return false;
+
+ if ( m_helpController )
+ {
+ // if it's a numeric topic, show it
+ long topic;
+ if ( text.ToLong(&topic) )
+ return m_helpController->DisplayContextPopup(topic);
+
+ // otherwise show the text directly
+ if ( m_helpController->DisplayTextPopup(text, wxGetMousePosition()) )
+ return true;
+ }
+
+ // if there is no help controller or it's not capable of showing the help,
+ // fallback to the default method
+ return wxSimpleHelpProvider::ShowHelp(window);
+}
+
+// Convenience function for turning context id into wxString
+wxString wxContextId(int id)
+{
+ return wxString::Format(_T("%d"), id);