JUCE  v6.1.6 (6.0.8-1114)
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::Justification Class Reference

Represents a type of justification to be used when positioning graphical items. More...

#include <juce_Justification.h>

Collaboration diagram for juce::Justification:

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
 
Justificationoperator= (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
 

Detailed Description

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}

Member Enumeration Documentation

◆ Flags

Flag values that can be combined and used in the constructor.

Enumerator
left 

Indicates that the item should be aligned against the left edge of the available space.

right 

Indicates that the item should be aligned against the right edge of the available space.

horizontallyCentred 

Indicates that the item should be placed in the centre between the left and right sides of the available space.

top 

Indicates that the item should be aligned against the top edge of the available space.

bottom 

Indicates that the item should be aligned against the bottom edge of the available space.

verticallyCentred 

Indicates that the item should be placed in the centre between the top and bottom sides of the available space.

horizontallyJustified 

Indicates that lines of text should be spread out to fill the maximum width available, so that both margins are aligned vertically.

centred 

Indicates that the item should be centred vertically and horizontally.

This is equivalent to (horizontallyCentred | verticallyCentred)

centredLeft 

Indicates that the item should be centred vertically but placed on the left hand side.

This is equivalent to (left | verticallyCentred)

centredRight 

Indicates that the item should be centred vertically but placed on the right hand side.

This is equivalent to (right | verticallyCentred)

centredTop 

Indicates that the item should be centred horizontally and placed at the top.

This is equivalent to (horizontallyCentred | top)

centredBottom 

Indicates that the item should be centred horizontally and placed at the bottom.

This is equivalent to (horizontallyCentred | bottom)

topLeft 

Indicates that the item should be placed in the top-left corner.

This is equivalent to (left | top)

topRight 

Indicates that the item should be placed in the top-right corner.

This is equivalent to (right | top)

bottomLeft 

Indicates that the item should be placed in the bottom-left corner.

This is equivalent to (left | bottom)

bottomRight 

Indicates that the item should be placed in the bottom-left corner.

This is equivalent to (right | bottom)

Constructor & Destructor Documentation

◆ Justification() [1/2]

juce::Justification::Justification ( int  justificationFlags)
inlinenoexcept

Creates a Justification object using a combination of flags from the Flags enum.

◆ Justification() [2/2]

juce::Justification::Justification ( const Justification )
default

Creates a copy of another Justification object.

Member Function Documentation

◆ appliedToRectangle()

template<typename ValueType >
const Rectangle<ValueType> juce::Justification::appliedToRectangle ( const Rectangle< ValueType > &  areaToAdjust,
const Rectangle< ValueType > &  targetSpace 
) const
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.

◆ applyToRectangle()

template<typename ValueType >
void juce::Justification::applyToRectangle ( ValueType &  x,
ValueType &  y,
ValueType  w,
ValueType  h,
ValueType  spaceX,
ValueType  spaceY,
ValueType  spaceW,
ValueType  spaceH 
) const
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().

◆ getFlags()

int juce::Justification::getFlags ( ) const
inlinenoexcept

Returns the raw flags that are set for this Justification object.

References flags.

◆ getOnlyHorizontalFlags()

int juce::Justification::getOnlyHorizontalFlags ( ) const
inlinenoexcept

Returns just the flags from this object that deal with horizontal layout.

References flags, horizontallyCentred, horizontallyJustified, left, and right.

◆ getOnlyVerticalFlags()

int juce::Justification::getOnlyVerticalFlags ( ) const
inlinenoexcept

Returns just the flags from this object that deal with vertical layout.

References bottom, flags, top, and verticallyCentred.

◆ operator!=()

bool juce::Justification::operator!= ( const Justification other) const
inlinenoexcept

References flags.

◆ operator=()

Justification& juce::Justification::operator= ( const Justification )
default

Copies another Justification object.

◆ operator==()

bool juce::Justification::operator== ( const Justification other) const
inlinenoexcept

References flags.

◆ testFlags()

bool juce::Justification::testFlags ( int  flagsToTest) const
inlinenoexcept

Tests a set of flags for this object.

Returns
true if any of the flags passed in are set on this object.

References flags.

Member Data Documentation

◆ flags


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