JUCE v8.0.9
JUCE API
 
Loading...
Searching...
No Matches
juce::BorderedComponentBoundsConstrainer Class Referenceabstract

A ComponentBoundsConstrainer that can be used to add a constant border onto another ComponentBoundsConstrainer. More...

#include <juce_BorderedComponentBoundsConstrainer.h>

Inheritance diagram for juce::BorderedComponentBoundsConstrainer:
Collaboration diagram for juce::BorderedComponentBoundsConstrainer:

Public Member Functions

 BorderedComponentBoundsConstrainer ()=default
 Default constructor.
 
virtual void applyBoundsToComponent (Component &, Rectangle< int > bounds)
 Called by setBoundsForComponent() to apply a new constrained size to a component.
 
void checkBounds (Rectangle< int > &bounds, const Rectangle< int > &previousBounds, const Rectangle< int > &limits, bool isStretchingTop, bool isStretchingLeft, bool isStretchingBottom, bool isStretchingRight) override
 
void checkComponentBounds (Component *component)
 Performs a check on the current size of a component, and moves or resizes it if it fails the constraints.
 
virtual BorderSize< int > getAdditionalBorder () const =0
 Returns the border that should be applied to the constrained bounds.
 
double getFixedAspectRatio () const noexcept
 Returns the aspect ratio that was set with setFixedAspectRatio().
 
int getMaximumHeight () const noexcept
 Returns the current maximum height.
 
int getMaximumWidth () const noexcept
 Returns the current maximum width.
 
int getMinimumHeight () const noexcept
 Returns the current minimum height.
 
int getMinimumWhenOffTheBottom () const noexcept
 Returns the minimum distance the bounds can be off-screen.
 
int getMinimumWhenOffTheLeft () const noexcept
 Returns the minimum distance the bounds can be off-screen.
 
int getMinimumWhenOffTheRight () const noexcept
 Returns the minimum distance the bounds can be off-screen.
 
int getMinimumWhenOffTheTop () const noexcept
 Returns the minimum distance the bounds can be off-screen.
 
int getMinimumWidth () const noexcept
 Returns the current minimum width.
 
virtual ComponentBoundsConstrainergetWrappedConstrainer () const =0
 Returns a pointer to another constrainer that will be used as the base for any resizing operations.
 
virtual void resizeEnd ()
 This callback happens when the resizer has finished dragging.
 
virtual void resizeStart ()
 This callback happens when the resizer is about to start dragging.
 
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 setFixedAspectRatio (double widthOverHeight) noexcept
 Specifies a width-to-height ratio that the resizer should always maintain.
 
void setMaximumHeight (int maximumHeight) noexcept
 Imposes a maximum height limit.
 
void setMaximumSize (int maximumWidth, int maximumHeight) noexcept
 Imposes a maximum width and height limit.
 
void setMaximumWidth (int maximumWidth) noexcept
 Imposes a maximum width limit.
 
void setMinimumHeight (int minimumHeight) noexcept
 Imposes a minimum height limit.
 
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 setMinimumSize (int minimumWidth, int minimumHeight) noexcept
 Imposes a minimum width and height limit.
 
void setMinimumWidth (int minimumWidth) noexcept
 Imposes a minimum width limit.
 
void setSizeLimits (int minimumWidth, int minimumHeight, int maximumWidth, int maximumHeight) noexcept
 Set all the maximum and minimum dimensions.
 

Private Attributes

double aspectRatio = 0
 
int maxH = 0x3fffffff
 
int maxW = 0x3fffffff
 
int minH = 0
 
int minOffBottom = 0
 
int minOffLeft = 0
 
int minOffRight = 0
 
int minOffTop = 0
 
int minW = 0
 

Detailed Description

A ComponentBoundsConstrainer that can be used to add a constant border onto another ComponentBoundsConstrainer.

This is useful when trying to constrain the size of a resizable window or other component that wraps a constrained component, such as a plugin editor.

See also
ResizableCornerComponent, ResizableBorderComponent, ResizableWindow, ComponentBoundsConstrainer

@tags{GUI}

Constructor & Destructor Documentation

◆ BorderedComponentBoundsConstrainer()

juce::BorderedComponentBoundsConstrainer::BorderedComponentBoundsConstrainer ( )
default

Default constructor.

Member Function Documentation

◆ applyBoundsToComponent()

virtual void juce::ComponentBoundsConstrainer::applyBoundsToComponent ( Component ,
Rectangle< int >  bounds 
)
virtualinherited

Called by setBoundsForComponent() to apply a new constrained size to a component.

By default this just calls setBounds(), but is virtual in case it's needed for extremely cunning purposes.

◆ checkBounds()

void juce::BorderedComponentBoundsConstrainer::checkBounds ( Rectangle< int > &  bounds,
const Rectangle< int > &  previousBounds,
const Rectangle< int > &  limits,
bool  isStretchingTop,
bool  isStretchingLeft,
bool  isStretchingBottom,
bool  isStretchingRight 
)
overridevirtual

Reimplemented from juce::ComponentBoundsConstrainer.

◆ checkComponentBounds()

void juce::ComponentBoundsConstrainer::checkComponentBounds ( Component component)
inherited

Performs a check on the current size of a component, and moves or resizes it if it fails the constraints.

◆ getAdditionalBorder()

virtual BorderSize< int > juce::BorderedComponentBoundsConstrainer::getAdditionalBorder ( ) const
pure virtual

Returns the border that should be applied to the constrained bounds.

Implemented in juce::StandaloneFilterWindow::DecoratorConstrainer.

◆ getFixedAspectRatio()

double juce::ComponentBoundsConstrainer::getFixedAspectRatio ( ) const
noexceptinherited

Returns the aspect ratio that was set with setFixedAspectRatio().

If no aspect ratio is being enforced, this will return 0.

◆ getMaximumHeight()

int juce::ComponentBoundsConstrainer::getMaximumHeight ( ) const
inlinenoexceptinherited

Returns the current maximum height.

◆ getMaximumWidth()

int juce::ComponentBoundsConstrainer::getMaximumWidth ( ) const
inlinenoexceptinherited

Returns the current maximum width.

◆ getMinimumHeight()

int juce::ComponentBoundsConstrainer::getMinimumHeight ( ) const
inlinenoexceptinherited

Returns the current minimum height.

◆ getMinimumWhenOffTheBottom()

int juce::ComponentBoundsConstrainer::getMinimumWhenOffTheBottom ( ) const
inlinenoexceptinherited

Returns the minimum distance the bounds can be off-screen.

See also
setMinimumOnscreenAmounts

◆ getMinimumWhenOffTheLeft()

int juce::ComponentBoundsConstrainer::getMinimumWhenOffTheLeft ( ) const
inlinenoexceptinherited

Returns the minimum distance the bounds can be off-screen.

See also
setMinimumOnscreenAmounts

◆ getMinimumWhenOffTheRight()

int juce::ComponentBoundsConstrainer::getMinimumWhenOffTheRight ( ) const
inlinenoexceptinherited

Returns the minimum distance the bounds can be off-screen.

See also
setMinimumOnscreenAmounts

◆ getMinimumWhenOffTheTop()

int juce::ComponentBoundsConstrainer::getMinimumWhenOffTheTop ( ) const
inlinenoexceptinherited

Returns the minimum distance the bounds can be off-screen.

See also
setMinimumOnscreenAmounts

◆ getMinimumWidth()

int juce::ComponentBoundsConstrainer::getMinimumWidth ( ) const
inlinenoexceptinherited

Returns the current minimum width.

◆ getWrappedConstrainer()

virtual ComponentBoundsConstrainer * juce::BorderedComponentBoundsConstrainer::getWrappedConstrainer ( ) const
pure virtual

Returns a pointer to another constrainer that will be used as the base for any resizing operations.

Implemented in juce::StandaloneFilterWindow::DecoratorConstrainer.

◆ resizeEnd()

virtual void juce::ComponentBoundsConstrainer::resizeEnd ( )
virtualinherited

This callback happens when the resizer has finished dragging.

◆ resizeStart()

virtual void juce::ComponentBoundsConstrainer::resizeStart ( )
virtualinherited

This callback happens when the resizer is about to start dragging.

◆ setBoundsForComponent()

void juce::ComponentBoundsConstrainer::setBoundsForComponent ( Component component,
Rectangle< int >  bounds,
bool  isStretchingTop,
bool  isStretchingLeft,
bool  isStretchingBottom,
bool  isStretchingRight 
)
inherited

Checks the given bounds, and then sets the component to the corrected size.

◆ setFixedAspectRatio()

void juce::ComponentBoundsConstrainer::setFixedAspectRatio ( double  widthOverHeight)
noexceptinherited

Specifies a width-to-height ratio that the resizer should always maintain.

If the value is 0, no aspect ratio is enforced. If it's non-zero, the width will always be maintained as this multiple of the height.

See also
setResizeLimits

◆ setMaximumHeight()

void juce::ComponentBoundsConstrainer::setMaximumHeight ( int  maximumHeight)
noexceptinherited

Imposes a maximum height limit.

◆ setMaximumSize()

void juce::ComponentBoundsConstrainer::setMaximumSize ( int  maximumWidth,
int  maximumHeight 
)
noexceptinherited

Imposes a maximum width and height limit.

◆ setMaximumWidth()

void juce::ComponentBoundsConstrainer::setMaximumWidth ( int  maximumWidth)
noexceptinherited

Imposes a maximum width limit.

◆ setMinimumHeight()

void juce::ComponentBoundsConstrainer::setMinimumHeight ( int  minimumHeight)
noexceptinherited

Imposes a minimum height limit.

◆ setMinimumOnscreenAmounts()

void juce::ComponentBoundsConstrainer::setMinimumOnscreenAmounts ( int  minimumWhenOffTheTop,
int  minimumWhenOffTheLeft,
int  minimumWhenOffTheBottom,
int  minimumWhenOffTheRight 
)
noexceptinherited

Sets the amount by which the component is allowed to go off-screen.

The values indicate how many pixels must remain on-screen when dragged off one of its parent's edges, so e.g. if minimumWhenOffTheTop is set to 10, then when the component goes off the top of the screen, its y-position will be clipped so that there are always at least 10 pixels on-screen. In other words, the lowest y-position it can take would be (10 - the component's height).

If you pass 0 or less for one of these amounts, the component is allowed to move beyond that edge completely, with no restrictions at all.

If you pass a very large number (i.e. larger that the dimensions of the component itself), then the component won't be allowed to overlap that edge at all. So e.g. setting minimumWhenOffTheLeft to 0xffffff will mean that the component will bump into the left side of the screen and go no further.

◆ setMinimumSize()

void juce::ComponentBoundsConstrainer::setMinimumSize ( int  minimumWidth,
int  minimumHeight 
)
noexceptinherited

Imposes a minimum width and height limit.

◆ setMinimumWidth()

void juce::ComponentBoundsConstrainer::setMinimumWidth ( int  minimumWidth)
noexceptinherited

Imposes a minimum width limit.

◆ setSizeLimits()

void juce::ComponentBoundsConstrainer::setSizeLimits ( int  minimumWidth,
int  minimumHeight,
int  maximumWidth,
int  maximumHeight 
)
noexceptinherited

Set all the maximum and minimum dimensions.

Member Data Documentation

◆ aspectRatio

double juce::ComponentBoundsConstrainer::aspectRatio = 0
privateinherited

◆ maxH

int juce::ComponentBoundsConstrainer::maxH = 0x3fffffff
privateinherited

◆ maxW

int juce::ComponentBoundsConstrainer::maxW = 0x3fffffff
privateinherited

◆ minH

int juce::ComponentBoundsConstrainer::minH = 0
privateinherited

◆ minOffBottom

int juce::ComponentBoundsConstrainer::minOffBottom = 0
privateinherited

◆ minOffLeft

int juce::ComponentBoundsConstrainer::minOffLeft = 0
privateinherited

◆ minOffRight

int juce::ComponentBoundsConstrainer::minOffRight = 0
privateinherited

◆ minOffTop

int juce::ComponentBoundsConstrainer::minOffTop = 0
privateinherited

◆ minW

int juce::ComponentBoundsConstrainer::minW = 0
privateinherited

The documentation for this class was generated from the following file: