Skyward boardcore
Loading...
Searching...
No Matches
Boardcore::GridLayout Class Reference

Displays childs in a numRows*numCols grid. More...

#include <GridLayout.h>

Inheritance diagram for Boardcore::GridLayout:
Collaboration diagram for Boardcore::GridLayout:

Public Types

using GridPosition = std::pair<uint8_t, uint8_t>
 
- Public Types inherited from Boardcore::View
using OnInteractionListener = std::function<void(View*, Interaction)>
 

Public Member Functions

 GridLayout (uint8_t numRows, uint8_t numCols, short int spacing=0)
 Creates a new GridLayout.
 
virtual ~GridLayout ()
 
void setCell (View *child, unsigned int position)
 
void setCell (View *child, uint8_t row, uint8_t col)
 
ViewgetCell (uint8_t row, uint8_t col)
 
ViewgetCell (unsigned int position)
 
void clearCell (View *child)
 
void setDrawBorder (bool drawBorder, mxgui::Color color=mxgui::white)
 Wether to draw the borders of each cell or not.
 
void setBounds (Bounds bounds) override
 Sets the bounds in which the view will be drawn.
 
virtual void draw (mxgui::DrawingContext &context) override
 Draw the view in its bounds.
 
uint8_t getRows ()
 
uint8_t getCols ()
 
std::vector< View * > getChilds () override
 Returns the list of childs.
 
- Public Member Functions inherited from Boardcore::View
 View ()
 
virtual ~View ()
 
Bounds getBounds ()
 
void invalidate ()
 Signal that what has been previously drawn is now invalid and has to be redrawn.
 
void invalidateTree ()
 Invalidate the view tree which has this view as a root.
 
virtual void setBackgroundColor (mxgui::Color color)
 
virtual mxgui::Color getBackgroundColor ()
 
void setSelectedColor (mxgui::Color color)
 
void setSelectable (bool selectable)
 
bool isSelectable ()
 
void setSelected (bool selected)
 
bool isSelected ()
 
void addOnInteractionListener (OnInteractionListener listener)
 
virtual void performInteraction (Interaction action)
 

Additional Inherited Members

- Protected Member Functions inherited from Boardcore::View
bool isInvalidated ()
 

Detailed Description

Displays childs in a numRows*numCols grid.

Definition at line 37 of file GridLayout.h.

Member Typedef Documentation

◆ GridPosition

using Boardcore::GridLayout::GridPosition = std::pair<uint8_t, uint8_t>

Definition at line 40 of file GridLayout.h.

Constructor & Destructor Documentation

◆ GridLayout()

Boardcore::GridLayout::GridLayout ( uint8_t numRows,
uint8_t numCols,
short int spacing = 0 )
inline

Creates a new GridLayout.

Parameters
numRowsNumber of rows
numColsNumber of columns
spacingDistance in pixels between each cell

Definition at line 49 of file GridLayout.h.

◆ ~GridLayout()

virtual Boardcore::GridLayout::~GridLayout ( )
inlinevirtual

Definition at line 54 of file GridLayout.h.

Member Function Documentation

◆ clearCell()

void Boardcore::GridLayout::clearCell ( View * child)
inline

Definition at line 93 of file GridLayout.h.

◆ draw()

virtual void Boardcore::GridLayout::draw ( mxgui::DrawingContext & dc)
inlineoverridevirtual

Draw the view in its bounds.

Parameters
dcReference to a drawingcontext

Reimplemented from Boardcore::View.

Definition at line 128 of file GridLayout.h.

◆ getCell() [1/2]

View * Boardcore::GridLayout::getCell ( uint8_t row,
uint8_t col )
inline

Definition at line 75 of file GridLayout.h.

◆ getCell() [2/2]

View * Boardcore::GridLayout::getCell ( unsigned int position)
inline

Definition at line 85 of file GridLayout.h.

◆ getChilds()

std::vector< View * > Boardcore::GridLayout::getChilds ( )
inlineoverridevirtual

Returns the list of childs.

Returns
std::vector<View*>

Reimplemented from Boardcore::View.

Definition at line 159 of file GridLayout.h.

◆ getCols()

uint8_t Boardcore::GridLayout::getCols ( )
inline

Definition at line 157 of file GridLayout.h.

◆ getRows()

uint8_t Boardcore::GridLayout::getRows ( )
inline

Definition at line 155 of file GridLayout.h.

◆ setBounds()

void Boardcore::GridLayout::setBounds ( Bounds bounds)
inlineoverridevirtual

Sets the bounds in which the view will be drawn.

Reimplemented from Boardcore::View.

Definition at line 121 of file GridLayout.h.

◆ setCell() [1/2]

void Boardcore::GridLayout::setCell ( View * child,
uint8_t row,
uint8_t col )
inline

Definition at line 64 of file GridLayout.h.

◆ setCell() [2/2]

void Boardcore::GridLayout::setCell ( View * child,
unsigned int position )
inline

Definition at line 56 of file GridLayout.h.

◆ setDrawBorder()

void Boardcore::GridLayout::setDrawBorder ( bool drawBorder,
mxgui::Color color = mxgui::white )
inline

Wether to draw the borders of each cell or not.

Parameters
drawBorderTrue: draw the border
colorBorder color

Definition at line 113 of file GridLayout.h.


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