]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/tbarbase.cpp
reorganized, improved and hopefully simplified wxchar.h and printf() functions handli...
[wxWidgets.git] / src / common / tbarbase.cpp
index 14b0bd80e299853b88f45baf92a68886d3e04e0a..5f4b02fa90576ac1e505b4b0f550f235e3bd7a10 100644 (file)
@@ -206,6 +206,24 @@ wxToolBarToolBase *wxToolBarBase::InsertControl(size_t pos, wxControl *control)
     return tool;
 }
 
+wxControl *wxToolBarBase::FindControl( int id )
+{
+    for ( wxToolBarToolsList::Node* node = m_tools.GetFirst();
+          node;
+          node = node->GetNext() )
+    {
+        wxControl *control = node->GetData()->GetControl();
+        
+        if (control)
+        {
+            if (control->GetId() == id)
+                return control;
+        }
+    }
+
+   return NULL;
+}
+
 wxToolBarToolBase *wxToolBarBase::AddSeparator()
 {
     return InsertSeparator(GetToolsCount());
@@ -536,11 +554,15 @@ void wxToolBarBase::DoToolbarUpdates()
     while (parent->GetParent())
         parent = parent->GetParent();
 
-#ifdef __WXMSW__
-    wxWindow* focusWin = wxFindFocusDescendant(parent);
-#else
+// 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
+// #endif
 
     wxEvtHandler* evtHandler = focusWin ? focusWin->GetEventHandler() : GetEventHandler() ;