aboutsummaryrefslogtreecommitdiff
path: root/src/ThemeBuilder/components/StyleRuleEditor.h
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-05-15 14:15:31 +0800
committercrupest <crupest@outlook.com>2022-05-15 14:15:31 +0800
commit34a64e6ffefaab007578932ddbab931a25f1d56e (patch)
tree541fdb8279e829a129df62288d09916bf23c9200 /src/ThemeBuilder/components/StyleRuleEditor.h
parent8ad2966933957ac5d6ff8dcd5e732736fd5e4dc6 (diff)
downloadcru-34a64e6ffefaab007578932ddbab931a25f1d56e.tar.gz
cru-34a64e6ffefaab007578932ddbab931a25f1d56e.tar.bz2
cru-34a64e6ffefaab007578932ddbab931a25f1d56e.zip
...
Diffstat (limited to 'src/ThemeBuilder/components/StyleRuleEditor.h')
-rw-r--r--src/ThemeBuilder/components/StyleRuleEditor.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/ThemeBuilder/components/StyleRuleEditor.h b/src/ThemeBuilder/components/StyleRuleEditor.h
new file mode 100644
index 00000000..8e3db3de
--- /dev/null
+++ b/src/ThemeBuilder/components/StyleRuleEditor.h
@@ -0,0 +1,45 @@
+#pragma once
+#include "conditions/ConditionEditor.h"
+#include "cru/ui/components/Component.h"
+#include "cru/ui/controls/Button.h"
+#include "cru/ui/controls/Control.h"
+#include "cru/ui/controls/FlexLayout.h"
+#include "cru/ui/controls/IconButton.h"
+#include "cru/ui/controls/TextBlock.h"
+#include "cru/ui/style/StyleRule.h"
+#include "stylers/StylerEditor.h"
+
+namespace cru::theme_builder::components {
+class StyleRuleEditor : public ui::components::Component {
+ public:
+ StyleRuleEditor();
+
+ CRU_DELETE_COPY(StyleRuleEditor)
+ CRU_DELETE_MOVE(StyleRuleEditor)
+
+ ~StyleRuleEditor() override;
+
+ public:
+ ui::controls::Control* GetRootControl() override { return &container_; }
+
+ ui::style::StyleRule GetValue() const;
+ void SetValue(const ui::style::StyleRule& style_rule,
+ bool trigger_change = true);
+
+ IEvent<std::nullptr_t>* ChangeEvent() { return &change_event_; }
+ IEvent<std::nullptr_t>* RemoveEvent() { return &remove_event_; }
+
+ private:
+ ui::controls::Container container_;
+ ui::controls::FlexLayout main_layout_;
+ ui::controls::TextBlock label_;
+ ui::controls::FlexLayout head_layout_;
+ ui::controls::IconButton remove_button_;
+ ui::controls::FlexLayout body_layout_;
+ std::unique_ptr<components::conditions::ConditionEditor> condition_editor_;
+ std::unique_ptr<components::stylers::StylerEditor> styler_editor_;
+
+ Event<std::nullptr_t> change_event_;
+ Event<std::nullptr_t> remove_event_;
+};
+} // namespace cru::theme_builder::components