From ecda6570b707617c4b9365180684bbe94f43e4f9 Mon Sep 17 00:00:00 2001 From: crupest Date: Sun, 13 Feb 2022 00:31:30 +0800 Subject: ... --- include/cru/ui/style/ApplyBorderStyleInfo.h | 2 +- include/cru/ui/style/Condition.h | 35 ++++++++++++++++++++++------- include/cru/ui/style/StyleRule.h | 2 +- include/cru/ui/style/StyleRuleSet.h | 4 ++-- include/cru/ui/style/Styler.h | 8 +++---- 5 files changed, 35 insertions(+), 16 deletions(-) (limited to 'include/cru/ui/style') 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 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 namespace cru::ui::style { -class Condition : public Object { +class CRU_UI_API Condition : public Object { public: virtual std::vector 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 Create() { return ClonablePtr(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> conditions); @@ -46,7 +46,7 @@ class CompoundCondition : public Condition { std::vector> conditions_; }; -class AndCondition : public CompoundCondition { +class CRU_UI_API AndCondition : public CompoundCondition { public: static ClonablePtr Create( std::vector> 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 Create( std::vector> 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 Create(bool has_focus) { return ClonablePtr(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 Create(bool hover) { return ClonablePtr(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 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 Create(bool checked) { + return ClonablePtr(new CheckedCondition(checked)); + } + + explicit CheckedCondition(bool checked); + + std::vector 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 namespace cru::ui::style { -class StyleRule : public Object { +class CRU_UI_API StyleRule : public Object { public: static ClonablePtr Create(ClonablePtr condition, ClonablePtr 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 namespace cru::ui::style { -class StyleRuleSet : public Object { +class CRU_UI_API StyleRuleSet : public Object { public: StyleRuleSet() = default; explicit StyleRuleSet(std::shared_ptr parent); @@ -53,7 +53,7 @@ class StyleRuleSet : public Object { std::vector rules_; }; -class StyleRuleSetBind { +class CRU_UI_API StyleRuleSetBind { public: StyleRuleSetBind(controls::Control* control, std::shared_ptr 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 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 static ClonablePtr Create(ClonablePtr... s) { @@ -45,7 +45,7 @@ class CompoundStyler : public Styler { std::vector> stylers_; }; -class BorderStyler : public Styler { +class CRU_UI_API BorderStyler : public Styler { public: static ClonablePtr Create() { return ClonablePtr(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 Create( std::shared_ptr cursor) { -- cgit v1.2.3