Vital
Loading...
Searching...
No Matches
BorderBoundsConstrainer Class Reference

A specialized ComponentBoundsConstrainer that applies border constraints and maintains aspect ratios for the Vital GUI window. More...

#include <border_bounds_constrainer.h>

Inheritance diagram for BorderBoundsConstrainer:

Public Member Functions

 BorderBoundsConstrainer ()
 Constructs a new BorderBoundsConstrainer with no associated GUI and default border settings.
 
virtual void checkBounds (Rectangle< int > &bounds, const Rectangle< int > &previous, const Rectangle< int > &limits, bool stretching_top, bool stretching_left, bool stretching_bottom, bool stretching_right) override
 Adjusts the given bounds to enforce border constraints, maintain aspect ratio, and limit the window size based on display characteristics.
 
virtual void resizeStart () override
 Called before a resize operation begins.
 
virtual void resizeEnd () override
 Called after a resize operation finishes.
 
void setBorder (const BorderSize< int > &border)
 Sets the border size that should be enforced during resizing.
 
void setGui (FullInterface *gui)
 Associates a FullInterface instance with this constrainer.
 

Protected Attributes

FullInterfacegui_
 A pointer to the associated GUI interface, which may be nullptr if none is set.
 
BorderSize< int > border_
 The border to be applied to the component bounds.
 

Detailed Description

A specialized ComponentBoundsConstrainer that applies border constraints and maintains aspect ratios for the Vital GUI window.

This class ensures that when the Vital window is resized, it adheres to certain borders, respects a fixed aspect ratio, and integrates with the main GUI interface to perform special actions at the start and end of a resize operation.

Constructor & Destructor Documentation

◆ BorderBoundsConstrainer()

BorderBoundsConstrainer::BorderBoundsConstrainer ( )
inline

Constructs a new BorderBoundsConstrainer with no associated GUI and default border settings.

Member Function Documentation

◆ checkBounds()

void BorderBoundsConstrainer::checkBounds ( Rectangle< int > & bounds,
const Rectangle< int > & previous,
const Rectangle< int > & limits,
bool stretching_top,
bool stretching_left,
bool stretching_bottom,
bool stretching_right )
overridevirtual

Adjusts the given bounds to enforce border constraints, maintain aspect ratio, and limit the window size based on display characteristics.

Parameters
boundsThe proposed new bounds of the component.
previousThe previous bounds of the component before resizing.
limitsThe limits within which the component must fit.
stretching_topTrue if the top edge is being dragged.
stretching_leftTrue if the left edge is being dragged.
stretching_bottomTrue if the bottom edge is being dragged.
stretching_rightTrue if the right edge is being dragged.

This method first adjusts the bounds by subtracting the set border, then calls the base class implementation to apply standard constraints. It also ensures that the resulting window size does not exceed the available display area, preserving the fixed aspect ratio.

◆ resizeEnd()

void BorderBoundsConstrainer::resizeEnd ( )
overridevirtual

Called after a resize operation finishes.

If an associated FullInterface is set, it saves the current window size for future sessions and re-enables any previously disabled redraw features.

◆ resizeStart()

void BorderBoundsConstrainer::resizeStart ( )
overridevirtual

Called before a resize operation begins.

If an associated FullInterface is set, it will temporarily disable certain background redraw features to improve UI responsiveness while resizing.

◆ setBorder()

void BorderBoundsConstrainer::setBorder ( const BorderSize< int > & border)
inline

Sets the border size that should be enforced during resizing.

Parameters
borderThe border size to apply.

◆ setGui()

void BorderBoundsConstrainer::setGui ( FullInterface * gui)
inline

Associates a FullInterface instance with this constrainer.

Parameters
guiA pointer to the FullInterface instance to be used.

Member Data Documentation

◆ border_

BorderSize<int> BorderBoundsConstrainer::border_
protected

The border to be applied to the component bounds.

◆ gui_

FullInterface* BorderBoundsConstrainer::gui_
protected

A pointer to the associated GUI interface, which may be nullptr if none is set.


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