+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 ( 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);
+}
+