void TopWindow::processEvent( EvtMotion &rEvtMotion ) { // New control hit by the mouse CtrlGeneric *pNewHitControl = findHitControl( rEvtMotion.getXPos() - getLeft(), rEvtMotion.getYPos() - getTop() ); setLastHit( pNewHitControl ); /// Update the help text VarManager *pVarManager = VarManager::instance( getIntf() ); if( pNewHitControl ) { pVarManager->getHelpText().set( pNewHitControl->getHelpText() ); } // Send a motion 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 ) { // Compute the coordinates relative to the window int xPos = rEvtMotion.getXPos() - getLeft(); int yPos = rEvtMotion.getYPos() - getTop(); // Send a motion event EvtMotion evt( getIntf(), xPos, yPos ); pActiveControl->handleEvent( evt ); } }
void VoutWindow::processEvent( EvtMotion &rEvtMotion ) { int x = rEvtMotion.getXPos() - m_pParentWindow->getLeft() - getLeft(); int y = rEvtMotion.getYPos() - m_pParentWindow->getTop() - getTop(); vout_window_ReportMouseMoved( m_pWnd, x, y ); showMouse(); }
void CtrlMove::CmdMovingMoving::execute() { EvtMotion *pEvtMotion = (EvtMotion*)m_pParent->m_pEvt; int xNewLeft = pEvtMotion->getXPos() - m_pParent->m_xPos + m_pParent->m_rWindow.getLeft(); int yNewTop = pEvtMotion->getYPos() - m_pParent->m_yPos + m_pParent->m_rWindow.getTop(); m_pParent->m_rWindowManager.move( m_pParent->m_rWindow, xNewLeft, yNewTop ); }
void CtrlResize::CmdResizeResize::execute() { EvtMotion *pEvtMotion = static_cast<EvtMotion*>(m_pParent->m_pEvt); m_pParent->changeCursor( m_pParent->m_direction ); int newWidth = m_pParent->m_width; newWidth += pEvtMotion->getXPos() - m_pParent->m_xPos; int newHeight = m_pParent->m_height; newHeight += pEvtMotion->getYPos() - m_pParent->m_yPos; // Create a resize command, instead of calling the window manager directly. // Thanks to this trick, the duplicate resizing commands will be trashed // in the asynchronous queue, thus making resizing faster CmdGeneric *pCmd = new CmdResize( m_pParent->getIntf(), m_pParent->m_rWindowManager, m_pParent->m_rLayout, newWidth, newHeight ); // Push the command in the asynchronous command queue AsyncQueue::instance( getIntf() )->push( CmdGenericPtr( pCmd ) ); }