X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ac91b9d22aea519059b3f64adfba506d43aba639..d4ffe273ca70deb8e2cff7be9a07b0640e24bee0:/src/common/tbarbase.cpp diff --git a/src/common/tbarbase.cpp b/src/common/tbarbase.cpp index fb0f5bda35..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); } @@ -720,7 +724,7 @@ void wxToolBarBase::ViewStart (int *x, int *y) const *y = m_yScrollPosition; } -void wxToolBarBase::OnIdle(wxIdleEvent& WXUNUSED(event)) +void wxToolBarBase::OnIdle(wxIdleEvent& event) { #ifndef __WXGTK__ wxWindow::OnIdle(event); @@ -732,6 +736,8 @@ void wxToolBarBase::OnIdle(wxIdleEvent& WXUNUSED(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());