X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/652ab15353e042c7dbaa7c5ab6ba5e28595e64ed..70dc287a3997b65d954bfbd5861f72696bd3dd27:/src/common/tbarbase.cpp?ds=sidebyside diff --git a/src/common/tbarbase.cpp b/src/common/tbarbase.cpp index e2a1ccd70f..caef94d252 100644 --- a/src/common/tbarbase.cpp +++ b/src/common/tbarbase.cpp @@ -5,8 +5,8 @@ // Modified by: VZ at 11.12.99 (wxScrollableToolBar splitted off) // Created: 04/01/98 // RCS-ID: $Id$ -// Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Copyright: (c) Julian Smart +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -458,6 +458,22 @@ void wxToolBarBase::SetToolClientData(int id, wxObject *clientData) tool->SetClientData(clientData); } +int wxToolBarBase::GetToolPos(int id) const +{ + size_t pos = 0; + wxToolBarToolsList::Node *node; + + for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) + { + if ( node->GetData()->GetId() == id ) + return pos; + + pos++; + } + + return wxNOT_FOUND; +} + bool wxToolBarBase::GetToolState(int id) const { wxToolBarToolBase *tool = FindById(id); @@ -575,21 +591,7 @@ void wxToolBarBase::OnIdle(wxIdleEvent& event) // Do the toolbar button updates (check for EVT_UPDATE_UI handlers) void wxToolBarBase::DoToolbarUpdates() { - wxWindow* parent = this; - while (parent->GetParent()) - parent = parent->GetParent(); - -// This kind of #ifdef is a good way to annoy people. It breaks -// apps, but only on one platform and due to a hack in officially -// platform independent code. It took me hours to fix this. RR. -// -// #ifdef __WXMSW__ -// wxWindow* focusWin = wxFindFocusDescendant(parent); -// #else - wxWindow* focusWin = (wxWindow*) NULL; -// #endif - - wxEvtHandler* evtHandler = focusWin ? focusWin->GetEventHandler() : GetEventHandler() ; + wxEvtHandler* evtHandler = GetEventHandler() ; for ( wxToolBarToolsList::Node* node = m_tools.GetFirst(); node;