Represents a type of justification to be used when positioning graphical items. More...
#include <juce_Justification.h>
Public Types | |
enum | Flags { 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 (const Justification &)=default | |
Creates a copy of another Justification object. More... | |
Justification (int justificationFlags) noexcept | |
Creates a Justification object using a combination of flags from the Flags enum. More... | |
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. More... | |
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. More... | |
int | getFlags () const noexcept |
Returns the raw flags that are set for this Justification object. More... | |
int | getOnlyHorizontalFlags () const noexcept |
Returns just the flags from this object that deal with horizontal layout. More... | |
int | getOnlyVerticalFlags () const noexcept |
Returns just the flags from this object that deal with vertical layout. More... | |
bool | operator!= (const Justification &other) const noexcept |
Justification & | operator= (const Justification &)=default |
Copies another Justification object. More... | |
bool | operator== (const Justification &other) const noexcept |
bool | testFlags (int flagsToTest) const noexcept |
Tests a set of flags for this object. More... | |
Private Attributes | |
int | flags |
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.
@tags{Graphics}
Flag values that can be combined and used in the constructor.
|
inlinenoexcept |
Creates a Justification object using a combination of flags from the Flags enum.
|
default |
Creates a copy of another Justification object.
|
inlinenoexcept |
Returns the new position of a rectangle that has been justified to fit within a given space.
References applyToRectangle(), juce::gl::x, and juce::gl::y.
|
inlinenoexcept |
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.
References bottom, flags, juce::gl::h, horizontallyCentred, right, verticallyCentred, juce::gl::w, juce::gl::x, and juce::gl::y.
Referenced by appliedToRectangle().
|
inlinenoexcept |
Returns the raw flags that are set for this Justification object.
References flags.
|
inlinenoexcept |
Returns just the flags from this object that deal with horizontal layout.
References flags, horizontallyCentred, horizontallyJustified, left, and right.
|
inlinenoexcept |
Returns just the flags from this object that deal with vertical layout.
References bottom, flags, top, and verticallyCentred.
|
inlinenoexcept |
References flags.
|
default |
Copies another Justification object.
|
inlinenoexcept |
References flags.
Tests a set of flags for this object.
References flags.
|
private |
Referenced by applyToRectangle(), getFlags(), getOnlyHorizontalFlags(), getOnlyVerticalFlags(), operator!=(), operator==(), and testFlags().