#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* ChangeEvent() { return &change_event_; } IEvent* 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 condition_editor_; std::unique_ptr styler_editor_; Event change_event_; Event remove_event_; }; } // namespace cru::theme_builder::components