sincerely Singaporean

If you have not done so, read this full tutorial on how to use SGEXTN to build an application.

SGWSingleTouchReceiver

see header file

see source file

class SGWSingleTouchReceiver;

part of SGEXTN module SG_Widgets

SGWidget ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ custom interactive component accepting 1 touch event

detailed description

list of all including inherited members

implementation details

preprocessor file inclusion directive: #include ‹SGWSingleTouchReceiver.h›

CMake target for BuildLah: SGEXTN::SG_Widgets

see this link for more information about BuildLah

parent class: SGWWidget

children classes: (none)

instance member variables

int attachedInt;

SGXString attachedString;

void (*callbackFunction)(const SGXTouchEvent&);

void (*callbackFunctionWithInt)(int, const SGXTouchEvent&);

void (*callbackFunctionWithPointer)(SGWSingleTouchReceiver*, const SGXTouchEvent&);

void (*callbackFunctionWithString)(SGXString, const SGXTouchEvent&);

instance member functions

SGWSingleTouchReceiver(SGWWidget* parent, void (*function)(const SGXTouchEvent&), float x1, float x0, float y1, float y0, float w1, float w0, float h1, float h0);

[[nodiscard]] float getHeight() const;

[[nodiscard]] float getWidth() const;

Detailed Description

SGWSingleTouchReceiver allows for custom programmed interactive components in SGWidget ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾. It receives 1 touch event at a time and sends it to a callback function ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ for processing in the form of a SGXTouchEvent. Additional touch events are ignored.

Implementation Details

Stores information about the SGWSingleTouchReceiver.

int attachedInt;

Int attached to this SGWSingleTouchReceiver.

This is used to identify the source of the callback in callback function ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾.

SGXString attachedString;

String attached to this SGWSingleTouchReceiver.

This is used to identify the source of the callback in callback function ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾.

void (*callbackFunction)(const SGXTouchEvent&);

callback function ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ called when the user interacts with the SGWSingleTouchReceiver. The touch event is sent as a SGXTouchEvent.

void (*callbackFunctionWithInt)(int, const SGXTouchEvent&);

callback function ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ called when the user interacts with the SGWSingleTouchReceiver. The touch event is sent as a SGXTouchEvent along with SGWSingleTouchReceiver::attachedInt.

void (*callbackFunctionWithPointer)(SGWSingleTouchReceiver*, const SGXTouchEvent&);

callback function ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ called when the user interacts with the SGWSingleTouchReceiver. The touch event is sent as a SGXTouchEvent along with a pointer to this SGWSingleTouchReceiver.

void (*callbackFunctionWithString)(SGXString, const SGXTouchEvent&);

callback function ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ called when the user interacts with the SGWSingleTouchReceiver. The touch event is sent as a SGXTouchEvent along with SGWSingleTouchReceiver::attachedString.

SGWSingleTouchReceiver(SGWWidget* parent, void (*function)(const SGXTouchEvent&), float x1, float x0, float y1, float y0, float w1, float w0, float h1, float h0);

Creates a SGWSingleTouchReceiver with parent SGWidget ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ parent, w-distance ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ coordinates (x1, x0, y1, y0, w1, w0, h1, h0), and callback function ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ function.

Only the first touch event will be sent, the others will be ignored.

parent being nullptr is undefined behaviour.

To avoid use after free bugs, deleting a SGWWidget directly will cause a crash. Use SGWWidget::deleteWidget to delete it safely.

[[nodiscard]] float getHeight() const;

Returns the height in pixels of this SGWSingleTouchReceiver.

This should only be used to interpret the SGXTouchEvent sent from the SGWSingleTouchReceiver. Using pixel size for any other purpose is not recommended, instead use w-distance ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾.

[[nodiscard]] float getWidth() const;

Returns the width in pixels of this SGWSingleTouchReceiver.

This should only be used to interpret the SGXTouchEvent sent from the SGWSingleTouchReceiver. Using pixel size for any other purpose is not recommended, instead use w-distance ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾.

©2025 05524F.sg (Singapore)

contact 05524F / report a bug / make a suggestion

about 05524F SINGAPORE values

list of 05524F projects