added test for toggling the main toolbar
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16257 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -31,7 +31,6 @@
|
|||||||
#include <wx/toolbar.h>
|
#include <wx/toolbar.h>
|
||||||
#include <wx/log.h>
|
#include <wx/log.h>
|
||||||
#include <wx/image.h>
|
#include <wx/image.h>
|
||||||
#include <wx/spinctrl.h>
|
|
||||||
|
|
||||||
// define this to 1 to use wxToolBarSimple instead of the native one
|
// define this to 1 to use wxToolBarSimple instead of the native one
|
||||||
#define USE_GENERIC_TBAR 0
|
#define USE_GENERIC_TBAR 0
|
||||||
@@ -102,6 +101,7 @@ public:
|
|||||||
|
|
||||||
void OnSize(wxSizeEvent& event);
|
void OnSize(wxSizeEvent& event);
|
||||||
|
|
||||||
|
void OnToggleToolbar(wxCommandEvent& event);
|
||||||
void OnToggleAnotherToolbar(wxCommandEvent& event);
|
void OnToggleAnotherToolbar(wxCommandEvent& event);
|
||||||
|
|
||||||
void OnToggleToolbarSize(wxCommandEvent& event);
|
void OnToggleToolbarSize(wxCommandEvent& event);
|
||||||
@@ -165,6 +165,7 @@ enum
|
|||||||
IDM_TOOLBAR_DELETEPRINT,
|
IDM_TOOLBAR_DELETEPRINT,
|
||||||
IDM_TOOLBAR_INSERTPRINT,
|
IDM_TOOLBAR_INSERTPRINT,
|
||||||
IDM_TOOLBAR_TOGGLEHELP,
|
IDM_TOOLBAR_TOGGLEHELP,
|
||||||
|
IDM_TOOLBAR_TOGGLE_TOOLBAR,
|
||||||
IDM_TOOLBAR_TOGGLE_ANOTHER_TOOLBAR,
|
IDM_TOOLBAR_TOGGLE_ANOTHER_TOOLBAR,
|
||||||
IDM_TOOLBAR_CHANGE_TOOLTIP,
|
IDM_TOOLBAR_CHANGE_TOOLTIP,
|
||||||
IDM_TOOLBAR_SHOW_TEXT,
|
IDM_TOOLBAR_SHOW_TEXT,
|
||||||
@@ -187,6 +188,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
EVT_MENU(wxID_EXIT, MyFrame::OnQuit)
|
EVT_MENU(wxID_EXIT, MyFrame::OnQuit)
|
||||||
EVT_MENU(wxID_HELP, MyFrame::OnAbout)
|
EVT_MENU(wxID_HELP, MyFrame::OnAbout)
|
||||||
|
|
||||||
|
EVT_MENU(IDM_TOOLBAR_TOGGLE_TOOLBAR, MyFrame::OnToggleToolbar)
|
||||||
EVT_MENU(IDM_TOOLBAR_TOGGLE_ANOTHER_TOOLBAR, MyFrame::OnToggleAnotherToolbar)
|
EVT_MENU(IDM_TOOLBAR_TOGGLE_ANOTHER_TOOLBAR, MyFrame::OnToggleAnotherToolbar)
|
||||||
|
|
||||||
EVT_MENU(IDM_TOOLBAR_TOGGLETOOLBARSIZE, MyFrame::OnToggleToolbarSize)
|
EVT_MENU(IDM_TOOLBAR_TOGGLETOOLBARSIZE, MyFrame::OnToggleToolbarSize)
|
||||||
@@ -353,23 +355,25 @@ MyFrame::MyFrame(wxFrame* parent,
|
|||||||
|
|
||||||
// Make a menubar
|
// Make a menubar
|
||||||
wxMenu *tbarMenu = new wxMenu;
|
wxMenu *tbarMenu = new wxMenu;
|
||||||
tbarMenu->Append(IDM_TOOLBAR_TOGGLE_ANOTHER_TOOLBAR,
|
tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLE_TOOLBAR,
|
||||||
"Toggle &another toolbar\tCtrl-A",
|
"Toggle &toolbar\tCtrl-Z",
|
||||||
"Show/hide another test toolbar",
|
"Show or hide the toolbar");
|
||||||
TRUE);
|
|
||||||
|
|
||||||
tbarMenu->Append(IDM_TOOLBAR_TOGGLETOOLBARSIZE,
|
tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLE_ANOTHER_TOOLBAR,
|
||||||
"&Toggle toolbar size\tCtrl-S",
|
"Toggle &another toolbar\tCtrl-A",
|
||||||
"Toggle between big/small toolbar",
|
"Show/hide another test toolbar");
|
||||||
TRUE);
|
|
||||||
tbarMenu->Append(IDM_TOOLBAR_TOGGLETOOLBARORIENT,
|
tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLETOOLBARSIZE,
|
||||||
"Toggle toolbar &orientation\tCtrl-O",
|
"&Toggle toolbar size\tCtrl-S",
|
||||||
"Toggle toolbar orientation",
|
"Toggle between big/small toolbar");
|
||||||
TRUE);
|
|
||||||
tbarMenu->Append(IDM_TOOLBAR_TOGGLETOOLBARROWS,
|
tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLETOOLBARORIENT,
|
||||||
"Toggle number of &rows\tCtrl-R",
|
"Toggle toolbar &orientation\tCtrl-O",
|
||||||
"Toggle number of toolbar rows between 1 and 2",
|
"Toggle toolbar orientation");
|
||||||
TRUE);
|
|
||||||
|
tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLETOOLBARROWS,
|
||||||
|
"Toggle number of &rows\tCtrl-R",
|
||||||
|
"Toggle number of toolbar rows between 1 and 2");
|
||||||
|
|
||||||
tbarMenu->AppendSeparator();
|
tbarMenu->AppendSeparator();
|
||||||
|
|
||||||
@@ -450,6 +454,22 @@ void MyFrame::OnSize(wxSizeEvent& event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnToggleToolbar(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
wxToolBar *tbar = GetToolBar();
|
||||||
|
|
||||||
|
if ( !tbar )
|
||||||
|
{
|
||||||
|
RecreateToolbar();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
delete tbar;
|
||||||
|
|
||||||
|
SetToolBar(NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MyFrame::OnToggleAnotherToolbar(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnToggleAnotherToolbar(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
if ( m_tbar )
|
if ( m_tbar )
|
||||||
|
Reference in New Issue
Block a user