DialogColor
The DialogColor class provides a platform-native color picker dialog that allows the user to select a color, with optional support for transparency. It provides functionality to set and get the current color, set the dialog position and title, and define callbacks for when the color changes or for updates.
#include <interface/TellusimDialogs.h>
Constructors
explicit DialogColor(const char *title = nullptr, Color color = Color::zero)
explicit DialogColor(const String &title, Color color = Color::zero)
Methods
Dialog position.
void setPosition(int32_t x, int32_t y)
int32_t getPositionX() const
int32_t getPositionY() const
Dialog title.
void setTitle(const char *title)
void setTitle(const String &title)
String getTitle() const
Dialog color.
void setColor(Color color, bool callback = false)
const Color getColor() const
Changed callback.
void setChangedCallback(const ChangedCallback &func)
ChangedCallback getChangedCallback() const
Update callback.
void setUpdateCallback(const UpdateCallback &func)
UpdateCallback getUpdateCallback() const
Run dialog.
Result run(Flags flags = DefaultFlags)
Types
using ChangedCallback = Function<void(Color)>
using UpdateCallback = Function<bool()>
Enums
Flags
Dialog flags.
Name | Value |
---|---|
FlagNone | 0 |
FlagAlpha | (1 << 0) |
FlagMouse | (1 << 1) |
DefaultFlags | FlagNone |
NumFlags | 2 |
Result
Dialog result.
Name | Value |
---|---|
ResultCancel | 0 |
ResultOk | 1 |
NumResults | 2 |