diff options
author | crupest <crupest@outlook.com> | 2022-02-13 00:31:30 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-02-13 00:31:30 +0800 |
commit | ecda6570b707617c4b9365180684bbe94f43e4f9 (patch) | |
tree | 9af11cf15a2f5a6531ca40e5e26aced1c2bcecbb /include/cru/ui/style | |
parent | 614c9d27ff0aa8eeff663469979af191c07792e3 (diff) | |
download | cru-ecda6570b707617c4b9365180684bbe94f43e4f9.tar.gz cru-ecda6570b707617c4b9365180684bbe94f43e4f9.tar.bz2 cru-ecda6570b707617c4b9365180684bbe94f43e4f9.zip |
...
Diffstat (limited to 'include/cru/ui/style')
-rw-r--r-- | include/cru/ui/style/ApplyBorderStyleInfo.h | 2 | ||||
-rw-r--r-- | include/cru/ui/style/Condition.h | 35 | ||||
-rw-r--r-- | include/cru/ui/style/StyleRule.h | 2 | ||||
-rw-r--r-- | include/cru/ui/style/StyleRuleSet.h | 4 | ||||
-rw-r--r-- | include/cru/ui/style/Styler.h | 8 |
5 files changed, 35 insertions, 16 deletions
diff --git a/include/cru/ui/style/ApplyBorderStyleInfo.h b/include/cru/ui/style/ApplyBorderStyleInfo.h index 2e6753fc..2a3a7db1 100644 --- a/include/cru/ui/style/ApplyBorderStyleInfo.h +++ b/include/cru/ui/style/ApplyBorderStyleInfo.h @@ -4,7 +4,7 @@ #include <optional> namespace cru::ui::style { -struct ApplyBorderStyleInfo { +struct CRU_UI_API ApplyBorderStyleInfo { ApplyBorderStyleInfo() = default; explicit ApplyBorderStyleInfo( diff --git a/include/cru/ui/style/Condition.h b/include/cru/ui/style/Condition.h index 221a7428..14d7e625 100644 --- a/include/cru/ui/style/Condition.h +++ b/include/cru/ui/style/Condition.h @@ -12,7 +12,7 @@ #include <vector> namespace cru::ui::style { -class Condition : public Object { +class CRU_UI_API Condition : public Object { public: virtual std::vector<IBaseEvent*> ChangeOn( controls::Control* control) const = 0; @@ -21,7 +21,7 @@ class Condition : public Object { virtual Condition* Clone() const = 0; }; -class NoCondition : public Condition { +class CRU_UI_API NoCondition : public Condition { public: static ClonablePtr<NoCondition> Create() { return ClonablePtr<NoCondition>(new NoCondition); @@ -36,7 +36,7 @@ class NoCondition : public Condition { NoCondition* Clone() const override { return new NoCondition; } }; -class CompoundCondition : public Condition { +class CRU_UI_API CompoundCondition : public Condition { public: explicit CompoundCondition(std::vector<ClonablePtr<Condition>> conditions); @@ -46,7 +46,7 @@ class CompoundCondition : public Condition { std::vector<ClonablePtr<Condition>> conditions_; }; -class AndCondition : public CompoundCondition { +class CRU_UI_API AndCondition : public CompoundCondition { public: static ClonablePtr<AndCondition> Create( std::vector<ClonablePtr<Condition>> conditions) { @@ -60,7 +60,7 @@ class AndCondition : public CompoundCondition { AndCondition* Clone() const override { return new AndCondition(conditions_); } }; -class OrCondition : public CompoundCondition { +class CRU_UI_API OrCondition : public CompoundCondition { public: static ClonablePtr<OrCondition> Create( std::vector<ClonablePtr<Condition>> conditions) { @@ -74,7 +74,7 @@ class OrCondition : public CompoundCondition { OrCondition* Clone() const override { return new OrCondition(conditions_); } }; -class FocusCondition : public Condition { +class CRU_UI_API FocusCondition : public Condition { public: static ClonablePtr<FocusCondition> Create(bool has_focus) { return ClonablePtr<FocusCondition>(new FocusCondition(has_focus)); @@ -93,7 +93,7 @@ class FocusCondition : public Condition { bool has_focus_; }; -class HoverCondition : public Condition { +class CRU_UI_API HoverCondition : public Condition { public: static ClonablePtr<HoverCondition> Create(bool hover) { return ClonablePtr<HoverCondition>(new HoverCondition(hover)); @@ -110,7 +110,7 @@ class HoverCondition : public Condition { bool hover_; }; -class ClickStateCondition : public Condition { +class CRU_UI_API ClickStateCondition : public Condition { public: static ClonablePtr<ClickStateCondition> Create( helper::ClickState click_state) { @@ -130,4 +130,23 @@ class ClickStateCondition : public Condition { private: helper::ClickState click_state_; }; + +class CRU_UI_API CheckedCondition : public Condition { + public: + static ClonablePtr<CheckedCondition> Create(bool checked) { + return ClonablePtr<CheckedCondition>(new CheckedCondition(checked)); + } + + explicit CheckedCondition(bool checked); + + std::vector<IBaseEvent*> ChangeOn(controls::Control* control) const override; + bool Judge(controls::Control* control) const override; + + CheckedCondition* Clone() const override { + return new CheckedCondition(checked_); + } + + private: + bool checked_; +}; } // namespace cru::ui::style diff --git a/include/cru/ui/style/StyleRule.h b/include/cru/ui/style/StyleRule.h index 68b239f3..fc37f7c7 100644 --- a/include/cru/ui/style/StyleRule.h +++ b/include/cru/ui/style/StyleRule.h @@ -8,7 +8,7 @@ #include <vector> namespace cru::ui::style { -class StyleRule : public Object { +class CRU_UI_API StyleRule : public Object { public: static ClonablePtr<StyleRule> Create(ClonablePtr<Condition> condition, ClonablePtr<Styler> styler, diff --git a/include/cru/ui/style/StyleRuleSet.h b/include/cru/ui/style/StyleRuleSet.h index 34d0fad4..f905d97a 100644 --- a/include/cru/ui/style/StyleRuleSet.h +++ b/include/cru/ui/style/StyleRuleSet.h @@ -6,7 +6,7 @@ #include <cstddef> namespace cru::ui::style { -class StyleRuleSet : public Object { +class CRU_UI_API StyleRuleSet : public Object { public: StyleRuleSet() = default; explicit StyleRuleSet(std::shared_ptr<StyleRuleSet> parent); @@ -53,7 +53,7 @@ class StyleRuleSet : public Object { std::vector<StyleRule> rules_; }; -class StyleRuleSetBind { +class CRU_UI_API StyleRuleSetBind { public: StyleRuleSetBind(controls::Control* control, std::shared_ptr<StyleRuleSet> ruleset); diff --git a/include/cru/ui/style/Styler.h b/include/cru/ui/style/Styler.h index 6f84329f..4d812643 100644 --- a/include/cru/ui/style/Styler.h +++ b/include/cru/ui/style/Styler.h @@ -8,14 +8,14 @@ #include <vector> namespace cru::ui::style { -class Styler : public Object { +class CRU_UI_API Styler : public Object { public: virtual void Apply(controls::Control* control) const = 0; virtual Styler* Clone() const = 0; }; -class CompoundStyler : public Styler { +class CRU_UI_API CompoundStyler : public Styler { public: template <typename... S> static ClonablePtr<CompoundStyler> Create(ClonablePtr<S>... s) { @@ -45,7 +45,7 @@ class CompoundStyler : public Styler { std::vector<ClonablePtr<Styler>> stylers_; }; -class BorderStyler : public Styler { +class CRU_UI_API BorderStyler : public Styler { public: static ClonablePtr<BorderStyler> Create() { return ClonablePtr<BorderStyler>(new BorderStyler()); @@ -66,7 +66,7 @@ class BorderStyler : public Styler { ApplyBorderStyleInfo style_; }; -class CursorStyler : public Styler { +class CRU_UI_API CursorStyler : public Styler { public: static ClonablePtr<CursorStyler> Create( std::shared_ptr<platform::gui::ICursor> cursor) { |