void VoutWindow::processEvent( EvtMouse &rEvtMouse ) { int button = -1; if( rEvtMouse.getButton() == EvtMouse::kLeft ) button = 0; else if( rEvtMouse.getButton() == EvtMouse::kMiddle ) button = 1; else if( rEvtMouse.getButton() == EvtMouse::kRight ) button = 2; if( rEvtMouse.getAction() == EvtMouse::kDown ) vout_window_ReportMousePressed( m_pWnd, button ); else if( rEvtMouse.getAction() == EvtMouse::kUp ) vout_window_ReportMouseReleased( m_pWnd, button ); else if( rEvtMouse.getAction() == EvtMouse::kDblClick ) vout_window_ReportMouseDoubleClick( m_pWnd, button ); showMouse(); }
void TopWindow::processEvent( EvtMouse &rEvtMouse ) { // Get the control hit by the mouse CtrlGeneric *pNewHitControl = findHitControl( rEvtMouse.getXPos(), rEvtMouse.getYPos() ); setLastHit( pNewHitControl ); // Change the focused control if( rEvtMouse.getAction() == EvtMouse::kDown ) { // Raise the window m_rWindowManager.raise( *this ); if( pNewHitControl && pNewHitControl->isFocusable() ) { // If a new control gains the focus, the previous one loses it if( m_pFocusControl && m_pFocusControl != pNewHitControl ) { EvtFocus evt( getIntf(), false ); m_pFocusControl->handleEvent( evt ); } if( pNewHitControl != m_pFocusControl ) { m_pFocusControl = pNewHitControl; EvtFocus evt( getIntf(), false ); pNewHitControl->handleEvent( evt ); } } else if( m_pFocusControl ) { // The previous control loses the focus EvtFocus evt( getIntf(), false ); m_pFocusControl->handleEvent( evt ); m_pFocusControl = NULL; } } // Send a mouse event to the hit control, or to the control // that captured the mouse, if any CtrlGeneric *pActiveControl = pNewHitControl; if( m_pCapturingControl ) { pActiveControl = m_pCapturingControl; } if( pActiveControl ) { pActiveControl->handleEvent( rEvtMouse ); } }