sincerely Singaporean

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

SGWWidget

see header file

see source file

class SGWWidget;

part of SGEXTN module SG_Widgets

base class of all SGWidget ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ UI element

detailed description

list of all including inherited members

implementation details

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

CMake target for BuildLah: SGEXTN::SG_Widgets

see this link for more information about BuildLah

parent class: (none)

children classes: SGRRendererWidget, SGWBackground, SGWBlankWidget, SGWButton, SGWColourPickerWidget, SGWInput, SGWLabel, SGWMultiTouchReceiver, SGWSingleTouchReceiver

instance member functions

void deleteWidget();

[[nodiscard]] SGLArraySGWWidget*› getChildren() const;

[[nodiscard]] float getH0() const;

[[nodiscard]] float getH1() const;

[[nodiscard]] bool getItemVisibility() const;

[[nodiscard]] SGWWidget* getParent() const;

[[nodiscard]] SGWType::Type getType() const;

[[nodiscard]] float getW0() const;

[[nodiscard]] float getW1() const;

[[nodiscard]] float getX0() const;

[[nodiscard]] float getX1() const;

[[nodiscard]] float getY0() const;

[[nodiscard]] float getY1() const;

void screenshot(void (*callback)(SGRImage*)) const;

void setH0(float h0);

void setH1(float h1);

void setItemVisibility(bool x);

void setW0(float w0);

void setW1(float w1);

void setX0(float x0);

void setX1(float x1);

void setY0(float y0);

void setY1(float y1);

static member variables

static SGWWidget* parentWidget;

static SGWWidget* rootWidget;

Detailed Description

SGWWidget is the base class of all SGWidget ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ UI elements and provides w-distance ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ functionality. SGWWidget also allows child SGWidget ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ elements to be deleted when the parent is deleted through maintaining a hierarchy tree.

Implementation Details

Stores information about the SGWWidget

void deleteWidget();

Deletes a SGWWidget safely.

To avoid use after delete bugs, deleting a SGWWidget directly will cause a crash.

[[nodiscard]] SGLArraySGWWidget*› getChildren() const;

Returns the children of this SGWWidget as a SGLArray of SGWWidget.

A SGWWidget can have more than 1 child SGWWidget.

[[nodiscard]] float getH0() const;

Returns the 0 coordinate of the w-distance ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ controlling the height of this SGWWidget.

[[nodiscard]] float getH1() const;

Returns the 1 coordinate of the w-distance ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ controlling the height of this SGWWidget.

[[nodiscard]] bool getItemVisibility() const;

Returns if the SGWWidget is currently visible on screen.

[[nodiscard]] SGWWidget* getParent() const;

Returns the parent SGWWidget.

[[nodiscard]] SGWType::Type getType() const;

Returns the type of this SGWWidget as a SGWType.

[[nodiscard]] float getW0() const;

Returns the 0 coordinate of the w-distance ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ controlling the width of this SGWWidget.

[[nodiscard]] float getW1() const;

Returns the 1 coordinate of the w-distance ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ controlling the width of this SGWWidget.

[[nodiscard]] float getX0() const;

Returns the 0 coordinate of the w-distance ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ controlling the x position of this SGWWidget.

[[nodiscard]] float getX1() const;

Returns the 1 coordinate of the w-distance ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ controlling the x position of this SGWWidget.

[[nodiscard]] float getY0() const;

Returns the 0 coordinate of the w-distance ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ controlling the y position of this SGWWidget.

[[nodiscard]] float getY1() const;

Returns the 1 coordinate of the w-distance ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ controlling the y position of this SGWWidget.

void screenshot(void (*callback)(SGRImage*)) const;

Requests a screenshot of the current SGWWidget and all of its children. callback which is a callback function ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ will be called with the SGRImage produced as argument when the screenshot is taken.

callback being nullptr will crash.

void setH0(float h0);

Sets the 0 coordinate of the w-distance ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ controlling the height of this SGWWidget to h0.

void setH1(float h1);

Sets the 1 coordinate of the w-distance ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ controlling the height of this SGWWidget to h1.

void setItemVisibility(bool x);

Shows the SGWWidget if x is true and hides it otherwise.

void setW0(float w0);

Sets the 0 coordinate of the w-distance ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ controlling the width of this SGWWidget to w0.

void setW1(float w1);

Sets the 1 coordinate of the w-distance ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ controlling the width of this SGWWidget to w1.

void setX0(float x0);

Sets the 0 coordinate of the w-distance ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ controlling the x position of this SGWWidget to x0.

void setX1(float x1);

Sets the 1 coordinate of the w-distance ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ controlling the x position of this SGWWidget to x1.

void setY0(float y0);

Sets the 0 coordinate of the w-distance ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ controlling the y position of this SGWWidget to y0.

void setY1(float y1);

Sets the 1 coordinate of the w-distance ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ controlling the y position of this SGWWidget to y1.

static SGWWidget* parentWidget;

The SGWWidget that should contain all your SGWidget ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ UI pages.

Attempting to modify this in any way, except for adding child SGWWidget objects, is undefined behaviour.

static SGWWidget* rootWidget;

The SGWWidget directly attached to the application window.

Attempting to modify this in any way is undefined behaviour.

©2025 05524F.sg (Singapore)

contact 05524F / report a bug / make a suggestion

about 05524F SINGAPORE values

list of 05524F projects