Skip to content

Class eva::ScrollButton

template <class TReader>

ClassList > eva > ScrollButton

Button with auto-repeat (typematic) functionality.More...

  • #include <evaScrollButton.h>

Inherits the following classes: eva::Button

Public Functions

Type Name
ScrollButton * enable (bool enabled)
Enables or disables the scroll button.

Public Functions inherited from eva::Button

See eva::Button

Type Name
Button * enable (bool enabled)
Enables or disables the button.

Public Functions inherited from eva::Switch

See eva::Switch

Type Name
Switch (IHandler * listener=nullptr, unsigned char eventMask=0, Args... args)
Constructs a Switch .
Switch * enable (bool enabled)
Enables or disables the switch.
signed short getValue ()
Gets the current level code.
bool isEnabled () const
Checks if the switch is enabled.
Switch * setListener (IHandler * listener, unsigned char eventMask)
Sets the event listener for this switch.

Public Functions inherited from eva::Tickable

See eva::Tickable

Type Name
Tickable ()
Tickable (const Tickable &) = delete
Tickable (Tickable &&) = delete
Tickable & operator= (const Tickable &) = delete
Tickable & operator= (Tickable &&) = delete
virtual ~Tickable ()

Public Static Functions inherited from eva::Tickable

See eva::Tickable

Type Name
void tac ()
Triggers tick on this and all linked tickables.

Protected Attributes

Type Name
unsigned long lastRepeatTime = 0

Protected Attributes inherited from eva::Button

See eva::Button

Type Name
unsigned long pressTime = 0

Protected Attributes inherited from eva::Switch

See eva::Switch

Type Name
bool enabled
unsigned char eventMask
unsigned char levelCode = 0
IHandler * listener = nullptr

Protected Functions

Type Name
bool checkRepeatTime (unsigned long now)
void handleDeactivating (unsigned char wasLevelCode, unsigned long now)
void handleLongPress (unsigned long now)
void handleRepeatTime (unsigned long now)

Protected Functions inherited from eva::Button

See eva::Button

Type Name
bool checkLongPress (unsigned long now)
void handleActivating (unsigned long now)
void handleDeactivating (unsigned char wasLevelCode)
void handleLongPress ()

Protected Functions inherited from eva::Switch

See eva::Switch

Type Name
bool checkActivating (unsigned char wasLevelCode)
inactive or different -> active
bool checkChanging (unsigned char wasLevelCode)
bool checkDeactivating (unsigned char wasLevelCode)
active -> inactive or different state
void handleActivating ()
void handleChanging ()
void handleDeactivating (unsigned char wasLevelCode)
void notify (unsigned short eventType, signed short eventCode)
bool updateState ()

Detailed Description

This class extends Button by adding periodic ON_REPEAT events while the button is held down. The naming reflects the primary use case (keyboard-like repeat).

  • ON_CHANGE - Any state change
  • ON_PRESS - Button becomes active (switch to active state)
  • ON_RELEASE - Button becomes inactive (switch to inactive state)
  • ON_SHORTCLICK - Press and release within LONGPRESS_DELAY
  • ON_LONGCLICK - Press and hold longer than LONGPRESS_DELAY then release
  • ON_LONGPRESS - Press and hold longer than LONGPRESS_DELAY (no release)
  • ON_REPEATKEY - Periodic events while holding (after LONGPRESS_DELAY)

Template parameters:

  • TReader Input reader type that returns numeric codes (0 = no button, >0 = button identifier)

See also: Button Base class for click detection

Public Functions Documentation

function enable

Enables or disables the scroll button.

inline ScrollButton * eva::ScrollButton::enable (
    bool enabled
) 

Overridden to clear repeat timing state when disabled.

Parameters:

  • enabled True to enable, false to disable

Returns:

Pointer to this for method chaining


Protected Attributes Documentation

variable lastRepeatTime

unsigned long eva::ScrollButton< TReader >::lastRepeatTime;

Protected Functions Documentation

function checkRepeatTime

inline bool eva::ScrollButton::checkRepeatTime (
    unsigned long now
) 

function handleDeactivating

inline void eva::ScrollButton::handleDeactivating (
    unsigned char wasLevelCode,
    unsigned long now
) 

function handleLongPress

inline void eva::ScrollButton::handleLongPress (
    unsigned long now
) 

function handleRepeatTime

inline void eva::ScrollButton::handleRepeatTime (
    unsigned long now
) 


The documentation for this class was generated from the following file src/evaScrollButton.h