#include <BaseGraphicalRenderer.h>
Public Types | |
enum | TitleMode : uint8_t { NO_TITLE , TITLE_FIRST_ROW , TITLE_ALWAYS } |
enum | RenderDrawingCommand { DRAW_COMMAND_CLEAR , DRAW_COMMAND_START , DRAW_COMMAND_ENDED } |
Public Types inherited from BaseMenuRenderer | |
enum | DisplayTakeoverMode { NOT_TAKEN_OVER , TAKEN_OVER_FN , START_CUSTOM_DRAW , RUNNING_CUSTOM_DRAW } |
Public Member Functions | |
MenuItem * | getCurrentRendererRoot () |
BaseGraphicalRenderer (int bufferSize, int wid, int hei, bool lastRowExact, const char *appTitle) | |
void | initialise () override |
void | setTitleMode (TitleMode mode) |
void | setDisplayNumber (uint8_t displayNum) |
uint8_t | getDisplayNumber () |
void | setUseSliderForAnalog (bool useSlider) |
void | setHasTouchInterface (bool hasTouch) |
void | setTitleOnDisplay (bool titleOn) |
void | setLastRowExactFit (bool exact) |
void | setRawTouchMode (bool rawTouch) |
void | setEditStatusIconsEnabled (bool ena) |
bool | isUseSliderForAnalog () const |
bool | isHasTouchInterface () const |
bool | isTitleOnDisplay () const |
bool | isLastRowExactFit () const |
bool | isRawTouchMode () const |
bool | isEditStatusIconEnabled () const |
void | render () override |
void | setDisplayDimensions (int w, int h) |
virtual LayoutMode | getLayoutMode (MenuItem *rootItem) |
virtual void | drawWidget (Coord where, TitleWidget *widget, color_t colorFg, color_t colorBg)=0 |
virtual void | drawMenuItem (GridPositionRowCacheEntry *entry, Coord where, Coord areaSize, const DrawingFlags &drawFlags)=0 |
virtual void | drawingCommand (RenderDrawingCommand command)=0 |
virtual void | fillWithBackgroundTo (int endPoint)=0 |
virtual ItemDisplayPropertiesFactory & | getDisplayPropertiesFactory ()=0 |
int | findItemIndex (MenuItem *root, MenuItem *toFind) override |
uint8_t | itemCount (MenuItem *root, bool) override |
GridPositionRowCacheEntry * | findMenuEntryAndDimensions (const Coord &screenPos, Coord &localStart, Coord &localSize) |
MenuItem * | getMenuItemAtIndex (MenuItem *currentRoot, uint8_t idx) override |
BaseDialog * | getDialog () override |
int | getWidth () const |
int | getHeight () const |
void | displayPropertiesHaveChanged () |
void | rootHasChanged (MenuItem *newItem) |
uint8_t | setActiveItem (MenuItem *item) override |
Public Member Functions inherited from BaseMenuRenderer | |
BaseMenuRenderer (int bufferSize, RendererType rType=RENDER_TYPE_BASE, uint8_t displayNum=0) | |
~BaseMenuRenderer () override | |
void | setUpdatesPerSecond (int updatesSec) |
void | turnOffDisplayUpdates (bool) |
void | setResetIntervalTimeSeconds (uint16_t interval) |
void | turnOffResetLogic () |
void | resetNotifiesOnly (uint16_t ticks) |
void | setResetCallback (ResetCallbackFn resetFn) |
void | setCustomDrawingHandler (CustomDrawing *customDrawingParam) |
CustomDrawing * | getCurrentCustomDrawing () |
void | exec () override |
bool | tryTakeSelectIfNeeded (int currentReading, RenderPressMode pressMode) override |
MenuItem * | getActiveItem () |
int | findActiveItem (MenuItem *root) |
void | setFirstWidget (TitleWidget *widget) |
TitleWidget * | getFirstWidget () |
void | menuAltered () |
void | takeOverDisplay (RendererCallbackFn displayFn=nullptr) |
void | giveBackDisplay () |
void | resetToDefault () |
void | redrawRequirement (MenuRedrawState state) |
void | invalidateAll () |
Public Member Functions inherited from MenuRenderer | |
MenuRenderer (RendererType rendererType, int bufferSize) | |
virtual | ~MenuRenderer () |
char * | getBuffer () |
uint8_t | getBufferSize () |
RendererType | getRendererType () |
Protected Member Functions | |
virtual void | subMenuRender (MenuItem *rootItem, uint8_t &locRedrawMode, bool &forceDrawWidgets) |
int | heightOfRow (int row, bool includeSpace=false) |
Protected Member Functions inherited from BaseMenuRenderer | |
void | countdownToDefaulting () |
Protected Attributes | |
BtreeList< uint16_t, GridPositionRowCacheEntry > | itemOrderByRow |
TitleMode | titleMode = TITLE_FIRST_ROW |
uint16_t | width |
uint16_t | height |
CachedDrawingLocation | drawingLocation |
uint8_t | flags |
Protected Attributes inherited from BaseMenuRenderer | |
uint8_t | lastOffset |
uint8_t | updatesPerSecond |
uint8_t | displayNumber = 0 |
MenuRedrawState | redrawMode |
uint16_t | ticksToReset |
uint16_t | resetValInTicks |
TitleWidget * | firstWidget |
CustomDrawing * | customDrawing |
BaseDialog * | dialog |
DisplayTakeoverMode | displayTakenMode |
RenderPressMode | renderFnPressType |
RendererCallbackFn | renderCallback |
MenuItem * | activeItem = nullptr |
Protected Attributes inherited from MenuRenderer | |
char * | buffer |
uint8_t | bufferSize |
RendererType | rendererType |
Additional Inherited Members | |
Static Public Member Functions inherited from BaseMenuRenderer | |
static BaseMenuRenderer * | getInstance () |
Static Public Member Functions inherited from MenuRenderer | |
static MenuRenderer * | getInstance () |
Static Protected Attributes inherited from MenuRenderer | |
static MenuRenderer * | theInstance = nullptr |
This is the base class for all simpler renderer classes where the height of a row is equal for all entries, and there is always exactly one item on a row. This takes away much of the work to row allocation for simple renderers. Examples of this are the LiquidCrystal renderer
enum tcgfx::BaseGraphicalRenderer::TitleMode : uint8_t |
|
inline |
The current menu from the renderers perspective
|
overridevirtual |
Initialise the render setting up the refresh task at the update frequency provided (or leave blank for default).
updatesPerSecond | the number of times to update the display per second, set to 0 or leave blank for default |
Reimplemented from BaseMenuRenderer.
|
inline |
TcMenu supports more than one display now, (presently 2) so you set the display number here and it will be passed to the isChanged function to ensure rendering works for both items.
displayNum | the display number. |
|
inline |
|
inline |
set the use of sliders by default for all integer items
useSlider | true to use sliders |
|
inline |
Enable touch support within the renderer
hasTouch | true to enable touch |
|
inline |
Set the title as on, so it appears on the display, somewhat internal to the library, control from the theme
titleOn | true to turn on |
|
inline |
Set that the last row has to fit exactly, this is for LCD cases and where a gap at the bottom is deemed as better than half rendering.
exact | true for LCD and cases where a gap is better, otherwise false. |
|
inline |
When this is on, the touch will not look up items, helpful for where you need complete control of the touch interface for a short time.
|
inline |
Turn off editing icons and editor indications of editing for a short time, for example during special layouts such as card layout. This is an override that can force editing icons OFF, it cannot force them ON if no icons were registered.
ena | true to enable (Default) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
overridevirtual |
This is the rendering call that must be implemented by subclasses. Generally it is called a few times a second, and should render the menu, if changes are detected
Implements BaseMenuRenderer.
|
inline |
Usually called during the initialisation of the display internally to set the width and height.
w | display width in current rotation |
h | display height in current rotation |
|
inlinevirtual |
Reimplemented in tcgfx::GraphicsDeviceRenderer.
|
pure virtual |
Draw a widget into the title area at the position indicated, the background will need to be cleared before performing the operation.
where | the position on the screen to draw the widget |
widget | the widget to be drawn. |
colorFg | the foreground color |
colorBg | the background color |
Implemented in tcgfx::GraphicsDeviceRenderer.
|
pure virtual |
Draw a menu item onto the display using the instructions
theItem | the item to be rendered |
mode | the suggested mode in which to draw |
where | the position on the display to render at |
areaSize | the size of the area where it should be rendered |
Implemented in tcgfx::GraphicsDeviceRenderer.
|
pure virtual |
This sends general purpose commands that can be implemened by the leaf class as needed.
Implemented in tcgfx::GraphicsDeviceRenderer.
|
pure virtual |
This indicates to the renderer leaf class that the background color should be filled from Y end point to the end of the screen.
endPoint | the last drawing point in the Y location |
Implemented in tcgfx::GraphicsDeviceRenderer.
|
pure virtual |
Gets the item display factory that provides the formatting information for this renderer, it holds the font, color, padding and grid information. For all bitmapped renderers (EG: AdaFruit_GFX, U8G2) you can safely up cast to the ConfigurableItemDisplayPropertiesFactory
Implemented in tcgfx::GraphicsDeviceRenderer.
|
overridevirtual |
Find an item's offset in a given root, safely returns 0.
root | the root item |
toFind | the item within that root |
Reimplemented from BaseMenuRenderer.
|
overridevirtual |
Reimplemented from BaseMenuRenderer.
GridPositionRowCacheEntry * tcgfx::BaseGraphicalRenderer::findMenuEntryAndDimensions | ( | const Coord & | screenPos, |
Coord & | localStart, | ||
Coord & | localSize | ||
) |
Provides the menu item grid position and dimensions of it, given a screen position. Usually used by touch screen implementations. Note that this will return nullptr if no entry is found.
screenPos | the raw screen position |
localStart | the local menu item start position |
localSize | the local menu item size |
|
overridevirtual |
Gets the menu item at a given index, which may be different to the order in the tree.
Reimplemented from BaseMenuRenderer.
|
overridevirtual |
All base graphical renderers use a dialog based on menu item, this provides the greatest flexibility and also reduces the amount of dialog code. This means nearly every display we support uses menu based dialogs
Implements MenuRenderer.
|
inline |
|
inline |
void tcgfx::BaseGraphicalRenderer::displayPropertiesHaveChanged | ( | ) |
Force the renderer to completely recalculate the display parameters next time it's drawn.
void tcgfx::BaseGraphicalRenderer::rootHasChanged | ( | MenuItem * | newItem | ) |
This is generally called by the navigation listener when the root item has changed due to a new menu being displayed, or display reset event. It will force an immediate recalculation of all items.
newItem | the new root item |
|
overridevirtual |
Sets the active item to be the menu item selected, also this recalculates the offset required to present that item.
item | the new active item |
Reimplemented from BaseMenuRenderer.
|
protectedvirtual |
This is responsible for redrawing a series of menu items onto the screen, it can be overridden as needed in extension classes, such that different rendering can be achieved. The default rendering is vertical, with the items scrolling downward if needed. It is virtual to allow for such extensions.
rootItem | the first item in the linked list of children |
locRedrawMode | the drawing mdoe, a reference, will be updated. |
forceDrawWidgets | reference to widgets force update flag, will be updated. |
Reimplemented in tcgfx::GraphicsDeviceRenderer.