Represents a type of justification to be used when positioning graphical items. More...
Public Types | |
| enum | { left = 1, right = 2, horizontallyCentred = 4, top = 8, bottom = 16, verticallyCentred = 32, horizontallyJustified = 64, centred = 36, centredLeft = 33, centredRight = 34, centredTop = 12, centredBottom = 20, topLeft = 9, topRight = 10, bottomLeft = 17, bottomRight = 18 } |
| Flag values that can be combined and used in the constructor. More... | |
Public Member Functions | |
| Justification (int flags_) noexcept | |
| Creates a Justification object using a combination of flags. | |
| Justification (const Justification &other) noexcept | |
| Creates a copy of another Justification object. | |
| Justification & | operator= (const Justification &other) noexcept |
| Copies another Justification object. | |
| bool | operator== (const Justification &other) const noexcept |
| bool | operator!= (const Justification &other) const noexcept |
| int | getFlags () const noexcept |
| Returns the raw flags that are set for this Justification object. | |
| bool | testFlags (int flagsToTest) const noexcept |
| Tests a set of flags for this object. | |
| int | getOnlyVerticalFlags () const noexcept |
| Returns just the flags from this object that deal with vertical layout. | |
| int | getOnlyHorizontalFlags () const noexcept |
| Returns just the flags from this object that deal with horizontal layout. | |
| template<typename ValueType > | |
| void | applyToRectangle (ValueType &x, ValueType &y, ValueType w, ValueType h, ValueType spaceX, ValueType spaceY, ValueType spaceW, ValueType spaceH) const noexcept |
| Adjusts the position of a rectangle to fit it into a space. | |
| template<typename ValueType > | |
| const Rectangle< ValueType > | appliedToRectangle (const Rectangle< ValueType > &areaToAdjust, const Rectangle< ValueType > &targetSpace) const noexcept |
| Returns the new position of a rectangle that has been justified to fit within a given space. | |
Represents a type of justification to be used when positioning graphical items.
e.g. it indicates whether something should be placed top-left, top-right, centred, etc.
It is used in various places wherever this kind of information is needed.
| anonymous enum |
Flag values that can be combined and used in the constructor.
| Justification::Justification | ( | int | flags_ | ) |
Creates a Justification object using a combination of flags.
| Justification::Justification | ( | const Justification & | other | ) |
Creates a copy of another Justification object.
| Justification& Justification::operator= | ( | const Justification & | other | ) |
Copies another Justification object.
| bool Justification::operator== | ( | const Justification & | other | ) | const |
| bool Justification::operator!= | ( | const Justification & | other | ) | const |
| int Justification::getFlags | ( | ) | const |
Returns the raw flags that are set for this Justification object.
| bool Justification::testFlags | ( | int | flagsToTest | ) | const |
Tests a set of flags for this object.
| int Justification::getOnlyVerticalFlags | ( | ) | const |
Returns just the flags from this object that deal with vertical layout.
| int Justification::getOnlyHorizontalFlags | ( | ) | const |
Returns just the flags from this object that deal with horizontal layout.
| void Justification::applyToRectangle | ( | ValueType & | x, |
| ValueType & | y, | ||
| ValueType | w, | ||
| ValueType | h, | ||
| ValueType | spaceX, | ||
| ValueType | spaceY, | ||
| ValueType | spaceW, | ||
| ValueType | spaceH | ||
| ) | const |
Adjusts the position of a rectangle to fit it into a space.
The (x, y) position of the rectangle will be updated to position it inside the given space according to the justification flags.
| const Rectangle<ValueType> Justification::appliedToRectangle | ( | const Rectangle< ValueType > & | areaToAdjust, |
| const Rectangle< ValueType > & | targetSpace | ||
| ) | const |
Returns the new position of a rectangle that has been justified to fit within a given space.
References Rectangle< ValueType >::getX().