AColorPicker
- Module
- Arc
- Header
#include "Arc/Widgets/AColorPicker.h"- Namespace
Arcf
Properties
| Type | Name | Description |
|---|---|---|
ArcDelegate<void(const ArcColor&)> | OnColorChanged | |
ArcDelegate<void(bool)> | OnClosed | Enter -> OnClosed(true); Escape -> current color reverts to the original, then OnClosed(false). Hosts embed the picker and use this as the accept/cancel signal. |
Public functions
| Returns | Name | Description |
|---|---|---|
ARC_WIDGET_ARGS | ||
ArcVec2 | ComputeDesiredSize | |
int32_t | OnPaint | |
CReply | OnMouseButtonDown | |
CReply | OnMouseButtonUp | |
CReply | OnMouseMove | |
EArcCursorType | OnCursorQuery | |
void | OnMouseCaptureLost | |
CReply | OnKeyDown | |
CReply | OnKeyChar | |
void | OnFocusLost | |
ArcColor | GetColor | |
void | SetColor | |
void | SetOriginalColor | |
ArcColor | GetOriginalColor | |
void | SetShowAlpha | The alpha row is a whole slider's worth of height. |
bool | IsHexEditing | |
void | SetEyedropperSampler | In-window eyedropper: the host installs a sampler that resolves a window-space position to a color (the editor samples the rendered viewport). |
uint32_t | GetSavedColors | The saved swatches are ONE process-wide palette — every picker shares it, so a colour saved while editing a light is offered in the material editor a minute later. |
void | SetSavedColors | |
void | SetOnSavedColorsChanged | |
bool | IsSrgbDisplay | How the NUMBERS are shown and parsed — the stored colour never changes. |
void | SetSrgbDisplay | |
bool | CanCacheDesiredSize | A fixed card whose height only depends on whether the alpha row is shown; the colour being edited never resizes it. |
const char* | GetTypeName |
Function details
ARC_WIDGET_ARGS
ARC_WIDGET_ARGS(AColorPicker) ARC_ATTR(ArcColor, InitialColor) ARC_ARG(bool, ShowAlpha) ARC_ARG(bool, DrawBackground) ARC_WIDGET_ARGS_END() void Construct(const CArguments& args)ComputeDesiredSize
ArcVec2 ComputeDesiredSize(float scale) const overrideOnPaint
int32_t OnPaint(const CArcPaintArgs& args, const CGeometry& geo, CArcUIRenderer& renderer, int32_t layerId) const overrideOnMouseButtonDown
CReply OnMouseButtonDown(const CGeometry& geo, const CPointerEvent& event) overrideOnMouseButtonUp
CReply OnMouseButtonUp(const CGeometry& geo, const CPointerEvent& event) overrideOnMouseMove
CReply OnMouseMove(const CGeometry& geo, const CPointerEvent& event) overrideOnCursorQuery
EArcCursorType OnCursorQuery(const CGeometry& geo, const CPointerEvent& event) const overrideOnMouseCaptureLost
void OnMouseCaptureLost() overrideOnKeyDown
CReply OnKeyDown(const CGeometry& geo, const CKeyEvent& event) overrideOnKeyChar
CReply OnKeyChar(const CGeometry& geo, const CCharacterEvent& event) overrideOnFocusLost
void OnFocusLost(const CFocusEvent& event) overrideGetColor
ArcColor GetColor() constSetColor
void SetColor(const ArcColor& color)SetOriginalColor
void SetOriginalColor(const ArcColor& color)GetOriginalColor
ArcColor GetOriginalColor() constSetShowAlpha
void SetShowAlpha(bool show)The alpha row is a whole slider's worth of height.
IsHexEditing
bool IsHexEditing() constSetEyedropperSampler
static void SetEyedropperSampler(std::function<bool(const ArcVec2&, ArcColor&)> sampler)In-window eyedropper: the host installs a sampler that resolves a window-space position to a color (the editor samples the rendered viewport). Without a sampler the pipette button hides. While active the picker live-previews under the cursor; click commits, Escape restores the pre-activation color.
GetSavedColors
static uint32_t GetSavedColors(std::array<ArcColor, 8>& out)The saved swatches are ONE process-wide palette — every picker shares it, so a colour saved while editing a light is offered in the material editor a minute later. The host may persist it: Get/Set round-trip the palette and the callback fires after every user edit.
SetSavedColors
static void SetSavedColors(const ArcColor* colors, uint32_t count)SetOnSavedColorsChanged
static void SetOnSavedColorsChanged(std::function<void()> callback)IsSrgbDisplay
static bool IsSrgbDisplay()How the NUMBERS are shown and parsed — the stored colour never changes. Engine colours (light tint, base colour) are LINEAR, so their raw 0..255 reads much darker than the same colour in any other tool; sRGB mode gamma-encodes the hex and the R/G/B labels so a value can be copied in and out of one. Process-wide, like the saved palette: switching it in one picker switches it everywhere. Linear (raw) is the default — that is what every picker showed before the toggle existed.
SetSrgbDisplay
static void SetSrgbDisplay(bool srgb)CanCacheDesiredSize
bool CanCacheDesiredSize() const overrideA fixed card whose height only depends on whether the alpha row is shown; the colour being edited never resizes it.
GetTypeName
const char* GetTypeName() const override