aboutsummaryrefslogtreecommitdiff
path: root/src/theme_builder/components/conditions/CompoundConditionEditor.h
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-02-15 16:02:55 +0800
committercrupest <crupest@outlook.com>2022-02-15 16:02:55 +0800
commit85f4cb239f10e1801e43f0874a4f637def5daaee (patch)
tree3587ebc63b9ecd6d0df745740f6ac94dd06e9460 /src/theme_builder/components/conditions/CompoundConditionEditor.h
parentb40bae96224fb6fb80e96d2072d0f104f2ef2f59 (diff)
downloadcru-85f4cb239f10e1801e43f0874a4f637def5daaee.tar.gz
cru-85f4cb239f10e1801e43f0874a4f637def5daaee.tar.bz2
cru-85f4cb239f10e1801e43f0874a4f637def5daaee.zip
...
Diffstat (limited to 'src/theme_builder/components/conditions/CompoundConditionEditor.h')
-rw-r--r--src/theme_builder/components/conditions/CompoundConditionEditor.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/theme_builder/components/conditions/CompoundConditionEditor.h b/src/theme_builder/components/conditions/CompoundConditionEditor.h
index 6631618f..db58b50a 100644
--- a/src/theme_builder/components/conditions/CompoundConditionEditor.h
+++ b/src/theme_builder/components/conditions/CompoundConditionEditor.h
@@ -2,11 +2,35 @@
#include "ConditionEditor.h"
#include "cru/common/ClonablePtr.h"
#include "cru/common/Event.h"
+#include "cru/ui/components/Component.h"
#include "cru/ui/controls/Button.h"
#include "cru/ui/controls/FlexLayout.h"
+#include "cru/ui/controls/TextBlock.h"
#include "cru/ui/style/Condition.h"
namespace cru::theme_builder::components::conditions {
+class CompoundConditionEditorChild : public ui::components::Component {
+ public:
+ explicit CompoundConditionEditorChild(
+ std::unique_ptr<ConditionEditor>&& editor);
+ ~CompoundConditionEditorChild() override;
+
+ public:
+ ui::controls::Control* GetRootControl() override { return &container_; }
+
+ ConditionEditor* GetConditionEditor() { return condition_editor_.get(); }
+
+ IEvent<std::nullptr_t>* RemoveEvent() { return &remove_event_; }
+
+ private:
+ ui::controls::FlexLayout container_;
+ ui::controls::Button remove_button_;
+ ui::controls::TextBlock remove_button_text_;
+ std::unique_ptr<ConditionEditor> condition_editor_;
+
+ Event<std::nullptr_t> remove_event_;
+};
+
class CompoundConditionEditor : public ConditionEditor {
public:
CompoundConditionEditor();
@@ -24,6 +48,7 @@ class CompoundConditionEditor : public ConditionEditor {
ui::controls::FlexLayout children_container_;
ui::controls::Button add_child_button_;
ui::controls::TextBlock add_child_button_text_;
+ std::vector<std::unique_ptr<CompoundConditionEditorChild>> children_;
Event<std::nullptr_t> children_change_event_;
};