diff options
| author | crupest <crupest@outlook.com> | 2020-12-01 23:20:01 +0800 |
|---|---|---|
| committer | crupest <crupest@outlook.com> | 2020-12-01 23:20:01 +0800 |
| commit | 0fb7a0e0b2b9e04ca414b1e47c69cc854c79831b (patch) | |
| tree | 46d7f93e96bca49b0ec114c5595567b9bbcec6e3 /src/ui/helper/Styler.cpp | |
| parent | 4fcf336d15fe246259ee18ccc99808d80e69c455 (diff) | |
| download | cru-0fb7a0e0b2b9e04ca414b1e47c69cc854c79831b.tar.gz cru-0fb7a0e0b2b9e04ca414b1e47c69cc854c79831b.tar.bz2 cru-0fb7a0e0b2b9e04ca414b1e47c69cc854c79831b.zip | |
...
Diffstat (limited to 'src/ui/helper/Styler.cpp')
| -rw-r--r-- | src/ui/helper/Styler.cpp | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/src/ui/helper/Styler.cpp b/src/ui/helper/Styler.cpp deleted file mode 100644 index 6500a3f7..00000000 --- a/src/ui/helper/Styler.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "cru/ui/helper/Styler.hpp" -#include "cru/ui/helper/ClickDetector.hpp" -#include "gsl/pointers" - -namespace cru::ui::helper { -Styler::Styler(gsl::not_null<controls::Control*> control, - ClickDetector* click_detector) - : control_(control), - managed_click_detector_(click_detector ? nullptr - : new ClickDetector(control)), - click_detector_(click_detector ? click_detector - : managed_click_detector_.get()) { - event_guard_ += control_->GainFocusEvent()->Direct()->AddHandler( - [this](auto) { this->RaiseStateChangeEvent(); }); - event_guard_ += control_->LoseFocusEvent()->Direct()->AddHandler( - [this](auto) { this->RaiseStateChangeEvent(); }); - event_guard_ += click_detector_->StateChangeEvent()->AddHandler( - [this](auto) { this->RaiseStateChangeEvent(); }); -} - -Styler::~Styler() = default; - -void Styler::RaiseStateChangeEvent() { - this->state_change_event_.Raise(ControlStyleState{ - this->click_detector_->GetState(), this->control_->HasFocus()}); -} -} // namespace cru::ui::helper |
