Handling erase background events for toolbars never worked for the ports other
than wxMSW and now it doesn't work for MSW neither as we need to skip erasing
the background in WM_ERASEBKGND handler to avoid flicker which would result
from erasing the background twice, from there and from WM_PAINT handler which
must do it. So don't even try to test if it works, it's unlikely to be very
useful anyhow.
This reverts the change to this file in r62805.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62972
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
void OnToolbarStyle(wxCommandEvent& event);
void OnToolbarBgCol(wxCommandEvent& event);
void OnToolbarStyle(wxCommandEvent& event);
void OnToolbarBgCol(wxCommandEvent& event);
- void OnToolbarCustomBg(wxCommandEvent& event);
void OnToolbarCustomBitmap(wxCommandEvent& event);
void OnToolLeftClick(wxCommandEvent& event);
void OnToolbarCustomBitmap(wxCommandEvent& event);
void OnToolLeftClick(wxCommandEvent& event);
{ event.Enable( m_tbar != NULL ); }
private:
{ event.Enable( m_tbar != NULL ); }
private:
- void OnEraseToolBarBackground(wxEraseEvent& event);
-
void DoEnablePrint();
void DoDeletePrint();
void DoToggleHelp();
void DoEnablePrint();
void DoDeletePrint();
void DoToggleHelp();
IDM_TOOLBAR_SHOW_ICONS,
IDM_TOOLBAR_SHOW_BOTH,
IDM_TOOLBAR_BG_COL,
IDM_TOOLBAR_SHOW_ICONS,
IDM_TOOLBAR_SHOW_BOTH,
IDM_TOOLBAR_BG_COL,
IDM_TOOLBAR_CUSTOM_PATH,
IDM_TOOLBAR_TOP_ORIENTATION,
IDM_TOOLBAR_LEFT_ORIENTATION,
IDM_TOOLBAR_CUSTOM_PATH,
IDM_TOOLBAR_TOP_ORIENTATION,
IDM_TOOLBAR_LEFT_ORIENTATION,
EVT_MENU_RANGE(IDM_TOOLBAR_SHOW_TEXT, IDM_TOOLBAR_SHOW_BOTH,
MyFrame::OnToolbarStyle)
EVT_MENU(IDM_TOOLBAR_BG_COL, MyFrame::OnToolbarBgCol)
EVT_MENU_RANGE(IDM_TOOLBAR_SHOW_TEXT, IDM_TOOLBAR_SHOW_BOTH,
MyFrame::OnToolbarStyle)
EVT_MENU(IDM_TOOLBAR_BG_COL, MyFrame::OnToolbarBgCol)
- EVT_MENU(IDM_TOOLBAR_CUSTOM_BG, MyFrame::OnToolbarCustomBg)
EVT_MENU(IDM_TOOLBAR_CUSTOM_PATH, MyFrame::OnToolbarCustomBitmap)
EVT_MENU(IDM_TOOLBAR_CUSTOM_PATH, MyFrame::OnToolbarCustomBitmap)
toolBar = CreateToolBar(style, ID_TOOLBAR);
#endif
toolBar = CreateToolBar(style, ID_TOOLBAR);
#endif
- if ( GetMenuBar()->IsChecked(IDM_TOOLBAR_CUSTOM_BG) )
- {
- toolBar->Connect
- (
- wxEVT_ERASE_BACKGROUND,
- wxEraseEventHandler(MyFrame::OnEraseToolBarBackground),
- NULL,
- this
- );
- }
-
PopulateToolbar(toolBar);
}
PopulateToolbar(toolBar);
}
tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_BOTH, wxT("Show &both\tCtrl-Alt-B"));
tbarMenu->AppendSeparator();
tbarMenu->Append(IDM_TOOLBAR_BG_COL, wxT("Choose bac&kground colour..."));
tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_BOTH, wxT("Show &both\tCtrl-Alt-B"));
tbarMenu->AppendSeparator();
tbarMenu->Append(IDM_TOOLBAR_BG_COL, wxT("Choose bac&kground colour..."));
- tbarMenu->AppendCheckItem(IDM_TOOLBAR_CUSTOM_BG, wxT("Draw custom back&ground"));
tbarMenu->Append(IDM_TOOLBAR_CUSTOM_PATH, wxT("Custom &bitmap...\tCtrl-B"));
wxMenu *toolMenu = new wxMenu;
tbarMenu->Append(IDM_TOOLBAR_CUSTOM_PATH, wxT("Custom &bitmap...\tCtrl-B"));
wxMenu *toolMenu = new wxMenu;
-void MyFrame::OnEraseToolBarBackground(wxEraseEvent& event)
-{
- wxDC& dc = *event.GetDC();
- const wxSize size = dc.GetSize();
- dc.SetPen(*wxRED_PEN);
- dc.DrawLine(0, 0, size.x, size.y);
- dc.DrawLine(0, size.y, size.x, 0);
-}
-
void MyFrame::OnToggleToolbar(wxCommandEvent& WXUNUSED(event))
{
wxToolBar *tbar = GetToolBar();
void MyFrame::OnToggleToolbar(wxCommandEvent& WXUNUSED(event))
{
wxToolBar *tbar = GetToolBar();
-void MyFrame::OnToolbarCustomBg(wxCommandEvent& event)
-{
- wxToolBarBase *tb = GetToolBar();
-
- if ( event.IsChecked() )
- {
- tb->Connect
- (
- wxEVT_ERASE_BACKGROUND,
- wxEraseEventHandler(MyFrame::OnEraseToolBarBackground),
- NULL,
- this
- );
- }
- else
- {
- tb->Disconnect
- (
- wxEVT_ERASE_BACKGROUND,
- wxEraseEventHandler(MyFrame::OnEraseToolBarBackground),
- NULL,
- this
- );
- }
-
- tb->Refresh();
-}
-
void MyFrame::OnToolbarCustomBitmap(wxCommandEvent& WXUNUSED(event))
{
m_pathBmp = wxLoadFileSelector("custom bitmap", "");
void MyFrame::OnToolbarCustomBitmap(wxCommandEvent& WXUNUSED(event))
{
m_pathBmp = wxLoadFileSelector("custom bitmap", "");