Skip to main content

ClickListener

touchgfx/mixins/ClickListener.hpp

Mix-in class that extends a class with a click action event that is called when the class receives a click event.

Template Parameters:

Inherits from: T

Public Functions

ClickListener()
Initializes a new instance of the ClickListener class.
virtual voidhandleClickEvent(const ClickEvent & event)
Ensures that the clickEvent is propagated to the super class T and to the clickAction listener.
voidsetClickAction(GenericCallback< const T <, const ClickEvent & > & callback)
Associates an action to be performed when the class T is clicked.

Protected Attributes

GenericCallback< const T <, const ClickEvent & > *clickAction
The callback to be executed when T is clicked.

Public Functions Documentation

ClickListener

Initializes a new instance of the ClickListener class.

Make the object touchable.

handleClickEvent

virtual void handleClickEvent(const ClickEvent &event)

Ensures that the clickEvent is propagated to the super class T and to the clickAction listener.

Parameters:
eventInformation about the click.

setClickAction

void setClickAction(GenericCallback< const T <, const ClickEvent & > &callback)

Associates an action to be performed when the class T is clicked.

Parameters:
callbackThe callback to be executed. The callback will be given a reference to T.

Protected Attributes Documentation

clickAction

GenericCallback< const T <, const ClickEvent & > * clickAction

The callback to be executed when T is clicked.