Ejemplo n.º 1
0
void CtrlSliderCursor::CmdMove::execute()
{
    EvtMouse *pEvtMouse = (EvtMouse*)m_pParent->m_pEvt;

    // Get the position of the control
    const Position *pPos = m_pParent->getPosition();

    // Compute the resize factors
    float factorX, factorY;
    m_pParent->getResizeFactors( factorX, factorY );

    // Compute the relative position of the centre of the cursor
    float relX = pEvtMouse->getXPos() - pPos->getLeft() - m_pParent->m_xOffset;
    float relY = pEvtMouse->getYPos() - pPos->getTop() - m_pParent->m_yOffset;
    // Ponderate with the resize factors
    int relXPond = (int)(relX / factorX);
    int relYPond = (int)(relY / factorY);

    // Update the position
    if( m_pParent->m_rCurve.getMinDist( relXPond, relYPond ) < RANGE )
    {
        float percentage = m_pParent->m_rCurve.getNearestPercent( relXPond,
                                                              relYPond );
        m_pParent->m_rVariable.set( percentage );
    }
    else
    {
        m_pParent->m_rVariable.set( m_pParent->m_lastPercentage );
    }
}
Ejemplo n.º 2
0
void CtrlRadialSlider::CmdMove::execute()
{
    EvtMouse *pEvtMouse = (EvtMouse*)m_pParent->m_pEvt;

    // Change the position of the cursor, in blocking mode
    m_pParent->setCursor( pEvtMouse->getXPos(), pEvtMouse->getYPos(), true );
}
Ejemplo n.º 3
0
void CtrlSliderCursor::transMove( SkinObject *pCtrl )
{
    CtrlSliderCursor *pThis = (CtrlSliderCursor*)pCtrl;
    EvtMouse *pEvtMouse = (EvtMouse*)pThis->m_pEvt;

    // Get the position of the control
    const Position *pPos = pThis->getPosition();

    // Compute the resize factors
    float factorX, factorY;
    pThis->getResizeFactors( factorX, factorY );

    // Compute the relative position of the centre of the cursor
    float relX = pEvtMouse->getXPos() - pPos->getLeft() - pThis->m_xOffset;
    float relY = pEvtMouse->getYPos() - pPos->getTop() - pThis->m_yOffset;
    // Ponderate with the resize factors
    int relXPond = (int)(relX / factorX);
    int relYPond = (int)(relY / factorY);

    // Update the position
    if( pThis->m_rCurve.getMinDist( relXPond, relYPond ) < RANGE )
    {
        float percentage = pThis->m_rCurve.getNearestPercent( relXPond,
                           relYPond );
        pThis->m_rVariable.set( percentage );
    }
    else
    {
        pThis->m_rVariable.set( pThis->m_lastPercentage );
    }
}
Ejemplo n.º 4
0
void CtrlRadialSlider::CmdUpDown::execute()
{
    EvtMouse *pEvtMouse = (EvtMouse*)m_pParent->m_pEvt;

    // Change the position of the cursor, in non-blocking mode
    m_pParent->setCursor( pEvtMouse->getXPos(), pEvtMouse->getYPos(), false );

    m_pParent->captureMouse();
}
Ejemplo n.º 5
0
void CtrlMove::CmdStillMoving::execute()
{
    EvtMouse *pEvtMouse = (EvtMouse*)m_pParent->m_pEvt;

    m_pParent->m_xPos = pEvtMouse->getXPos();
    m_pParent->m_yPos = pEvtMouse->getYPos();

    m_pParent->captureMouse();

    m_pParent->m_rWindowManager.startMove( m_pParent->m_rWindow );
}
Ejemplo n.º 6
0
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 );
    }
}
Ejemplo n.º 7
0
void CtrlResize::CmdStillResize::execute()
{
    EvtMouse *pEvtMouse = static_cast<EvtMouse*>(m_pParent->m_pEvt);

    // Set the cursor
    m_pParent->changeCursor( m_pParent->m_direction );

    m_pParent->m_xPos = pEvtMouse->getXPos();
    m_pParent->m_yPos = pEvtMouse->getYPos();

    m_pParent->captureMouse();

    m_pParent->m_width = m_pParent->m_rLayout.getWidth();
    m_pParent->m_height = m_pParent->m_rLayout.getHeight();

    m_pParent->m_rWindowManager.startResize( m_pParent->m_rLayout,
                                             m_pParent->m_direction);
}
Ejemplo n.º 8
0
void CtrlSliderCursor::CmdOverDown::execute()
{
    EvtMouse *pEvtMouse = (EvtMouse*)m_pParent->m_pEvt;

    // Compute the resize factors
    float factorX, factorY;
    m_pParent->getResizeFactors( factorX, factorY );

    // Get the position of the control
    const Position *pPos = m_pParent->getPosition();

    // Compute the offset
    int tempX, tempY;
    m_pParent->m_rCurve.getPoint( m_pParent->m_rVariable.get(), tempX, tempY );
    m_pParent->m_xOffset = pEvtMouse->getXPos() - pPos->getLeft()
                       - (int)(tempX * factorX);
    m_pParent->m_yOffset = pEvtMouse->getYPos() - pPos->getTop()
                       - (int)(tempY * factorY);

    m_pParent->captureMouse();
    m_pParent->m_pImg = m_pParent->m_pImgDown;
    m_pParent->refreshLayout();
}
Ejemplo n.º 9
0
void CtrlSliderCursor::transOverDown( SkinObject *pCtrl )
{
    CtrlSliderCursor *pThis = (CtrlSliderCursor*)pCtrl;
    EvtMouse *pEvtMouse = (EvtMouse*)pThis->m_pEvt;

    // Compute the resize factors
    float factorX, factorY;
    pThis->getResizeFactors( factorX, factorY );

    // Get the position of the control
    const Position *pPos = pThis->getPosition();

    // Compute the offset
    int tempX, tempY;
    pThis->m_rCurve.getPoint( pThis->m_rVariable.get(), tempX, tempY );
    pThis->m_xOffset = pEvtMouse->getXPos() - pPos->getLeft()
                       - (int)(tempX * factorX);
    pThis->m_yOffset = pEvtMouse->getYPos() - pPos->getTop()
                       - (int)(tempY * factorY);

    pThis->captureMouse();
    pThis->m_pImg = pThis->m_pImgDown;
    pThis->notifyLayout();
}