blob: aa6cfcfa3e38f727abdfe3a2b6f226bbe2fca73e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#pragma once
#include "../Editor.h"
#include "cru/platform/graphics/Base.h"
#include "cru/ui/controls/Container.h"
#include "cru/ui/controls/FlexLayout.h"
#include "cru/ui/controls/TextBlock.h"
#include "cru/ui/controls/TextBox.h"
namespace cru::theme_builder::components::properties {
class ColorPropertyEditor : public Editor {
public:
using PropertyType = ui::Color;
ColorPropertyEditor();
~ColorPropertyEditor() override;
public:
ui::controls::Control* GetRootControl() override { return &container_; }
String GetLabel() const { return label_.GetText(); }
void SetLabel(String label) { label_.SetText(std::move(label)); }
ui::Color GetValue() const { return color_; }
void SetValue(const ui::Color& color, bool trigger_change = true);
private:
ui::Color color_ = ui::colors::transparent;
ui::controls::FlexLayout container_;
ui::controls::TextBlock label_;
ui::controls::Container color_cube_;
std::shared_ptr<platform::graphics::ISolidColorBrush> color_cube_brush_;
ui::controls::TextBox color_text_;
bool is_color_text_valid_;
};
} // namespace cru::theme_builder::components::properties
|