diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-30 01:01:04 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-30 01:01:04 +0300 |
commit | 2e07a7af24cf8a2928ab6a3431ab5b01b29969bb (patch) | |
tree | 8e3ab15e6ce2f6e085f5c7be0d4c9a43ef85f44a | |
parent | f29616d8d1309ee135afe2b2e7baf1d91d677a95 (diff) | |
download | manaplus-2e07a7af24cf8a2928ab6a3431ab5b01b29969bb.tar.gz manaplus-2e07a7af24cf8a2928ab6a3431ab5b01b29969bb.tar.bz2 manaplus-2e07a7af24cf8a2928ab6a3431ab5b01b29969bb.tar.xz manaplus-2e07a7af24cf8a2928ab6a3431ab5b01b29969bb.zip |
Convert MouseEventType enum into strong typed enum.
-rw-r--r-- | src/enums/events/mouseeventtype.h | 33 | ||||
-rw-r--r-- | src/events/mouseevent.h | 6 | ||||
-rw-r--r-- | src/gui/gui.cpp | 4 | ||||
-rw-r--r-- | src/gui/gui.h | 2 | ||||
-rw-r--r-- | src/input/mouseinput.h | 6 |
5 files changed, 24 insertions, 27 deletions
diff --git a/src/enums/events/mouseeventtype.h b/src/enums/events/mouseeventtype.h index 7fa568960..f430953fa 100644 --- a/src/enums/events/mouseeventtype.h +++ b/src/enums/events/mouseeventtype.h @@ -64,24 +64,21 @@ #ifndef ENUMS_EVENTS_MOUSEEVENTTYPE_H #define ENUMS_EVENTS_MOUSEEVENTTYPE_H -namespace MouseEventType +#include "enums/simpletypes/enumdefines.h" + +enumStart(MouseEventType) { - /** - * Mouse event types. - */ - enum Type - { - MOVED = 0, - PRESSED, - RELEASED, - WHEEL_MOVED_DOWN, - WHEEL_MOVED_UP, - CLICKED, - ENTERED, - EXITED, - DRAGGED, - RELEASED2 = 100 - }; -} // namespace MouseEventType + MOVED = 0, + PRESSED, + RELEASED, + WHEEL_MOVED_DOWN, + WHEEL_MOVED_UP, + CLICKED, + ENTERED, + EXITED, + DRAGGED, + RELEASED2 = 100 +} +enumEnd(MouseEventType); #endif // ENUMS_EVENTS_MOUSEEVENTTYPE_H diff --git a/src/events/mouseevent.h b/src/events/mouseevent.h index 1be008827..66215da15 100644 --- a/src/events/mouseevent.h +++ b/src/events/mouseevent.h @@ -92,7 +92,7 @@ class MouseEvent: public InputGuiEvent * It's set to zero if another button is used. */ MouseEvent(Widget *const source, - const MouseEventType::Type type, + const MouseEventTypeT type, const MouseButtonT button, const int x, const int y, @@ -150,7 +150,7 @@ class MouseEvent: public InputGuiEvent * * @return The type of the event. */ - MouseEventType::Type getType() const A_WARN_UNUSED + MouseEventTypeT getType() const A_WARN_UNUSED { return mType; } void setX(int n) @@ -163,7 +163,7 @@ class MouseEvent: public InputGuiEvent /** * Holds the type of the mouse event. */ - MouseEventType::Type mType; + MouseEventTypeT mType; /** * Holds the button of the mouse event. diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 23b640737..f00821c60 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -802,7 +802,7 @@ void Gui::updateFonts() } void Gui::distributeMouseEvent(Widget *const source, - const MouseEventType::Type type, + const MouseEventTypeT type, const MouseButtonT button, const int x, const int y, const bool force, @@ -853,7 +853,7 @@ void Gui::distributeMouseEvent(Widget *const source, std::list<MouseListener*> mouseListeners = widget->getMouseListeners(); - const MouseEventType::Type mouseType = event.getType(); + const MouseEventTypeT mouseType = event.getType(); // Send the event to all mouse listeners of the widget. FOR_EACH (std::list<MouseListener*>::const_iterator, it, mouseListeners) diff --git a/src/gui/gui.h b/src/gui/gui.h index b1d443b81..8a2935208 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -328,7 +328,7 @@ class Gui final void handleMouseInput(); void distributeMouseEvent(Widget *const source, - const MouseEventType::Type type, + const MouseEventTypeT type, const MouseButtonT button, const int x, const int y, const bool force = false, diff --git a/src/input/mouseinput.h b/src/input/mouseinput.h index f84303308..dc5ad8a1a 100644 --- a/src/input/mouseinput.h +++ b/src/input/mouseinput.h @@ -85,12 +85,12 @@ class MouseInput final ~MouseInput() { } - void setType(MouseEventType::Type type) + void setType(MouseEventTypeT type) { mType = type; } - MouseEventType::Type getType() const + MouseEventTypeT getType() const { return mType; } @@ -162,7 +162,7 @@ class MouseInput final /** * Holds the type of the mouse input. */ - MouseEventType::Type mType; + MouseEventTypeT mType; /** * Holds the button of the mouse input. |