sincerely Singaporean

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

SGWLabel

see header file

see source file

class SGWLabel;

part of SGEXTN module SG_Widgets

SGWidget ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ text label base class

detailed description

list of all including inherited members

implementation details

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

CMake target for BuildLah: SGEXTN::SG_Widgets

see this link for more information about BuildLah

parent class: SGWWidget

children classes: SGWIconLabel, SGWLongLabel, SGWSequentialLongLabel, SGWTextLabel

instance member functions

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

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

[[nodiscard]] float getF0() const;

[[nodiscard]] float getF1() const;

[[nodiscard]] SGXString getFont() const;

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

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

[[nodiscard]] SGWHorizontalAlignment::Flag getHorizontalAlignment() const;

[[nodiscard]] float getTextAsFloat(bool* isValid, float minimum, float maximum) const;

[[nodiscard]] int getTextAsInt(bool* isValid, int minimum, int maximum) const;

[[nodiscard]] SGXString getTextAsString() const;

[[nodiscard]] SGWVerticalAlignment::Flag getVerticalAlignment() const;

void setBackgroundColour(SGXColourRGBA colour);

void setBackgroundThemeColour(int themeColour);

void setF0(float f0);

void setF1(float f1);

void setFont(const SGXString& font);

void setForegroundColour(SGXColourRGBA colour);

void setForegroundThemeColour(int themeColour);

void setHorizontalAlignment(SGWHorizontalAlignment::Flag alignment);

void setTextFromFloat(float x);

void setTextFromInt(int x);

void setTextFromString(const SGXString& text);

void setVerticalAlignment(SGWVerticalAlignment::Flag alignment);

Detailed Description

SGWLabel provides a base class for SGWidget ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ text labels. This is not meant to be instantiated directly, you are supposed to create its subclasses (SGWTextLabel, SGWIconLabel, SGWLongLabel, SGWSequentialLongLabel) to use its functionality.

Implementation Details

Stores information about the SGWLabel.

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

Returns the SGXColourRGBA currently being used for the background of this SGWLabel. 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 getBackgroundThemeColour(bool* isUsing) const;

Returns the theme colour ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ currently being used for the background of this SGWLabel. 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.

[[nodiscard]] float getF0() const;

Returns the 0 coordinate of the font size as a w-distance ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾.

[[nodiscard]] float getF1() const;

Returns the 1 coordinate of the font size as a w-distance ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾.

[[nodiscard]] SGXString getFont() const;

Returns the current font used to display text in the SGWLabel.

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

Returns the SGXColourRGBA currently being used for the foreground of this SGWLabel. 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 getForegroundThemeColour(bool* isUsing) const;

Returns the theme colour ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ currently being used for the foreground of this SGWLabel. 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.

[[nodiscard]] SGWHorizontalAlignment::Flag getHorizontalAlignment() const;

Returns the current SGWHorizontalAlignment mode used to display text in this SGWLabel.

[[nodiscard]] float getTextAsFloat(bool* isValid, float minimum, float maximum) const;

Returns the text displayed in the SGWLabel as a number between minimum and maximum inclusive. If the text does not represent a number or if it is out of bounds, isValid is set to false and 0 is returned, otherwise isValid is set to true.

Pass nullptr to isValid if you are not interested if the text represents a number and the integer is in bounds.

minimum more than maximum is undefined behaviour.

[[nodiscard]] int getTextAsInt(bool* isValid, int minimum, int maximum) const;

Returns the text displayed in the SGWLabel as an integer between minimum and maximum inclusive. If the text does not represent an integer or if it is out of bounds, isValid is set to false and 0 is returned, otherwise isValid is set to true.

Pass nullptr to isValid if you are not interested if the text represents an integer and the integer is in bounds.

minimum more than maximum is undefined behaviour.

[[nodiscard]] SGXString getTextAsString() const;

Returns the text displayed in the SGWLabel.

[[nodiscard]] SGWVerticalAlignment::Flag getVerticalAlignment() const;

Returns the current SGWVerticalAlignment mode used to display text in this SGWLabel.

void setBackgroundColour(SGXColourRGBA colour);

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

void setBackgroundThemeColour(int themeColour);

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

void setF0(float f0);

Sets the 0 coordinate of the font size as a w-distance ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ to f0.

void setF1(float f1);

Sets the 1 coordinate of the font size as a w-distance ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ to f1.

void setFont(const SGXString& font);

Sets the SGWLabel to use font to display text.

If font is not a valid font, this is undefined behaviour.

void setForegroundColour(SGXColourRGBA colour);

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

void setForegroundThemeColour(int themeColour);

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

void setHorizontalAlignment(SGWHorizontalAlignment::Flag alignment);

Sets the SGWHorizontalAlignment mode used to display text in this SGWLabel to alignment.

void setTextFromFloat(float x);

Sets the text currently displayed in the SGWLabel to the string representation of x.

void setTextFromInt(int x);

Sets the text currently displayed in the SGWLabel to the string representation of x.

void setTextFromString(const SGXString& text);

Sets the text currently displayed in the SGWLabel to text.

void setVerticalAlignment(SGWVerticalAlignment::Flag alignment);

Sets the SGWVerticalAlignment mode used to display text in this SGWLabel to alignment.

©2025 05524F.sg (Singapore)

contact 05524F / report a bug / make a suggestion

about 05524F SINGAPORE values

list of 05524F projects