diff options
author | crupest <crupest@outlook.com> | 2020-12-02 19:19:22 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-12-02 19:19:22 +0800 |
commit | 145cfd5b82d76e0c937eceda707aa22427899943 (patch) | |
tree | ab98708eea0e0ba7b965e20927303e49a8d9ae23 /include/cru/ui/style/Trigger.hpp | |
parent | 0fb7a0e0b2b9e04ca414b1e47c69cc854c79831b (diff) | |
download | cru-145cfd5b82d76e0c937eceda707aa22427899943.tar.gz cru-145cfd5b82d76e0c937eceda707aa22427899943.tar.bz2 cru-145cfd5b82d76e0c937eceda707aa22427899943.zip |
...
Diffstat (limited to 'include/cru/ui/style/Trigger.hpp')
-rw-r--r-- | include/cru/ui/style/Trigger.hpp | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/include/cru/ui/style/Trigger.hpp b/include/cru/ui/style/Trigger.hpp deleted file mode 100644 index ab012a3e..00000000 --- a/include/cru/ui/style/Trigger.hpp +++ /dev/null @@ -1,75 +0,0 @@ -#pragma once -#include "../Base.hpp" -#include "cru/common/Base.hpp" -#include "cru/common/Event.hpp" -#include "cru/ui/controls/IClickableControl.hpp" -#include "cru/ui/helper/ClickDetector.hpp" - -#include <utility> -#include <vector> - -namespace cru::ui::style { -class Trigger { - public: - virtual ~Trigger() = default; - - bool GetState() const { return current_; } - IEvent<bool>* ChangeEvent() { return &change_event_; } - - protected: - void Raise(bool value); - - private: - bool current_ = false; - Event<bool> change_event_; - - protected: - EventRevokerListGuard guard_; -}; - -class CompoundTrigger : public Trigger { - public: - explicit CompoundTrigger(std::vector<Trigger*> triggers); - - const std::vector<Trigger*>& GetTriggers() const { return triggers_; } - - protected: - virtual bool CalculateState(const std::vector<Trigger*>& triggers) const = 0; - - private: - std::vector<Trigger*> triggers_; -}; - -class AndTrigger : public CompoundTrigger { - public: - using CompoundTrigger::CompoundTrigger; - - protected: - bool CalculateState(const std::vector<Trigger*>& triggers) const override; -}; - -class OrTrigger : public CompoundTrigger { - public: - using CompoundTrigger::CompoundTrigger; - - protected: - bool CalculateState(const std::vector<Trigger*>& triggers) const override; -}; - -class FocusTrigger : public Trigger { - public: - FocusTrigger(controls::Control* control, bool has_focus); - - private: - bool has_focus_; -}; - -class ClickStateTrigger : public Trigger { - public: - ClickStateTrigger(controls::IClickableControl* control, - helper::ClickState click_state); - - private: - helper::ClickState click_state_; -}; -} // namespace cru::ui::style |