JUCE
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
Grid Class Referencefinal

Container that handles geometry for grid layouts (fixed columns and rows) using a set of declarative rules. More...

Classes

struct  Fr
 A fractional ratio integer. More...
 
struct  Px
 A size in pixels. More...
 
struct  TrackInfo
 Represents a track. More...
 

Public Types

enum  JustifyItems : int { JustifyItems::start = 0, JustifyItems::end, JustifyItems::center, JustifyItems::stretch }
 Possible values for the justifyItems property. More...
 
enum  AlignItems : int { AlignItems::start = 0, AlignItems::end, AlignItems::center, AlignItems::stretch }
 Possible values for the alignItems property. More...
 
enum  JustifyContent {
  JustifyContent::start, JustifyContent::end, JustifyContent::center, JustifyContent::stretch,
  JustifyContent::spaceAround, JustifyContent::spaceBetween, JustifyContent::spaceEvenly
}
 Possible values for the justifyContent property. More...
 
enum  AlignContent {
  AlignContent::start, AlignContent::end, AlignContent::center, AlignContent::stretch,
  AlignContent::spaceAround, AlignContent::spaceBetween, AlignContent::spaceEvenly
}
 Possible values for the alignContent property. More...
 
enum  AutoFlow { AutoFlow::row, AutoFlow::column, AutoFlow::rowDense, AutoFlow::columnDense }
 Possible values for the autoFlow property. More...
 

Public Member Functions

 Grid () noexcept
 Creates an empty Grid container with default parameters. More...
 
 ~Grid () noexcept
 Destructor. More...
 
void setGap (Px sizeInPixels) noexcept
 Sets the gap between rows and columns in pixels. More...
 
void performLayout (Rectangle< int >)
 Lays-out the grid's items within the given rectangle. More...
 
int getNumberOfColumns () const noexcept
 Returns the number of columns. More...
 
int getNumberOfRows () const noexcept
 Returns the number of rows. More...
 

Public Attributes

JustifyItems justifyItems = JustifyItems::stretch
 Specifies the alignment of content inside the items along the rows. More...
 
AlignItems alignItems = AlignItems::stretch
 Specifies the alignment of content inside the items along the columns. More...
 
JustifyContent justifyContent = JustifyContent::stretch
 Specifies the alignment of items along the rows. More...
 
AlignContent alignContent = AlignContent::stretch
 Specifies the alignment of items along the columns. More...
 
AutoFlow autoFlow = AutoFlow::row
 Specifies how the auto-placement algorithm places items. More...
 
Array< TrackInfotemplateColumns
 The set of column tracks to lay out. More...
 
Array< TrackInfotemplateRows
 The set of row tracks to lay out. More...
 
StringArray templateAreas
 Template areas. More...
 
TrackInfo autoRows
 The row track for auto dimension. More...
 
TrackInfo autoColumns
 The column track for auto dimension. More...
 
Px columnGap { 0 }
 The gap in pixels between columns. More...
 
Px rowGap { 0 }
 The gap in pixels between rows. More...
 
Array< GridItemitems
 The set of items to lay-out. More...
 

Detailed Description

Container that handles geometry for grid layouts (fixed columns and rows) using a set of declarative rules.

Implemented from the CSS Grid Layout specification as described at: https://css-tricks.com/snippets/css/complete-guide-grid/

See also
GridItem

Member Enumeration Documentation

◆ JustifyItems

enum Grid::JustifyItems : int
strong

Possible values for the justifyItems property.

Enumerator
start 

Content inside the item is justified towards the left.

end 

Content inside the item is justified towards the right.

center 

Content inside the item is justified towards the center.

stretch 

Content inside the item is stretched from left to right.

◆ AlignItems

enum Grid::AlignItems : int
strong

Possible values for the alignItems property.

Enumerator
start 

Content inside the item is aligned towards the top.

end 

Content inside the item is aligned towards the bottom.

center 

Content inside the item is aligned towards the center.

stretch 

Content inside the item is stretched from top to bottom.

◆ JustifyContent

enum Grid::JustifyContent
strong

Possible values for the justifyContent property.

Enumerator
start 

Items are justified towards the left of the container.

end 

Items are justified towards the right of the container.

center 

Items are justified towards the center of the container.

stretch 

Items are stretched from left to right of the container.

spaceAround 

Items are evenly spaced along the row with spaces between them.

spaceBetween 

Items are evenly spaced along the row with spaces around them.

spaceEvenly 

Items are evenly spaced along the row with even amount of spaces between them.

◆ AlignContent

enum Grid::AlignContent
strong

Possible values for the alignContent property.

Enumerator
start 

Items are aligned towards the top of the container.

end 

Items are aligned towards the bottom of the container.

center 

Items are aligned towards the center of the container.

stretch 

Items are stretched from top to bottom of the container.

spaceAround 

Items are evenly spaced along the column with spaces between them.

spaceBetween 

Items are evenly spaced along the column with spaces around them.

spaceEvenly 

Items are evenly spaced along the column with even amount of spaces between them.

◆ AutoFlow

enum Grid::AutoFlow
strong

Possible values for the autoFlow property.

Enumerator
row 

Fills the grid by adding rows of items.

column 

Fills the grid by adding columns of items.

rowDense 

Fills the grid by adding rows of items and attempts to fill in gaps.

columnDense 

Fills the grid by adding columns of items and attempts to fill in gaps.

Constructor & Destructor Documentation

◆ Grid()

Grid::Grid ( )
noexcept

Creates an empty Grid container with default parameters.

◆ ~Grid()

Grid::~Grid ( )
noexcept

Destructor.

Member Function Documentation

◆ setGap()

void Grid::setGap ( Px  sizeInPixels)
noexcept

Sets the gap between rows and columns in pixels.

◆ performLayout()

void Grid::performLayout ( Rectangle< int )

Lays-out the grid's items within the given rectangle.

◆ getNumberOfColumns()

int Grid::getNumberOfColumns ( ) const
noexcept

◆ getNumberOfRows()

int Grid::getNumberOfRows ( ) const
noexcept

Member Data Documentation

◆ justifyItems

JustifyItems Grid::justifyItems = JustifyItems::stretch

Specifies the alignment of content inside the items along the rows.

◆ alignItems

AlignItems Grid::alignItems = AlignItems::stretch

Specifies the alignment of content inside the items along the columns.

◆ justifyContent

JustifyContent Grid::justifyContent = JustifyContent::stretch

Specifies the alignment of items along the rows.

◆ alignContent

AlignContent Grid::alignContent = AlignContent::stretch

Specifies the alignment of items along the columns.

◆ autoFlow

AutoFlow Grid::autoFlow = AutoFlow::row

Specifies how the auto-placement algorithm places items.

◆ templateColumns

Array<TrackInfo> Grid::templateColumns

The set of column tracks to lay out.

◆ templateRows

Array<TrackInfo> Grid::templateRows

The set of row tracks to lay out.

◆ templateAreas

StringArray Grid::templateAreas

Template areas.

◆ autoRows

TrackInfo Grid::autoRows

The row track for auto dimension.

◆ autoColumns

TrackInfo Grid::autoColumns

The column track for auto dimension.

◆ columnGap

Px Grid::columnGap { 0 }

The gap in pixels between columns.

◆ rowGap

Px Grid::rowGap { 0 }

The gap in pixels between rows.

◆ items

Array<GridItem> Grid::items

The set of items to lay-out.


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