+ else
+ return wxControl::PerformAction(action, numArg, strArg);
+
+ return true;
+}
+
+// ============================================================================
+// wxStdToolbarInputHandler implementation
+// ============================================================================
+
+wxStdToolbarInputHandler::wxStdToolbarInputHandler(wxInputHandler *handler)
+ : wxStdInputHandler(handler)
+{
+ m_winCapture = NULL;
+ m_toolCapture = NULL;
+ m_toolLast = NULL;
+}
+
+bool wxStdToolbarInputHandler::HandleKey(wxInputConsumer *consumer,
+ const wxKeyEvent& event,
+ bool pressed)
+{
+ // TODO: when we have a current button we should allow the arrow
+ // keys to move it
+ return wxStdInputHandler::HandleKey(consumer, event, pressed);
+}
+
+bool wxStdToolbarInputHandler::HandleMouse(wxInputConsumer *consumer,
+ const wxMouseEvent& event)
+{
+ wxToolBar *tbar = wxStaticCast(consumer->GetInputWindow(), wxToolBar);
+ wxToolBarToolBase *tool = tbar->FindToolForPosition(event.GetX(), event.GetY());
+
+ if ( event.Button(1) )
+ {
+
+ if ( event.LeftDown() || event.LeftDClick() )
+ {
+ if ( !tool || !tool->IsEnabled() )
+ return true;
+
+ m_winCapture = tbar;
+ m_winCapture->CaptureMouse();
+
+ m_toolCapture = tool;
+
+ consumer->PerformAction( wxACTION_BUTTON_PRESS, tool->GetId() );
+
+ return true;
+ }
+ else if ( event.LeftUp() )
+ {
+ if ( m_winCapture )
+ {
+ m_winCapture->ReleaseMouse();
+ m_winCapture = NULL;
+ }
+
+ if (m_toolCapture)
+ {
+ if ( tool == m_toolCapture )
+ consumer->PerformAction( wxACTION_BUTTON_TOGGLE, m_toolCapture->GetId() );
+ else
+ consumer->PerformAction( wxACTION_TOOLBAR_LEAVE, m_toolCapture->GetId() );
+ }
+
+ m_toolCapture = NULL;
+
+ return true;
+ }
+ //else: don't do anything special about the double click
+ }
+
+ return wxStdInputHandler::HandleMouse(consumer, event);
+}
+
+bool wxStdToolbarInputHandler::HandleMouseMove(wxInputConsumer *consumer,
+ const wxMouseEvent& event)
+{
+ if ( !wxStdInputHandler::HandleMouseMove(consumer, event) )