blob: 9c7852d4a44a888ef0f90ee9fcccb4439eefb8c2 (
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
|
#include "StylerEditor.h"
#include "BorderStylerEditor.h"
#include "CompoundStylerEditor.h"
#include "CursorStylerEditor.h"
#include "cru/ui/style/Styler.h"
namespace cru::theme_builder::components::stylers {
StylerEditor::StylerEditor() {
container_.SetFlexDirection(ui::controls::FlexDirection::Vertical);
container_.AddChild(&label_);
}
StylerEditor::~StylerEditor() { container_.RemoveFromParent(); }
std::unique_ptr<StylerEditor> CreateStylerEditor(ui::style::Styler* styler) {
if (auto compound_styler = dynamic_cast<ui::style::CompoundStyler*>(styler)) {
auto result = std::make_unique<CompoundStylerEditor>();
result->SetValue(compound_styler);
return result;
} else if (auto border_styler =
dynamic_cast<ui::style::BorderStyler*>(styler)) {
auto editor = std::make_unique<BorderStylerEditor>();
editor->SetValue(border_styler);
return editor;
} else if (auto cursor_styler =
dynamic_cast<ui::style::CursorStyler*>(styler)) {
auto editor = std::make_unique<CursorStylerEditor>();
editor->SetValue(cursor_styler);
return editor;
} else {
return nullptr;
}
}
} // namespace cru::theme_builder::components::stylers
|