tcMenu
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
tcgfx::ThemePropertiesBuilder Class Reference

#include <TcThemeBuilder.h>

Public Types

enum  ThemeLevel : uint8_t {
  THEME_GLOBAL , THEME_SUB , THEME_ITEM , THEME_ITEM_NEEDS_PROPS ,
  THEME_ITEM_NEEDS_GRID , THEME_ITEM_NEEDS_BOTH
}
 

Public Member Functions

 ThemePropertiesBuilder (TcThemeBuilder *themeBuilder)
 
ThemePropertiesBuilderwithBorder (const MenuBorder &b)
 
ThemePropertiesBuilderwithAdaFont (const GFXfont *font, int mag=1)
 
ThemePropertiesBuilderwithTcUnicodeFont (const UnicodeFont *font)
 
ThemePropertiesBuilderwithNativeFont (const void *data, uint8_t mag)
 
ThemePropertiesBuilderwithPadding (MenuPadding p)
 
ThemePropertiesBuilderwithSpacing (uint8_t s)
 
ThemePropertiesBuilderwithJustification (GridPosition::GridJustification j)
 
ThemePropertiesBuilderwithPalette (const color_t *p)
 
ThemePropertiesBuilderwithRowHeight (uint16_t height)
 
ThemePropertiesBuilderwithImageOfType (Coord size, DrawableIcon::IconType iconType, const uint8_t *regIcon, const uint8_t *selIcon, const color_t *palette=nullptr)
 
ThemePropertiesBuilderwithImageXbmp (Coord size, const uint8_t *regIcon, const uint8_t *selIcon=nullptr)
 
ThemePropertiesBuilderwithImage2bpp (Coord size, const color_t *imgPalette, const uint8_t *regIcon, const uint8_t *selIcon=nullptr)
 
ThemePropertiesBuilderwithImage4bpp (Coord size, const color_t *imgPalette, const uint8_t *regIcon, const uint8_t *selIcon=nullptr)
 
ThemePropertiesBuilderwithMonoBitmap (Coord size, const uint8_t *regIcon, const uint8_t *selIcon=nullptr)
 
ThemePropertiesBuilderwithDrawingMode (GridPosition::GridDrawingMode dm)
 
ThemePropertiesBuilderonRowCol (uint8_t actRow, uint8_t column, uint8_t numberOfCols)
 
ThemePropertiesBuilderonRow (uint8_t actualRow)
 
void apply ()
 

Protected Member Functions

void initForLevel (TcThemeBuilder *b, ItemDisplayProperties::ComponentType compType, ThemeLevel level, MenuItem *item=nullptr)
 
void needsProps ()
 
void needsGrid (bool propsOk)
 

Protected Attributes

friend TcThemeBuilder
 

Detailed Description

Represents a set of theme properties that can be applied at any level, if at the item level, this class can also create grid layout. You normally don't create these directly, instead one is normally provided from builder, using the various properties/override methods. This class uses builder syntax, so most methods other than apply can be chained together as the methods return a reference to the same object.

Member Function Documentation

◆ withBorder()

ThemePropertiesBuilder& tcgfx::ThemePropertiesBuilder::withBorder ( const MenuBorder b)
inline

Sets the border to something other than the default

Parameters
bthe border
Returns
reference to itself for chaining

◆ withAdaFont()

ThemePropertiesBuilder& tcgfx::ThemePropertiesBuilder::withAdaFont ( const GFXfont *  font,
int  mag = 1 
)
inline

Sets the font to be an adafruit font

Parameters
fontthe font to use
magan optional magnification (default 1)
Returns
reference to itself for chaining

◆ withTcUnicodeFont()

ThemePropertiesBuilder& tcgfx::ThemePropertiesBuilder::withTcUnicodeFont ( const UnicodeFont *  font)
inline

Sets the font to be a tcUnicode font

Parameters
fontthe font to use
Returns
reference to itself for chaining

◆ withNativeFont()

ThemePropertiesBuilder& tcgfx::ThemePropertiesBuilder::withNativeFont ( const void *  data,
uint8_t  mag 
)
inline

Sets the font to be a native font, IE any font whatsoever

Parameters
fontthe font to use
magthe magnification value
Returns
reference to itself for chaining

◆ withPadding()

ThemePropertiesBuilder& tcgfx::ThemePropertiesBuilder::withPadding ( MenuPadding  p)
inline

Sets the padding to a custom value

Parameters
pthe padding to apply
Returns
reference to itself for chaining

◆ withSpacing()

ThemePropertiesBuilder& tcgfx::ThemePropertiesBuilder::withSpacing ( uint8_t  s)
inline

Sets the spacing to a custom value

Parameters
sthe spacing to apply
Returns
reference to itself for chaining

◆ withJustification()

ThemePropertiesBuilder& tcgfx::ThemePropertiesBuilder::withJustification ( GridPosition::GridJustification  j)
inline

Sets the justification to be a custom value

Parameters
jthe justification to apply
Returns
reference to itself for chaining

◆ withPalette()

ThemePropertiesBuilder& tcgfx::ThemePropertiesBuilder::withPalette ( const color_t p)
inline

Sets the palette to a custom value, other than the default

Parameters
pthe padding to apply
Returns
reference to itself for chaining

◆ withRowHeight()

ThemePropertiesBuilder& tcgfx::ThemePropertiesBuilder::withRowHeight ( uint16_t  height)
inline

Sets the row height directly for a given menu item. Only applicable at the menu item level, and only needed if you don't want to use calculated heights.

Parameters
heightthe height to apply
Returns
reference to itself for chaining

◆ withImageOfType()

ThemePropertiesBuilder & ThemePropertiesBuilder::withImageOfType ( Coord  size,
DrawableIcon::IconType  iconType,
const uint8_t *  regIcon,
const uint8_t *  selIcon,
const color_t palette = nullptr 
)

A somewhat internal method that allows for all withImage.. calls to be simplified.

◆ withImageXbmp()

ThemePropertiesBuilder& tcgfx::ThemePropertiesBuilder::withImageXbmp ( Coord  size,
const uint8_t *  regIcon,
const uint8_t *  selIcon = nullptr 
)
inline

For item level use only, this sets the menu item to render as an image, instead of as text. Xbmp format is a byte packed array in LSB first order. IE (0,0) is MSB of byte 1.

Parameters
sizesize of the images provided
regIconthe icon when not active / edited
selIconthe icon when selected, IE active / edited
Returns
reference to itself for chaining

◆ withImage2bpp()

ThemePropertiesBuilder& tcgfx::ThemePropertiesBuilder::withImage2bpp ( Coord  size,
const color_t imgPalette,
const uint8_t *  regIcon,
const uint8_t *  selIcon = nullptr 
)
inline

For item level use only, this sets the menu item to render as an image with 2 bits per pixel, that is the each color index defined by each 2 bits maps to en entry in the palette.

Parameters
sizesize of the images provided
palettethe palette for each color index, must be color_t array of size 4
regIconthe icon when not active / edited
selIconthe icon when selected, IE active / edited
Returns
reference to itself for chaining

◆ withImage4bpp()

ThemePropertiesBuilder& tcgfx::ThemePropertiesBuilder::withImage4bpp ( Coord  size,
const color_t imgPalette,
const uint8_t *  regIcon,
const uint8_t *  selIcon = nullptr 
)
inline

For item level use only, this sets the menu item to render as an image with 4 bits per pixel, that is the each color index defined by each 4 bits maps to en entry in the palette.

Parameters
sizesize of the images provided
palettethe palette for each color index, must be color_t array of size 16
regIconthe icon when not active / edited
selIconthe icon when selected, IE active / edited
Returns
reference to itself for chaining

◆ withMonoBitmap()

ThemePropertiesBuilder& tcgfx::ThemePropertiesBuilder::withMonoBitmap ( Coord  size,
const uint8_t *  regIcon,
const uint8_t *  selIcon = nullptr 
)
inline

For item level use only, this sets the menu item to render as a mono bitmap, instead of as text. Mono bitmaps are byte packed arrays in MSB first order. IE (0,0) is LSB of byte 1.

Parameters
sizesize of the images provided
regIconthe icon when not active / edited
selIconthe icon when selected, IE active / edited
Returns
reference to itself for chaining

◆ withDrawingMode()

ThemePropertiesBuilder& tcgfx::ThemePropertiesBuilder::withDrawingMode ( GridPosition::GridDrawingMode  dm)
inline

Sets the drawing mode to use that overrides the default

Parameters
dmthe drawing mode
Returns
reference to itself for chaining

◆ onRowCol()

ThemePropertiesBuilder& tcgfx::ThemePropertiesBuilder::onRowCol ( uint8_t  actRow,
uint8_t  column,
uint8_t  numberOfCols 
)
inline

Sets the column index and number of columns on the row. Note that each entry on the row must properly set the same number of columns. If you don't need to specify the column, prefer using onRow(n) instead.

Parameters
actualRowthe row where the item should appear
numberOfColsthe number of columns across
columnthe column number
Returns
reference to itself for chaining

◆ onRow()

ThemePropertiesBuilder& tcgfx::ThemePropertiesBuilder::onRow ( uint8_t  actualRow)
inline

Sets the row that an item should appear on, used when there is a single column on the row. Use this when there is only one item on the row as the column will be defaulted to column 1 spanning the row.

Parameters
actualRowthe row number
Returns
reference to itself for chaining

◆ apply()

void ThemePropertiesBuilder::apply ( )

Call this after all other settings have been configured, this will actually put the newly created properties into the factory for later use. Important: Without calling this the changes will not be applied.


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