diff options
author | crupest <crupest@outlook.com> | 2022-02-16 20:22:25 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-02-16 20:22:25 +0800 |
commit | 3cd44092c44651650a760752a3d374f610ca4f77 (patch) | |
tree | d3481e8d93d8d47674d0df46eb765ccf9100bca8 /src/theme_builder/components/stylers/StylerEditor.cpp | |
parent | 6459edc7c8af9e5c9bafe4f1635194334f42f415 (diff) | |
download | cru-3cd44092c44651650a760752a3d374f610ca4f77.tar.gz cru-3cd44092c44651650a760752a3d374f610ca4f77.tar.bz2 cru-3cd44092c44651650a760752a3d374f610ca4f77.zip |
...
Diffstat (limited to 'src/theme_builder/components/stylers/StylerEditor.cpp')
-rw-r--r-- | src/theme_builder/components/stylers/StylerEditor.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/theme_builder/components/stylers/StylerEditor.cpp b/src/theme_builder/components/stylers/StylerEditor.cpp new file mode 100644 index 00000000..9c7852d4 --- /dev/null +++ b/src/theme_builder/components/stylers/StylerEditor.cpp @@ -0,0 +1,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 |