diff options
author | crupest <crupest@outlook.com> | 2018-11-27 17:53:21 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2018-11-27 17:53:21 +0800 |
commit | 7ccb08ac09a83e81a822712b712dc0473c9b23cf (patch) | |
tree | a5757aca9903a5bcddf6b480d57030fd27b2ba1f /src/ui/events | |
parent | 7e00386fc0895f8b08cd64ef737cb6c618955635 (diff) | |
download | cru-7ccb08ac09a83e81a822712b712dc0473c9b23cf.tar.gz cru-7ccb08ac09a83e81a822712b712dc0473c9b23cf.tar.bz2 cru-7ccb08ac09a83e81a822712b712dc0473c9b23cf.zip |
Add mouse wheel support.
Diffstat (limited to 'src/ui/events')
-rw-r--r-- | src/ui/events/ui_event.hpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/ui/events/ui_event.hpp b/src/ui/events/ui_event.hpp index cc651832..321e7135 100644 --- a/src/ui/events/ui_event.hpp +++ b/src/ui/events/ui_event.hpp @@ -88,6 +88,30 @@ namespace cru::ui::events }; + class MouseWheelEventArgs : public MouseEventArgs + { + public: + MouseWheelEventArgs(Object* sender, Object* original_sender, const Point& point, const float delta) + : MouseEventArgs(sender, original_sender, point), delta_(delta) + { + + } + MouseWheelEventArgs(const MouseWheelEventArgs& other) = default; + MouseWheelEventArgs(MouseWheelEventArgs&& other) = default; + MouseWheelEventArgs& operator=(const MouseWheelEventArgs& other) = default; + MouseWheelEventArgs& operator=(MouseWheelEventArgs&& other) = default; + ~MouseWheelEventArgs() override = default; + + float GetDelta() const + { + return delta_; + } + + private: + float delta_; + }; + + class DrawEventArgs : public UiEventArgs { public: @@ -307,6 +331,7 @@ namespace cru::ui::events using UiEvent = Event<UiEventArgs>; using MouseEvent = Event<MouseEventArgs>; using MouseButtonEvent = Event<MouseButtonEventArgs>; + using MouseWheelEvent = Event<MouseWheelEventArgs>; using DrawEvent = Event<DrawEventArgs>; using PositionChangedEvent = Event<PositionChangedEventArgs>; using SizeChangedEvent = Event<SizeChangedEventArgs>; |