diff options
author | crupest <crupest@outlook.com> | 2022-05-15 14:15:31 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-05-15 14:15:31 +0800 |
commit | 34a64e6ffefaab007578932ddbab931a25f1d56e (patch) | |
tree | 541fdb8279e829a129df62288d09916bf23c9200 /src/ThemeBuilder/components/StyleRuleSetEditor.h | |
parent | 8ad2966933957ac5d6ff8dcd5e732736fd5e4dc6 (diff) | |
download | cru-34a64e6ffefaab007578932ddbab931a25f1d56e.tar.gz cru-34a64e6ffefaab007578932ddbab931a25f1d56e.tar.bz2 cru-34a64e6ffefaab007578932ddbab931a25f1d56e.zip |
...
Diffstat (limited to 'src/ThemeBuilder/components/StyleRuleSetEditor.h')
-rw-r--r-- | src/ThemeBuilder/components/StyleRuleSetEditor.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/ThemeBuilder/components/StyleRuleSetEditor.h b/src/ThemeBuilder/components/StyleRuleSetEditor.h new file mode 100644 index 00000000..03148889 --- /dev/null +++ b/src/ThemeBuilder/components/StyleRuleSetEditor.h @@ -0,0 +1,44 @@ +#pragma once +#include "StyleRuleEditor.h" +#include "cru/ui/DeleteLater.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/ScrollView.h" +#include "cru/ui/model/IListChangeNotify.h" +#include "cru/ui/style/StyleRuleSet.h" + +namespace cru::theme_builder::components { +class StyleRuleSetEditor : public ui::components::Component { + public: + StyleRuleSetEditor(); + + CRU_DELETE_COPY(StyleRuleSetEditor) + CRU_DELETE_MOVE(StyleRuleSetEditor) + + ~StyleRuleSetEditor() override; + + public: + ui::controls::Control* GetRootControl() override { return &scroll_view_; } + + void BindStyleRuleSet(std::shared_ptr<ui::style::StyleRuleSet> rule_set); + + private: + Index IndexOfRuleEditor(StyleRuleEditor* editor); + + void UpdateView(ui::style::StyleRuleSet* style_rule_set, + std::optional<ui::model::ListChange> change = std::nullopt); + + private: + std::shared_ptr<ui::style::StyleRuleSet> style_rule_set_; + + ui::controls::ScrollView scroll_view_; + ui::controls::FlexLayout container_; + ui::controls::FlexLayout rules_layout_; + std::vector<ui::DeleteLaterPtr<StyleRuleEditor>> style_rule_editors_; + ui::controls::IconButton add_button_; + + bool suppress_next_set_ = false; +}; +} // namespace cru::theme_builder::components |