11 #ifndef TCMENU_BASEGRAPHICALRENDERER_H
12 #define TCMENU_BASEGRAPHICALRENDERER_H
15 #include "GfxMenuConfig.h"
18 #define GFX_LAST_ROW_FIT_FLAG 0
19 #define GFX_USING_RAW_TOUCH 1
20 #define GFX_USING_TOUCH_INTERFACE 2
21 #define GFX_SLIDER_FOR_ANALOG 3
22 #define GFX_TITLE_ON_DISPLAY 4
23 #define GFX_EDIT_STATUS_ICONS_ENABLED 5
33 inline uint16_t
rowCol(
int row,
int col) {
34 return (row * 100) + col;
41 DrawingFlags(
bool drawAll,
bool active,
bool editing) : flags(0) {
42 bitWrite(flags, 0, drawAll);
43 bitWrite(flags, 1, active);
44 bitWrite(flags, 2, editing);
49 bool isDrawingAll()
const {
return bitRead(flags, 0); }
50 bool isActive()
const {
return bitRead(flags, 1); }
51 bool isEditing()
const {
return bitRead(flags, 2); }
73 const GridPosition &getPosition() {
return thePosition; }
77 uint16_t getKey()
const {
return rowCol(thePosition.getRow(), thePosition.getGridPosition()); }
79 uint16_t getHeight() {
80 return thePosition.getGridHeight() != 0 ? thePosition.getGridHeight() : properties->getRequiredHeight();
83 MenuItem *getMenuItem() {
return menuItem; }
96 class BaseGraphicalRenderer;
104 void navigationHasChanged(
MenuItem *newItem,
bool completelyReset)
override;
110 uint8_t currentOffset;
113 CachedDrawingLocation(uint16_t startY, uint8_t currentOffset) : startY(startY), currentOffset(currentOffset) {}
117 uint16_t getStartY()
const {
121 uint8_t getCurrentOffset()
const {
122 return currentOffset;
165 const char *pgmTitle;
168 BtreeList<uint16_t, GridPositionRowCacheEntry> itemOrderByRow;
170 uint16_t width, height;
216 void setRawTouchMode(
bool rawTouch) { bitWrite(flags, GFX_USING_RAW_TOUCH, rawTouch); }
257 serlogF3(SER_TCMENU_INFO,
"Set dimensions: ", w, h);
380 int heightOfRow(
int row,
bool includeSpace=
false);
382 bool drawTheMenuItems(
int startRow,
int startY,
bool drawEveryLine);
386 void recalculateDisplayOrder(
MenuItem *pItem,
bool safeMode);
388 void redrawAllWidgets(
bool forceRedraw);
390 bool areRowsOutOfOrder();
392 int calculateHeightTo(
int index,
MenuItem *pItem);
398 int skipRow(
int row);
421 void preparePropertiesFromConfig(ConfigurableItemDisplayPropertiesFactory &factory,
422 const ColorGfxMenuConfig<const void *> *gfxConfig,
int titleHeight,
uint16_t rowCol(int row, int col)
Definition: BaseGraphicalRenderer.h:33
int analogRangeToScreen(AnalogMenuItem *item, int screenWidth)
Definition: BaseGraphicalRenderer.h:408
LayoutMode
Definition: BaseGraphicalRenderer.h:89
@ LAYOUT_CARD_SIDEWAYS
Definition: BaseGraphicalRenderer.h:93
@ LAYOUT_VERTICAL_DEFAULT
Definition: BaseGraphicalRenderer.h:91
The base definitions and classes shared by all TcMenu renderers.
uint32_t color_t
Definition: DrawingPrimitives.h:29
Definition: BaseDialog.h:102
Definition: BaseGraphicalRenderer.h:131
bool isUseSliderForAnalog() const
Definition: BaseGraphicalRenderer.h:227
int findItemIndex(MenuItem *root, MenuItem *toFind) override
Definition: BaseGraphicalRenderer.cpp:467
virtual void drawMenuItem(GridPositionRowCacheEntry *entry, Coord where, Coord areaSize, const DrawingFlags &drawFlags)=0
void setUseSliderForAnalog(bool useSlider)
Definition: BaseGraphicalRenderer.h:195
TitleMode
Definition: BaseGraphicalRenderer.h:136
@ TITLE_FIRST_ROW
Definition: BaseGraphicalRenderer.h:140
@ NO_TITLE
Definition: BaseGraphicalRenderer.h:138
@ TITLE_ALWAYS
Definition: BaseGraphicalRenderer.h:142
void setEditStatusIconsEnabled(bool ena)
Definition: BaseGraphicalRenderer.h:223
int getWidth() const
Definition: BaseGraphicalRenderer.h:344
int getHeight() const
Definition: BaseGraphicalRenderer.h:349
virtual ItemDisplayPropertiesFactory & getDisplayPropertiesFactory()=0
void rootHasChanged(MenuItem *newItem)
Definition: BaseGraphicalRenderer.cpp:291
RenderDrawingCommand
Definition: BaseGraphicalRenderer.h:147
@ DRAW_COMMAND_ENDED
Definition: BaseGraphicalRenderer.h:153
@ DRAW_COMMAND_START
Definition: BaseGraphicalRenderer.h:151
@ DRAW_COMMAND_CLEAR
Definition: BaseGraphicalRenderer.h:149
void setRawTouchMode(bool rawTouch)
Definition: BaseGraphicalRenderer.h:216
void initialise() override
Definition: BaseGraphicalRenderer.cpp:524
bool isLastRowExactFit() const
Definition: BaseGraphicalRenderer.h:239
uint8_t itemCount(MenuItem *root, bool) override
Definition: BaseGraphicalRenderer.cpp:457
void displayPropertiesHaveChanged()
Definition: BaseGraphicalRenderer.cpp:529
void render() override
Definition: BaseGraphicalRenderer.cpp:12
MenuItem * getCurrentRendererRoot()
Definition: BaseGraphicalRenderer.h:160
virtual void drawingCommand(RenderDrawingCommand command)=0
GridPositionRowCacheEntry * findMenuEntryAndDimensions(const Coord &screenPos, Coord &localStart, Coord &localSize)
Definition: BaseGraphicalRenderer.cpp:114
BaseDialog * getDialog() override
Definition: BaseGraphicalRenderer.cpp:498
void setDisplayDimensions(int w, int h)
Definition: BaseGraphicalRenderer.h:256
void setLastRowExactFit(bool exact)
Definition: BaseGraphicalRenderer.h:211
bool isRawTouchMode() const
Definition: BaseGraphicalRenderer.h:243
virtual void drawWidget(Coord where, TitleWidget *widget, color_t colorFg, color_t colorBg)=0
uint8_t getDisplayNumber()
Definition: BaseGraphicalRenderer.h:189
void setHasTouchInterface(bool hasTouch)
Definition: BaseGraphicalRenderer.h:200
virtual LayoutMode getLayoutMode(MenuItem *rootItem)
Definition: BaseGraphicalRenderer.h:265
MenuItem * getMenuItemAtIndex(MenuItem *currentRoot, uint8_t idx) override
Definition: BaseGraphicalRenderer.cpp:475
virtual void subMenuRender(MenuItem *rootItem, uint8_t &locRedrawMode, bool &forceDrawWidgets)
Definition: BaseGraphicalRenderer.cpp:92
uint8_t setActiveItem(MenuItem *item) override
Definition: BaseGraphicalRenderer.cpp:48
bool isHasTouchInterface() const
Definition: BaseGraphicalRenderer.h:231
bool isTitleOnDisplay() const
Definition: BaseGraphicalRenderer.h:235
void setTitleOnDisplay(bool titleOn)
Definition: BaseGraphicalRenderer.h:205
virtual void fillWithBackgroundTo(int endPoint)=0
void setDisplayNumber(uint8_t displayNum)
Definition: BaseGraphicalRenderer.h:184
bool isEditStatusIconEnabled() const
Definition: BaseGraphicalRenderer.h:247
Definition: BaseGraphicalRenderer.h:107
Definition: BaseGraphicalRenderer.h:37
Definition: GfxMenuConfig.h:69
@ JUSTIFY_TITLE_LEFT_VALUE_RIGHT
Definition: GfxMenuConfig.h:107
GridDrawingMode
Definition: GfxMenuConfig.h:74
@ DRAW_TEXTUAL_ITEM
Definition: GfxMenuConfig.h:76
Definition: BaseGraphicalRenderer.h:60
Definition: GfxMenuConfig.h:358
Definition: GfxMenuConfig.h:245
ComponentType
Definition: GfxMenuConfig.h:260
Definition: BaseGraphicalRenderer.h:99
Definition: MenuHistoryNavigator.h:22
Definition: DrawingPrimitives.h:123