|
|
|
@@ -89,9 +89,7 @@ public: |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component* p = comp.parentComponent;
|
|
|
|
|
|
|
|
while (p != nullptr)
|
|
|
|
for (Component* p = comp.parentComponent; p != nullptr; p = p->parentComponent)
|
|
|
|
{
|
|
|
|
MouseListenerList* const list = p->mouseListeners;
|
|
|
|
|
|
|
|
@@ -109,8 +107,6 @@ public: |
|
|
|
i = jmin (i, list->numDeepMouseListeners);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
p = p->parentComponent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@@ -134,9 +130,7 @@ public: |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component* p = comp.parentComponent;
|
|
|
|
|
|
|
|
while (p != nullptr)
|
|
|
|
for (Component* p = comp.parentComponent; p != nullptr; p = p->parentComponent)
|
|
|
|
{
|
|
|
|
MouseListenerList* const list = p->mouseListeners;
|
|
|
|
|
|
|
|
@@ -154,8 +148,6 @@ public: |
|
|
|
i = jmin (i, list->numDeepMouseListeners);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
p = p->parentComponent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@@ -336,8 +328,7 @@ struct Component::ComponentHelpers |
|
|
|
}
|
|
|
|
|
|
|
|
static void subtractObscuredRegions (const Component& comp, RectangleList& result,
|
|
|
|
const Point<int>& delta,
|
|
|
|
const Rectangle<int>& clipRect,
|
|
|
|
const Point<int>& delta, const Rectangle<int>& clipRect,
|
|
|
|
const Component* const compToAvoid)
|
|
|
|
{
|
|
|
|
for (int i = comp.childComponentList.size(); --i >= 0;)
|
|
|
|
@@ -372,74 +363,6 @@ struct Component::ComponentHelpers |
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
class StandardCachedComponentImage : public CachedComponentImage
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
StandardCachedComponentImage (Component& owner_) noexcept : owner (owner_) {}
|
|
|
|
|
|
|
|
void paint (Graphics& g)
|
|
|
|
{
|
|
|
|
const Rectangle<int> bounds (owner.getLocalBounds());
|
|
|
|
|
|
|
|
if (image.isNull() || image.getBounds() != bounds)
|
|
|
|
{
|
|
|
|
image = Image (owner.isOpaque() ? Image::RGB : Image::ARGB,
|
|
|
|
jmax (1, bounds.getWidth()), jmax (1, bounds.getHeight()), ! owner.isOpaque());
|
|
|
|
|
|
|
|
validArea.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
Graphics imG (image);
|
|
|
|
LowLevelGraphicsContext* const lg = imG.getInternalContext();
|
|
|
|
|
|
|
|
for (RectangleList::Iterator i (validArea); i.next();)
|
|
|
|
lg->excludeClipRectangle (*i.getRectangle());
|
|
|
|
|
|
|
|
if (! lg->isClipEmpty())
|
|
|
|
{
|
|
|
|
if (! owner.isOpaque())
|
|
|
|
{
|
|
|
|
lg->setFill (Colours::transparentBlack);
|
|
|
|
lg->fillRect (bounds, true);
|
|
|
|
lg->setFill (Colours::black);
|
|
|
|
}
|
|
|
|
|
|
|
|
owner.paintEntireComponent (imG, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
validArea = bounds;
|
|
|
|
|
|
|
|
g.setColour (Colours::black.withAlpha (owner.getAlpha()));
|
|
|
|
g.drawImageAt (image, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void invalidateAll()
|
|
|
|
{
|
|
|
|
validArea.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
void invalidate (const Rectangle<int>& area)
|
|
|
|
{
|
|
|
|
validArea.subtract (area);
|
|
|
|
}
|
|
|
|
|
|
|
|
void releaseResources()
|
|
|
|
{
|
|
|
|
image = Image::null;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Image image;
|
|
|
|
RectangleList validArea;
|
|
|
|
Component& owner;
|
|
|
|
|
|
|
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (StandardCachedComponentImage);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
Component::Component()
|
|
|
|
: parentComponent (nullptr),
|
|
|
|
@@ -564,14 +487,11 @@ void Component::setVisible (bool shouldBeVisible) |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::visibilityChanged()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void Component::visibilityChanged() {}
|
|
|
|
|
|
|
|
void Component::sendVisibilityChangeMessage()
|
|
|
|
{
|
|
|
|
BailOutChecker checker (this);
|
|
|
|
|
|
|
|
visibilityChanged();
|
|
|
|
|
|
|
|
if (! checker.shouldBailOut())
|
|
|
|
@@ -580,21 +500,14 @@ void Component::sendVisibilityChangeMessage() |
|
|
|
|
|
|
|
bool Component::isShowing() const
|
|
|
|
{
|
|
|
|
if (flags.visibleFlag)
|
|
|
|
{
|
|
|
|
if (parentComponent != nullptr)
|
|
|
|
{
|
|
|
|
return parentComponent->isShowing();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const ComponentPeer* const peer = getPeer();
|
|
|
|
if (! flags.visibleFlag)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return peer != nullptr && ! peer->isMinimised();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (parentComponent != nullptr)
|
|
|
|
return parentComponent->isShowing();
|
|
|
|
|
|
|
|
return false;
|
|
|
|
const ComponentPeer* const peer = getPeer();
|
|
|
|
return peer != nullptr && ! peer->isMinimised();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -657,7 +570,6 @@ void Component::addToDesktop (int styleWanted, void* nativeWindowToAttachTo) |
|
|
|
oldNonFullScreenBounds = peer->getNonFullScreenBounds();
|
|
|
|
|
|
|
|
removeFromDesktop();
|
|
|
|
|
|
|
|
setTopLeftPosition (topLeft);
|
|
|
|
}
|
|
|
|
|
|
|
|
@@ -711,10 +623,9 @@ void Component::removeFromDesktop() |
|
|
|
if (flags.hasHeavyweightPeerFlag)
|
|
|
|
{
|
|
|
|
ComponentPeer* const peer = ComponentPeer::getPeerFor (this);
|
|
|
|
jassert (peer != nullptr);
|
|
|
|
|
|
|
|
flags.hasHeavyweightPeerFlag = false;
|
|
|
|
|
|
|
|
jassert (peer != nullptr);
|
|
|
|
delete peer;
|
|
|
|
|
|
|
|
Desktop::getInstance().removeDesktopComponent (this);
|
|
|
|
@@ -726,6 +637,16 @@ bool Component::isOnDesktop() const noexcept |
|
|
|
return flags.hasHeavyweightPeerFlag;
|
|
|
|
}
|
|
|
|
|
|
|
|
ComponentPeer* Component::getPeer() const
|
|
|
|
{
|
|
|
|
if (flags.hasHeavyweightPeerFlag)
|
|
|
|
return ComponentPeer::getPeerFor (this);
|
|
|
|
else if (parentComponent == nullptr)
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
return parentComponent->getPeer();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::userTriedToCloseWindow()
|
|
|
|
{
|
|
|
|
/* This means that the user's trying to get rid of your window with the 'close window' system
|
|
|
|
@@ -738,9 +659,7 @@ void Component::userTriedToCloseWindow() |
|
|
|
jassertfalse;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::minimisationStateChanged (bool)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void Component::minimisationStateChanged (bool) {}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
void Component::setOpaque (const bool shouldBeOpaque)
|
|
|
|
@@ -770,6 +689,61 @@ bool Component::isOpaque() const noexcept |
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
class StandardCachedComponentImage : public CachedComponentImage
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
StandardCachedComponentImage (Component& owner_) noexcept : owner (owner_) {}
|
|
|
|
|
|
|
|
void paint (Graphics& g)
|
|
|
|
{
|
|
|
|
const Rectangle<int> bounds (owner.getLocalBounds());
|
|
|
|
|
|
|
|
if (image.isNull() || image.getBounds() != bounds)
|
|
|
|
{
|
|
|
|
image = Image (owner.isOpaque() ? Image::RGB : Image::ARGB,
|
|
|
|
jmax (1, bounds.getWidth()), jmax (1, bounds.getHeight()), ! owner.isOpaque());
|
|
|
|
|
|
|
|
validArea.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
Graphics imG (image);
|
|
|
|
LowLevelGraphicsContext* const lg = imG.getInternalContext();
|
|
|
|
|
|
|
|
for (RectangleList::Iterator i (validArea); i.next();)
|
|
|
|
lg->excludeClipRectangle (*i.getRectangle());
|
|
|
|
|
|
|
|
if (! lg->isClipEmpty())
|
|
|
|
{
|
|
|
|
if (! owner.isOpaque())
|
|
|
|
{
|
|
|
|
lg->setFill (Colours::transparentBlack);
|
|
|
|
lg->fillRect (bounds, true);
|
|
|
|
lg->setFill (Colours::black);
|
|
|
|
}
|
|
|
|
|
|
|
|
owner.paintEntireComponent (imG, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
validArea = bounds;
|
|
|
|
|
|
|
|
g.setColour (Colours::black.withAlpha (owner.getAlpha()));
|
|
|
|
g.drawImageAt (image, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void invalidateAll() { validArea.clear(); }
|
|
|
|
void invalidate (const Rectangle<int>& area) { validArea.subtract (area); }
|
|
|
|
void releaseResources() { image = Image::null; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
Image image;
|
|
|
|
RectangleList validArea;
|
|
|
|
Component& owner;
|
|
|
|
|
|
|
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (StandardCachedComponentImage);
|
|
|
|
};
|
|
|
|
|
|
|
|
void Component::setCachedComponentImage (CachedComponentImage* newCachedImage)
|
|
|
|
{
|
|
|
|
cachedImage = newCachedImage;
|
|
|
|
@@ -795,7 +769,7 @@ void Component::setBufferedToImage (const bool shouldBeBuffered) |
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
void Component::moveChildInternal (const int sourceIndex, const int destIndex)
|
|
|
|
void Component::reorderChildInternal (const int sourceIndex, const int destIndex)
|
|
|
|
{
|
|
|
|
if (sourceIndex != destIndex)
|
|
|
|
{
|
|
|
|
@@ -848,7 +822,7 @@ void Component::toFront (const bool setAsForeground) |
|
|
|
--insertIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
parentComponent->moveChildInternal (index, insertIndex);
|
|
|
|
parentComponent->reorderChildInternal (index, insertIndex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@@ -881,7 +855,7 @@ void Component::toBehind (Component* const other) |
|
|
|
if (index < otherIndex)
|
|
|
|
--otherIndex;
|
|
|
|
|
|
|
|
parentComponent->moveChildInternal (index, otherIndex);
|
|
|
|
parentComponent->reorderChildInternal (index, otherIndex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -924,7 +898,7 @@ void Component::toBack() |
|
|
|
while (insertIndex < childList.size() && ! childList.getUnchecked (insertIndex)->isAlwaysOnTop())
|
|
|
|
++insertIndex;
|
|
|
|
|
|
|
|
parentComponent->moveChildInternal (index, insertIndex);
|
|
|
|
parentComponent->reorderChildInternal (index, insertIndex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -970,15 +944,8 @@ bool Component::isAlwaysOnTop() const noexcept |
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
int Component::proportionOfWidth (const float proportion) const noexcept
|
|
|
|
{
|
|
|
|
return roundToInt (proportion * bounds.getWidth());
|
|
|
|
}
|
|
|
|
|
|
|
|
int Component::proportionOfHeight (const float proportion) const noexcept
|
|
|
|
{
|
|
|
|
return roundToInt (proportion * bounds.getHeight());
|
|
|
|
}
|
|
|
|
int Component::proportionOfWidth (const float proportion) const noexcept { return roundToInt (proportion * bounds.getWidth()); }
|
|
|
|
int Component::proportionOfHeight (const float proportion) const noexcept { return roundToInt (proportion * bounds.getHeight()); }
|
|
|
|
|
|
|
|
int Component::getParentWidth() const noexcept
|
|
|
|
{
|
|
|
|
@@ -1018,7 +985,7 @@ Rectangle<int> Component::localAreaToGlobal (const Rectangle<int>& area) const |
|
|
|
return ComponentHelpers::convertCoordinate (nullptr, this, area);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Deprecated methods... */
|
|
|
|
// Deprecated methods...
|
|
|
|
Point<int> Component::relativePositionToGlobal (const Point<int>& relativePosition) const
|
|
|
|
{
|
|
|
|
return localPointToGlobal (relativePosition);
|
|
|
|
@@ -1522,7 +1489,6 @@ void Component::deleteAllChildren() |
|
|
|
delete (removeChildComponent (childComponentList.size() - 1));
|
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
int Component::getNumChildComponents() const noexcept
|
|
|
|
{
|
|
|
|
return childComponentList.size();
|
|
|
|
@@ -1574,13 +1540,8 @@ bool Component::isParentOf (const Component* possibleChild) const noexcept |
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
void Component::parentHierarchyChanged()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::childrenChanged()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void Component::parentHierarchyChanged() {}
|
|
|
|
void Component::childrenChanged() {}
|
|
|
|
|
|
|
|
void Component::internalChildrenChanged()
|
|
|
|
{
|
|
|
|
@@ -1861,6 +1822,19 @@ void Component::internalRepaintUnchecked (const Rectangle<int>& area, const bool |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
void Component::paint (Graphics&)
|
|
|
|
{
|
|
|
|
// all painting is done in the subclasses
|
|
|
|
|
|
|
|
jassert (! isOpaque()); // if your component's opaque, you've gotta paint it!
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::paintOverChildren (Graphics&)
|
|
|
|
{
|
|
|
|
// all painting is done in the subclasses
|
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
void Component::paintWithinParentContext (Graphics& g)
|
|
|
|
{
|
|
|
|
@@ -2041,16 +2015,13 @@ void Component::setLookAndFeel (LookAndFeel* const newLookAndFeel) |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::lookAndFeelChanged()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void Component::lookAndFeelChanged() {}
|
|
|
|
void Component::colourChanged() {}
|
|
|
|
|
|
|
|
void Component::sendLookAndFeelChange()
|
|
|
|
{
|
|
|
|
repaint();
|
|
|
|
|
|
|
|
const WeakReference<Component> safePointer (this);
|
|
|
|
|
|
|
|
repaint();
|
|
|
|
lookAndFeelChanged();
|
|
|
|
|
|
|
|
if (safePointer != nullptr)
|
|
|
|
@@ -2115,10 +2086,6 @@ void Component::copyAllExplicitColoursTo (Component& target) const |
|
|
|
target.colourChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::colourChanged()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
MarkerList* Component::getMarkers (bool /*xAxis*/)
|
|
|
|
{
|
|
|
|
@@ -2178,45 +2145,17 @@ void Component::getVisibleArea (RectangleList& result, const bool includeSibling |
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
void Component::mouseEnter (const MouseEvent&)
|
|
|
|
{
|
|
|
|
// base class does nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::mouseExit (const MouseEvent&)
|
|
|
|
{
|
|
|
|
// base class does nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::mouseDown (const MouseEvent&)
|
|
|
|
{
|
|
|
|
// base class does nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::mouseUp (const MouseEvent&)
|
|
|
|
{
|
|
|
|
// base class does nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::mouseDrag (const MouseEvent&)
|
|
|
|
{
|
|
|
|
// base class does nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::mouseMove (const MouseEvent&)
|
|
|
|
{
|
|
|
|
// base class does nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::mouseDoubleClick (const MouseEvent&)
|
|
|
|
{
|
|
|
|
// base class does nothing
|
|
|
|
}
|
|
|
|
void Component::mouseEnter (const MouseEvent&) {}
|
|
|
|
void Component::mouseExit (const MouseEvent&) {}
|
|
|
|
void Component::mouseDown (const MouseEvent&) {}
|
|
|
|
void Component::mouseUp (const MouseEvent&) {}
|
|
|
|
void Component::mouseDrag (const MouseEvent&) {}
|
|
|
|
void Component::mouseMove (const MouseEvent&) {}
|
|
|
|
void Component::mouseDoubleClick (const MouseEvent&) {}
|
|
|
|
|
|
|
|
void Component::mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY)
|
|
|
|
{
|
|
|
|
// the base class just passes this event up to its parent..
|
|
|
|
|
|
|
|
if (parentComponent != nullptr)
|
|
|
|
parentComponent->mouseWheelMove (e.getEventRelativeTo (parentComponent),
|
|
|
|
wheelIncrementX, wheelIncrementY);
|
|
|
|
@@ -2224,25 +2163,10 @@ void Component::mouseWheelMove (const MouseEvent& e, float wheelIncrementX, floa |
|
|
|
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
void Component::resized()
|
|
|
|
{
|
|
|
|
// base class does nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::moved()
|
|
|
|
{
|
|
|
|
// base class does nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::childBoundsChanged (Component*)
|
|
|
|
{
|
|
|
|
// base class does nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::parentSizeChanged()
|
|
|
|
{
|
|
|
|
// base class does nothing
|
|
|
|
}
|
|
|
|
void Component::resized() {}
|
|
|
|
void Component::moved() {}
|
|
|
|
void Component::childBoundsChanged (Component*) {}
|
|
|
|
void Component::parentSizeChanged() {}
|
|
|
|
|
|
|
|
void Component::addComponentListener (ComponentListener* const newListener)
|
|
|
|
{
|
|
|
|
@@ -2278,20 +2202,6 @@ void Component::internalModalInputAttempt() |
|
|
|
current->inputAttemptWhenModal();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
void Component::paint (Graphics&)
|
|
|
|
{
|
|
|
|
// all painting is done in the subclasses
|
|
|
|
|
|
|
|
jassert (! isOpaque()); // if your component's opaque, you've gotta paint it!
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::paintOverChildren (Graphics&)
|
|
|
|
{
|
|
|
|
// all painting is done in the subclasses
|
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
void Component::postCommandMessage (const int commandId)
|
|
|
|
{
|
|
|
|
@@ -2395,7 +2305,6 @@ void Component::internalMouseExit (MouseInputSource& source, const Point<int>& r |
|
|
|
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseExit, me);
|
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
void Component::internalMouseDown (MouseInputSource& source, const Point<int>& relativePos, const Time& time)
|
|
|
|
{
|
|
|
|
Desktop& desktop = Desktop::getInstance();
|
|
|
|
@@ -2458,7 +2367,6 @@ void Component::internalMouseDown (MouseInputSource& source, const Point<int>& r |
|
|
|
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseDown, me);
|
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
void Component::internalMouseUp (MouseInputSource& source, const Point<int>& relativePos, const Time& time, const ModifierKeys& oldModifiers)
|
|
|
|
{
|
|
|
|
BailOutChecker checker (this);
|
|
|
|
@@ -2590,6 +2498,7 @@ void Component::beginDragAutoRepeat (const int interval) |
|
|
|
Desktop::getInstance().beginDragAutoRepeat (interval);
|
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
void Component::broughtToFront()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
@@ -2620,10 +2529,10 @@ void Component::internalBroughtToFront() |
|
|
|
// active, and therefore can't receive mouse-clicks
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::focusGained (FocusChangeType)
|
|
|
|
{
|
|
|
|
// base class does nothing
|
|
|
|
}
|
|
|
|
//==============================================================================
|
|
|
|
void Component::focusGained (FocusChangeType) {}
|
|
|
|
void Component::focusLost (FocusChangeType) {}
|
|
|
|
void Component::focusOfChildComponentChanged (FocusChangeType) {}
|
|
|
|
|
|
|
|
void Component::internalFocusGain (const FocusChangeType cause)
|
|
|
|
{
|
|
|
|
@@ -2638,11 +2547,6 @@ void Component::internalFocusGain (const FocusChangeType cause, const WeakRefere |
|
|
|
internalChildFocusChange (cause, safePointer);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::focusLost (FocusChangeType)
|
|
|
|
{
|
|
|
|
// base class does nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::internalFocusLoss (const FocusChangeType cause)
|
|
|
|
{
|
|
|
|
const WeakReference<Component> safePointer (this);
|
|
|
|
@@ -2653,11 +2557,6 @@ void Component::internalFocusLoss (const FocusChangeType cause) |
|
|
|
internalChildFocusChange (cause, safePointer);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::focusOfChildComponentChanged (FocusChangeType /*cause*/)
|
|
|
|
{
|
|
|
|
// base class does nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::internalChildFocusChange (FocusChangeType cause, const WeakReference<Component>& safePointer)
|
|
|
|
{
|
|
|
|
const bool childIsNowFocused = hasKeyboardFocus (true);
|
|
|
|
@@ -2676,54 +2575,6 @@ void Component::internalChildFocusChange (FocusChangeType cause, const WeakRefer |
|
|
|
parentComponent->internalChildFocusChange (cause, WeakReference<Component> (parentComponent));
|
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
bool Component::isEnabled() const noexcept
|
|
|
|
{
|
|
|
|
return (! flags.isDisabledFlag)
|
|
|
|
&& (parentComponent == nullptr || parentComponent->isEnabled());
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::setEnabled (const bool shouldBeEnabled)
|
|
|
|
{
|
|
|
|
if (flags.isDisabledFlag == shouldBeEnabled)
|
|
|
|
{
|
|
|
|
flags.isDisabledFlag = ! shouldBeEnabled;
|
|
|
|
|
|
|
|
// if any parent components are disabled, setting our flag won't make a difference,
|
|
|
|
// so no need to send a change message
|
|
|
|
if (parentComponent == nullptr || parentComponent->isEnabled())
|
|
|
|
sendEnablementChangeMessage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::sendEnablementChangeMessage()
|
|
|
|
{
|
|
|
|
const WeakReference<Component> safePointer (this);
|
|
|
|
|
|
|
|
enablementChanged();
|
|
|
|
|
|
|
|
if (safePointer == nullptr)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (int i = getNumChildComponents(); --i >= 0;)
|
|
|
|
{
|
|
|
|
Component* const c = getChildComponent (i);
|
|
|
|
|
|
|
|
if (c != nullptr)
|
|
|
|
{
|
|
|
|
c->sendEnablementChangeMessage();
|
|
|
|
|
|
|
|
if (safePointer == nullptr)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::enablementChanged()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
void Component::setWantsKeyboardFocus (const bool wantsFocus) noexcept
|
|
|
|
{
|
|
|
|
flags.wantsFocusFlag = wantsFocus;
|
|
|
|
@@ -2916,6 +2767,51 @@ void Component::giveAwayFocus (const bool sendFocusLossEvent) |
|
|
|
Desktop::getInstance().triggerFocusCallback();
|
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
bool Component::isEnabled() const noexcept
|
|
|
|
{
|
|
|
|
return (! flags.isDisabledFlag)
|
|
|
|
&& (parentComponent == nullptr || parentComponent->isEnabled());
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::setEnabled (const bool shouldBeEnabled)
|
|
|
|
{
|
|
|
|
if (flags.isDisabledFlag == shouldBeEnabled)
|
|
|
|
{
|
|
|
|
flags.isDisabledFlag = ! shouldBeEnabled;
|
|
|
|
|
|
|
|
// if any parent components are disabled, setting our flag won't make a difference,
|
|
|
|
// so no need to send a change message
|
|
|
|
if (parentComponent == nullptr || parentComponent->isEnabled())
|
|
|
|
sendEnablementChangeMessage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Component::enablementChanged() {}
|
|
|
|
|
|
|
|
void Component::sendEnablementChangeMessage()
|
|
|
|
{
|
|
|
|
const WeakReference<Component> safePointer (this);
|
|
|
|
|
|
|
|
enablementChanged();
|
|
|
|
|
|
|
|
if (safePointer == nullptr)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (int i = getNumChildComponents(); --i >= 0;)
|
|
|
|
{
|
|
|
|
Component* const c = getChildComponent (i);
|
|
|
|
|
|
|
|
if (c != nullptr)
|
|
|
|
{
|
|
|
|
c->sendEnablementChangeMessage();
|
|
|
|
|
|
|
|
if (safePointer == nullptr)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
bool Component::isMouseOver (const bool includeChildren) const
|
|
|
|
{
|
|
|
|
@@ -3015,17 +2911,6 @@ void Component::internalModifierKeysChanged() |
|
|
|
modifierKeysChanged (ModifierKeys::getCurrentModifiers());
|
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
ComponentPeer* Component::getPeer() const
|
|
|
|
{
|
|
|
|
if (flags.hasHeavyweightPeerFlag)
|
|
|
|
return ComponentPeer::getPeerFor (this);
|
|
|
|
else if (parentComponent == nullptr)
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
return parentComponent->getPeer();
|
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
Component::BailOutChecker::BailOutChecker (Component* const component)
|
|
|
|
: safePointer (component)
|
|
|
|
|