-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#236 theme builder not defaulting correctly, example updated to use.
- Loading branch information
Showing
9 changed files
with
146 additions
and
125 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
60 changes: 60 additions & 0 deletions
60
examples/arduino32/stm32DuinoDemo/ThemeMonoInverseBuilder.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#ifndef TCMENU_THEME_MONO_INVERSE | ||
#define TCMENU_THEME_MONO_INVERSE | ||
|
||
#include <graphics/TcThemeBuilder.h> | ||
|
||
color_t defaultItemPaletteMono[] = {1, 0, 1, 1}; | ||
color_t defaultTitlePaletteMono[] = {0, 1, 0, 0}; | ||
|
||
#define TITLE_PADDING 2 | ||
#define TITLE_SPACING 2 | ||
|
||
/** | ||
* This is one of the stock themes, you can modify it to meet your requirements, and it will not be updated by tcMenu | ||
* Designer unless you delete it. This sets up the fonts, spacing and padding for all items. | ||
* @param gr the graphical renderer | ||
* @param itemFont the font for items | ||
* @param titleFont the font for titles | ||
* @param needEditingIcons if editing icons are needed | ||
*/ | ||
void installMonoInverseTitleTheme(GraphicsDeviceRenderer& gr, const MenuFontDef& itemFont, const MenuFontDef& titleFont, | ||
bool needEditingIcons, BaseGraphicalRenderer::TitleMode titleMode, bool useUnicode) { | ||
|
||
// See https://tcmenu.github.io/documentation/arduino-libraries/tc-menu/themes/rendering-with-themes-icons-grids/ | ||
TcThemeBuilder themeBuilder(gr); | ||
themeBuilder.withSelectedColors(0, 2) | ||
.dimensionsFromRenderer() | ||
.withItemPadding(MenuPadding(1)) | ||
.withRenderingSettings(titleMode, false) | ||
.withPalette(defaultItemPaletteMono) | ||
.withNativeFont(itemFont.fontData, itemFont.fontMag) | ||
.withSpacing(1); | ||
|
||
if(needEditingIcons) { | ||
themeBuilder.withStandardLowResCursorIcons(); | ||
} | ||
|
||
if(useUnicode) { | ||
themeBuilder.enableTcUnicode(); | ||
} | ||
|
||
themeBuilder.defaultTitleProperties() | ||
.withNativeFont(titleFont.fontData, titleFont.fontMag) | ||
.withPalette(defaultTitlePaletteMono) | ||
.withPadding(MenuPadding(TITLE_PADDING)) | ||
.withJustification(tcgfx::GridPosition::JUSTIFY_TITLE_LEFT_WITH_VALUE) | ||
.withSpacing(TITLE_SPACING) | ||
.apply(); | ||
|
||
themeBuilder.defaultActionProperties() | ||
.withJustification(tcgfx::GridPosition::JUSTIFY_TITLE_LEFT_WITH_VALUE) | ||
.apply(); | ||
|
||
themeBuilder.defaultItemProperties() | ||
.withJustification(tcgfx::GridPosition::JUSTIFY_TITLE_LEFT_VALUE_RIGHT) | ||
.apply(); | ||
|
||
themeBuilder.apply(); | ||
} | ||
|
||
#endif //TCMENU_THEME_MONO_INVERSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters