#include <GraphicsDeviceRenderer.h>
Public Member Functions | |
GraphicsDeviceRenderer (int bufferSize, const char *appTitle, DeviceDrawable *drawable) | |
void | drawWidget (Coord where, TitleWidget *widget, color_t colorFg, color_t colorBg) override |
void | drawMenuItem (GridPositionRowCacheEntry *entry, Coord where, Coord areaSize, const DrawingFlags &drawingFlags) override |
void | drawingCommand (RenderDrawingCommand command) override |
void | fillWithBackgroundTo (int endPoint) override |
int | heightForFontPadding (const void *font, int mag, MenuPadding &padding) |
void | setGraphicsConfiguration (void *gfxConfig) |
void | prepareDisplay (bool monoPalette, const void *itemFont, int magItem, const void *titleFont, int magTitle, bool needEditingIcons) |
ItemDisplayPropertiesFactory & | getDisplayPropertiesFactory () override |
ConfigurableItemDisplayPropertiesFactory & | getGraphicsPropertiesFactory () |
DeviceDrawable * | getDeviceDrawable () |
void | enableTcUnicode () |
void | enableCardLayout (const DrawableIcon &left, const DrawableIcon &right, MenuTouchScreenManager *touchManager, bool monoDisplay) |
void | setCardLayoutStatusForSubMenu (MenuItem *root, bool onOrOff) |
LayoutMode | getLayoutMode (MenuItem *rootItem) override |
Public Member Functions inherited from tcgfx::BaseGraphicalRenderer | |
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) |
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 | |
void | subMenuRender (MenuItem *rootItem, uint8_t &locRedrawMode, bool &forceDrawWidgets) override |
bool | isActiveOrEditing (MenuItem *pItem, const DrawingFlags &drawingFlags) |
Protected Member Functions inherited from tcgfx::BaseGraphicalRenderer | |
int | heightOfRow (int row, bool includeSpace=false) |
Protected Member Functions inherited from BaseMenuRenderer | |
void | countdownToDefaulting () |
Additional Inherited Members | |
Public Types inherited from tcgfx::BaseGraphicalRenderer | |
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 } |
Static Public Member Functions inherited from BaseMenuRenderer | |
static BaseMenuRenderer * | getInstance () |
Static Public Member Functions inherited from MenuRenderer | |
static MenuRenderer * | getInstance () |
Protected Attributes inherited from tcgfx::BaseGraphicalRenderer | |
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 |
Static Protected Attributes inherited from MenuRenderer | |
static MenuRenderer * | theInstance = nullptr |
This class contains all the drawing code that is used for most graphical displays, it relies on an instance of device drawable to do the drawing. It can also use sub drawing if the drawing device supports it, and it is enabled. This means that on supported devices it is possible to do flicker free rendering.
To support a new display, do not touch this class unless something is amiss or there is a bug, instead just implement the above DeviceDrawable for that display. Take a look at the other rendering classes we already have for an example of how.
|
overridevirtual |
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 |
Implements tcgfx::BaseGraphicalRenderer.
|
overridevirtual |
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 |
Implements tcgfx::BaseGraphicalRenderer.
|
overridevirtual |
This sends general purpose commands that can be implemened by the leaf class as needed.
Implements tcgfx::BaseGraphicalRenderer.
|
overridevirtual |
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 |
Implements tcgfx::BaseGraphicalRenderer.
int tcgfx::GraphicsDeviceRenderer::heightForFontPadding | ( | const void * | font, |
int | mag, | ||
MenuPadding & | padding | ||
) |
Get the height for the font and add the descent to the bottom padding.
font | the font to measure |
mag | any magnification to apply - if supported |
padding | the padding for the item, bottom will be adjusted |
void tcgfx::GraphicsDeviceRenderer::setGraphicsConfiguration | ( | void * | gfxConfig | ) |
Set up the display based on the legacy graphics configuration. This is deprecated and you should move to using prepareDisplay. New code should NOT use this as it will be removed in a future build.
gfxConfig | the legacy graphics configuration |
void tcgfx::GraphicsDeviceRenderer::prepareDisplay | ( | bool | monoPalette, |
const void * | itemFont, | ||
int | magItem, | ||
const void * | titleFont, | ||
int | magTitle, | ||
bool | needEditingIcons | ||
) |
Set up the display using a basic configuration. Setting factories with default colours and sizes.
monoPalette | true if the display is monochrome, otherwise false. |
itemFont | the font to use for items |
titleFont | the font to use for the title |
needEditingIcons | true if editing icons should be prepared, otherwise false. |
|
inlineoverridevirtual |
Gets the abstract display properties factory, used internally to get the factory regardless of what actual type it is, in user code that is using graphics properties factory, use getGraphicsPropertiesFactory
Implements tcgfx::BaseGraphicalRenderer.
|
inline |
Gets the graphical display properties factory, so that you can add graphics configuration easily.
|
inline |
Gets the underlying device drawable so that you can render to the screen in a device independent way. On most systems this is a very thin wrapper on the library and performs very well for all but the most intensive of drawing operations.
|
inline |
Enables TcUnicode as the default font processor for all operations, and ensures that the unicode helper can be accessed too.
void tcgfx::GraphicsDeviceRenderer::enableCardLayout | ( | const DrawableIcon & | left, |
const DrawableIcon & | right, | ||
MenuTouchScreenManager * | touchManager, | ||
bool | monoDisplay | ||
) |
Enables the card layout system for the items provided, a card layout shows a single item at once, with left and right images present that work somewhat like buttons. Rotating the encoder (or up/down buttons) will result in switching between the menu items. This works particularly well when combined with using drawable icons for each of the menu items. Note that after enabling, you must call setCardLayoutStatusForSubMenu
to enable menus, see the method docs for details.
left | the icon to use for left, (takes its colors from the title) |
right | the icon to use for right, (takes its colors from the title) |
touchManager | optionally provide the touch manager to make the buttons work with a touch screen |
monoDisplay | for mono displays the direction buttons completely disappears instead of greying out |
void tcgfx::GraphicsDeviceRenderer::setCardLayoutStatusForSubMenu | ( | MenuItem * | root, |
bool | onOrOff | ||
) |
Allows the card layout mode to be enabled for a root item, this is the first item in the linked list, for submenus you can obtain this by calling menuSub.getChild()
on a submenu, or for root call rootMenuItem()
to get the first item of the root menu.
root | the root menu item to change status |
onOrOff | true if on, otherwise false. |
|
overridevirtual |
Reimplemented from tcgfx::BaseGraphicalRenderer.
|
overrideprotectedvirtual |
Overrides the default implementation to allow for card based layouts, if this is not enabled for the submenu then regular rendering is used instead.
rootItem | the first item in the linked list for this submenu |
locRedrawMode | reference to the local redraw mode. May be updated |
forceDrawWidgets | reference to if the widgets are to be force drawn, may be updated |
Reimplemented from tcgfx::BaseGraphicalRenderer.