Loading...
Searching...
No Matches
Public Member Functions | List of all members
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 BorderedComponentBoundsConstrainer:

Public Member Functions

 BorderedComponentBoundsConstrainer ()=default
 Default constructor.
 
virtual ComponentBoundsConstrainergetWrappedConstrainer () const =0
 Returns a pointer to another constrainer that will be used as the base for any resizing operations.
 
virtual BorderSize< int > getAdditionalBorder () const =0
 Returns the border that should be applied to the constrained bounds.
 
void checkBounds (Rectangle< int > &bounds, const Rectangle< int > &previousBounds, const Rectangle< int > &limits, bool isStretchingTop, bool isStretchingLeft, bool isStretchingBottom, bool isStretchingRight) override
 This callback changes the given coordinates to impose whatever the current constraints are set to be.
 
- Public Member Functions inherited from ComponentBoundsConstrainer
 ComponentBoundsConstrainer () noexcept
 When first created, the object will not impose any restrictions on the components.
 
virtual ~ComponentBoundsConstrainer ()
 Destructor.
 
void setMinimumWidth (int minimumWidth) noexcept
 Imposes a minimum width limit.
 
int getMinimumWidth () const noexcept
 Returns the current minimum width.
 
void setMaximumWidth (int maximumWidth) noexcept
 Imposes a maximum width limit.
 
int getMaximumWidth () const noexcept
 Returns the current maximum width.
 
void setMinimumHeight (int minimumHeight) noexcept
 Imposes a minimum height limit.
 
int getMinimumHeight () const noexcept
 Returns the current minimum height.
 
void setMaximumHeight (int maximumHeight) noexcept
 Imposes a maximum height limit.
 
int getMaximumHeight () const noexcept
 Returns the current maximum height.
 
void setMinimumSize (int minimumWidth, int minimumHeight) noexcept
 Imposes a minimum width and height limit.
 
void setMaximumSize (int maximumWidth, int maximumHeight) noexcept
 Imposes a maximum width and height limit.
 
void setSizeLimits (int minimumWidth, int minimumHeight, int maximumWidth, int maximumHeight) noexcept
 Set all the maximum and minimum dimensions.
 
void setMinimumOnscreenAmounts (int minimumWhenOffTheTop, int minimumWhenOffTheLeft, int minimumWhenOffTheBottom, int minimumWhenOffTheRight) noexcept
 Sets the amount by which the component is allowed to go off-screen.
 
int getMinimumWhenOffTheTop () 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 getMinimumWhenOffTheBottom () 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.
 
void setFixedAspectRatio (double widthOverHeight) noexcept
 Specifies a width-to-height ratio that the resizer should always maintain.
 
double getFixedAspectRatio () const noexcept
 Returns the aspect ratio that was set with setFixedAspectRatio().
 
virtual void resizeStart ()
 This callback happens when the resizer is about to start dragging.
 
virtual void resizeEnd ()
 This callback happens when the resizer has finished 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 checkComponentBounds (Component *component)
 Performs a check on the current size of a component, and moves or resizes it if it fails the constraints.
 
virtual void applyBoundsToComponent (Component &, Rectangle< int > bounds)
 Called by setBoundsForComponent() to apply a new constrained size to a component.
 

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

Constructor & Destructor Documentation

◆ BorderedComponentBoundsConstrainer()

BorderedComponentBoundsConstrainer::BorderedComponentBoundsConstrainer ( )
default

Default constructor.

Member Function Documentation

◆ getWrappedConstrainer()

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

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

◆ getAdditionalBorder()

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

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

◆ checkBounds()

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

This callback changes the given coordinates to impose whatever the current constraints are set to be.

Parameters
boundsthe target position that should be examined and adjusted
previousBoundsthe component's current size
limitsthe region in which the component can be positioned
isStretchingTopwhether the top edge of the component is being resized
isStretchingLeftwhether the left edge of the component is being resized
isStretchingBottomwhether the bottom edge of the component is being resized
isStretchingRightwhether the right edge of the component is being resized

Reimplemented from ComponentBoundsConstrainer.


The documentation for this class was generated from the following file:
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram