context help for notebook pages tests added
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39727 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
dc134969ef
commit
df1496e3eb
@ -34,6 +34,10 @@ IMPLEMENT_APP(MyApp)
|
|||||||
|
|
||||||
bool MyApp::OnInit()
|
bool MyApp::OnInit()
|
||||||
{
|
{
|
||||||
|
#if wxUSE_HELP
|
||||||
|
wxHelpProvider::Set( new wxSimpleHelpProvider );
|
||||||
|
#endif
|
||||||
|
|
||||||
// Create the main window
|
// Create the main window
|
||||||
MyFrame *frame = new MyFrame();
|
MyFrame *frame = new MyFrame();
|
||||||
|
|
||||||
@ -54,6 +58,10 @@ wxPanel *CreateUserCreatedPage(wxBookCtrlBase *parent)
|
|||||||
{
|
{
|
||||||
wxPanel *panel = new wxPanel(parent);
|
wxPanel *panel = new wxPanel(parent);
|
||||||
|
|
||||||
|
#if wxUSE_HELP
|
||||||
|
panel->SetHelpText( wxT( "Panel with a Button" ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
(void) new wxButton( panel, wxID_ANY, wxT("Button"),
|
(void) new wxButton( panel, wxID_ANY, wxT("Button"),
|
||||||
wxPoint(10, 10), wxDefaultSize );
|
wxPoint(10, 10), wxDefaultSize );
|
||||||
|
|
||||||
@ -64,6 +72,10 @@ wxPanel *CreateRadioButtonsPage(wxBookCtrlBase *parent)
|
|||||||
{
|
{
|
||||||
wxPanel *panel = new wxPanel(parent);
|
wxPanel *panel = new wxPanel(parent);
|
||||||
|
|
||||||
|
#if wxUSE_HELP
|
||||||
|
panel->SetHelpText( wxT( "Panel with some Radio Buttons" ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
wxString animals[] = { wxT("Fox"), wxT("Hare"), wxT("Rabbit"),
|
wxString animals[] = { wxT("Fox"), wxT("Hare"), wxT("Rabbit"),
|
||||||
wxT("Sabre-toothed tiger"), wxT("T Rex") };
|
wxT("Sabre-toothed tiger"), wxT("T Rex") };
|
||||||
|
|
||||||
@ -89,6 +101,10 @@ wxPanel *CreateVetoPage(wxBookCtrlBase *parent)
|
|||||||
{
|
{
|
||||||
wxPanel *panel = new wxPanel(parent);
|
wxPanel *panel = new wxPanel(parent);
|
||||||
|
|
||||||
|
#if wxUSE_HELP
|
||||||
|
panel->SetHelpText( wxT( "An empty panel" ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
(void) new wxStaticText( panel, wxID_ANY,
|
(void) new wxStaticText( panel, wxID_ANY,
|
||||||
wxT("This page intentionally left blank"), wxPoint(10, 10) );
|
wxT("This page intentionally left blank"), wxPoint(10, 10) );
|
||||||
|
|
||||||
@ -99,6 +115,10 @@ wxPanel *CreateBigButtonPage(wxBookCtrlBase *parent)
|
|||||||
{
|
{
|
||||||
wxPanel *panel = new wxPanel(parent);
|
wxPanel *panel = new wxPanel(parent);
|
||||||
|
|
||||||
|
#if wxUSE_HELP
|
||||||
|
panel->SetHelpText( wxT( "Panel with a maximized button" ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
wxButton *buttonBig = new wxButton(panel, wxID_ANY, wxT("Maximized button"));
|
wxButton *buttonBig = new wxButton(panel, wxID_ANY, wxT("Maximized button"));
|
||||||
|
|
||||||
wxBoxSizer *sizerPanel = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer *sizerPanel = new wxBoxSizer(wxVERTICAL);
|
||||||
@ -113,6 +133,10 @@ wxPanel *CreateInsertPage(wxBookCtrlBase *parent)
|
|||||||
{
|
{
|
||||||
wxPanel *panel = new wxPanel(parent);
|
wxPanel *panel = new wxPanel(parent);
|
||||||
|
|
||||||
|
#if wxUSE_HELP
|
||||||
|
panel->SetHelpText( wxT( "Maroon panel" ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
panel->SetBackgroundColour( wxColour( wxT("MAROON") ) );
|
panel->SetBackgroundColour( wxColour( wxT("MAROON") ) );
|
||||||
(void) new wxStaticText( panel, wxID_ANY,
|
(void) new wxStaticText( panel, wxID_ANY,
|
||||||
wxT("This page has been inserted, not added."), wxPoint(10, 10) );
|
wxT("This page has been inserted, not added."), wxPoint(10, 10) );
|
||||||
@ -181,6 +205,10 @@ wxPanel *CreatePage(wxBookCtrlBase *parent, const wxString&pageName)
|
|||||||
MyFrame::MyFrame()
|
MyFrame::MyFrame()
|
||||||
: wxFrame(NULL, wxID_ANY, wxString(wxT("wxWidgets book controls sample")))
|
: wxFrame(NULL, wxID_ANY, wxString(wxT("wxWidgets book controls sample")))
|
||||||
{
|
{
|
||||||
|
#if wxUSE_HELP
|
||||||
|
SetExtraStyle(wxFRAME_EX_CONTEXTHELP);
|
||||||
|
#endif // wxUSE_HELP
|
||||||
|
|
||||||
#if wxUSE_NOTEBOOK
|
#if wxUSE_NOTEBOOK
|
||||||
m_type = Type_Notebook;
|
m_type = Type_Notebook;
|
||||||
#elif wxUSE_CHOICEBOOK
|
#elif wxUSE_CHOICEBOOK
|
||||||
@ -239,6 +267,9 @@ MyFrame::MyFrame()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxMenu *menuOperations = new wxMenu;
|
wxMenu *menuOperations = new wxMenu;
|
||||||
|
#if wxUSE_HELP
|
||||||
|
menuOperations->Append(ID_CONTEXT_HELP, wxT("&Context help\tCtrl-F1"));
|
||||||
|
#endif // wxUSE_HELP
|
||||||
menuOperations->Append(ID_HITTEST, wxT("&Hit test\tCtrl-H"));
|
menuOperations->Append(ID_HITTEST, wxT("&Hit test\tCtrl-H"));
|
||||||
|
|
||||||
wxMenu *menuFile = new wxMenu;
|
wxMenu *menuFile = new wxMenu;
|
||||||
@ -487,6 +518,9 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
EVT_MENU(ID_DELETE_LAST_PAGE, MyFrame::OnDeleteLastPage)
|
EVT_MENU(ID_DELETE_LAST_PAGE, MyFrame::OnDeleteLastPage)
|
||||||
EVT_MENU(ID_NEXT_PAGE, MyFrame::OnNextPage)
|
EVT_MENU(ID_NEXT_PAGE, MyFrame::OnNextPage)
|
||||||
|
|
||||||
|
#if wxUSE_HELP
|
||||||
|
EVT_MENU(ID_CONTEXT_HELP, MyFrame::OnContextHelp)
|
||||||
|
#endif // wxUSE_HELP
|
||||||
EVT_MENU(ID_HITTEST, MyFrame::OnHitTest)
|
EVT_MENU(ID_HITTEST, MyFrame::OnHitTest)
|
||||||
|
|
||||||
// Book controls
|
// Book controls
|
||||||
@ -520,6 +554,16 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
EVT_IDLE(MyFrame::OnIdle)
|
EVT_IDLE(MyFrame::OnIdle)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
#if wxUSE_HELP
|
||||||
|
|
||||||
|
void MyFrame::OnContextHelp(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
// launches local event loop
|
||||||
|
wxContextHelp ch( this );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // wxUSE_HELP
|
||||||
|
|
||||||
void MyFrame::AddFlagStrIfFlagPresent(wxString & flagStr, long flags, long flag, const wxChar * flagName) const
|
void MyFrame::AddFlagStrIfFlagPresent(wxString & flagStr, long flags, long flag, const wxChar * flagName) const
|
||||||
{
|
{
|
||||||
if( (flags & flag) == flag )
|
if( (flags & flag) == flag )
|
||||||
@ -603,6 +647,10 @@ wxPanel *MyFrame::CreateNewPage() const
|
|||||||
{
|
{
|
||||||
wxPanel *panel = new wxPanel(m_bookCtrl, wxID_ANY );
|
wxPanel *panel = new wxPanel(m_bookCtrl, wxID_ANY );
|
||||||
|
|
||||||
|
#if wxUSE_HELP
|
||||||
|
panel->SetHelpText( wxT( "Panel with \"First\" and \"Second\" buttons" ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
(void) new wxButton(panel, wxID_ANY, wxT("First button"), wxPoint(10, 10));
|
(void) new wxButton(panel, wxID_ANY, wxT("First button"), wxPoint(10, 10));
|
||||||
(void) new wxButton(panel, wxID_ANY, wxT("Second button"), wxPoint(50, 100));
|
(void) new wxButton(panel, wxID_ANY, wxT("Second button"), wxPoint(50, 100));
|
||||||
|
|
||||||
|
@ -52,6 +52,10 @@ public:
|
|||||||
void OnAddSubPage(wxCommandEvent& event);
|
void OnAddSubPage(wxCommandEvent& event);
|
||||||
void OnAddPageBefore(wxCommandEvent& event);
|
void OnAddPageBefore(wxCommandEvent& event);
|
||||||
|
|
||||||
|
#if wxUSE_HELP
|
||||||
|
void OnContextHelp(wxCommandEvent& event);
|
||||||
|
#endif // wxUSE_HELP
|
||||||
|
|
||||||
void OnHitTest(wxCommandEvent& event);
|
void OnHitTest(wxCommandEvent& event);
|
||||||
|
|
||||||
void OnBookCtrl(wxBookCtrlBaseEvent& event);
|
void OnBookCtrl(wxBookCtrlBaseEvent& event);
|
||||||
@ -144,6 +148,9 @@ enum ID_COMMANDS
|
|||||||
ID_ADD_PAGE_BEFORE,
|
ID_ADD_PAGE_BEFORE,
|
||||||
ID_ADD_SUB_PAGE,
|
ID_ADD_SUB_PAGE,
|
||||||
|
|
||||||
|
#if wxUSE_HELP
|
||||||
|
ID_CONTEXT_HELP,
|
||||||
|
#endif // wxUSE_HELP
|
||||||
ID_HITTEST
|
ID_HITTEST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user