Loading...
Searching...
No Matches
juce::FlexItem Class Referencefinal

## Detailed Description

Describes the properties of an item inside a FlexBox container.

See also
  FlexBox

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

- juce_gui_basics/layout/juce_FlexItem.h

## Classes

struct | Margin
| Represents a margin. More...

## Public Types

enum class | AlignSelf { autoAlign , flexStart , flexEnd , center , stretch }
| Possible value for the alignSelf property. More...

## Public Member Functions

| FlexItem () noexcept
| Creates an item with default parameters, and zero size.
| FlexItem (float width, float height) noexcept
| Creates an item with the given size.
| FlexItem (float width, float height, Component &targetComponent) noexcept
| Creates an item with the given size and target Component.
| FlexItem (float width, float height, FlexBox &flexBoxToControl) noexcept
| Creates an item that represents an embedded FlexBox with a given size.
| FlexItem (Component &componentToControl) noexcept
| Creates an item with a given target Component.
| FlexItem (FlexBox &flexBoxToControl) noexcept
| Creates an item that represents an embedded FlexBox.
FlexItem | withFlex (float newFlexGrow) const noexcept
| Returns a copy of this object with a new flex-grow value.
FlexItem | withFlex (float newFlexGrow, float newFlexShrink) const noexcept
| Returns a copy of this object with new flex-grow and flex-shrink values.
FlexItem | withFlex (float newFlexGrow, float newFlexShrink, float newFlexBasis) const noexcept
| Returns a copy of this object with new flex-grow, flex-shrink and flex-basis values.
FlexItem | withWidth (float newWidth) const noexcept
| Returns a copy of this object with a new width.
FlexItem | withMinWidth (float newMinWidth) const noexcept
| Returns a copy of this object with a new minimum width.
FlexItem | withMaxWidth (float newMaxWidth) const noexcept
| Returns a copy of this object with a new maximum width.
FlexItem | withHeight (float newHeight) const noexcept
| Returns a copy of this object with a new height.
FlexItem | withMinHeight (float newMinHeight) const noexcept
| Returns a copy of this object with a new minimum height.
FlexItem | withMaxHeight (float newMaxHeight) const noexcept
| Returns a copy of this object with a new maximum height.
FlexItem | withMargin (Margin) const noexcept
| Returns a copy of this object with a new margin.
FlexItem | withOrder (int newOrder) const noexcept
| Returns a copy of this object with a new order.
FlexItem | withAlignSelf (AlignSelf newAlignSelf) const noexcept
| Returns a copy of this object with a new alignSelf value.

## Public Attributes

Rectangle< float > | currentBounds
| The item's current bounds.
Component * | associatedComponent = nullptr
| If this is non-null, it represents a Component whose bounds are controlled by this item.
FlexBox * | associatedFlexBox = nullptr
| If this is non-null, it represents a FlexBox whose bounds are controlled by this item.
int | order = 0
| Determines the order used to lay out items in their flex container.
float | flexGrow = 0.0f
| Specifies the flex grow factor of this item.
float | flexShrink = 1.0f
| Specifies the flex shrink factor of the item.
float | flexBasis = 0.0f
| Specifies the flex-basis of the item.
AlignSelf | alignSelf = AlignSelf::autoAlign
| This is the align-self property of the item.
float | width = (float) notAssigned
| The item's width.
float | minWidth = 0.0f
| The item's minimum width.
float | maxWidth = (float) notAssigned
| The item's maximum width.
float | height = (float) notAssigned
| The item's height.
float | minHeight = 0.0f
| The item's minimum height.
float | maxHeight = (float) notAssigned
| The item's maximum height.
Margin | margin
| The margin to leave around this item.

## Static Public Attributes

static const int | autoValue = -2
| This constant can be used for sizes to indicate that 'auto' mode should be used.
static const int | notAssigned = -1
| This constant can be used for sizes to indicate that no value has been set.

## Member Enums

## AlignSelf

enum class juce::FlexItem::AlignSelf

strong

Possible value for the alignSelf property.

Enumerator
autoAlign | Follows the FlexBox container's alignItems property.
flexStart | Item is aligned towards the start of the cross axis.
flexEnd | Item is aligned towards the end of the cross axis.
center | Item is aligned towards the center of the cross axis.
stretch | Item is stretched from start to end of the cross axis.

## Constructors and Destructors

## FlexItem() [1/6]

juce::FlexItem::FlexItem | ( |  | ) |

noexcept

Creates an item with default parameters, and zero size.

Referenced by FlexItem(), FlexItem(), FlexItem(), FlexItem(), FlexItem(), withAlignSelf(), withFlex(), withFlex(), withFlex(), withHeight(), withMargin(), withMaxHeight(), withMaxWidth(), withMinHeight(), withMinWidth(), withOrder(), and withWidth().

## FlexItem() [2/6]

juce::FlexItem::FlexItem | ( | float | width,
|  | float | height )

noexcept

Creates an item with the given size.

References FlexItem(), height, and width.

## FlexItem() [3/6]

juce::FlexItem::FlexItem | ( | float | width,
|  | float | height,
|  | Component & | targetComponent )

noexcept

Creates an item with the given size and target Component.

References FlexItem(), height, and width.

## FlexItem() [4/6]

juce::FlexItem::FlexItem | ( | float | width,
|  | float | height,
|  | FlexBox & | flexBoxToControl )

noexcept

Creates an item that represents an embedded FlexBox with a given size.

References FlexItem(), height, and width.

## FlexItem() [5/6]

juce::FlexItem::FlexItem | ( | Component & | componentToControl | ) |

noexcept

Creates an item with a given target Component.

References FlexItem().

## FlexItem() [6/6]

juce::FlexItem::FlexItem | ( | FlexBox & | flexBoxToControl | ) |

noexcept

Creates an item that represents an embedded FlexBox.

This class will not create a copy of the supplied flex box. You need to ensure that the life-time of flexBoxToControl is longer than the FlexItem.

References FlexItem().

## Member Functions

## withFlex() [1/3]

FlexItem juce::FlexItem::withFlex | ( | float | newFlexGrow | ) | const

noexcept

Returns a copy of this object with a new flex-grow value.

References FlexItem(), and withFlex().

Referenced by withFlex(), withFlex(), and withFlex().

## withFlex() [2/3]

FlexItem juce::FlexItem::withFlex | ( | float | newFlexGrow,
|  | float | newFlexShrink ) const

noexcept

Returns a copy of this object with new flex-grow and flex-shrink values.

References FlexItem(), and withFlex().

## withFlex() [3/3]

FlexItem juce::FlexItem::withFlex | ( | float | newFlexGrow,
|  | float | newFlexShrink,
|  | float | newFlexBasis ) const

noexcept

Returns a copy of this object with new flex-grow, flex-shrink and flex-basis values.

References FlexItem(), and withFlex().

## withWidth()

FlexItem juce::FlexItem::withWidth | ( | float | newWidth | ) | const

noexcept

Returns a copy of this object with a new width.

References FlexItem(), and withWidth().

Referenced by withWidth().

## withMinWidth()

FlexItem juce::FlexItem::withMinWidth | ( | float | newMinWidth | ) | const

noexcept

Returns a copy of this object with a new minimum width.

References FlexItem(), and withMinWidth().

Referenced by withMinWidth().

## withMaxWidth()

FlexItem juce::FlexItem::withMaxWidth | ( | float | newMaxWidth | ) | const

noexcept

Returns a copy of this object with a new maximum width.

References FlexItem(), and withMaxWidth().

Referenced by withMaxWidth().

## withHeight()

FlexItem juce::FlexItem::withHeight | ( | float | newHeight | ) | const

noexcept

Returns a copy of this object with a new height.

References FlexItem(), and withHeight().

Referenced by withHeight().

## withMinHeight()

FlexItem juce::FlexItem::withMinHeight | ( | float | newMinHeight | ) | const

noexcept

Returns a copy of this object with a new minimum height.

References FlexItem(), and withMinHeight().

Referenced by withMinHeight().

## withMaxHeight()

FlexItem juce::FlexItem::withMaxHeight | ( | float | newMaxHeight | ) | const

noexcept

Returns a copy of this object with a new maximum height.

References FlexItem(), and withMaxHeight().

Referenced by withMaxHeight().

## withMargin()

FlexItem juce::FlexItem::withMargin | ( | Margin |  | ) | const

noexcept

Returns a copy of this object with a new margin.

References FlexItem(), and withMargin().

Referenced by withMargin().

## withOrder()

FlexItem juce::FlexItem::withOrder | ( | int | newOrder | ) | const

noexcept

Returns a copy of this object with a new order.

References FlexItem(), and withOrder().

Referenced by withOrder().

## withAlignSelf()

FlexItem juce::FlexItem::withAlignSelf | ( | AlignSelf | newAlignSelf | ) | const

noexcept

Returns a copy of this object with a new alignSelf value.

References FlexItem(), and withAlignSelf().

Referenced by withAlignSelf().

## Member Data Documentation

## currentBounds

Rectangle<float> juce::FlexItem::currentBounds

The item's current bounds.

## associatedComponent

Component* juce::FlexItem::associatedComponent = nullptr

If this is non-null, it represents a Component whose bounds are controlled by this item.

## associatedFlexBox

FlexBox* juce::FlexItem::associatedFlexBox = nullptr

If this is non-null, it represents a FlexBox whose bounds are controlled by this item.

## order

int juce::FlexItem::order = 0

Determines the order used to lay out items in their flex container.

Elements are laid out in ascending order of thus order value. Elements with the same order value are laid out in the order in which they appear in the array.

## flexGrow

float juce::FlexItem::flexGrow = 0.0f

Specifies the flex grow factor of this item.

This indicates the amount of space inside the flex container the item should take up.

## flexShrink

float juce::FlexItem::flexShrink = 1.0f

Specifies the flex shrink factor of the item.

This indicates the rate at which the item shrinks if there is insufficient space in the container.

## flexBasis

float juce::FlexItem::flexBasis = 0.0f

Specifies the flex-basis of the item.

This is the initial main size of a flex item in the direction of flow. It determines the size of the content-box unless specified otherwise using box-sizing.

## alignSelf

AlignSelf juce::FlexItem::alignSelf = AlignSelf::autoAlign

This is the align-self property of the item.

This determines the alignment of the item along the cross-axis (perpendicular to the direction of flow).

## autoValue

const int juce::FlexItem::autoValue = -2

static

This constant can be used for sizes to indicate that 'auto' mode should be used.

## notAssigned

const int juce::FlexItem::notAssigned = -1

static

This constant can be used for sizes to indicate that no value has been set.

## width

float juce::FlexItem::width = (float) notAssigned

The item's width.

Referenced by FlexItem(), FlexItem(), and FlexItem().

## minWidth

float juce::FlexItem::minWidth = 0.0f

The item's minimum width.

## maxWidth

float juce::FlexItem::maxWidth = (float) notAssigned

The item's maximum width.

## height

float juce::FlexItem::height = (float) notAssigned

The item's height.

Referenced by FlexItem(), FlexItem(), and FlexItem().

## minHeight

float juce::FlexItem::minHeight = 0.0f

The item's minimum height.

## maxHeight

float juce::FlexItem::maxHeight = (float) notAssigned

The item's maximum height.

## margin

Margin juce::FlexItem::margin

The margin to leave around this item.

### Purchase

Get JUCE

### Discover

What's New in JUCE Features

### Learn

Documentaion Tutorials Made with JUCE Resources

### Support

JUCE Forum Newsletter Archive

### About

Contact Us JUCE Legal JUCE Licensing FAQ

### Events

Audio Developer Conference
© Raw Material Software Limited