当前位置: 首页>>代码示例>>C++>>正文


C++ ModifierKeys::isAnyMouseButtonDown方法代码示例

本文整理汇总了C++中ModifierKeys::isAnyMouseButtonDown方法的典型用法代码示例。如果您正苦于以下问题:C++ ModifierKeys::isAnyMouseButtonDown方法的具体用法?C++ ModifierKeys::isAnyMouseButtonDown怎么用?C++ ModifierKeys::isAnyMouseButtonDown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ModifierKeys的用法示例。


在下文中一共展示了ModifierKeys::isAnyMouseButtonDown方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setButtons

    //==============================================================================
    // (returns true if the button change caused a modal event loop)
    bool setButtons (const Point<int>& screenPos, const Time& time, const ModifierKeys& newButtonState)
    {
        if (buttonState == newButtonState)
            return false;

        // (avoid sending a spurious mouse-drag when we receive a mouse-up)
        if (! (isDragging() && ! newButtonState.isAnyMouseButtonDown()))
            setScreenPos (screenPos, time, false);

        // (ignore secondary clicks when there's already a button down)
        if (buttonState.isAnyMouseButtonDown() == newButtonState.isAnyMouseButtonDown())
        {
            buttonState = newButtonState;
            return false;
        }

        const int lastCounter = mouseEventCounter;

        if (buttonState.isAnyMouseButtonDown())
        {
            Component* const current = getComponentUnderMouse();

            if (current != nullptr)
            {
                const ModifierKeys oldMods (getCurrentModifiers());
                buttonState = newButtonState; // must change this before calling sendMouseUp, in case it runs a modal loop

                sendMouseUp (current, screenPos + unboundedMouseOffset, time, oldMods);
            }

            enableUnboundedMouseMovement (false, false);
        }

        buttonState = newButtonState;

        if (buttonState.isAnyMouseButtonDown())
        {
            Desktop::getInstance().incrementMouseClickCounter();

            Component* const current = getComponentUnderMouse();

            if (current != nullptr)
            {
                registerMouseDown (screenPos, time, current, buttonState);
                sendMouseDown (current, screenPos, time);
            }
        }

        return lastCounter != mouseEventCounter;
    }
开发者ID:zabrus,项目名称:JUCE,代码行数:52,代码来源:juce_MouseInputSource.cpp

示例2: handleEvent

    //==============================================================================
    void handleEvent (ComponentPeer& newPeer, Point<float> positionWithinPeer, Time time,
                      const ModifierKeys newMods, float newPressure)
    {
        lastTime = time;
        const bool pressureChanged = (pressure != newPressure);
        pressure = newPressure;
        ++mouseEventCounter;
        const Point<float> screenPos (newPeer.localToGlobal (positionWithinPeer));

        if (isDragging() && newMods.isAnyMouseButtonDown())
        {
            setScreenPos (screenPos, time, pressureChanged);
        }
        else
        {
            setPeer (newPeer, screenPos, time);

            if (ComponentPeer* peer = getPeer())
            {
                if (setButtons (screenPos, time, newMods))
                    return; // some modal events have been dispatched, so the current event is now out-of-date

                peer = getPeer();

                if (peer != nullptr)
                    setScreenPos (screenPos, time, pressureChanged);
            }
        }
    }
开发者ID:EthanZuo,项目名称:JUCE,代码行数:30,代码来源:juce_MouseInputSource.cpp

示例3: handleEvent

    //==============================================================================
    void handleEvent (ComponentPeer* const newPeer, Point<int> positionWithinPeer, Time time, const ModifierKeys newMods)
    {
        jassert (newPeer != nullptr);
        lastTime = time;
        ++mouseEventCounter;
        const Point<int> screenPos (newPeer->localToGlobal (positionWithinPeer));

        if (isDragging() && newMods.isAnyMouseButtonDown())
        {
            setScreenPos (screenPos, time, false);
        }
        else
        {
            setPeer (newPeer, screenPos, time);

            if (ComponentPeer* peer = getPeer())
            {
                if (setButtons (screenPos, time, newMods))
                    return; // some modal events have been dispatched, so the current event is now out-of-date

                peer = getPeer();
                if (peer != nullptr)
                    setScreenPos (screenPos, time, false);
            }
        }
    }
开发者ID:AGenews,项目名称:GUI,代码行数:27,代码来源:juce_MouseInputSource.cpp


注:本文中的ModifierKeys::isAnyMouseButtonDown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。