47 if (minW > maxW) maxW = minW;
48 if (minH > maxH) maxH = minH;
57 maxW =
jmax (minW, maximumWidth);
66 jassert (maximumWidth >= minimumWidth);
71 minW =
jmax (0, minimumWidth);
73 maxW =
jmax (minW, maximumWidth);
105 jassert (component !=
nullptr);
112 return { parent->
getWidth(), parent->getHeight() };
126 if (
auto* peer = component->
getPeer())
127 if (
const auto frameSize = peer->getFrameSizeIfPresent())
133 border.
addTo (bounds);
136 border.addedTo (component->
getBounds()), limits,
140 border.subtractFrom (bounds);
148 false,
false,
false,
false);
154 positioner->applyNewBounds (bounds);
216 if (minOffBottom > 0)
243 if (aspectRatio > 0.0)
Specifies a set of gaps to be left around the sides of a rectangle.
void addTo(Rectangle< ValueType > &rectangle) const noexcept
Adds this border around a given rectangle.
double getFixedAspectRatio() const noexcept
Returns the aspect ratio that was set with setFixedAspectRatio().
void setMaximumHeight(int maximumHeight) noexcept
Imposes a maximum height limit.
void setMinimumSize(int minimumWidth, int minimumHeight) noexcept
Imposes a minimum width and height limit.
void setFixedAspectRatio(double widthOverHeight) noexcept
Specifies a width-to-height ratio that the resizer should always maintain.
void setMinimumOnscreenAmounts(int minimumWhenOffTheTop, int minimumWhenOffTheLeft, int minimumWhenOffTheBottom, int minimumWhenOffTheRight) noexcept
Sets the amount by which the component is allowed to go off-screen.
void setBoundsForComponent(Component *component, Rectangle< int > bounds, bool isStretchingTop, bool isStretchingLeft, bool isStretchingBottom, bool isStretchingRight)
Checks the given bounds, and then sets the component to the corrected size.
void setMinimumWidth(int minimumWidth) noexcept
Imposes a minimum width limit.
void setMaximumSize(int maximumWidth, int maximumHeight) noexcept
Imposes a maximum width and height limit.
void setMinimumHeight(int minimumHeight) noexcept
Imposes a minimum height limit.
virtual void resizeEnd()
This callback happens when the resizer has finished dragging.
virtual void applyBoundsToComponent(Component &, Rectangle< int > bounds)
Called by setBoundsForComponent() to apply a new constrained size to a component.
void setMaximumWidth(int maximumWidth) noexcept
Imposes a maximum width limit.
virtual ~ComponentBoundsConstrainer()
Destructor.
ComponentBoundsConstrainer() noexcept
When first created, the object will not impose any restrictions on the components.
void setSizeLimits(int minimumWidth, int minimumHeight, int maximumWidth, int maximumHeight) noexcept
Set all the maximum and minimum dimensions.
virtual void resizeStart()
This callback happens when the resizer is about to start dragging.
void checkComponentBounds(Component *component)
Performs a check on the current size of a component, and moves or resizes it if it fails the constrai...
virtual void checkBounds(Rectangle< int > &bounds, const Rectangle< int > &previousBounds, const Rectangle< int > &limits, bool isStretchingTop, bool isStretchingLeft, bool isStretchingBottom, bool isStretchingRight)
This callback changes the given coordinates to impose whatever the current constraints are set to be.
The base class for all JUCE user-interface objects.
Component * getParentComponent() const noexcept
Returns the component which this component is inside.
Point< int > getPosition() const noexcept
Returns the component's top-left position as a Point.
Rectangle< int > getLocalArea(const Component *sourceComponent, Rectangle< int > areaRelativeToSourceComponent) const
Converts a rectangle to be relative to this component's coordinate space.
Positioner * getPositioner() const noexcept
Returns the Positioner object that has been set for this component.
Rectangle< int > getBounds() const noexcept
Returns this component's bounding box.
Rectangle< int > localAreaToGlobal(Rectangle< int > localArea) const
Converts a rectangle from this component's coordinate space to a screen coordinate.
void setBounds(int x, int y, int width, int height)
Changes the component's position and size.
ComponentPeer * getPeer() const
Returns the heavyweight window that contains this component.
const Displays & getDisplays() const noexcept
Returns the Displays object representing the connected displays.
static Desktop &JUCE_CALLTYPE getInstance()
There's only one desktop object, and this method will return it.
const Display * getDisplayForPoint(Point< int > point, bool isPhysical=false) const noexcept
Returns the Display object representing the display containing a given Point (either in logical or ph...
Manages a rectangle and allows geometric operations to be performed on it.
ValueType getRight() const noexcept
Returns the x coordinate of the rectangle's right-hand-side.
void setLeft(ValueType newLeft) noexcept
Moves the x position, adjusting the width so that the right-hand edge remains in the same place.
void setY(ValueType newY) noexcept
Changes the rectangle's Y coordinate.
ValueType getX() const noexcept
Returns the x coordinate of the rectangle's left-hand-side.
void setRight(ValueType newRight) noexcept
Adjusts the width so that the right-hand edge of the rectangle has this new value.
void setHeight(ValueType newHeight) noexcept
Changes the rectangle's height.
void setBottom(ValueType newBottom) noexcept
Adjusts the height so that the bottom edge of the rectangle has this new value.
ValueType getBottom() const noexcept
Returns the y coordinate of the rectangle's bottom edge.
ValueType getWidth() const noexcept
Returns the width of the rectangle.
void setTop(ValueType newTop) noexcept
Moves the y position, adjusting the height so that the bottom edge remains in the same place.
ValueType getY() const noexcept
Returns the y coordinate of the rectangle's top edge.
bool isEmpty() const noexcept
Returns true if the rectangle's width or height are zero or less.
void setX(ValueType newX) noexcept
Changes the rectangle's X coordinate.
void setWidth(ValueType newWidth) noexcept
Changes the rectangle's width.
ValueType getHeight() const noexcept
Returns the height of the rectangle.
constexpr Type jmin(Type a, Type b)
Returns the smaller of two values.
constexpr Type jmax(Type a, Type b)
Returns the larger of two values.
Type jlimit(Type lowerLimit, Type upperLimit, Type valueToConstrain) noexcept
Constrains a value to keep it within a given range.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
int roundToInt(const FloatType value) noexcept
Fast floating-point-to-integer conversion.