diff options
author | crupest <crupest@outlook.com> | 2022-02-15 00:06:30 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-02-15 00:06:30 +0800 |
commit | b40bae96224fb6fb80e96d2072d0f104f2ef2f59 (patch) | |
tree | 67abc2fe6f90cb1027fce1562546c544bf0d6713 /src/theme_builder | |
parent | ab80b32dc6acd7fdfd1da3b63d69535264af0ef3 (diff) | |
download | cru-b40bae96224fb6fb80e96d2072d0f104f2ef2f59.tar.gz cru-b40bae96224fb6fb80e96d2072d0f104f2ef2f59.tar.bz2 cru-b40bae96224fb6fb80e96d2072d0f104f2ef2f59.zip |
...
Diffstat (limited to 'src/theme_builder')
-rw-r--r-- | src/theme_builder/components/conditions/CompoundConditionEditor.h | 25 | ||||
-rw-r--r-- | src/theme_builder/components/conditions/CompoundConditonEditor.cpp | 14 |
2 files changed, 38 insertions, 1 deletions
diff --git a/src/theme_builder/components/conditions/CompoundConditionEditor.h b/src/theme_builder/components/conditions/CompoundConditionEditor.h index 00f73e09..6631618f 100644 --- a/src/theme_builder/components/conditions/CompoundConditionEditor.h +++ b/src/theme_builder/components/conditions/CompoundConditionEditor.h @@ -1,7 +1,30 @@ #pragma once #include "ConditionEditor.h" +#include "cru/common/ClonablePtr.h" +#include "cru/common/Event.h" +#include "cru/ui/controls/Button.h" +#include "cru/ui/controls/FlexLayout.h" +#include "cru/ui/style/Condition.h" namespace cru::theme_builder::components::conditions { -class CompoundConditionEditor : public ConditionEditor {}; +class CompoundConditionEditor : public ConditionEditor { + public: + CompoundConditionEditor(); + ~CompoundConditionEditor(); + protected: + std::vector<ClonablePtr<ui::style::Condition>> GetChildren(); + void SetChildren(std::vector<ClonablePtr<ui::style::Condition>> children); + + IEvent<std::nullptr_t>* ChildrenChangeEvent() { + return &children_change_event_; + } + + private: + ui::controls::FlexLayout children_container_; + ui::controls::Button add_child_button_; + ui::controls::TextBlock add_child_button_text_; + + Event<std::nullptr_t> children_change_event_; +}; } // namespace cru::theme_builder::components::conditions diff --git a/src/theme_builder/components/conditions/CompoundConditonEditor.cpp b/src/theme_builder/components/conditions/CompoundConditonEditor.cpp new file mode 100644 index 00000000..d3e82878 --- /dev/null +++ b/src/theme_builder/components/conditions/CompoundConditonEditor.cpp @@ -0,0 +1,14 @@ +#include "CompoundConditionEditor.h" + +namespace cru::theme_builder::components::conditions { +CompoundConditionEditor::CompoundConditionEditor() { + GetContainer()->AddChild(&children_container_); + GetContainer()->AddChild(&add_child_button_); + + add_child_button_.SetChild(&add_child_button_text_); + add_child_button_text_.SetText(u"Add"); +} + +CompoundConditionEditor::~CompoundConditionEditor() {} + +} // namespace cru::theme_builder::components::conditions |