sincerely Singaporean

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

SGWBackground

see header file

see source file

class SGWBackground;

part of SGEXTN module SG_Widgets

SGWidget ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ UI page background base class

detailed description

list of all including inherited members

implementation details

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

CMake target for BuildLah: SGEXTN::SG_Widgets

see this link for more information about BuildLah

parent class: SGWWidget

children classes: SGWPageBackground, SGWScrollView, SGWSequentialScrollView

instance member functions

[[nodiscard]] SGXColourRGBA getColour(bool* isUsing) const;

[[nodiscard]] int getThemeColour(bool* isUsing) const;

void setColour(SGXColourRGBA colour);

void setThemeColour(int themeColour);

static member functions

static void disable(SGWBackground*& thisPointer);

static void enable(SGWBackground*& thisPointer, SGWBackground* (*initFunction)(), void (*resetFunction)());

Detailed Description

SGWBackground provides a base class for UI pages. This is not meant to be instantiated directly, you are supposed to create its subclasses (SGWPageBackground, SGWScrollView, SGWSequentialScrollView) to use its functionality. SGWBackground allows you to easily turn on and turn off SGWidget ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ UI pages. Use a SGWBlankWidget instead if only a blank rectangle is needed.

Implementation Details

Stores information about the SGWBackground and also within static variables, information about which SGWBackground are on.

[[nodiscard]] SGXColourRGBA getColour(bool* isUsing) const;

Returns the SGXColourRGBA currently being used for the background of this SGWBackground. The bool that isUsing points to is set to true if theme colour ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ mode is off, and false otherwise.

If you are not interested in the current theme colour ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ mode, pass nullptr to isUsing.

[[nodiscard]] int getThemeColour(bool* isUsing) const;

Returns the theme colour ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ currently being used for the background of this SGWBackground. The bool that isUsing points to is set to true if theme colour ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ mode is on, and false otherwise.

If you are not interested in the current theme colour ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ mode, pass nullptr to isUsing.

void setColour(SGXColourRGBA colour);

Sets the SGXColourRGBA of the background of this SGWBackground to colour and turns off theme colour ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ mode.

void setThemeColour(int themeColour);

Sets the theme colour ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ of the background of this SGWBackground to themeColour and turns on theme colour ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ mode.

static void disable(SGWBackground*& thisPointer);

Turns off the UI page referenced by thisPointer then set thisPointer, which is passed by reference, to nullptr.

If thisPointer is nullptr when the function is called, it is assumed that the UI page is already off so nothing is done. If the UI page was previously turned on using SGWBackground::enable, this is not a concern.

static void enable(SGWBackground*& thisPointer, SGWBackground* (*initFunction)(), void (*resetFunction)());

Turn on a SGWBackground using a initialisation function and a reset function. initFunction is run to create the SGWBackground instance which is stored in thisPointer which is passed by reference, then resetFunction is run.

If no resetFunction is needed, pass nullptr to it.

This hides all other UI pages to ensure that keyboard focus (pressing tab) works as expected.

Forgetting to return a valid SGWBackground in initFunction is undefined behaviour.

Passing nullptr to initFunction will crash.

If thisPointer is not nullptr when the function is called, it is assumed that the UI page is already on so nothing is done. If the UI page was previously turned off using SGWBackground::disable, this is not a concern.

©2025 05524F.sg (Singapore)

contact 05524F / report a bug / make a suggestion

about 05524F SINGAPORE values

list of 05524F projects