From 75ea6db250716bc7991dfffebb5f45827a848bc3 Mon Sep 17 00:00:00 2001 From: hogliux Date: Thu, 27 Oct 2016 16:52:47 +0100 Subject: [PATCH] Renamed bounds member variable in Component to "boundsRelativeToParent" to avoid shadowing warnings when using a local variable nambed "bounds" --- .../components/juce_Component.cpp | 16 ++++++++-------- .../components/juce_Component.h | 18 +++++++++--------- .../windows/juce_ComponentPeer.cpp | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/modules/juce_gui_basics/components/juce_Component.cpp b/modules/juce_gui_basics/components/juce_Component.cpp index 3f13fbbe9e..f544e77533 100644 --- a/modules/juce_gui_basics/components/juce_Component.cpp +++ b/modules/juce_gui_basics/components/juce_Component.cpp @@ -409,7 +409,7 @@ struct Component::ComponentHelpers if (child.isVisible() && ! child.isTransformed()) { - const Rectangle newClip (clipRect.getIntersection (child.bounds)); + const Rectangle newClip (clipRect.getIntersection (child.boundsRelativeToParent)); if (! newClip.isEmpty()) { @@ -665,7 +665,7 @@ void Component::addToDesktop (int styleWanted, void* nativeWindowToAttachTo) Desktop::getInstance().addDesktopComponent (this); - bounds.setPosition (topLeft); + boundsRelativeToParent.setPosition (topLeft); peer->updateBounds(); if (oldRenderingEngine >= 0) @@ -1031,8 +1031,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 * boundsRelativeToParent.getWidth()); } +int Component::proportionOfHeight (const float proportion) const noexcept { return roundToInt (proportion * boundsRelativeToParent.getHeight()); } int Component::getParentWidth() const noexcept { @@ -1135,7 +1135,7 @@ void Component::setBounds (const int x, const int y, int w, int h) repaintParent(); } - bounds.setBounds (x, y, w, h); + boundsRelativeToParent.setBounds (x, y, w, h); if (showing) { @@ -2249,13 +2249,13 @@ void Component::setPositioner (Positioner* newPositioner) //============================================================================== Rectangle Component::getLocalBounds() const noexcept { - return bounds.withZeroOrigin(); + return boundsRelativeToParent.withZeroOrigin(); } Rectangle Component::getBoundsInParent() const noexcept { - return affineTransform == nullptr ? bounds - : bounds.transformedBy (*affineTransform); + return affineTransform == nullptr ? boundsRelativeToParent + : boundsRelativeToParent.transformedBy (*affineTransform); } //============================================================================== diff --git a/modules/juce_gui_basics/components/juce_Component.h b/modules/juce_gui_basics/components/juce_Component.h index 3852448e29..e60dff79d1 100644 --- a/modules/juce_gui_basics/components/juce_Component.h +++ b/modules/juce_gui_basics/components/juce_Component.h @@ -253,7 +253,7 @@ public: bounds will no longer be a direct reflection of the position at which it appears within its parent, as the transform will be applied to its bounding box. */ - int getX() const noexcept { return bounds.getX(); } + int getX() const noexcept { return boundsRelativeToParent.getX(); } /** Returns the y coordinate of the top of this component. This is a distance in pixels from the top edge of the component's parent. @@ -262,13 +262,13 @@ public: bounds will no longer be a direct reflection of the position at which it appears within its parent, as the transform will be applied to its bounding box. */ - int getY() const noexcept { return bounds.getY(); } + int getY() const noexcept { return boundsRelativeToParent.getY(); } /** Returns the component's width in pixels. */ - int getWidth() const noexcept { return bounds.getWidth(); } + int getWidth() const noexcept { return boundsRelativeToParent.getWidth(); } /** Returns the component's height in pixels. */ - int getHeight() const noexcept { return bounds.getHeight(); } + int getHeight() const noexcept { return boundsRelativeToParent.getHeight(); } /** Returns the x coordinate of the component's right-hand edge. This is a distance in pixels from the left edge of the component's parent. @@ -277,10 +277,10 @@ public: bounds will no longer be a direct reflection of the position at which it appears within its parent, as the transform will be applied to its bounding box. */ - int getRight() const noexcept { return bounds.getRight(); } + int getRight() const noexcept { return boundsRelativeToParent.getRight(); } /** Returns the component's top-left position as a Point. */ - Point getPosition() const noexcept { return bounds.getPosition(); } + Point getPosition() const noexcept { return boundsRelativeToParent.getPosition(); } /** Returns the y coordinate of the bottom edge of this component. This is a distance in pixels from the top edge of the component's parent. @@ -289,7 +289,7 @@ public: bounds will no longer be a direct reflection of the position at which it appears within its parent, as the transform will be applied to its bounding box. */ - int getBottom() const noexcept { return bounds.getBottom(); } + int getBottom() const noexcept { return boundsRelativeToParent.getBottom(); } /** Returns this component's bounding box. The rectangle returned is relative to the top-left of the component's parent. @@ -298,7 +298,7 @@ public: bounds will no longer be a direct reflection of the position at which it appears within its parent, as the transform will be applied to its bounding box. */ - const Rectangle& getBounds() const noexcept { return bounds; } + const Rectangle& getBounds() const noexcept { return boundsRelativeToParent; } /** Returns the component's bounds, relative to its own origin. This is like getBounds(), but returns the rectangle in local coordinates, In practice, it'll @@ -2244,7 +2244,7 @@ private: //============================================================================== String componentName, componentID; Component* parentComponent; - Rectangle bounds; + Rectangle boundsRelativeToParent; ScopedPointer positioner; ScopedPointer affineTransform; Array childComponentList; diff --git a/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp b/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp index 324b9d274b..172dc11d5e 100644 --- a/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp +++ b/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp @@ -320,7 +320,7 @@ void ComponentPeer::handleMovedOrResized() if (wasMoved || wasResized) { - component.bounds = newBounds; + component.boundsRelativeToParent = newBounds; if (wasResized) component.repaint();