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:
@@ -17,6 +17,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
|
#include "wx/help.h"
|
||||||
|
|
||||||
#if wxUSE_HELP
|
#if wxUSE_HELP
|
||||||
|
|
||||||
@@ -83,7 +84,7 @@ private:
|
|||||||
// classes used to implement context help support
|
// classes used to implement context help support
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// wxHelpProvider is an ABC used by the program implementing context help to
|
// wxHelpProvider is an abstract class used by the program implementing context help to
|
||||||
// show the help text (or whatever: it may be HTML page or anything else) for
|
// show the help text (or whatever: it may be HTML page or anything else) for
|
||||||
// the given window.
|
// the given window.
|
||||||
//
|
//
|
||||||
@@ -151,5 +152,30 @@ protected:
|
|||||||
m_hashIds;
|
m_hashIds;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// wxHelpControllerHelpProvider is an implementation of wxHelpProvider which supports
|
||||||
|
// both context identifiers and plain text help strings. If the help text is an integer,
|
||||||
|
// it is passed to wxHelpController::DisplayContextPopup. Otherwise, it shows the string
|
||||||
|
// in a tooltip as per wxSimpleHelpProvider.
|
||||||
|
class WXDLLEXPORT wxHelpControllerHelpProvider : public wxSimpleHelpProvider
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Note that it doesn't own the help controller. The help controller
|
||||||
|
// should be deleted separately.
|
||||||
|
wxHelpControllerHelpProvider(wxHelpControllerBase* hc = (wxHelpControllerBase*) NULL);
|
||||||
|
|
||||||
|
// implement wxHelpProvider methods
|
||||||
|
virtual bool ShowHelp(wxWindowBase *window);
|
||||||
|
|
||||||
|
// Other accessors
|
||||||
|
void SetHelpController(wxHelpControllerBase* hc) { m_helpController = hc; }
|
||||||
|
wxHelpControllerBase* GetHelpController() const { return m_helpController; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
wxHelpControllerBase* m_helpController;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Convenience function for turning context id into wxString
|
||||||
|
wxString wxContextId(int id);
|
||||||
|
|
||||||
#endif // _WX_CSHELPH__
|
#endif // _WX_CSHELPH__
|
||||||
|
|
||||||
|
@@ -1311,6 +1311,10 @@ enum wxStretch
|
|||||||
#define wxID_SETUP 5110
|
#define wxID_SETUP 5110
|
||||||
#define wxID_RESET 5111
|
#define wxID_RESET 5111
|
||||||
#define wxID_CONTEXT_HELP 5112
|
#define wxID_CONTEXT_HELP 5112
|
||||||
|
#define wxID_YESTOALL 5113
|
||||||
|
#define wxID_NOTOALL 5114
|
||||||
|
#define wxID_ABORT 5115
|
||||||
|
#define wxID_RETRY 5116
|
||||||
|
|
||||||
// IDs used by generic file dialog (11 consecutive starting from this value)
|
// IDs used by generic file dialog (11 consecutive starting from this value)
|
||||||
#define wxID_FILEDLGG 5900
|
#define wxID_FILEDLGG 5900
|
||||||
|
@@ -47,9 +47,19 @@ public:
|
|||||||
|
|
||||||
// If file is "", reloads file given in Initialize
|
// If file is "", reloads file given in Initialize
|
||||||
virtual bool LoadFile(const wxString& file = "") = 0;
|
virtual bool LoadFile(const wxString& file = "") = 0;
|
||||||
|
|
||||||
|
// Displays the contents
|
||||||
virtual bool DisplayContents(void) = 0;
|
virtual bool DisplayContents(void) = 0;
|
||||||
|
|
||||||
|
// Display the given section
|
||||||
virtual bool DisplaySection(int sectionNo) = 0;
|
virtual bool DisplaySection(int sectionNo) = 0;
|
||||||
|
|
||||||
|
// Display the section using a context id
|
||||||
|
virtual bool DisplayContextPopup(int WXUNUSED(contextId)) { return FALSE; };
|
||||||
|
|
||||||
|
// Display the text in a popup, if possible
|
||||||
|
virtual bool DisplayTextPopup(const wxString& WXUNUSED(text), const wxPoint& WXUNUSED(pos)) { return FALSE; };
|
||||||
|
|
||||||
// By default, uses KeywordSection to display a topic. Implementations
|
// By default, uses KeywordSection to display a topic. Implementations
|
||||||
// may override this for more specific behaviour.
|
// may override this for more specific behaviour.
|
||||||
virtual bool DisplaySection(const wxString& section) { return KeywordSearch(section); };
|
virtual bool DisplaySection(const wxString& section) { return KeywordSearch(section); };
|
||||||
|
@@ -39,6 +39,8 @@ public:
|
|||||||
virtual bool DisplaySection(int sectionNo);
|
virtual bool DisplaySection(int sectionNo);
|
||||||
virtual bool DisplaySection(const wxString& section);
|
virtual bool DisplaySection(const wxString& section);
|
||||||
virtual bool DisplayBlock(long blockNo);
|
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);
|
||||||
virtual bool Quit();
|
virtual bool Quit();
|
||||||
|
|
||||||
|
@@ -38,6 +38,7 @@ public:
|
|||||||
virtual bool DisplayContents();
|
virtual bool DisplayContents();
|
||||||
virtual bool DisplaySection(int sectionNo);
|
virtual bool DisplaySection(int sectionNo);
|
||||||
virtual bool DisplayBlock(long blockNo);
|
virtual bool DisplayBlock(long blockNo);
|
||||||
|
virtual bool DisplayContextPopup(int contextId);
|
||||||
virtual bool KeywordSearch(const wxString& k);
|
virtual bool KeywordSearch(const wxString& k);
|
||||||
virtual bool Quit();
|
virtual bool Quit();
|
||||||
|
|
||||||
|
@@ -121,7 +121,6 @@ public:
|
|||||||
void OnAdvancedHtmlHelp(wxCommandEvent& event);
|
void OnAdvancedHtmlHelp(wxCommandEvent& event);
|
||||||
void OnMSHtmlHelp(wxCommandEvent& event);
|
void OnMSHtmlHelp(wxCommandEvent& event);
|
||||||
|
|
||||||
void OnContextHelp(wxHelpEvent& event);
|
|
||||||
void OnShowContextHelp(wxCommandEvent& event);
|
void OnShowContextHelp(wxCommandEvent& event);
|
||||||
void OnShowDialogContextHelp(wxCommandEvent& event);
|
void OnShowDialogContextHelp(wxCommandEvent& event);
|
||||||
|
|
||||||
@@ -151,8 +150,6 @@ class MyModalDialog : public wxDialog
|
|||||||
public:
|
public:
|
||||||
MyModalDialog(wxWindow *parent);
|
MyModalDialog(wxWindow *parent);
|
||||||
|
|
||||||
void OnContextHelp(wxHelpEvent& event);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
@@ -166,7 +163,7 @@ private:
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
// menu items
|
// menu items
|
||||||
HelpDemo_Quit = 1,
|
HelpDemo_Quit = 100,
|
||||||
HelpDemo_Help_Index,
|
HelpDemo_Help_Index,
|
||||||
HelpDemo_Help_Classes,
|
HelpDemo_Help_Classes,
|
||||||
HelpDemo_Help_Functions,
|
HelpDemo_Help_Functions,
|
||||||
@@ -217,8 +214,6 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
EVT_MENU(HelpDemo_Help_ContextHelp, MyFrame::OnShowContextHelp)
|
EVT_MENU(HelpDemo_Help_ContextHelp, MyFrame::OnShowContextHelp)
|
||||||
EVT_MENU(HelpDemo_Help_DialogContextHelp, MyFrame::OnShowDialogContextHelp)
|
EVT_MENU(HelpDemo_Help_DialogContextHelp, MyFrame::OnShowDialogContextHelp)
|
||||||
|
|
||||||
EVT_HELP(-1, MyFrame::OnContextHelp)
|
|
||||||
|
|
||||||
EVT_MENU(HelpDemo_Html_Help_Index, MyFrame::OnHtmlHelp)
|
EVT_MENU(HelpDemo_Html_Help_Index, MyFrame::OnHtmlHelp)
|
||||||
EVT_MENU(HelpDemo_Html_Help_Classes, MyFrame::OnHtmlHelp)
|
EVT_MENU(HelpDemo_Html_Help_Classes, MyFrame::OnHtmlHelp)
|
||||||
EVT_MENU(HelpDemo_Html_Help_Functions, MyFrame::OnHtmlHelp)
|
EVT_MENU(HelpDemo_Html_Help_Functions, MyFrame::OnHtmlHelp)
|
||||||
@@ -260,6 +255,12 @@ IMPLEMENT_APP(MyApp)
|
|||||||
// `Main program' equivalent: the program execution "starts" here
|
// `Main program' equivalent: the program execution "starts" here
|
||||||
bool MyApp::OnInit()
|
bool MyApp::OnInit()
|
||||||
{
|
{
|
||||||
|
// Create a simple help provider to make SetHelpText() do something.
|
||||||
|
// Note that this must be set before any SetHelpText() calls are made.
|
||||||
|
//wxHelpProvider::Set(new wxSimpleHelpProvider);
|
||||||
|
wxHelpControllerHelpProvider* provider = new wxHelpControllerHelpProvider;
|
||||||
|
wxHelpProvider::Set(provider);
|
||||||
|
|
||||||
#if wxUSE_HTML
|
#if wxUSE_HTML
|
||||||
#if wxUSE_GIF
|
#if wxUSE_GIF
|
||||||
// Required for images in the online documentation
|
// Required for images in the online documentation
|
||||||
@@ -277,6 +278,12 @@ bool MyApp::OnInit()
|
|||||||
MyFrame *frame = new MyFrame("HelpDemo wxWindows App",
|
MyFrame *frame = new MyFrame("HelpDemo wxWindows App",
|
||||||
wxPoint(50, 50), wxSize(450, 340));
|
wxPoint(50, 50), wxSize(450, 340));
|
||||||
|
|
||||||
|
#if wxUSE_MS_HTML_HELP
|
||||||
|
provider->SetHelpController(& frame->GetMSHtmlHelpController());
|
||||||
|
#else
|
||||||
|
provider->SetHelpController(& frame->GetHelpController());
|
||||||
|
#endif
|
||||||
|
|
||||||
frame->Show(TRUE);
|
frame->Show(TRUE);
|
||||||
SetTopWindow(frame);
|
SetTopWindow(frame);
|
||||||
|
|
||||||
@@ -321,9 +328,6 @@ bool MyApp::OnInit()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// create a simple help provider to make SetHelpText() do something
|
|
||||||
wxHelpProvider::Set(new wxSimpleHelpProvider);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,7 +345,7 @@ int MyApp::OnExit()
|
|||||||
|
|
||||||
// frame constructor
|
// frame constructor
|
||||||
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||||
: wxFrame((wxFrame *)NULL, -1, title, pos, size)
|
: wxFrame((wxFrame *)NULL, 300, title, pos, size)
|
||||||
{
|
{
|
||||||
// set the frame icon
|
// set the frame icon
|
||||||
SetIcon(wxICON(mondrian));
|
SetIcon(wxICON(mondrian));
|
||||||
@@ -408,10 +412,13 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
|||||||
|
|
||||||
// a panel first - if there were several controls, it would allow us to
|
// a panel first - if there were several controls, it would allow us to
|
||||||
// navigate between them from the keyboard
|
// navigate between them from the keyboard
|
||||||
wxPanel *panel = new wxPanel(this, -1, wxPoint(0, 0), wxSize(400, 200));
|
wxPanel *panel = new wxPanel(this, 301, wxPoint(0, 0), wxSize(400, 200));
|
||||||
|
//panel->SetHelpText(_("This panel just holds a static text control."));
|
||||||
|
panel->SetHelpText(wxContextId(300));
|
||||||
|
|
||||||
// and a static control whose parent is the panel
|
// and a static control whose parent is the panel
|
||||||
(void)new wxStaticText(panel, -1, "Hello, world!", wxPoint(10, 10));
|
wxStaticText* staticText = new wxStaticText(panel, 302, "Hello, world!", wxPoint(10, 10));
|
||||||
|
staticText->SetHelpText(_("This static text control isn't doing a lot right now."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -441,14 +448,6 @@ void MyFrame::OnShowDialogContextHelp(wxCommandEvent& event)
|
|||||||
dialog.ShowModal();
|
dialog.ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnContextHelp(wxHelpEvent& event)
|
|
||||||
{
|
|
||||||
// In a real app, if we didn't recognise this ID, we should call event.Skip()
|
|
||||||
wxString msg;
|
|
||||||
msg.Printf(wxT("We should now display help for window %d"), event.GetId());
|
|
||||||
wxMessageBox(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyFrame::OnHtmlHelp(wxCommandEvent& event)
|
void MyFrame::OnHtmlHelp(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
#if USE_HTML_HELP && USE_OLD_HTML_HELP
|
#if USE_HTML_HELP && USE_OLD_HTML_HELP
|
||||||
@@ -607,27 +606,32 @@ void MyFrame::ShowHelp(int commandId, wxHelpControllerBase& helpController)
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(MyModalDialog, wxDialog)
|
BEGIN_EVENT_TABLE(MyModalDialog, wxDialog)
|
||||||
EVT_HELP(-1, MyModalDialog::OnContextHelp)
|
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
MyModalDialog::MyModalDialog(wxWindow *parent)
|
MyModalDialog::MyModalDialog(wxWindow *parent)
|
||||||
: wxDialog()
|
: wxDialog()
|
||||||
{
|
{
|
||||||
|
// Add the context-sensitive help button on the caption for MSW
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
SetExtraStyle(wxDIALOG_EX_CONTEXTHELP);
|
||||||
|
#endif
|
||||||
|
|
||||||
wxDialog::Create(parent, -1, wxString("Modal dialog"));
|
wxDialog::Create(parent, -1, wxString("Modal dialog"));
|
||||||
|
|
||||||
wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
|
||||||
wxBoxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL);
|
wxBoxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
|
||||||
wxButton* btnOK = new wxButton(this, wxID_OK, "&OK");
|
wxButton* btnOK = new wxButton(this, wxID_OK, "&OK");
|
||||||
|
btnOK->SetHelpText(_("The OK button confirms the dialog choices."));
|
||||||
|
|
||||||
wxButton* btnCancel = new wxButton(this, wxID_CANCEL, "&Cancel");
|
wxButton* btnCancel = new wxButton(this, wxID_CANCEL, "&Cancel");
|
||||||
|
btnCancel->SetHelpText(_("The Cancel button cancels the dialog."));
|
||||||
|
|
||||||
sizerRow->Add(btnOK, 0, wxALIGN_CENTER | wxALL, 5);
|
sizerRow->Add(btnOK, 0, wxALIGN_CENTER | wxALL, 5);
|
||||||
sizerRow->Add(btnCancel, 0, wxALIGN_CENTER | wxALL, 5);
|
sizerRow->Add(btnCancel, 0, wxALIGN_CENTER | wxALL, 5);
|
||||||
|
|
||||||
// Add the context-sensitive help button on the caption for MSW and the
|
// Add explicit context-sensitive help button for non-MSW
|
||||||
// explicit context-sensitive help button elsewhere
|
#ifndef __WXMSW__
|
||||||
#ifdef __WXMSW__
|
|
||||||
SetExtraStyle(wxDIALOG_EX_CONTEXTHELP);
|
|
||||||
#else
|
|
||||||
sizerRow->Add(new wxContextHelpButton(this), 0, wxALIGN_CENTER | wxALL, 5);
|
sizerRow->Add(new wxContextHelpButton(this), 0, wxALIGN_CENTER | wxALL, 5);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -649,33 +653,3 @@ MyModalDialog::MyModalDialog(wxWindow *parent)
|
|||||||
btnOK->SetDefault();
|
btnOK->SetDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyModalDialog::OnContextHelp(wxHelpEvent& event)
|
|
||||||
{
|
|
||||||
wxString msg;
|
|
||||||
switch (event.GetId())
|
|
||||||
{
|
|
||||||
case wxID_OK:
|
|
||||||
{
|
|
||||||
msg = _("The OK button confirms the dialog choices.");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case wxID_CANCEL:
|
|
||||||
{
|
|
||||||
msg = _("The Cancel button cancels the dialog.");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case wxID_APPLY:
|
|
||||||
{
|
|
||||||
msg = _("This is a text control that does nothing in particular.");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case wxID_CONTEXT_HELP:
|
|
||||||
{
|
|
||||||
msg = _("If you didn't know what this button is for, why did you press it? :-)");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!msg.IsEmpty())
|
|
||||||
wxMessageBox(msg, _("Help"), wxICON_INFORMATION, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Binary file not shown.
7
samples/help/doc.h
Normal file
7
samples/help/doc.h
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#define doc1 100
|
||||||
|
#define doc2 2
|
||||||
|
#define doc3 1
|
||||||
|
#define doc4 3
|
||||||
|
#define IDH_PANEL 300
|
||||||
|
#define IDH_TEXT 301
|
||||||
|
#define IDH_OK 302
|
@@ -1,15 +1,18 @@
|
|||||||
[OPTIONS]
|
[OPTIONS]
|
||||||
Compatibility=1.1
|
Compatibility=1.1 or later
|
||||||
Full-text search=Yes
|
|
||||||
Contents file=doc.hhc
|
|
||||||
Compiled file=doc.chm
|
Compiled file=doc.chm
|
||||||
|
Contents file=doc.hhc
|
||||||
Default Window=docHelp
|
Default Window=docHelp
|
||||||
Default topic=doc.htm
|
Default topic=doc.htm
|
||||||
|
Display compile progress=No
|
||||||
|
Full-text search=Yes
|
||||||
Index file=doc.hhk
|
Index file=doc.hhk
|
||||||
|
Language=0x809 English (United Kingdom)
|
||||||
Title=Help Demo
|
Title=Help Demo
|
||||||
|
|
||||||
[WINDOWS]
|
[WINDOWS]
|
||||||
docHelp=,"doc.hhc","doc.hhk","doc.htm",,,,,,0x2420,,0x380e,,,,,0,,,
|
docHelp=,"doc.hhc","doc.hhk","doc.htm",,,,,,0x2420,,0x380e,,,,,0,,,0
|
||||||
|
|
||||||
|
|
||||||
[FILES]
|
[FILES]
|
||||||
doc.htm
|
doc.htm
|
||||||
@@ -20,8 +23,11 @@ doc4.htm
|
|||||||
doc5.htm
|
doc5.htm
|
||||||
|
|
||||||
[MAP]
|
[MAP]
|
||||||
#define doc1 100
|
#include doc.h
|
||||||
#define doc3 1
|
|
||||||
#define doc2 2
|
[TEXT POPUPS]
|
||||||
#define doc4 3
|
doc.h
|
||||||
|
popups.txt
|
||||||
|
|
||||||
|
[INFOTYPES]
|
||||||
|
|
||||||
|
9
samples/help/popups.txt
Normal file
9
samples/help/popups.txt
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
.topic IDH_PANEL
|
||||||
|
This is the topic for the main panel.
|
||||||
|
|
||||||
|
.topic IDH_TEXT
|
||||||
|
This is the topic for the text control.
|
||||||
|
|
||||||
|
.topic IDH_OK
|
||||||
|
This is the topic for the OK button.
|
||||||
|
|
@@ -312,6 +312,48 @@ bool wxSimpleHelpProvider::ShowHelp(wxWindowBase *window)
|
|||||||
return FALSE;
|
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.
|
// wxHelpProviderModule: module responsible for cleaning up help provider.
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -36,6 +36,7 @@
|
|||||||
#include "wx/app.h"
|
#include "wx/app.h"
|
||||||
#include "wx/dc.h"
|
#include "wx/dc.h"
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
|
#include "wx/settings.h"
|
||||||
|
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -360,13 +361,18 @@ void wxInitializeStockObjects ()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// why under MSW fonts shouldn't have the standard system size?
|
// why under MSW fonts shouldn't have the standard system size?
|
||||||
|
/*
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
static const int sizeFont = 10;
|
static const int sizeFont = 10;
|
||||||
#else
|
#else
|
||||||
static const int sizeFont = 12;
|
static const int sizeFont = 12;
|
||||||
#endif
|
#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);
|
wxSMALL_FONT = new wxFont (sizeFont - 2, wxSWISS, wxNORMAL, wxNORMAL);
|
||||||
wxITALIC_FONT = new wxFont (sizeFont, wxROMAN, wxITALIC, wxNORMAL);
|
wxITALIC_FONT = new wxFont (sizeFont, wxROMAN, wxITALIC, wxNORMAL);
|
||||||
wxSWISS_FONT = new wxFont (sizeFont, wxSWISS, wxNORMAL, wxNORMAL);
|
wxSWISS_FONT = new wxFont (sizeFont, wxSWISS, wxNORMAL, wxNORMAL);
|
||||||
|
@@ -102,6 +102,47 @@ bool wxCHMHelpController::DisplaySection(int section)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxCHMHelpController::DisplayContextPopup(int contextId)
|
||||||
|
{
|
||||||
|
if (m_helpFile.IsEmpty()) return FALSE;
|
||||||
|
|
||||||
|
wxString str = GetValidFilename(m_helpFile);
|
||||||
|
|
||||||
|
// TODO: what should this be?
|
||||||
|
//HtmlHelp(GetSuitableHWND(), (const wxChar*) str, HH_HELP_CONTEXT, (DWORD)contextId);
|
||||||
|
HH_POPUP popup;
|
||||||
|
popup.cbStruct = sizeof(popup);
|
||||||
|
popup.hinst = (HINSTANCE) wxGetInstance();
|
||||||
|
popup.idString = contextId ;
|
||||||
|
|
||||||
|
GetCursorPos(& popup.pt);
|
||||||
|
popup.clrForeground = -1;
|
||||||
|
popup.clrBackground = -1;
|
||||||
|
popup.rcMargins.top = popup.rcMargins.left = popup.rcMargins.right = popup.rcMargins.bottom = -1;
|
||||||
|
popup.pszFont = NULL;
|
||||||
|
popup.pszText = NULL;
|
||||||
|
|
||||||
|
HtmlHelp(GetSuitableHWND(), (const wxChar*) str, HH_DISPLAY_TEXT_POPUP, (DWORD) & popup);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxCHMHelpController::DisplayTextPopup(const wxString& text, const wxPoint& pos)
|
||||||
|
{
|
||||||
|
HH_POPUP popup;
|
||||||
|
popup.cbStruct = sizeof(popup);
|
||||||
|
popup.hinst = (HINSTANCE) wxGetInstance();
|
||||||
|
popup.idString = 0 ;
|
||||||
|
popup.pt.x = pos.x; popup.pt.y = pos.y;
|
||||||
|
popup.clrForeground = -1;
|
||||||
|
popup.clrBackground = -1;
|
||||||
|
popup.rcMargins.top = popup.rcMargins.left = popup.rcMargins.right = popup.rcMargins.bottom = -1;
|
||||||
|
popup.pszFont = NULL;
|
||||||
|
popup.pszText = (const wxChar*) text;
|
||||||
|
|
||||||
|
HtmlHelp(GetSuitableHWND(), NULL, HH_DISPLAY_TEXT_POPUP, (DWORD) & popup);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
bool wxCHMHelpController::DisplayBlock(long block)
|
bool wxCHMHelpController::DisplayBlock(long block)
|
||||||
{
|
{
|
||||||
return DisplaySection(block);
|
return DisplaySection(block);
|
||||||
|
@@ -67,11 +67,10 @@ bool wxWinHelpController::DisplayContents(void)
|
|||||||
wxString str = GetValidFilename(m_helpFile);
|
wxString str = GetValidFilename(m_helpFile);
|
||||||
|
|
||||||
#if defined(__WIN95__)
|
#if defined(__WIN95__)
|
||||||
WinHelp(GetSuitableHWND(), (const wxChar*) str, HELP_FINDER, 0L);
|
return (WinHelp(GetSuitableHWND(), (const wxChar*) str, HELP_FINDER, 0L) != 0);
|
||||||
#else
|
#else
|
||||||
WinHelp(GetSuitableHWND(), (const wxChar*) str, HELP_CONTENTS, 0L);
|
return (WinHelp(GetSuitableHWND(), (const wxChar*) str, HELP_CONTENTS, 0L) != 0);
|
||||||
#endif
|
#endif
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWinHelpController::DisplaySection(int section)
|
bool wxWinHelpController::DisplaySection(int section)
|
||||||
@@ -81,8 +80,16 @@ bool wxWinHelpController::DisplaySection(int section)
|
|||||||
|
|
||||||
wxString str = GetValidFilename(m_helpFile);
|
wxString str = GetValidFilename(m_helpFile);
|
||||||
|
|
||||||
WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)section);
|
return (WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)section) != 0);
|
||||||
return TRUE;
|
}
|
||||||
|
|
||||||
|
bool wxWinHelpController::DisplayContextPopup(int contextId)
|
||||||
|
{
|
||||||
|
if (m_helpFile.IsEmpty()) return FALSE;
|
||||||
|
|
||||||
|
wxString str = GetValidFilename(m_helpFile);
|
||||||
|
|
||||||
|
return (WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXTPOPUP, (DWORD) contextId) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWinHelpController::DisplayBlock(long block)
|
bool wxWinHelpController::DisplayBlock(long block)
|
||||||
@@ -97,15 +104,13 @@ bool wxWinHelpController::KeywordSearch(const wxString& k)
|
|||||||
|
|
||||||
wxString str = GetValidFilename(m_helpFile);
|
wxString str = GetValidFilename(m_helpFile);
|
||||||
|
|
||||||
WinHelp(GetSuitableHWND(), (const wxChar*) str, HELP_PARTIALKEY, (DWORD)(const wxChar*) k);
|
return (WinHelp(GetSuitableHWND(), (const wxChar*) str, HELP_PARTIALKEY, (DWORD)(const wxChar*) k) != 0);
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can't close the help window explicitly in WinHelp
|
// Can't close the help window explicitly in WinHelp
|
||||||
bool wxWinHelpController::Quit(void)
|
bool wxWinHelpController::Quit(void)
|
||||||
{
|
{
|
||||||
WinHelp(GetSuitableHWND(), 0, HELP_QUIT, 0L);
|
return (WinHelp(GetSuitableHWND(), 0, HELP_QUIT, 0L) != 0);
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append extension if necessary.
|
// Append extension if necessary.
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "wx/settings.h"
|
||||||
#include "wx/ownerdrw.h"
|
#include "wx/ownerdrw.h"
|
||||||
#include "wx/menuitem.h"
|
#include "wx/menuitem.h"
|
||||||
|
|
||||||
@@ -51,6 +52,8 @@ wxOwnerDrawn::wxOwnerDrawn(const wxString& str,
|
|||||||
m_bOwnerDrawn = FALSE;
|
m_bOwnerDrawn = FALSE;
|
||||||
m_nHeight = 0;
|
m_nHeight = 0;
|
||||||
m_nMarginWidth = ms_nLastMarginWidth;
|
m_nMarginWidth = ms_nLastMarginWidth;
|
||||||
|
if (wxNORMAL_FONT)
|
||||||
|
m_font = * wxNORMAL_FONT;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__WXMSW__) && defined(__WIN32__) && defined(SM_CXMENUCHECK)
|
#if defined(__WXMSW__) && defined(__WIN32__) && defined(SM_CXMENUCHECK)
|
||||||
|
Reference in New Issue
Block a user