|
|
|
@@ -404,7 +404,8 @@ struct Component::ComponentHelpers |
|
|
|
return convertFromDistantParentSpace (topLevelComp, *target, p);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool clipObscuredRegions (const Component& comp, Graphics& g, const Rectangle<int> clipRect, Point<int> delta)
|
|
|
|
static bool clipObscuredRegions (const Component& comp, Graphics& g,
|
|
|
|
const Rectangle<int> clipRect, Point<int> delta)
|
|
|
|
{
|
|
|
|
bool wasClipped = false;
|
|
|
|
|
|
|
|
@@ -747,7 +748,7 @@ void Component::minimisationStateChanged (bool) {} |
|
|
|
float Component::getDesktopScaleFactor() const { return Desktop::getInstance().getGlobalScaleFactor(); }
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
void Component::setOpaque (const bool shouldBeOpaque)
|
|
|
|
void Component::setOpaque (bool shouldBeOpaque)
|
|
|
|
{
|
|
|
|
if (shouldBeOpaque != flags.opaqueFlag)
|
|
|
|
{
|
|
|
|
@@ -838,7 +839,7 @@ void Component::setCachedComponentImage (CachedComponentImage* newCachedImage) |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::setBufferedToImage (const bool shouldBeBuffered)
|
|
|
|
void Component::setBufferedToImage (bool shouldBeBuffered)
|
|
|
|
{
|
|
|
|
// This assertion means that this component is already using a custom CachedComponentImage,
|
|
|
|
// so by calling setBufferedToImage, you'll be deleting the custom one - this is almost certainly
|
|
|
|
@@ -858,7 +859,7 @@ void Component::setBufferedToImage (const bool shouldBeBuffered) |
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
void Component::reorderChildInternal (const int sourceIndex, const int destIndex)
|
|
|
|
void Component::reorderChildInternal (int sourceIndex, int destIndex)
|
|
|
|
{
|
|
|
|
if (sourceIndex != destIndex)
|
|
|
|
{
|
|
|
|
@@ -873,7 +874,7 @@ void Component::reorderChildInternal (const int sourceIndex, const int destIndex |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::toFront (const bool setAsForeground)
|
|
|
|
void Component::toFront (bool setAsForeground)
|
|
|
|
{
|
|
|
|
// if component methods are being called from threads other than the message
|
|
|
|
// thread, you'll need to use a MessageManagerLock object to make sure it's thread-safe.
|
|
|
|
@@ -923,7 +924,7 @@ void Component::toFront (const bool setAsForeground) |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::toBehind (Component* const other)
|
|
|
|
void Component::toBehind (Component* other)
|
|
|
|
{
|
|
|
|
if (other != nullptr && other != this)
|
|
|
|
{
|
|
|
|
@@ -993,7 +994,7 @@ void Component::toBack() |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::setAlwaysOnTop (const bool shouldStayOnTop)
|
|
|
|
void Component::setAlwaysOnTop (bool shouldStayOnTop)
|
|
|
|
{
|
|
|
|
if (shouldStayOnTop != flags.alwaysOnTopFlag)
|
|
|
|
{
|
|
|
|
@@ -1030,8 +1031,8 @@ bool Component::isAlwaysOnTop() const noexcept |
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
int Component::proportionOfWidth (const float proportion) const noexcept { return roundToInt (proportion * boundsRelativeToParent.getWidth()); }
|
|
|
|
int Component::proportionOfHeight (const float proportion) const noexcept { return roundToInt (proportion * boundsRelativeToParent.getHeight()); }
|
|
|
|
int Component::proportionOfWidth (float proportion) const noexcept { return roundToInt (proportion * boundsRelativeToParent.getWidth()); }
|
|
|
|
int Component::proportionOfHeight (float proportion) const noexcept { return roundToInt (proportion * boundsRelativeToParent.getHeight()); }
|
|
|
|
|
|
|
|
int Component::getParentWidth() const noexcept
|
|
|
|
{
|
|
|
|
@@ -1086,26 +1087,8 @@ Rectangle<int> Component::localAreaToGlobal (Rectangle<int> area) const |
|
|
|
return ComponentHelpers::convertCoordinate (nullptr, this, area);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Deprecated methods...
|
|
|
|
Point<int> Component::relativePositionToGlobal (Point<int> relativePosition) const
|
|
|
|
{
|
|
|
|
return localPointToGlobal (relativePosition);
|
|
|
|
}
|
|
|
|
|
|
|
|
Point<int> Component::globalPositionToRelative (Point<int> screenPosition) const
|
|
|
|
{
|
|
|
|
return getLocalPoint (nullptr, screenPosition);
|
|
|
|
}
|
|
|
|
|
|
|
|
Point<int> Component::relativePositionToOtherComponent (const Component* const targetComponent, Point<int> positionRelativeToThis) const
|
|
|
|
{
|
|
|
|
return targetComponent == nullptr ? localPointToGlobal (positionRelativeToThis)
|
|
|
|
: targetComponent->getLocalPoint (this, positionRelativeToThis);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
void Component::setBounds (const int x, const int y, int w, int h)
|
|
|
|
void Component::setBounds (int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
// if component methods are being called from threads other than the message
|
|
|
|
// thread, you'll need to use a MessageManagerLock object to make sure it's thread-safe.
|
|
|
|
@@ -1125,6 +1108,7 @@ void Component::setBounds (const int x, const int y, int w, int h) |
|
|
|
if (wasMoved || wasResized)
|
|
|
|
{
|
|
|
|
const bool showing = isShowing();
|
|
|
|
|
|
|
|
if (showing)
|
|
|
|
{
|
|
|
|
// send a fake mouse move to trigger enter/exit messages if needed..
|
|
|
|
@@ -1173,7 +1157,7 @@ void Component::sendMovedResizedMessagesIfPending() |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::sendMovedResizedMessages (const bool wasMoved, const bool wasResized)
|
|
|
|
void Component::sendMovedResizedMessages (bool wasMoved, bool wasResized)
|
|
|
|
{
|
|
|
|
BailOutChecker checker (this);
|
|
|
|
|
|
|
|
@@ -1225,7 +1209,7 @@ void Component::setTopLeftPosition (Point<int> pos) |
|
|
|
setBounds (pos.x, pos.y, getWidth(), getHeight());
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::setTopRightPosition (const int x, const int y)
|
|
|
|
void Component::setTopRightPosition (int x, int y)
|
|
|
|
{
|
|
|
|
setTopLeftPosition (x - getWidth(), y);
|
|
|
|
}
|
|
|
|
@@ -1235,18 +1219,7 @@ void Component::setBounds (Rectangle<int> r) |
|
|
|
setBounds (r.getX(), r.getY(), r.getWidth(), r.getHeight());
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::setBounds (const RelativeRectangle& newBounds)
|
|
|
|
{
|
|
|
|
newBounds.applyToComponent (*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::setBounds (const String& newBoundsExpression)
|
|
|
|
{
|
|
|
|
RelativeRectangle (newBoundsExpression).applyToComponent (*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::setBoundsRelative (const float x, const float y,
|
|
|
|
const float w, const float h)
|
|
|
|
void Component::setBoundsRelative (float x, float y, float w, float h)
|
|
|
|
{
|
|
|
|
auto pw = getParentWidth();
|
|
|
|
auto ph = getParentHeight();
|
|
|
|
@@ -1266,7 +1239,7 @@ void Component::setCentreRelative (float x, float y) |
|
|
|
roundToInt (getParentHeight() * y));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::centreWithSize (const int width, const int height)
|
|
|
|
void Component::centreWithSize (int width, int height)
|
|
|
|
{
|
|
|
|
auto parentArea = ComponentHelpers::getParentOrMainMonitorBounds (*this)
|
|
|
|
.transformedBy (getTransform().inverted());
|
|
|
|
@@ -1282,8 +1255,7 @@ void Component::setBoundsInset (BorderSize<int> borders) |
|
|
|
}
|
|
|
|
|
|
|
|
void Component::setBoundsToFit (int x, int y, int width, int height,
|
|
|
|
Justification justification,
|
|
|
|
const bool onlyReduceInSize)
|
|
|
|
Justification justification, bool onlyReduceInSize)
|
|
|
|
{
|
|
|
|
// it's no good calling this method unless both the component and
|
|
|
|
// target rectangle have a finite size.
|
|
|
|
@@ -1387,8 +1359,8 @@ bool Component::hitTest (int x, int y) |
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::setInterceptsMouseClicks (const bool allowClicks,
|
|
|
|
const bool allowClicksOnChildComponents) noexcept
|
|
|
|
void Component::setInterceptsMouseClicks (bool allowClicks,
|
|
|
|
bool allowClicksOnChildComponents) noexcept
|
|
|
|
{
|
|
|
|
flags.ignoresMouseClicksFlag = ! allowClicks;
|
|
|
|
flags.allowChildMouseClicksFlag = allowClicksOnChildComponents;
|
|
|
|
@@ -1416,7 +1388,7 @@ bool Component::contains (Point<int> point) |
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Component::reallyContains (Point<int> point, const bool returnTrueIfWithinAChild)
|
|
|
|
bool Component::reallyContains (Point<int> point, bool returnTrueIfWithinAChild)
|
|
|
|
{
|
|
|
|
if (! contains (point))
|
|
|
|
return false;
|
|
|
|
@@ -1498,19 +1470,19 @@ void Component::addAndMakeVisible (Component& child, int zOrder) |
|
|
|
addChildComponent (child, zOrder);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::addChildComponent (Component* const child, int zOrder)
|
|
|
|
void Component::addChildComponent (Component* child, int zOrder)
|
|
|
|
{
|
|
|
|
if (child != nullptr)
|
|
|
|
addChildComponent (*child, zOrder);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::addAndMakeVisible (Component* const child, int zOrder)
|
|
|
|
void Component::addAndMakeVisible (Component* child, int zOrder)
|
|
|
|
{
|
|
|
|
if (child != nullptr)
|
|
|
|
addAndMakeVisible (*child, zOrder);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::addChildAndSetID (Component* const child, const String& childID)
|
|
|
|
void Component::addChildAndSetID (Component* child, const String& childID)
|
|
|
|
{
|
|
|
|
if (child != nullptr)
|
|
|
|
{
|
|
|
|
@@ -1519,17 +1491,17 @@ void Component::addChildAndSetID (Component* const child, const String& childID) |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::removeChildComponent (Component* const child)
|
|
|
|
void Component::removeChildComponent (Component* child)
|
|
|
|
{
|
|
|
|
removeChildComponent (childComponentList.indexOf (child), true, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
Component* Component::removeChildComponent (const int index)
|
|
|
|
Component* Component::removeChildComponent (int index)
|
|
|
|
{
|
|
|
|
return removeChildComponent (index, true, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
Component* Component::removeChildComponent (const int index, bool sendParentEvents, const bool sendChildEvents)
|
|
|
|
Component* Component::removeChildComponent (int index, bool sendParentEvents, bool sendChildEvents)
|
|
|
|
{
|
|
|
|
// if component methods are being called from threads other than the message
|
|
|
|
// thread, you'll need to use a MessageManagerLock object to make sure it's thread-safe.
|
|
|
|
@@ -1602,12 +1574,12 @@ int Component::getNumChildComponents() const noexcept |
|
|
|
return childComponentList.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
Component* Component::getChildComponent (const int index) const noexcept
|
|
|
|
Component* Component::getChildComponent (int index) const noexcept
|
|
|
|
{
|
|
|
|
return childComponentList[index];
|
|
|
|
}
|
|
|
|
|
|
|
|
int Component::getIndexOfChildComponent (const Component* const child) const noexcept
|
|
|
|
int Component::getIndexOfChildComponent (const Component* child) const noexcept
|
|
|
|
{
|
|
|
|
return childComponentList.indexOf (const_cast<Component*> (child));
|
|
|
|
}
|
|
|
|
@@ -1714,9 +1686,9 @@ int Component::runModalLoop() |
|
|
|
#endif
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
void Component::enterModalState (const bool shouldTakeKeyboardFocus,
|
|
|
|
void Component::enterModalState (bool shouldTakeKeyboardFocus,
|
|
|
|
ModalComponentManager::Callback* callback,
|
|
|
|
const bool deleteWhenDismissed)
|
|
|
|
bool deleteWhenDismissed)
|
|
|
|
{
|
|
|
|
// if component methods are being called from threads other than the message
|
|
|
|
// thread, you'll need to use a MessageManagerLock object to make sure it's thread-safe.
|
|
|
|
@@ -1740,7 +1712,7 @@ void Component::enterModalState (const bool shouldTakeKeyboardFocus, |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::exitModalState (const int returnValue)
|
|
|
|
void Component::exitModalState (int returnValue)
|
|
|
|
{
|
|
|
|
if (isCurrentlyModal (false))
|
|
|
|
{
|
|
|
|
@@ -1798,7 +1770,7 @@ Component* JUCE_CALLTYPE Component::getCurrentlyModalComponent (int index) noexc |
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
void Component::setBroughtToFrontOnMouseClick (const bool shouldBeBroughtToFront) noexcept
|
|
|
|
void Component::setBroughtToFrontOnMouseClick (bool shouldBeBroughtToFront) noexcept
|
|
|
|
{
|
|
|
|
flags.bringToFrontOnClickFlag = shouldBeBroughtToFront;
|
|
|
|
}
|
|
|
|
@@ -1831,7 +1803,7 @@ void Component::updateMouseCursor() const |
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
void Component::setRepaintsOnMouseActivity (const bool shouldRepaint) noexcept
|
|
|
|
void Component::setRepaintsOnMouseActivity (bool shouldRepaint) noexcept
|
|
|
|
{
|
|
|
|
flags.repaintOnMouseActivityFlag = shouldRepaint;
|
|
|
|
}
|
|
|
|
@@ -2024,7 +1996,7 @@ void Component::paintComponentAndChildren (Graphics& g) |
|
|
|
g.restoreState();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::paintEntireComponent (Graphics& g, const bool ignoreAlphaLevel)
|
|
|
|
void Component::paintEntireComponent (Graphics& g, bool ignoreAlphaLevel)
|
|
|
|
{
|
|
|
|
// If sizing a top-level-window and the OS paint message is delivered synchronously
|
|
|
|
// before resized() is called, then we'll invoke the callback here, to make sure
|
|
|
|
@@ -2077,7 +2049,7 @@ void Component::paintEntireComponent (Graphics& g, const bool ignoreAlphaLevel) |
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::setPaintingIsUnclipped (const bool shouldPaintWithoutClipping) noexcept
|
|
|
|
void Component::setPaintingIsUnclipped (bool shouldPaintWithoutClipping) noexcept
|
|
|
|
{
|
|
|
|
flags.dontClipGraphicsFlag = shouldPaintWithoutClipping;
|
|
|
|
}
|
|
|
|
@@ -2099,8 +2071,8 @@ Image Component::createComponentSnapshot (Rectangle<int> areaToGrab, |
|
|
|
if (r.isEmpty())
|
|
|
|
return Image();
|
|
|
|
|
|
|
|
const int w = roundToInt (scaleFactor * r.getWidth());
|
|
|
|
const int h = roundToInt (scaleFactor * r.getHeight());
|
|
|
|
auto w = roundToInt (scaleFactor * r.getWidth());
|
|
|
|
auto h = roundToInt (scaleFactor * r.getHeight());
|
|
|
|
|
|
|
|
Image image (flags.opaqueFlag ? Image::RGB : Image::ARGB, w, h, true);
|
|
|
|
|
|
|
|
@@ -2116,7 +2088,7 @@ Image Component::createComponentSnapshot (Rectangle<int> areaToGrab, |
|
|
|
return image;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::setComponentEffect (ImageEffectFilter* const newEffect)
|
|
|
|
void Component::setComponentEffect (ImageEffectFilter* newEffect)
|
|
|
|
{
|
|
|
|
if (effect != newEffect)
|
|
|
|
{
|
|
|
|
@@ -2135,7 +2107,7 @@ LookAndFeel& Component::getLookAndFeel() const noexcept |
|
|
|
return LookAndFeel::getDefaultLookAndFeel();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::setLookAndFeel (LookAndFeel* const newLookAndFeel)
|
|
|
|
void Component::setLookAndFeel (LookAndFeel* newLookAndFeel)
|
|
|
|
{
|
|
|
|
if (lookAndFeel != newLookAndFeel)
|
|
|
|
{
|
|
|
|
@@ -2172,7 +2144,7 @@ void Component::sendLookAndFeelChange() |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Colour Component::findColour (const int colourId, const bool inheritFromParent) const
|
|
|
|
Colour Component::findColour (int colourId, bool inheritFromParent) const
|
|
|
|
{
|
|
|
|
if (auto* v = properties.getVarPointer (ComponentHelpers::getColourPropertyId (colourId)))
|
|
|
|
return Colour ((uint32) static_cast<int> (*v));
|
|
|
|
@@ -2184,18 +2156,18 @@ Colour Component::findColour (const int colourId, const bool inheritFromParent) |
|
|
|
return getLookAndFeel().findColour (colourId);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Component::isColourSpecified (const int colourId) const
|
|
|
|
bool Component::isColourSpecified (int colourId) const
|
|
|
|
{
|
|
|
|
return properties.contains (ComponentHelpers::getColourPropertyId (colourId));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::removeColour (const int colourId)
|
|
|
|
void Component::removeColour (int colourId)
|
|
|
|
{
|
|
|
|
if (properties.remove (ComponentHelpers::getColourPropertyId (colourId)))
|
|
|
|
colourChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::setColour (const int colourId, Colour colour)
|
|
|
|
void Component::setColour (int colourId, Colour colour)
|
|
|
|
{
|
|
|
|
if (properties.set (ComponentHelpers::getColourPropertyId (colourId), (int) colour.getARGB()))
|
|
|
|
colourChanged();
|
|
|
|
@@ -2283,7 +2255,7 @@ void Component::moved() {} |
|
|
|
void Component::childBoundsChanged (Component*) {}
|
|
|
|
void Component::parentSizeChanged() {}
|
|
|
|
|
|
|
|
void Component::addComponentListener (ComponentListener* const newListener)
|
|
|
|
void Component::addComponentListener (ComponentListener* newListener)
|
|
|
|
{
|
|
|
|
// if component methods are being called from threads other than the message
|
|
|
|
// thread, you'll need to use a MessageManagerLock object to make sure it's thread-safe.
|
|
|
|
@@ -2295,7 +2267,7 @@ void Component::addComponentListener (ComponentListener* const newListener) |
|
|
|
componentListeners.add (newListener);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::removeComponentListener (ComponentListener* const listenerToRemove)
|
|
|
|
void Component::removeComponentListener (ComponentListener* listenerToRemove)
|
|
|
|
{
|
|
|
|
componentListeners.remove (listenerToRemove);
|
|
|
|
}
|
|
|
|
@@ -2319,7 +2291,7 @@ void Component::internalModalInputAttempt() |
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
void Component::postCommandMessage (const int commandID)
|
|
|
|
void Component::postCommandMessage (int commandID)
|
|
|
|
{
|
|
|
|
WeakReference<Component> target (this);
|
|
|
|
|
|
|
|
@@ -2336,8 +2308,8 @@ void Component::handleCommandMessage (int) |
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
void Component::addMouseListener (MouseListener* const newListener,
|
|
|
|
const bool wantsEventsForAllNestedChildComponents)
|
|
|
|
void Component::addMouseListener (MouseListener* newListener,
|
|
|
|
bool wantsEventsForAllNestedChildComponents)
|
|
|
|
{
|
|
|
|
// if component methods are being called from threads other than the message
|
|
|
|
// thread, you'll need to use a MessageManagerLock object to make sure it's thread-safe.
|
|
|
|
@@ -2353,7 +2325,7 @@ void Component::addMouseListener (MouseListener* const newListener, |
|
|
|
mouseListeners->addListener (newListener, wantsEventsForAllNestedChildComponents);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::removeMouseListener (MouseListener* const listenerToRemove)
|
|
|
|
void Component::removeMouseListener (MouseListener* listenerToRemove)
|
|
|
|
{
|
|
|
|
// if component methods are being called from threads other than the message
|
|
|
|
// thread, you'll need to use a MessageManagerLock object to make sure it's thread-safe.
|
|
|
|
@@ -2633,7 +2605,7 @@ void Component::sendFakeMouseMove() const |
|
|
|
mainMouse.triggerFakeMove();
|
|
|
|
}
|
|
|
|
|
|
|
|
void JUCE_CALLTYPE Component::beginDragAutoRepeat (const int interval)
|
|
|
|
void JUCE_CALLTYPE Component::beginDragAutoRepeat (int interval)
|
|
|
|
{
|
|
|
|
Desktop::getInstance().beginDragAutoRepeat (interval);
|
|
|
|
}
|
|
|
|
@@ -2673,12 +2645,12 @@ void Component::focusGained (FocusChangeType) {} |
|
|
|
void Component::focusLost (FocusChangeType) {}
|
|
|
|
void Component::focusOfChildComponentChanged (FocusChangeType) {}
|
|
|
|
|
|
|
|
void Component::internalFocusGain (const FocusChangeType cause)
|
|
|
|
void Component::internalFocusGain (FocusChangeType cause)
|
|
|
|
{
|
|
|
|
internalFocusGain (cause, WeakReference<Component> (this));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::internalFocusGain (const FocusChangeType cause, const WeakReference<Component>& safePointer)
|
|
|
|
void Component::internalFocusGain (FocusChangeType cause, const WeakReference<Component>& safePointer)
|
|
|
|
{
|
|
|
|
focusGained (cause);
|
|
|
|
|
|
|
|
@@ -2686,7 +2658,7 @@ void Component::internalFocusGain (const FocusChangeType cause, const WeakRefere |
|
|
|
internalChildFocusChange (cause, safePointer);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::internalFocusLoss (const FocusChangeType cause)
|
|
|
|
void Component::internalFocusLoss (FocusChangeType cause)
|
|
|
|
{
|
|
|
|
const WeakReference<Component> safePointer (this);
|
|
|
|
|
|
|
|
@@ -2714,12 +2686,12 @@ void Component::internalChildFocusChange (FocusChangeType cause, const WeakRefer |
|
|
|
parentComponent->internalChildFocusChange (cause, WeakReference<Component> (parentComponent));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::setWantsKeyboardFocus (const bool wantsFocus) noexcept
|
|
|
|
void Component::setWantsKeyboardFocus (bool wantsFocus) noexcept
|
|
|
|
{
|
|
|
|
flags.wantsFocusFlag = wantsFocus;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::setMouseClickGrabsKeyboardFocus (const bool shouldGrabFocus)
|
|
|
|
void Component::setMouseClickGrabsKeyboardFocus (bool shouldGrabFocus)
|
|
|
|
{
|
|
|
|
flags.dontFocusOnMouseClickFlag = ! shouldGrabFocus;
|
|
|
|
}
|
|
|
|
@@ -2734,7 +2706,7 @@ bool Component::getWantsKeyboardFocus() const noexcept |
|
|
|
return flags.wantsFocusFlag && ! flags.isDisabledFlag;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::setFocusContainer (const bool shouldBeFocusContainer) noexcept
|
|
|
|
void Component::setFocusContainer (bool shouldBeFocusContainer) noexcept
|
|
|
|
{
|
|
|
|
flags.isFocusContainerFlag = shouldBeFocusContainer;
|
|
|
|
}
|
|
|
|
@@ -2751,7 +2723,7 @@ int Component::getExplicitFocusOrder() const |
|
|
|
return properties [juce_explicitFocusOrderId];
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::setExplicitFocusOrder (const int newFocusOrderIndex)
|
|
|
|
void Component::setExplicitFocusOrder (int newFocusOrderIndex)
|
|
|
|
{
|
|
|
|
properties.set (juce_explicitFocusOrderId, newFocusOrderIndex);
|
|
|
|
}
|
|
|
|
@@ -2764,7 +2736,7 @@ KeyboardFocusTraverser* Component::createFocusTraverser() |
|
|
|
return parentComponent->createFocusTraverser();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::takeKeyboardFocus (const FocusChangeType cause)
|
|
|
|
void Component::takeKeyboardFocus (FocusChangeType cause)
|
|
|
|
{
|
|
|
|
// give the focus to this component
|
|
|
|
if (currentlyFocusedComponent != this)
|
|
|
|
@@ -2794,7 +2766,7 @@ void Component::takeKeyboardFocus (const FocusChangeType cause) |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::grabFocusInternal (const FocusChangeType cause, const bool canTryParent)
|
|
|
|
void Component::grabFocusInternal (FocusChangeType cause, bool canTryParent)
|
|
|
|
{
|
|
|
|
if (isShowing())
|
|
|
|
{
|
|
|
|
@@ -2852,7 +2824,7 @@ void Component::grabKeyboardFocus() |
|
|
|
jassert (isShowing() || isOnDesktop());
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::moveKeyboardFocusToSibling (const bool moveToNext)
|
|
|
|
void Component::moveKeyboardFocusToSibling (bool moveToNext)
|
|
|
|
{
|
|
|
|
// if component methods are being called from threads other than the message
|
|
|
|
// thread, you'll need to use a MessageManagerLock object to make sure it's thread-safe.
|
|
|
|
@@ -2886,7 +2858,7 @@ void Component::moveKeyboardFocusToSibling (const bool moveToNext) |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Component::hasKeyboardFocus (const bool trueIfChildIsFocused) const
|
|
|
|
bool Component::hasKeyboardFocus (bool trueIfChildIsFocused) const
|
|
|
|
{
|
|
|
|
return (currentlyFocusedComponent == this)
|
|
|
|
|| (trueIfChildIsFocused && isParentOf (currentlyFocusedComponent));
|
|
|
|
@@ -2921,7 +2893,7 @@ bool Component::isEnabled() const noexcept |
|
|
|
&& (parentComponent == nullptr || parentComponent->isEnabled());
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::setEnabled (const bool shouldBeEnabled)
|
|
|
|
void Component::setEnabled (bool shouldBeEnabled)
|
|
|
|
{
|
|
|
|
if (flags.isDisabledFlag == shouldBeEnabled)
|
|
|
|
{
|
|
|
|
@@ -2961,7 +2933,7 @@ void Component::sendEnablementChangeMessage() |
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
bool Component::isMouseOver (const bool includeChildren) const
|
|
|
|
bool Component::isMouseOver (bool includeChildren) const
|
|
|
|
{
|
|
|
|
for (auto& ms : Desktop::getInstance().getMouseSources())
|
|
|
|
{
|
|
|
|
@@ -2985,7 +2957,7 @@ bool Component::isMouseButtonDown() const |
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Component::isMouseOverOrDragging (const bool includeChildren) const
|
|
|
|
bool Component::isMouseOverOrDragging (bool includeChildren) const
|
|
|
|
{
|
|
|
|
for (auto& ms : Desktop::getInstance().getMouseSources())
|
|
|
|
{
|
|
|
|
@@ -3010,7 +2982,7 @@ Point<int> Component::getMouseXYRelative() const |
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
void Component::addKeyListener (KeyListener* const newListener)
|
|
|
|
void Component::addKeyListener (KeyListener* newListener)
|
|
|
|
{
|
|
|
|
if (keyListeners == nullptr)
|
|
|
|
keyListeners = new Array<KeyListener*>();
|
|
|
|
@@ -3018,7 +2990,7 @@ void Component::addKeyListener (KeyListener* const newListener) |
|
|
|
keyListeners->addIfNotAlreadyThere (newListener);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::removeKeyListener (KeyListener* const listenerToRemove)
|
|
|
|
void Component::removeKeyListener (KeyListener* listenerToRemove)
|
|
|
|
{
|
|
|
|
if (keyListeners != nullptr)
|
|
|
|
keyListeners->removeFirstMatchingValue (listenerToRemove);
|
|
|
|
@@ -3040,7 +3012,7 @@ void Component::internalModifierKeysChanged() |
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
Component::BailOutChecker::BailOutChecker (Component* const component)
|
|
|
|
Component::BailOutChecker::BailOutChecker (Component* component)
|
|
|
|
: safePointer (component)
|
|
|
|
{
|
|
|
|
jassert (component != nullptr);
|
|
|
|
|