Added wxHelpControllerHelpProvider, added DisplayContextPopup, DisplayTextPopup

to wxHelpControllerBase and wxCHMHelpController; updated sample


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8339 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2000-09-12 14:53:39 +00:00
parent 135ce19c67
commit 5100cabffa
15 changed files with 211 additions and 75 deletions

View File

@@ -312,6 +312,48 @@ bool wxSimpleHelpProvider::ShowHelp(wxWindowBase *window)
return FALSE;
}
// ----------------------------------------------------------------------------
// wxHelpControllerHelpProvider
// ----------------------------------------------------------------------------
wxHelpControllerHelpProvider::wxHelpControllerHelpProvider(wxHelpControllerBase* hc)
{
m_helpController = hc;
}
bool wxHelpControllerHelpProvider::ShowHelp(wxWindowBase *window)
{
wxString text = GetHelp(window);
if ( !text.empty() )
{
if (m_helpController)
{
if (text.IsNumber())
return m_helpController->DisplayContextPopup(wxAtoi(text));
// If the help controller is capable of popping up the text...
else if (m_helpController->DisplayTextPopup(text, wxGetMousePosition()))
{
return TRUE;
}
else
// ...else use the default method.
return wxSimpleHelpProvider::ShowHelp(window);
}
else
return wxSimpleHelpProvider::ShowHelp(window);
}
return FALSE;
}
// Convenience function for turning context id into wxString
wxString wxContextId(int id)
{
return wxString(IntToString(id));
}
// ----------------------------------------------------------------------------
// wxHelpProviderModule: module responsible for cleaning up help provider.
// ----------------------------------------------------------------------------

View File

@@ -36,6 +36,7 @@
#include "wx/app.h"
#include "wx/dc.h"
#include "wx/utils.h"
#include "wx/settings.h"
#include "wx/log.h"
#include <string.h>
@@ -360,13 +361,18 @@ void wxInitializeStockObjects ()
#endif
// why under MSW fonts shouldn't have the standard system size?
/*
#ifdef __WXMSW__
static const int sizeFont = 10;
#else
static const int sizeFont = 12;
#endif
*/
// wxNORMAL_FONT = new wxFont (sizeFont, wxMODERN, wxNORMAL, wxNORMAL);
wxNORMAL_FONT = new wxFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
static const int sizeFont = wxNORMAL_FONT->GetPointSize();
wxNORMAL_FONT = new wxFont (sizeFont, wxMODERN, wxNORMAL, wxNORMAL);
wxSMALL_FONT = new wxFont (sizeFont - 2, wxSWISS, wxNORMAL, wxNORMAL);
wxITALIC_FONT = new wxFont (sizeFont, wxROMAN, wxITALIC, wxNORMAL);
wxSWISS_FONT = new wxFont (sizeFont, wxSWISS, wxNORMAL, wxNORMAL);