mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-04 03:40:07 +00:00
Added an 'includeChildren' parameter to Component::isMouseOverOrDragging
This commit is contained in:
parent
082b15969f
commit
92bb5e8b74
2 changed files with 7 additions and 3 deletions
|
|
@ -2969,14 +2969,18 @@ bool Component::isMouseButtonDown() const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Component::isMouseOverOrDragging() const
|
||||
bool Component::isMouseOverOrDragging (const bool includeChildren) const
|
||||
{
|
||||
const Array<MouseInputSource>& mouseSources = Desktop::getInstance().getMouseSources();
|
||||
|
||||
for (MouseInputSource* mi = mouseSources.begin(), * const e = mouseSources.end(); mi != e; ++mi)
|
||||
if (mi->getComponentUnderMouse() == this
|
||||
{
|
||||
Component* const c = mi->getComponentUnderMouse();
|
||||
|
||||
if ((c == this || (includeChildren && isParentOf (c)))
|
||||
&& (mi->isMouse() || mi->isDragging()))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1768,7 +1768,7 @@ public:
|
|||
This is a handy equivalent to (isMouseOver() || isMouseButtonDown()).
|
||||
@see isMouseOver, isMouseButtonDown, isMouseButtonDownAnywhere
|
||||
*/
|
||||
bool isMouseOverOrDragging() const;
|
||||
bool isMouseOverOrDragging (bool includeChildren = false) const;
|
||||
|
||||
/** Returns true if a mouse button is currently down.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue