本文整理汇总了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;
}
示例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);
}
}
}
示例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);
}
}
}