sincerely Singaporean

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

SGWColourPickerWidget

see header file

see source file

class SGWColourPickerWidget;

part of SGEXTN module SG_RI

SGWidget ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ for choosing a colour

detailed description

list of all including inherited members

implementation details

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

CMake target for BuildLah: SGEXTN::SG_RI

see this link for more information about BuildLah

parent class: SGWWidget

children classes: (none)

instance member variables

void (*attachedFunction)();

void (*attachedFunctionWithInt)(int);

void (*attachedFunctionWithPointer)(SGWColourPickerWidget*);

void (*attachedFunctionWithString)(const SGXString&);

int attachedInt;

SGXString attachedString;

instance member functions

SGWColourPickerWidget(SGWWidget* parent, float x1, float x0, float y1, float y0, float w1, float w0, float h1, float h0, SGXColourRGBA defaultColour);

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

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

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

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

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

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

[[nodiscard]] SGXColourRGBA getColour() const;

[[nodiscard]] float getE0() const;

[[nodiscard]] float getE1() const;

void setBackgroundColour(SGXColourRGBA colour);

void setBackgroundFocusColour(SGXColourRGBA colour);

void setBackgroundFocusThemeColour(int themeColour);

void setBackgroundHoverColour(SGXColourRGBA colour);

void setBackgroundHoverThemeColour(int themeColour);

void setBackgroundThemeColour(int themeColour);

void setColour(SGXColourRGBA colour);

void setE0(float e0);

void setE1(float e1);

Detailed Description

SGWColourPickerWidget is part of the SGWidget ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ system that provides a colour picker, allowing the user to choose a colour. It also supports running a callback function ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ after the colour is chosen. The colour picker UI is builtin to SGEXTN and does not need to be implemented.

Implementation Details

SGWColourPickerWidget internally uses SG - RI ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾.

void (*attachedFunction)();

callback function ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ taking no arguments, triggered when a colour is selected by the user.

void (*attachedFunctionWithInt)(int);

callback function ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ taking a int, triggered when a colour is selected by the user and SGWColourPickerWidget::attachedInt is passed as argument.

void (*attachedFunctionWithPointer)(SGWColourPickerWidget*);

callback function ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ taking a pointer to SGWColourPickerWidget, triggered when a colour is selected by the user and the pointer to this SGWColourPickerWidget is passed as argument.

void (*attachedFunctionWithString)(const SGXString&);

callback function ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ taking a string, triggered when a colour is selected by the user and SGWColourPickerWidget::attachedString is passed as argument.

int attachedInt;

Int attached to this SGWColourPickerWidget.

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

SGXString attachedString;

String attached to this SGWColourPickerWidget.

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

SGWColourPickerWidget(SGWWidget* parent, float x1, float x0, float y1, float y0, float w1, float w0, float h1, float h0, SGXColourRGBA defaultColour);

Creates a SGWColourPickerWidget with parent SGWidget ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ parent, w-distance ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ coordinates (x1, x0, y1, y0, w1, w0, h1, h0), and the default choice of colour set to defaultColour.

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]] SGXColourRGBA getBackgroundColour(bool* isUsing) const;

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

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

Returns the theme colour ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ currently being used for the background of this SGWColourPickerWidget when focused. 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]] SGXColourRGBA getBackgroundHoverColour(bool* isUsing) const;

Returns the SGXColourRGBA currently being used for the background of this SGWColourPickerWidget when hovered over. 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 getBackgroundHoverThemeColour(bool* isUsing) const;

Returns the theme colour ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ currently being used for the background of this SGWColourPickerWidget when hovered over. 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]] int getBackgroundThemeColour(bool* isUsing) const;

Returns the theme colour ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ currently being used for the background of this SGWColourPickerWidget. 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]] SGXColourRGBA getColour() const;

Returns the currently chosen SGXColourRGBA.

[[nodiscard]] float getE0() const;

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

[[nodiscard]] float getE1() const;

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

void setBackgroundColour(SGXColourRGBA colour);

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

void setBackgroundFocusColour(SGXColourRGBA colour);

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

void setBackgroundFocusThemeColour(int themeColour);

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

void setBackgroundHoverColour(SGXColourRGBA colour);

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

void setBackgroundHoverThemeColour(int themeColour);

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

void setBackgroundThemeColour(int themeColour);

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

void setColour(SGXColourRGBA colour);

Sets the currently chosen SGXColourRGBA to colour.

This does not activate callback function ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾.

void setE0(float e0);

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

void setE1(float e1);

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

©2025 05524F.sg (Singapore)

contact 05524F / report a bug / make a suggestion

about 05524F SINGAPORE values

list of 05524F projects