tcMenu
Loading...
Searching...
No Matches
GraphicsDeviceRenderer.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 https://www.thecoderscorner.com (Dave Cherry).
3 * This product is licensed under an Apache license, see the LICENSE file in the top-level directory.
4 */
5
11#ifndef TCLIBRARYDEV_GRAPHICSDEVICERENDERER_H
12#define TCLIBRARYDEV_GRAPHICSDEVICERENDERER_H
13
14#include <PlatformDetermination.h>
15#include "../tcMenu.h"
17#include "GfxMenuConfig.h"
18#include "DeviceDrawable.h"
20#include "TcDrawableButton.h"
22
23#ifndef MINIMUM_CURSOR_SIZE
24#define MINIMUM_CURSOR_SIZE 6
25#endif // MINIMUM_CURSOR_SIZE
26
27namespace tcgfx {
28
29 class CardLayoutPane;
30
35 class DrawableTextPlotPipeline : public TextPlotPipeline {
36 private:
37 DeviceDrawable *drawable;
38 Coord cursor;
39 public:
40 explicit DrawableTextPlotPipeline(DeviceDrawable *drawable) : drawable(drawable) {}
41 void drawPixel(uint16_t x, uint16_t y, uint32_t color) override {
42 drawable->setDrawColor(color);
43 drawable->drawPixel(x, y);
44 }
45 void setCursor(const Coord& where) override { cursor = where; }
46 Coord getCursor() override { return cursor; }
47 Coord getDimensions() override { return drawable->getDisplayDimensions(); }
48 };
49
60 private:
61 DeviceDrawable* rootDrawable;
64 CardLayoutPane* cardLayoutPane = nullptr;
65 bool redrawNeeded = false;
66 public:
67 GraphicsDeviceRenderer(int bufferSize, const char *appTitle, DeviceDrawable *drawable);
68
72
73 void fillWithBackgroundTo(int endPoint) override;
74
82 int heightForFontPadding(const void *font, int mag, MenuPadding &padding);
83
91
99 void prepareDisplay(bool monoPalette, const void *itemFont, int magItem, const void *titleFont, int magTitle, bool needEditingIcons);
100
106 ItemDisplayPropertiesFactory &getDisplayPropertiesFactory() override { return propertiesFactory; }
107
113
120 DeviceDrawable* getDeviceDrawable() { return rootDrawable; }
121
126 void enableTcUnicode() { rootDrawable->enableTcUnicode(); }
127
140
149
151 protected:
160 bool isActiveOrEditing(MenuItem* pItem, const DrawingFlags& drawingFlags);
161 private:
162 int calculateSpaceBetween(const void* font, uint8_t mag, const char* buffer, int start, int end);
163 void internalDrawText(GridPositionRowCacheEntry* pEntry, const Coord& where, const Coord& size, const DrawingFlags& drawingFlags);
164 void drawCoreLineItem(GridPositionRowCacheEntry* entry, DrawableIcon* icon, Coord &where, Coord &size,
165 const DrawingFlags& drawingFlags, bool drawBg);
166 void drawTextualItem(GridPositionRowCacheEntry* entry, Coord& where, Coord& size, const DrawingFlags& drawingFlags);
167 void drawCheckbox(GridPositionRowCacheEntry *entry, Coord& where, Coord& size, const DrawingFlags& drawingFlags);
168 void drawSlider(GridPositionRowCacheEntry* entry, AnalogMenuItem* pItem, Coord& where, Coord& size, const DrawingFlags& drawingFlags);
169 void drawUpDownItem(GridPositionRowCacheEntry* entry, Coord& where, Coord& size, const DrawingFlags& drawingFlags);
170 void drawIconItem(GridPositionRowCacheEntry *pEntry, Coord& where, Coord& size, const DrawingFlags& drawingFlags);
171 void drawBorderAndAdjustSize(Coord &where, Coord &size, MenuBorder &border);
172
173 DrawableIcon *getStateIndicatorIcon(GridPositionRowCacheEntry *entry);
174 };
175} // namespace tcgfx
176
177#endif //TCLIBRARYDEV_GRAPHICSDEVICERENDERER_H
Contains the base functionality for all graphical renderers.
LayoutMode
Definition BaseGraphicalRenderer.h:89
A few helper classes that provides useful functions on top of a tcMenu device drawable.
uint32_t color_t
Definition DrawingPrimitives.h:29
contains the interface between the touch screen and tcMenu.
a button that can be rendered onto any drawable, remembers it's position, and can integrate with touc...
Definition MenuItems.h:476
Definition MenuItems.h:329
Definition BaseRenderers.h:126
Definition BaseGraphicalRenderer.h:131
RenderDrawingCommand
Definition BaseGraphicalRenderer.h:147
Definition CardLayoutPanel.h:54
Definition DeviceDrawableHelper.h:116
Definition DeviceDrawable.h:34
virtual void drawPixel(uint16_t x, uint16_t y)=0
virtual Coord getDisplayDimensions()=0
void setDrawColor(color_t fg)
Definition DeviceDrawable.h:212
void enableTcUnicode()
Definition DeviceDrawable.h:219
Definition DrawingPrimitives.h:152
Definition GraphicsDeviceRenderer.h:35
Definition BaseGraphicalRenderer.h:37
Definition GraphicsDeviceRenderer.h:59
void setCardLayoutStatusForSubMenu(MenuItem *root, bool onOrOff)
Definition GraphicsDeviceRenderer.cpp:502
void setGraphicsConfiguration(void *gfxConfig)
Definition GraphicsDeviceRenderer.cpp:431
void enableCardLayout(const DrawableIcon &left, const DrawableIcon &right, MenuTouchScreenManager *touchManager, bool monoDisplay)
Definition GraphicsDeviceRenderer.cpp:494
void subMenuRender(MenuItem *rootItem, uint8_t &locRedrawMode, bool &forceDrawWidgets) override
Definition GraphicsDeviceRenderer.cpp:457
void enableTcUnicode()
Definition GraphicsDeviceRenderer.h:126
int heightForFontPadding(const void *font, int mag, MenuPadding &padding)
Definition GraphicsDeviceRenderer.cpp:422
void fillWithBackgroundTo(int endPoint) override
Definition GraphicsDeviceRenderer.cpp:450
void drawWidget(Coord where, TitleWidget *widget, color_t colorFg, color_t colorBg) override
Definition GraphicsDeviceRenderer.cpp:49
void prepareDisplay(bool monoPalette, const void *itemFont, int magItem, const void *titleFont, int magTitle, bool needEditingIcons)
void drawMenuItem(GridPositionRowCacheEntry *entry, Coord where, Coord areaSize, const DrawingFlags &drawingFlags) override
Definition GraphicsDeviceRenderer.cpp:55
DeviceDrawable * getDeviceDrawable()
Definition GraphicsDeviceRenderer.h:120
ConfigurableItemDisplayPropertiesFactory & getGraphicsPropertiesFactory()
Definition GraphicsDeviceRenderer.h:112
void drawingCommand(RenderDrawingCommand command) override
Definition GraphicsDeviceRenderer.cpp:33
LayoutMode getLayoutMode(MenuItem *rootItem) override
Definition GraphicsDeviceRenderer.cpp:510
ItemDisplayPropertiesFactory & getDisplayPropertiesFactory() override
Definition GraphicsDeviceRenderer.h:106
Definition BaseGraphicalRenderer.h:60
Definition GfxMenuConfig.h:358
Definition MenuTouchScreenEncoder.h:84
Definition GfxMenuConfig.h:32
Definition DrawingPrimitives.h:123
Definition DrawingPrimitives.h:92
Definition DrawingPrimitives.h:56