X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6fd5fa4fcc83bfc4be401e0d4e752f48ae0a38bf..28be2e8a170979d476a5ea4f585505b8a2f5af27:/src/common/tbarbase.cpp?ds=sidebyside diff --git a/src/common/tbarbase.cpp b/src/common/tbarbase.cpp index f66ce0f3b1..d904ff9194 100644 --- a/src/common/tbarbase.cpp +++ b/src/common/tbarbase.cpp @@ -53,6 +53,8 @@ END_EVENT_TABLE() #endif +IMPLEMENT_CLASS(wxToolBarBase, wxControl) + #include "wx/listimpl.cpp" WX_DEFINE_LIST(wxToolBarToolsList); @@ -526,7 +528,17 @@ void wxToolBarBase::OnIdle(wxIdleEvent& event) // Do the toolbar button updates (check for EVT_UPDATE_UI handlers) void wxToolBarBase::DoToolbarUpdates() { - wxEvtHandler* evtHandler = GetEventHandler(); + wxWindow* parent = this; + while (parent->GetParent()) + parent = parent->GetParent(); + +#ifdef __WXMSW__ + wxWindow* focusWin = wxFindFocusDescendant(parent); +#else + wxWindow* focusWin = (wxWindow*) NULL; +#endif + + wxEvtHandler* evtHandler = focusWin ? focusWin->GetEventHandler() : GetEventHandler() ; for ( wxToolBarToolsList::Node* node = m_tools.GetFirst(); node;