Palettes::ColorPickerUI class

This class holds all information related with the color picker in editor categories and its user interface.

A color picker is made of multiple color buttons, represented by the Palettes::ColorSwatchUI class. A color picker object can only have one selected color at a time.

Base classes

class DefaultRefCounted
The default implementation of a reference counted class.
class Object
This class represents a basic reference counted object.

Public static variables

static const uint32_t TYPE

Constructors, destructors, conversion operators

ColorPickerUI()
~ColorPickerUI() virtual

Public functions

auto Load(UTFWin::IWindow* pWindow, uint32_t propID, uint32_t regionFilter, eastl::vector<Math::ColorRGB>* pColors = nullptr) -> bool
Loads and generates the UI for this color picker.
auto SetVisible(bool visible) -> void
Toggles the visibility of this color picker.
auto GetSwatchArea(int index, bool = false) const -> Math::Rectangle
Returns the area that a swatch in the given index would fit.
auto SetColor(const Math::ColorRGB& color) -> void
auto Update(long deltaMS) -> void
auto AddRef() -> int override
auto Release() -> int override
auto Cast(uint32_t type) const -> void* override

Public variables

ObjectPtr mpSelectedColorSwatch
UTFWin::IWindow* mpWindow
The container window where the layout is inserted.
float mWidth
The total width of the container window.
float mHeight
The total height of the container window.
Math::ColorRGB mSelectedColor
The currently selected color.
int mCustomColorIndex
The index of the button for setting a custom color, only used if the property 'colorpickerAddCustomColor' is true.
int mDefaultColorIndex
The index of the button for setting the default color, only used if the property 'colorpickerAddDefaultColor' is true.
eastl::vector<ColorSwatchUIPtr> mpColorUIs
The user interfaces of the multiple color swatches that are shown in the color picker.
size_t mColorsCount
The number of color buttons that fit into the picker layout.
PropertyListPtr mpPropList
The PROP file that contains the configuration for this color picker.
uint32_t mRegionFilter
In block painting, the instance ID of a file that defines which region is painted in partial styles; The file is assumed to be in the folder with group ID 0x406A6F00.

Function documentation

bool Palettes::ColorPickerUI::Load(UTFWin::IWindow* pWindow, uint32_t propID, uint32_t regionFilter, eastl::vector<Math::ColorRGB>* pColors = nullptr)

Loads and generates the UI for this color picker.

Parameters
pWindow The container window where the layout will be inserted.
propID The instanceID of the property list that contains the properties of the color picker. The folder is assumed to be 'ColorPickerConfig'.
regionFilter
pColors [Optional] A list of the colors that must be generated. If it is not present, the list will be taken from the property 'colorpickerColors' of the .prop file.

This creates the layout for all the color buttons.

void Palettes::ColorPickerUI::SetVisible(bool visible)

Toggles the visibility of this color picker.

If bVisible is true, the color picker UI will be brought to the front of its parent window.

Math::Rectangle Palettes::ColorPickerUI::GetSwatchArea(int index, bool = false) const

Returns the area that a swatch in the given index would fit.

It calculates it based on the 'colorpickerGapPercent' property, the number of color buttons and the width/height of the container.

Variable documentation

uint32_t Palettes::ColorPickerUI::mRegionFilter

In block painting, the instance ID of a file that defines which region is painted in partial styles; The file is assumed to be in the folder with group ID 0x406A6F00.

In skinpaints, this is the skinpaint index (0 -> base, 1 -> coat, 2 -> detail).