#include <TcThemeBuilder.h>
A theme builder class that is used to simply create themes for tcMenu GraphicalDisplayRenderer class. It allows most graphical configurations to be applied without the complexities of directly using the item display factory. This class uses a builder approach where most methods can be chained, because they return references to this class.
|
inlineexplicit |
Creates a theme builder by providing the renderer to use with it.
renderer | the renderer to use, must be a GraphicsDeviceRenderer |
|
inline |
Set the colours to be used for the background and foreground when an item is selected.
bg | the background color |
fg | the foreground color |
|
inline |
Configure the default font as an adafruit font, normally for use either when using an Adafruit_GFX based library, or tcUnicode which also supports Adafruit font rendering.
font | the adafruit font |
mag | the magnification factor - defaults to 1. |
|
inline |
Configure the default font as a tcUnicode font, this is only supported when tcUnicode is enabled.
font | the tcUnicode font |
|
inline |
Configure the default font as a native font consulting the plugin documentation for the chosen display and library.
font | the native font |
mag | the native mag value |
TcThemeBuilder & TcThemeBuilder::enableTcUnicode | ( | ) |
Turn on tcUnicode drawing support if it is not already turned on. This means that instead of using native fonts, the rendering engine will use TcUnicode for all text drawing. This is seamless from the rendering perspective, but requires that you use fonts supported by TcUnicode, these are Adafruit or TcUnicode fonts.
|
inline |
Prefer to use enableTcUnicode() instead
TcThemeBuilder & TcThemeBuilder::withCursorIconsXbmp | ( | Coord | size, |
const uint8_t * | editIcon, | ||
const uint8_t * | activeIcon | ||
) |
Provide custom cursor icons that are used when an item is selected or edited. Use this when you don't want to use the standard cursor icons. Note that the two icons must be the same size. Cursor icons are the visual cues, IE the active arrow and the editing icon usually on the left of an item.
size | the size of the icons |
editIcon | the edit icon in XBM form |
activeIcon | the active icon in XBM form |
TcThemeBuilder & TcThemeBuilder::withStandardLowResCursorIcons | ( | ) |
Use the standard lower resolution cursor icons suitable for OLED and similar resolution displays. Cursor icons are the visual cues, IE the active arrow and the editing icon usually on the left of an item.
TcThemeBuilder & TcThemeBuilder::withStandardMedResCursorIcons | ( | ) |
Use the standard medium resolution cursor icons suitable for larger TFT and higher resolution displays Cursor icons are the visual cues, IE the active arrow and the editing icon usually on the left of an item.
|
inline |
Set the standard spacing that will be used by default unless overridden
spacing | the standard item spacing |
|
inline |
Set the item padding that will be used by default, unless overridden
padding | the padding to apply |
|
inline |
Set the title spacing that will be used by default, unless overridden
padding | the padding to apply |
|
inline |
Get access to default theme properties for regular items.
|
inline |
Get access to default theme properties for title items.
|
inline |
Get access to default theme properties for action items.
ThemePropertiesBuilder & TcThemeBuilder::menuItemOverride | ( | MenuItem & | item | ) |
Get access to theme properties for a specific menu item, with this you can change how an item renders, and even apply different grid settings. This guesses the component type in most cases but if you want to force a particular component type see the override method with the second parameter.
item | the menu item to override drawing |
ThemePropertiesBuilder & TcThemeBuilder::menuItemOverride | ( | MenuItem & | item, |
ItemDisplayProperties::ComponentType | componentType | ||
) |
Get access to theme properties for a specific menu item, with this you can change how an item renders, and even apply different grid settings. This specifically sets the component type for situations where it cannot be easily guessed.
item | the menu item to override drawing. |
componentType | one of COMPTYPE_TITLE , COMPTYPE_ITEM , COMPTYPE_ACTION |
|
inline |
Get access to theme properties for a sub menu, with this you can change how all items in that submenu render This applies to regular items
item | the sub menu item |
|
inline |
Get access to theme properties for a sub menu, with this you can change how all items in that submenu render This applies to action items
item | the sub menu item |
|
inline |
Get access to theme properties for a sub menu, with this you can change how all items in that submenu render This applies to title items
item | the sub menu item |
TcThemeBuilder & TcThemeBuilder::withPalette | ( | const color_t * | cols | ) |
Set the default palette that will be used unless overrridden
cols | the colors to use, must be 4 entry array. |
|
inline |
Set up the core rendering settings, that is the way the title should be drawn, and also if analog sliders should be used to represent analog items.
mode | how the title should be drawing, one of BaseGraphicalRenderer::TitleMode enum values. |
useAnalogSliders | true to use sliders, otherwise false |
TcThemeBuilder & TcThemeBuilder::dimensionsFromRenderer | ( | ) |
Apply the dimensions from the device drawable to the renderer, this takes the device specific size and applies it to the renderer.
TcThemeBuilder & TcThemeBuilder::manualDimensions | ( | int | x, |
int | y | ||
) |
Manually set the dimensions of the display, for cases where dimensionsFromRenderer
does not work.
x | the width |
y | the height |
TcThemeBuilder & TcThemeBuilder::enableCardLayoutWithXbmImages | ( | Coord | iconSize, |
const uint8_t * | leftIcon, | ||
const uint8_t * | rightIcon, | ||
bool | isMono | ||
) |
Use this to enable card layout for the root menu, and configure the icons that will be used for left and right buttons.
iconSize | the size of the left and right icons |
leftIcon | the icon for left |
rightIcon | the icon for right |
isMono | true if mono, otherwise false |
TcThemeBuilder & TcThemeBuilder::setMenuAsCard | ( | SubMenuItem & | item, |
bool | on | ||
) |
Toggle card layout on and off for a given submenu.
item | the sub menu to turn on/off |
on | the status for that submenu |
void TcThemeBuilder::apply | ( | ) |
Call after you've finished configuring your theme, this forces a refresh and ensures it presents properly.