11 #ifndef TCCLIBSDK_TCTHEMEBUILDER_H
12 #define TCCLIBSDK_TCTHEMEBUILDER_H
14 #include "GfxMenuConfig.h"
17 #define COL_COUNT_FLAG_BULK_MODE 0x80
30 enum ThemeLevel : uint8_t {
31 THEME_GLOBAL, THEME_SUB, THEME_ITEM, THEME_ITEM_NEEDS_PROPS, THEME_ITEM_NEEDS_GRID, THEME_ITEM_NEEDS_BOTH
37 const void* fontData{};
41 uint16_t gridHeight {};
43 ThemeLevel currentLevel = THEME_GLOBAL;
73 fontMag = internal_min(1, mag);
143 memcpy(palette, p,
sizeof(palette));
163 const uint8_t* selIcon,
const color_t* palette =
nullptr);
242 colCount = numberOfCols;
269 if(currentLevel == THEME_SUB || currentLevel == THEME_GLOBAL)
return;
270 if(currentLevel == THEME_ITEM) currentLevel = THEME_ITEM_NEEDS_PROPS;
271 else currentLevel = THEME_ITEM_NEEDS_BOTH;
274 void needsGrid(
bool propsOk) {
275 if(currentLevel == THEME_SUB || currentLevel == THEME_GLOBAL)
return;
276 if(currentLevel == THEME_ITEM_NEEDS_PROPS && propsOk)
return;
277 if(currentLevel == THEME_ITEM) currentLevel = THEME_ITEM_NEEDS_GRID;
278 else currentLevel = THEME_ITEM_NEEDS_BOTH;
281 friend TcThemeBuilder;
295 color_t defaultPalette[4] = {};
298 const void *fontData;
300 uint8_t defaultSpacing;
307 propertiesBuilder(this) {
308 auto titleDef = factory.
configFor(
nullptr, ItemDisplayProperties::COMPTYPE_TITLE);
309 globalTitlePadding = titleDef->getPadding();
310 auto itemDef = factory.
configFor(
nullptr, ItemDisplayProperties::COMPTYPE_ITEM);
311 memcpy(defaultPalette, itemDef->getPalette(),
sizeof defaultPalette);
312 globalItemPadding = itemDef->getPadding();
313 fontData = itemDef->getFont();
314 fontMag = itemDef->getFontMagnification();
315 defaultSpacing = itemDef->getSpaceAfter();
338 fontMag = internal_min(1, mag);
411 defaultSpacing = spacing;
421 globalItemPadding = padding;
431 globalTitlePadding = padding;
440 propertiesBuilder.initForLevel(
this, ItemDisplayProperties::COMPTYPE_ITEM, ThemePropertiesBuilder::THEME_GLOBAL);
441 return propertiesBuilder;
449 propertiesBuilder.initForLevel(
this, ItemDisplayProperties::COMPTYPE_TITLE, ThemePropertiesBuilder::THEME_GLOBAL);
450 return propertiesBuilder;
458 propertiesBuilder.initForLevel(
this, ItemDisplayProperties::COMPTYPE_ACTION, ThemePropertiesBuilder::THEME_GLOBAL);
459 return propertiesBuilder;
488 propertiesBuilder.initForLevel(
this, ItemDisplayProperties::COMPTYPE_ITEM, ThemePropertiesBuilder::THEME_SUB, &item);
489 return propertiesBuilder;
499 propertiesBuilder.initForLevel(
this, ItemDisplayProperties::COMPTYPE_ACTION, ThemePropertiesBuilder::THEME_SUB, &item);
500 return propertiesBuilder;
510 propertiesBuilder.initForLevel(
this, ItemDisplayProperties::COMPTYPE_TITLE, ThemePropertiesBuilder::THEME_SUB, &item);
511 return propertiesBuilder;
529 renderer.setTitleMode(mode);
577 return type == ItemDisplayProperties::COMPTYPE_TITLE ? globalTitlePadding : globalItemPadding;
580 uint8_t getDefaultSpacing()
const {
581 return defaultSpacing;
584 GraphicsDeviceRenderer& getRenderer() {
588 const color_t* getDefaultPalette() {
589 return defaultPalette;
592 const void* getDefaultFontData() {
596 uint8_t getDefaultFontMag()
const {
uint32_t color_t
Definition: DrawingPrimitives.h:29
the interface that all graphics devices should implement to do the actual graphics rendering.
void setUseSliderForAnalog(bool useSlider)
Definition: BaseGraphicalRenderer.h:195
TitleMode
Definition: BaseGraphicalRenderer.h:136
Definition: GfxMenuConfig.h:479
ItemDisplayProperties * configFor(MenuItem *pItem, ItemDisplayProperties::ComponentType compType) override
Definition: GfxMenuConfig.cpp:66
void setSelectedColors(color_t background, color_t text)
Definition: GfxMenuConfig.h:641
IconType
Definition: DrawingPrimitives.h:154
@ ICON_XBITMAP
Definition: DrawingPrimitives.h:156
@ ICON_MONO
Definition: DrawingPrimitives.h:158
@ ICON_PALLETE_2BPP
Definition: DrawingPrimitives.h:161
@ ICON_PALLETE_4BPP
Definition: DrawingPrimitives.h:164
Definition: GraphicsDeviceRenderer.h:59
GridJustification
Definition: GfxMenuConfig.h:93
@ JUSTIFY_TITLE_LEFT_VALUE_RIGHT
Definition: GfxMenuConfig.h:107
GridDrawingMode
Definition: GfxMenuConfig.h:74
ComponentType
Definition: GfxMenuConfig.h:260
Definition: TcThemeBuilder.h:290
ThemePropertiesBuilder & defaultActionProperties()
Definition: TcThemeBuilder.h:457
TcThemeBuilder & withSpacing(uint8_t spacing)
Definition: TcThemeBuilder.h:410
TcThemeBuilder & withRenderingSettings(BaseGraphicalRenderer::TitleMode mode, bool useAnalogSliders)
Definition: TcThemeBuilder.h:528
TcThemeBuilder & withSelectedColors(color_t bg, color_t fg)
Definition: TcThemeBuilder.h:324
TcThemeBuilder & withStandardLowResCursorIcons()
Definition: TcThemeBuilder.cpp:131
TcThemeBuilder & withPalette(const color_t *cols)
Definition: TcThemeBuilder.cpp:97
ThemePropertiesBuilder & defaultItemProperties()
Definition: TcThemeBuilder.h:439
ThemePropertiesBuilder & menuItemOverride(MenuItem &item)
Definition: TcThemeBuilder.cpp:102
TcThemeBuilder & enableTcUnicode()
Definition: TcThemeBuilder.cpp:139
TcThemeBuilder & dimensionsFromRenderer()
Definition: TcThemeBuilder.cpp:144
ThemePropertiesBuilder & submenuPropertiesItemOverride(SubMenuItem &item)
Definition: TcThemeBuilder.h:487
TcThemeBuilder(GraphicsDeviceRenderer &renderer)
Definition: TcThemeBuilder.h:306
TcThemeBuilder & withTcUnicodeFont(const UnicodeFont *font)
Definition: TcThemeBuilder.h:347
TcThemeBuilder & withAdaFont(const GFXfont *font, int mag=1)
Definition: TcThemeBuilder.h:336
TcThemeBuilder & enableCardLayoutWithXbmImages(Coord iconSize, const uint8_t *leftIcon, const uint8_t *rightIcon, bool isMono)
Definition: TcThemeBuilder.cpp:119
TcThemeBuilder & manualDimensions(int x, int y)
Definition: TcThemeBuilder.cpp:150
TcThemeBuilder & enablingTcUnicode()
Definition: TcThemeBuilder.h:378
ThemePropertiesBuilder & submenuPropertiesActionOverride(SubMenuItem &item)
Definition: TcThemeBuilder.h:498
TcThemeBuilder & withStandardMedResCursorIcons()
Definition: TcThemeBuilder.cpp:135
TcThemeBuilder & withCursorIconsXbmp(Coord size, const uint8_t *editIcon, const uint8_t *activeIcon)
Definition: TcThemeBuilder.cpp:87
void apply()
Definition: TcThemeBuilder.cpp:93
TcThemeBuilder & withNativeFont(const void *data, uint8_t mag)
Definition: TcThemeBuilder.h:360
TcThemeBuilder & withTitlePadding(MenuPadding padding)
Definition: TcThemeBuilder.h:430
ThemePropertiesBuilder & defaultTitleProperties()
Definition: TcThemeBuilder.h:448
ThemePropertiesBuilder & submenuPropertiesTitleOverride(SubMenuItem &item)
Definition: TcThemeBuilder.h:509
TcThemeBuilder & setMenuAsCard(SubMenuItem &item, bool on)
Definition: TcThemeBuilder.cpp:126
TcThemeBuilder & withItemPadding(MenuPadding padding)
Definition: TcThemeBuilder.h:420
Definition: TcThemeBuilder.h:28
ThemePropertiesBuilder & withPadding(MenuPadding p)
Definition: TcThemeBuilder.h:108
ThemePropertiesBuilder & withRowHeight(uint16_t height)
Definition: TcThemeBuilder.h:153
ThemePropertiesBuilder & withSpacing(uint8_t s)
Definition: TcThemeBuilder.h:119
ThemePropertiesBuilder & onRowCol(uint8_t actRow, uint8_t column, uint8_t numberOfCols)
Definition: TcThemeBuilder.h:239
ThemePropertiesBuilder & withImage2bpp(Coord size, const color_t *imgPalette, const uint8_t *regIcon, const uint8_t *selIcon=nullptr)
Definition: TcThemeBuilder.h:187
ThemePropertiesBuilder & withBorder(const MenuBorder &b)
Definition: TcThemeBuilder.h:59
ThemePropertiesBuilder & withImage4bpp(Coord size, const color_t *imgPalette, const uint8_t *regIcon, const uint8_t *selIcon=nullptr)
Definition: TcThemeBuilder.h:201
ThemePropertiesBuilder & withNativeFont(const void *data, uint8_t mag)
Definition: TcThemeBuilder.h:96
ThemePropertiesBuilder & withImageOfType(Coord size, DrawableIcon::IconType iconType, const uint8_t *regIcon, const uint8_t *selIcon, const color_t *palette=nullptr)
Definition: TcThemeBuilder.cpp:80
ThemePropertiesBuilder & withPalette(const color_t *p)
Definition: TcThemeBuilder.h:141
ThemePropertiesBuilder & withTcUnicodeFont(const UnicodeFont *font)
Definition: TcThemeBuilder.h:83
ThemePropertiesBuilder & withJustification(GridPosition::GridJustification j)
Definition: TcThemeBuilder.h:130
ThemePropertiesBuilder & withMonoBitmap(Coord size, const uint8_t *regIcon, const uint8_t *selIcon=nullptr)
Definition: TcThemeBuilder.h:214
ThemePropertiesBuilder & onRow(uint8_t actualRow)
Definition: TcThemeBuilder.h:252
ThemePropertiesBuilder & withImageXbmp(Coord size, const uint8_t *regIcon, const uint8_t *selIcon=nullptr)
Definition: TcThemeBuilder.h:173
ThemePropertiesBuilder & withDrawingMode(GridPosition::GridDrawingMode dm)
Definition: TcThemeBuilder.h:225
void apply()
Definition: TcThemeBuilder.cpp:8
ThemePropertiesBuilder & withAdaFont(const GFXfont *font, int mag=1)
Definition: TcThemeBuilder.h:71
Definition: DrawingPrimitives.h:123