Ejemplo n.º 1
0
    void Slider::mouseDragged(MouseEvent& mouseEvent)
    {
        if (getOrientation() == HORIZONTAL)
        {
            setValue(markerPositionToValue(mouseEvent.getX() - getMarkerLength() / 2));
        }
        else
        {
            setValue(markerPositionToValue(getHeight() - mouseEvent.getY() - getMarkerLength() / 2));
        }

        distributeActionEvent();

        mouseEvent.consume();
    }
Ejemplo n.º 2
0
    void Slider::mouseMotion(int x, int y)
    {
        if (mMouseDrag)
        {
            if (getOrientation() == HORIZONTAL)
            {
                setValue(markerPositionToValue(x - getMarkerLength() / 2));
            }
            else
            {
                setValue(markerPositionToValue(getHeight() - y - getMarkerLength() / 2));
            }

            generateAction();
            setDirty(true);
        }
    }
Ejemplo n.º 3
0
    void Slider::mousePressed(MouseEvent& mouseEvent)
    {
        if (mouseEvent.getButton() == gcn::MouseEvent::LEFT
            && mouseEvent.getX() >= 0
            && mouseEvent.getX() <= getWidth()
            && mouseEvent.getY() >= 0
            && mouseEvent.getY() <= getHeight())
        {
            if (getOrientation() == HORIZONTAL)
            {
                setValue(markerPositionToValue(mouseEvent.getX() - getMarkerLength() / 2));
            }
            else
            {
                setValue(markerPositionToValue(getHeight() - mouseEvent.getY() - getMarkerLength() / 2));
            }

            distributeActionEvent();
        }
    }
Ejemplo n.º 4
0
    void Slider::mousePress(int x, int y, int button)
    {
        if (button == gcn::MouseInput::LEFT
            && x >= 0 && x <= getWidth()
            && y >= 0 && y <= getHeight())
        {
            if (getOrientation() == HORIZONTAL)
            {
                setValue(markerPositionToValue(x - getMarkerLength() / 2));
            }
            else
            {
                setValue(markerPositionToValue(getHeight() - y - getMarkerLength() / 2));
            }

            mMouseDrag = true;
            generateAction();
        }
        else
        {
            mMouseDrag = false;
        }
    }