X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ed7701bd5f8866c49bc0f0972315cd2cc2c5840a..dc813e6c7ef8a9a26c035b004b512e1aa1b0bf3f:/src/msw/toolbar.cpp diff --git a/src/msw/toolbar.cpp b/src/msw/toolbar.cpp index 09b7d221cd..6399465223 100644 --- a/src/msw/toolbar.cpp +++ b/src/msw/toolbar.cpp @@ -1250,7 +1250,16 @@ bool wxToolBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id_) bool allowLeftClick = OnLeftClick(id, toggled); - // restore the unpressed state + // Restore the unpressed state. Enabled/toggled state might have been + // changed since so take care of it. + if (tool->IsEnabled()) + state |= TBSTATE_ENABLED; + else + state &= ~TBSTATE_ENABLED; + if (tool->IsToggled()) + state |= TBSTATE_CHECKED; + else + state &= ~TBSTATE_CHECKED; ::SendMessage(GetHwnd(), TB_SETSTATE, id, MAKELONG(state, 0)); // OnLeftClick() can veto the button state change - for buttons which @@ -1501,7 +1510,7 @@ void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(tog void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap ) { - wxToolBarTool* tool = wx_static_cast(wxToolBarTool*, FindById(id)); + wxToolBarTool* tool = static_cast(FindById(id)); if ( tool ) { wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools.")); @@ -1513,7 +1522,7 @@ void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap ) void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmap& bitmap ) { - wxToolBarTool* tool = wx_static_cast(wxToolBarTool*, FindById(id)); + wxToolBarTool* tool = static_cast(FindById(id)); if ( tool ) { wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools."));