tcMenu
Classes | Typedefs | Enumerations | Functions
BaseRenderers.h File Reference

Go to the source code of this file.

Classes

class  CustomDrawing
 
class  TitleWidget
 
class  MenuRenderer
 
class  NoRenderer
 
class  BaseMenuRenderer
 

Typedefs

typedef void(* RendererCallbackFn) (unsigned int currentValue, RenderPressMode userClicked)
 
typedef void(* ResetCallbackFn) ()
 

Enumerations

enum  RenderPressMode : uint8_t { RPRESS_NONE = 0, RPRESS_PRESSED = 1, RPRESS_HELD = 2 }
 
enum  RendererType : uint8_t { RENDER_TYPE_NOLOCAL, RENDER_TYPE_BASE, RENDER_TYPE_CONFIGURABLE }
 
enum  MenuRedrawState : uint8_t { MENUDRAW_NO_CHANGE = 0, MENUDRAW_EDITOR_CHANGE, MENUDRAW_COMPLETE_REDRAW }
 
enum  MenuDrawJustification : uint8_t { JUSTIFY_TEXT_LEFT, JUSTIFY_TEXT_RIGHT }
 

Functions

bool isItemActionable (MenuItem *item)
 

Detailed Description

This file contains the common code for rendering onto displays, making it much easier to implement a renderer.

Typedef Documentation

◆ RendererCallbackFn

typedef void(* RendererCallbackFn) (unsigned int currentValue, RenderPressMode userClicked)

Used to take over rendering for a period of time. Normally one calls renderer.takeOverDisplay(..) with a reference to a function meeting this spec. Whenever the callback occurs the current value of the rotary encoder is provided along with the state of the menu select switch.

Parameters
currentValueis the current value of the rotary encoder
userClickedif the user clicked the select button

◆ ResetCallbackFn

typedef void(* ResetCallbackFn) ()

Used to indicate when the renderer is about to be reset, you could use this to do custom rendering when the menu is not active, for example taking over the display until some condition is met.

Enumeration Type Documentation

◆ RenderPressMode

enum RenderPressMode : uint8_t

an enumeration of possible values that are given to either custom render functions or used internally by renderers to describe the state of the select button. Values should be self explanatory. High compatibility with bool for determining if the button is pressed.

Enumerator
RPRESS_NONE 

The select button is not pressed

RPRESS_PRESSED 

The select button has been pressed

RPRESS_HELD 

The selected button is held down

◆ MenuRedrawState

enum MenuRedrawState : uint8_t

Used by renderers to determine how significant a redraw is needed at the next redraw interval. They are prioritised in ascending order, so a more complete redraw has a higher number.

Function Documentation

◆ isItemActionable()

bool isItemActionable ( MenuItem item)

Checks if a given menu item can have an action performed on it.