X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cfb7687556620cc0a558c9dab3f582de31369e67..6b769f3d1f81ffebba557208083a1fc161dfbe23:/src/common/tbarbase.cpp?ds=sidebyside diff --git a/src/common/tbarbase.cpp b/src/common/tbarbase.cpp index 218ecbea4f..6f7793b419 100644 --- a/src/common/tbarbase.cpp +++ b/src/common/tbarbase.cpp @@ -24,6 +24,8 @@ #include "wx/wx.h" #endif +#include "wx/frame.h" + // For ::UpdateWindow #ifdef __WXMSW__ #include @@ -147,6 +149,7 @@ bool wxToolBarBase::OnLeftClick(int toolIndex, bool toggleDown) event.SetEventObject(this); event.SetExtraLong((long) toggleDown); + // Send events to this toolbar instead (and thence up the window hierarchy) GetEventHandler()->ProcessEvent(event); return TRUE; @@ -217,6 +220,7 @@ wxToolBarTool *wxToolBarBase::AddTool(int index, const wxBitmap& bitmap, const w void wxToolBarBase::AddSeparator () { wxToolBarTool *tool = new wxToolBarTool; + tool->m_index = -1; tool->m_toolStyle = wxTOOL_STYLE_SEPARATOR; m_tools.Append(-1, tool); } @@ -732,6 +736,8 @@ void wxToolBarBase::OnIdle(wxIdleEvent& event) // Do the toolbar button updates (check for EVT_UPDATE_UI handlers) void wxToolBarBase::DoToolbarUpdates() { + wxEvtHandler* evtHandler = GetEventHandler() ; + wxNode* node = GetTools().First(); while (node) { @@ -740,7 +746,7 @@ void wxToolBarBase::DoToolbarUpdates() wxUpdateUIEvent event(tool->m_index); event.SetEventObject(this); - if (GetEventHandler()->ProcessEvent(event)) + if (evtHandler->ProcessEvent(event)) { if (event.GetSetEnabled()) EnableTool(tool->m_index, event.GetEnabled());