diff options
author | crupest <crupest@outlook.com> | 2021-12-13 20:58:42 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-12-13 20:58:42 +0800 |
commit | 21fccf43ec049569f690674840ca1a10420a40da (patch) | |
tree | 33341a51f41bc9d783221ad363e33ffeb177886b /include/cru/ui/events/MouseEventArgs.hpp | |
parent | c850d817cc0d8c2c80728f373f89dce91650023a (diff) | |
download | cru-21fccf43ec049569f690674840ca1a10420a40da.tar.gz cru-21fccf43ec049569f690674840ca1a10420a40da.tar.bz2 cru-21fccf43ec049569f690674840ca1a10420a40da.zip |
...
Diffstat (limited to 'include/cru/ui/events/MouseEventArgs.hpp')
-rw-r--r-- | include/cru/ui/events/MouseEventArgs.hpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/cru/ui/events/MouseEventArgs.hpp b/include/cru/ui/events/MouseEventArgs.hpp new file mode 100644 index 00000000..6d6aba15 --- /dev/null +++ b/include/cru/ui/events/MouseEventArgs.hpp @@ -0,0 +1,26 @@ +#pragma once +#include "UiEventArgs.hpp" + +#include <optional> + +namespace cru::ui::events { +class MouseEventArgs : public UiEventArgs { + public: + MouseEventArgs(Object* sender, Object* original_sender, + const std::optional<Point>& point = std::nullopt) + : UiEventArgs(sender, original_sender), point_(point) {} + MouseEventArgs(const MouseEventArgs& other) = default; + MouseEventArgs(MouseEventArgs&& other) = default; + MouseEventArgs& operator=(const MouseEventArgs& other) = default; + MouseEventArgs& operator=(MouseEventArgs&& other) = default; + ~MouseEventArgs() override = default; + + // This point is relative to window client lefttop. + Point GetPoint() const { return point_.value_or(Point{}); } + Point GetPoint(render::RenderObject* render_target) const; + Point GetPointToContent(render::RenderObject* render_target) const; + + private: + std::optional<Point> point_; +}; +} // namespace cru::ui::event |