Exemple #1
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool
ScrollBarSlider::moved(MouseMessage& message)
{
    if(_oldMousePos.x() >= 0.0f)
    {
        if(state() == Button::down)
        {
            int value = _scrollBar.value();
            switch(_scrollBar.justification())
            {
            case ScrollBar::horizontal:
                {
                    const float delta = message.x() - _oldMousePos.x();
                    if(delta != 0) moveHorizontally(delta);
                }
                break;
            case ScrollBar::vertical:
                {
                    const float delta = message.y() - _oldMousePos.y();
                    if(delta != 0) moveVertically(delta);
                }
                break;
            }
            if(value != _scrollBar.value()) _scrollBar.sliderMoved(_scrollBar.value());
        }
    }
    _oldMousePos.setX(message.x());
    _oldMousePos.setY(message.y());
    return true;
}
Exemple #2
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool
FrameWindowMouseListener::moved(MouseMessage& message)
{
    bool isHandled = false;
    if(frameWindow_.isMovable())
    {
        if(WindowManager::instance().captureWindow() == &frameWindow_)
        {
            Core::Vector2 delta(message.x() - _oldMousePos.x(), message.y() - _oldMousePos.y());
            frameWindow_.setPosition(frameWindow_.position() + delta);
        }
        _oldMousePos.setX(message.x());
        _oldMousePos.setY(message.y());
        isHandled = true;
    }

    return isHandled;
}