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/Condition.h | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) (limited to 'include/cru/ui/style/Condition.h') 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 -- cgit v1.2.3