Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2015-01-06 18:51:37 +0000
committerStijn Buys <ingar@osirion.org>2015-01-06 18:51:37 +0000
commit72ee43e9470c6fdbc6ed7ff92b85dfa5062c5762 (patch)
tree6474fa59066d5212dcd40e3d76652dce35565280 /src/ui/widget.h
parent57d958d40af061e83aa99ca12e375e5345836ecd (diff)
Added separate event handlers for mouse button clicks and mouse wheel movement.
Diffstat (limited to 'src/ui/widget.h')
-rw-r--r--src/ui/widget.h30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/ui/widget.h b/src/ui/widget.h
index fafdf58..a3994af 100644
--- a/src/ui/widget.h
+++ b/src/ui/widget.h
@@ -7,7 +7,7 @@
#ifndef __INCLUDED_UI_WIDGET_H__
#define __INCLUDED_UI_WIDGET_H__
-#include "SDL/SDL.h"
+#include "SDL2/SDL.h"
#include <string>
#include <list>
@@ -270,13 +270,26 @@ public:
* @see on_keyrelease
**/
bool event_key(const bool pressed, const int key, const unsigned int modifier);
+
+ /**
+ * @brief calls the on_mousepress and on_mouserelease event handlers and sends undhandled events to the parent widget
+ * @see on_mousepress
+ * @see on_mouserelease
+ * */
+ bool event_mouse_button(const bool pressed, const unsigned int button);
+
+ /**
+ * @brief calls the on_mousewheel event handlers and sends unhandled events to the parent widget
+ * @see on_mousewheel
+ * */
+ bool event_mouse_wheel(const math::Vector2f & direction);
/**
* @brief calls the mouse event handlers and sends unhandled keys to the parent widget
* @see on_mousemove
* @see on_mouseover
**/
- bool event_mouse(const math::Vector2f &cursor);
+ void event_mouse(const math::Vector2f & cursor);
/**
* @brief calls the custom event handler and sends unhandled events to the parent widget
@@ -284,7 +297,9 @@ public:
**/
bool event_emit(Widget *sender, const Event event, void *data = 0);
- /// emit a custom event
+ /**
+ * @brief emit a custom event
+ * */
inline void emit(const Event event, void *data=0) {
event_emit(this, event, data);
}
@@ -355,6 +370,15 @@ protected:
/// called when the mouse enters the widget
virtual void on_mouseover(const math::Vector2f &cursor);
+
+ /// called when a mouse button is pressed
+ virtual bool on_mousepress(const unsigned int button);
+
+ /// called when a mouse button is released
+ virtual bool on_mouserelease(const unsigned int button);
+
+ /// called when the scrollwheel is used
+ virtual bool on_mousewheel(const math::Vector2f & direction);
/// called when the widget receives a key press
virtual bool on_keypress(const int key, const unsigned int modifier);