Skip to content

daisy::UiPage

Module: LIBDAISY / UI

The base class for a page in the UI system. More...

#include <UI.h>

Inherited by daisy::AbstractMenu

Public Functions

Name
UiPage()
virtual ~UiPage()
virtual bool IsOpaque(const UiCanvasDescriptor & display)
bool IsActive()
virtual void OnUserInteraction()
void Close()
virtual bool OnOkayButton(uint8_t numberOfPresses, bool isRetriggering)
virtual bool OnCancelButton(uint8_t numberOfPresses, bool isRetriggering)
virtual bool OnArrowButton(ArrowButtonType arrowType, uint8_t numberOfPresses, bool isRetriggering)
virtual bool OnFunctionButton(uint8_t numberOfPresses, bool isRetriggering)
virtual bool OnButton(uint16_t buttonID, uint8_t numberOfPresses, bool isRetriggering)
virtual bool OnMenuEncoderTurned(int16_t turns, uint16_t stepsPerRevolution)
virtual bool OnValueEncoderTurned(int16_t turns, uint16_t stepsPerRevolution)
virtual bool OnEncoderTurned(uint16_t encoderID, int16_t turns, uint16_t stepsPerRevolution)
virtual bool OnMenuEncoderActivityChanged(bool isCurrentlyActive)
virtual bool OnValueEncoderActivityChanged(bool isCurrentlyActive)
virtual bool OnEncoderActivityChanged(uint16_t encoderID, bool isCurrentlyActive)
virtual bool OnValuePotMoved(float newPosition)
virtual bool OnPotMoved(uint16_t potID, float newPosition)
virtual bool OnValuePotActivityChanged(bool isCurrentlyActive)
virtual bool OnPotActivityChanged(uint16_t potID, bool isCurrentlyActive)
virtual void OnShow()
virtual void OnHide()
virtual void OnFocusGained()
virtual void OnFocusLost()
virtual void Draw(const UiCanvasDescriptor & canvas) =0
UI * GetParentUI()
const UI * GetParentUI() const

Friends

Name
class UI

Detailed Description

class daisy::UiPage;

The base class for a page in the UI system.

Author: jelliesen

Public Functions Documentation

function UiPage

inline UiPage()

function ~UiPage

inline virtual ~UiPage()

function IsOpaque

inline virtual bool IsOpaque(
    const UiCanvasDescriptor & display
)

Returns true, if the page fills the entire canvas. A canvas can be individual leds, text displays, alphanumeric displays, graphics displays, etc. The UI class will use this to determine if underlying pages must be drawn before this page.


function IsActive

inline bool IsActive()

Returns true if the page is currently active on a UI - it may not be visible, though.


function OnUserInteraction

inline virtual void OnUserInteraction()

Called on any user input event, after the respective callback has completed. OnUserInteraction will be invoked for all pages in the page stack and can be used to track general user activity.


function Close

void Close()

Closes the current page. This calls the parent UI and asks it to Remove this page from the page stack.


function OnOkayButton

inline virtual bool OnOkayButton(
    uint8_t numberOfPresses,
    bool isRetriggering
)

Parameters:

  • numberOfPresses Holds the number of successive button presses. It will be 1 on the first call and increasing by 1 with each successive call. A button down event is signaled by numberOfButtonPresses == 0.
  • isRetriggering True if the button is auto-retriggering (due to being held down)

Return: false, if you want the event to be passed on to the page below.

Reimplemented by: daisy::AbstractMenu::OnOkayButton

Called when the okay button is pressed or released.


function OnCancelButton

inline virtual bool OnCancelButton(
    uint8_t numberOfPresses,
    bool isRetriggering
)

Parameters:

  • numberOfPresses Holds the number of successive button presses. It will be 1 on the first call and increasing by 1 with each successive call. A button down event is signaled by numberOfButtonPresses == 0.
  • isRetriggering True if the button is auto-retriggering (due to being held down)

Return: false, if you want the event to be passed on to the page below.

Reimplemented by: daisy::AbstractMenu::OnCancelButton

Called when the cancel button is pressed or released.


function OnArrowButton

inline virtual bool OnArrowButton(
    ArrowButtonType arrowType,
    uint8_t numberOfPresses,
    bool isRetriggering
)

Parameters:

  • arrowType The arrow button affected.
  • numberOfPresses Holds the number of successive button presses. It will be 1 on the first call and increasing by 1 with each successive call. A button down event is signaled by numberOfButtonPresses == 0.
  • isRetriggering True if the button is auto-retriggering (due to being held down)

Return: false, if you want the event to be passed on to the page below.

Reimplemented by: daisy::AbstractMenu::OnArrowButton

Called when an arrow button is pressed or released.


function OnFunctionButton

inline virtual bool OnFunctionButton(
    uint8_t numberOfPresses,
    bool isRetriggering
)

Parameters:

  • numberOfPresses Holds the number of successive button presses. It will be 1 on the first call and increasing by 1 with each successive call. A button down event is signaled by numberOfButtonPresses == 0.
  • isRetriggering True if the button is auto-retriggering (due to being held down)

Return: false, if you want the event to be passed on to the page below.

Reimplemented by: daisy::AbstractMenu::OnFunctionButton

Called when the function button is pressed or released.


function OnButton

inline virtual bool OnButton(
    uint16_t buttonID,
    uint8_t numberOfPresses,
    bool isRetriggering
)

Parameters:

  • buttonID The ID of the affected button.
  • numberOfPresses Holds the number of successive button presses. It will be 1 on the first call and increasing by 1 with each successive call. A button down event is signaled by numberOfButtonPresses == 0.
  • isRetriggering True if the button is auto-retriggering (due to being held down)

Return: false, if you want the event to be passed on to the page below.

Called when any button is pressed or released that is not an arrow button, the function button or the okay / cancel buttons.


function OnMenuEncoderTurned

inline virtual bool OnMenuEncoderTurned(
    int16_t turns,
    uint16_t stepsPerRevolution
)

Parameters:

  • turns The number of increments, positive is clockwise.
  • stepsPerRevolution The total number of increments per revolution on this encoder.

Return: false, if you want the event to be passed on to the page below.

Reimplemented by: daisy::AbstractMenu::OnMenuEncoderTurned

Called when the menu encoder is turned.


function OnValueEncoderTurned

inline virtual bool OnValueEncoderTurned(
    int16_t turns,
    uint16_t stepsPerRevolution
)

Parameters:

  • turns The number of increments, positive is clockwise.
  • stepsPerRevolution The total number of increments per revolution on this encoder.

Return: false, if you want the event to be passed on to the page below.

Reimplemented by: daisy::AbstractMenu::OnValueEncoderTurned

Called when the menu encoder is turned.


function OnEncoderTurned

inline virtual bool OnEncoderTurned(
    uint16_t encoderID,
    int16_t turns,
    uint16_t stepsPerRevolution
)

Parameters:

  • encoderID The ID of the affected encoder.
  • turns The number of increments, positive is clockwise.
  • stepsPerRevolution The total number of increments per revolution on this encoder.

Return: false, if you want the event to be passed on to the page below.

Called when an encoder is turned that is not the menu encoder or the value encoder.


function OnMenuEncoderActivityChanged

inline virtual bool OnMenuEncoderActivityChanged(
    bool isCurrentlyActive
)

Parameters:

  • isCurrentlyActive True, if the user currently moves this encoder.

Return: false, if you want the event to be passed on to the page below.

Called when the user starts or stops turning the menu encoder.


function OnValueEncoderActivityChanged

inline virtual bool OnValueEncoderActivityChanged(
    bool isCurrentlyActive
)

Parameters:

  • isCurrentlyActive True, if the user currently moves this encoder.

Return: false, if you want the event to be passed on to the page below.

Called when the user starts or stops turning the value encoder.


function OnEncoderActivityChanged

inline virtual bool OnEncoderActivityChanged(
    uint16_t encoderID,
    bool isCurrentlyActive
)

Parameters:

  • encoderID The ID of the affected encoder.
  • isCurrentlyActive True, if the user currently moves this encoder.

Return: false, if you want the event to be passed on to the page below.

Called when the user starts or stops turning an encoder that is not the menu encoder or the value encoder.


function OnValuePotMoved

inline virtual bool OnValuePotMoved(
    float newPosition
)

Parameters:

  • newPosition The new position in the range 0 .. 1

Return: false, if you want the event to be passed on to the page below.

Reimplemented by: daisy::AbstractMenu::OnValuePotMoved

Called when the value potentiometer is turned.


function OnPotMoved

inline virtual bool OnPotMoved(
    uint16_t potID,
    float newPosition
)

Parameters:

  • potID The ID of the affected potentiometer.
  • newPosition The new position in the range 0 .. 1

Return: false, if you want the event to be passed on to the page below.

Called when a potentiometer is turned that's not the value potentiometer.


function OnValuePotActivityChanged

inline virtual bool OnValuePotActivityChanged(
    bool isCurrentlyActive
)

Parameters:

  • isCurrentlyActive True, if the user currently moves this potentiometer.

Return: false, if you want the event to be passed on to the page below.

Called when the user starts or stops turning the value potentiometer.


function OnPotActivityChanged

inline virtual bool OnPotActivityChanged(
    uint16_t potID,
    bool isCurrentlyActive
)

Parameters:

  • potID The ID of the affected potentiometer.
  • isCurrentlyActive True, if the user currently moves this potentiometer.

Return: false, if you want the event to be passed on to the page below.

Called when the user starts or stops turning a potentiometer that's not the value potentiometer.


function OnShow

inline virtual void OnShow()

Reimplemented by: daisy::AbstractMenu::OnShow

Called when the page is added to the UI.


function OnHide

inline virtual void OnHide()

Called when the page is removed from the UI.


function OnFocusGained

inline virtual void OnFocusGained()

Called when the page becomes the topmost page in the page stack.


function OnFocusLost

inline virtual void OnFocusLost()

Called when the page is no longer the topmost page in the page stack.


function Draw

virtual void Draw(
    const UiCanvasDescriptor & canvas
) =0

Reimplemented by: daisy::FullScreenItemMenu::Draw

Called to make the UIPage repaint everything on a canvas. Check the ID to determine which display this corresponds to. Cast the handle to the corresponding type and do your draw operations on it.


function GetParentUI

inline UI * GetParentUI()

Returns a reference to the parent UI object, or nullptr if not added to any UI at the moment.


function GetParentUI

inline const UI * GetParentUI() const

Returns a reference to the parent UI object, or nullptr if not added to any UI at the moment.


Friends

friend UI

friend class UI(
    UI 
);

Updated on 2024-01-03 at 19:41:01 +0000