aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls/Control.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-12-03 22:44:57 +0800
committercrupest <crupest@outlook.com>2020-12-03 22:44:57 +0800
commitb29fb11be2f043a3438a50d8942b4ad7d2af0034 (patch)
tree5847f7b880b43f2596bc10b46fc52c6f028a7a58 /src/ui/controls/Control.cpp
parent93a8bf8b967817031cd2798cdaedfa73f867dead (diff)
downloadcru-b29fb11be2f043a3438a50d8942b4ad7d2af0034.tar.gz
cru-b29fb11be2f043a3438a50d8942b4ad7d2af0034.tar.bz2
cru-b29fb11be2f043a3438a50d8942b4ad7d2af0034.zip
...
Diffstat (limited to 'src/ui/controls/Control.cpp')
-rw-r--r--src/ui/controls/Control.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ui/controls/Control.cpp b/src/ui/controls/Control.cpp
index c1316a62..1c4ffe51 100644
--- a/src/ui/controls/Control.cpp
+++ b/src/ui/controls/Control.cpp
@@ -6,6 +6,7 @@
#include "cru/ui/Base.hpp"
#include "cru/ui/host/WindowHost.hpp"
#include "cru/ui/render/RenderObject.hpp"
+#include "cru/ui/style/StyleRuleSet.hpp"
#include <memory>
@@ -15,6 +16,8 @@ using platform::gui::IUiApplication;
using platform::gui::SystemCursorType;
Control::Control() {
+ style_rule_set_ = std::make_unique<style::StyleRuleSet>(this);
+
MouseEnterEvent()->Direct()->AddHandler([this](event::MouseEventArgs&) {
this->is_mouse_over_ = true;
this->OnMouseHoverChange(true);
@@ -94,6 +97,10 @@ void Control::SetCursor(std::shared_ptr<ICursor> cursor) {
}
}
+style::StyleRuleSet* Control::GetStyleRuleSet() {
+ return style_rule_set_.get();
+}
+
void Control::AddChild(Control* control, const Index position) {
Expects(control->GetParent() ==
nullptr); // The control already has a parent.