Ejemplo n.º 1
0
MouseResult Pane::Button(
    IInputProvider* pprovider,
    const Point& point,
    int button,
    bool bCaptured,
    bool bInside,
    bool bDown
) {
    MouseResult mouseResult;
    TRef<Pane> pthis = this;

    if (m_ppaneCapture) {
        mouseResult =
            m_ppaneCapture->Button(
                pprovider,
                point - Point::Cast(m_ppaneCapture->m_offset),
                button,
                true,
                m_ppaneHit != NULL,
                bDown
            );

        if (mouseResult.Test(MouseResultRelease())) {
            m_ppaneCapture = NULL;
        }
    } else if (m_ppaneHit) {
        mouseResult = 
            m_ppaneHit->Button(
                pprovider,
                point - Point::Cast(m_ppaneHit->m_offset),
                button,
                false,
                true,
                bDown
            );

        if (mouseResult.Test(MouseResultCapture())) {
            m_ppaneCapture = m_ppaneHit;
        }
    }

    return mouseResult;
}
Ejemplo n.º 2
0
    MouseResult Button(IInputProvider* pprovider, const Point& point, int button, bool bCaptured, bool bInside, bool bDown)
    {
        if (bDown)
        {
            if (0 == button)
            {
				if (m_bCanDrag)
                {
                    // start a drag
                    m_bDragging = true;
                    m_pointLastDrag = point;
                    GetWindow()->SetCursor(AWF_CURSOR_DRAG);
                    Changed();
                    return MouseResultCapture();
                }
            }
        }
        else
        {
            if (m_bDragging && 0 == button)
            {
                m_bDragging = false;

				if (!bInside)
                {
                    GetWindow()->SetCursor(AWF_CURSOR_DEFAULT);
                }
                else
                {
                    GetWindow()->SetCursor(AWF_CURSOR_DRAG);
                }

                Changed();
                return MouseResultRelease();
            }
        }
    
        Changed();
        return MouseResult();
    }