add test for setting toolbar background colour

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52267 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-03-02 23:27:20 +00:00
parent 4c865f6df3
commit 211df0565b

View File

@@ -32,6 +32,7 @@
#include "wx/log.h" #include "wx/log.h"
#include "wx/image.h" #include "wx/image.h"
#include "wx/filedlg.h" #include "wx/filedlg.h"
#include "wx/colordlg.h"
#include "wx/spinctrl.h" #include "wx/spinctrl.h"
#include "wx/srchctrl.h" #include "wx/srchctrl.h"
@@ -128,6 +129,7 @@ public:
void OnToggleRadioBtn(wxCommandEvent& event); void OnToggleRadioBtn(wxCommandEvent& event);
void OnToolbarStyle(wxCommandEvent& event); void OnToolbarStyle(wxCommandEvent& event);
void OnToolbarBgCol(wxCommandEvent& event);
void OnToolbarCustomBitmap(wxCommandEvent& event); void OnToolbarCustomBitmap(wxCommandEvent& event);
void OnToolLeftClick(wxCommandEvent& event); void OnToolLeftClick(wxCommandEvent& event);
@@ -201,6 +203,7 @@ enum
IDM_TOOLBAR_SHOW_TEXT, IDM_TOOLBAR_SHOW_TEXT,
IDM_TOOLBAR_SHOW_ICONS, IDM_TOOLBAR_SHOW_ICONS,
IDM_TOOLBAR_SHOW_BOTH, IDM_TOOLBAR_SHOW_BOTH,
IDM_TOOLBAR_BG_COL,
IDM_TOOLBAR_CUSTOM_PATH, IDM_TOOLBAR_CUSTOM_PATH,
IDM_TOOLBAR_TOP_ORIENTATION, IDM_TOOLBAR_TOP_ORIENTATION,
IDM_TOOLBAR_LEFT_ORIENTATION, IDM_TOOLBAR_LEFT_ORIENTATION,
@@ -247,6 +250,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU_RANGE(IDM_TOOLBAR_SHOW_TEXT, IDM_TOOLBAR_SHOW_BOTH, EVT_MENU_RANGE(IDM_TOOLBAR_SHOW_TEXT, IDM_TOOLBAR_SHOW_BOTH,
MyFrame::OnToolbarStyle) MyFrame::OnToolbarStyle)
EVT_MENU(IDM_TOOLBAR_BG_COL, MyFrame::OnToolbarBgCol)
EVT_MENU(IDM_TOOLBAR_CUSTOM_PATH, MyFrame::OnToolbarCustomBitmap) EVT_MENU(IDM_TOOLBAR_CUSTOM_PATH, MyFrame::OnToolbarCustomBitmap)
@@ -584,6 +588,7 @@ MyFrame::MyFrame(wxFrame* parent,
tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_ICONS, _T("Show &icons\tCtrl-Alt-I")); tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_ICONS, _T("Show &icons\tCtrl-Alt-I"));
tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_BOTH, _T("Show &both\tCtrl-Alt-B")); tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_BOTH, _T("Show &both\tCtrl-Alt-B"));
tbarMenu->AppendSeparator(); tbarMenu->AppendSeparator();
tbarMenu->Append(IDM_TOOLBAR_BG_COL, _T("Choose bac&kground colour..."));
tbarMenu->Append(IDM_TOOLBAR_CUSTOM_PATH, _T("Custom &bitmap...\tCtrl-B")); tbarMenu->Append(IDM_TOOLBAR_CUSTOM_PATH, _T("Custom &bitmap...\tCtrl-B"));
wxMenu *fileMenu = new wxMenu; wxMenu *fileMenu = new wxMenu;
@@ -879,6 +884,21 @@ void MyFrame::OnToolbarStyle(wxCommandEvent& event)
GetToolBar()->SetWindowStyle(style); GetToolBar()->SetWindowStyle(style);
} }
void MyFrame::OnToolbarBgCol(wxCommandEvent& WXUNUSED(event))
{
wxColour col = wxGetColourFromUser
(
this,
GetToolBar()->GetBackgroundColour(),
"Toolbar background colour"
);
if ( col.IsOk() )
{
GetToolBar()->SetBackgroundColour(col);
GetToolBar()->Refresh();
}
}
void MyFrame::OnToolbarCustomBitmap(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnToolbarCustomBitmap(wxCommandEvent& WXUNUSED(event))
{ {
m_pathBmp = wxFileSelector(_T("Custom bitmap path")); m_pathBmp = wxFileSelector(_T("Custom bitmap path"));