]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/tbarbase.cpp
fixes to allow dragging in multiselection tree ctrl (patch 759421)
[wxWidgets.git] / src / common / tbarbase.cpp
index e2a1ccd70f5010560bee1806619d4264612ca6b3..a187599235a0ad8bbb3dc0fc5eb6900c54ceebaf 100644 (file)
@@ -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
 /////////////////////////////////////////////////////////////////////////////
 
 // ============================================================================
@@ -38,7 +38,7 @@
 #include "wx/image.h"
 #include "wx/settings.h"
 
-#include "wx/tbarbase.h"
+#include "wx/toolbar.h"
 
 // ----------------------------------------------------------------------------
 // wxWindows macros
@@ -47,7 +47,6 @@
 IMPLEMENT_CLASS(wxToolBarBase, wxControl)
 
 BEGIN_EVENT_TABLE(wxToolBarBase, wxControl)
-    EVT_IDLE(wxToolBarBase::OnIdle)
 END_EVENT_TABLE()
 
 #include "wx/listimpl.cpp"
@@ -458,6 +457,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);
@@ -565,31 +580,12 @@ void wxToolBarBase::OnMouseEnter(int id)
 // UI updates
 // ----------------------------------------------------------------------------
 
-void wxToolBarBase::OnIdle(wxIdleEvent& event)
+// Do the toolbar button updates (check for EVT_UPDATE_UI handlers)
+void wxToolBarBase::UpdateWindowUI(long flags)
 {
-    DoToolbarUpdates();
-
-    event.Skip();
-}
+    wxWindowBase::UpdateWindowUI(flags);
 
-// 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;