diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-30 00:41:05 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-30 00:41:05 +0300 |
commit | ec51be4fd71babf30a73332bc4b73edb994ee462 (patch) | |
tree | 0199da5c75066083b4287204d3532f69420764eb | |
parent | 7969f0590204ac48d74e98c3211bca27693bac44 (diff) | |
download | mv-ec51be4fd71babf30a73332bc4b73edb994ee462.tar.gz mv-ec51be4fd71babf30a73332bc4b73edb994ee462.tar.bz2 mv-ec51be4fd71babf30a73332bc4b73edb994ee462.tar.xz mv-ec51be4fd71babf30a73332bc4b73edb994ee462.zip |
Convert KeyEvent enum into strong typed enum.
-rw-r--r-- | src/enums/events/keyeventtype.h | 17 | ||||
-rw-r--r-- | src/events/keyevent.h | 6 | ||||
-rw-r--r-- | src/gui/gui.cpp | 4 | ||||
-rw-r--r-- | src/input/keyinput.h | 6 |
4 files changed, 15 insertions, 18 deletions
diff --git a/src/enums/events/keyeventtype.h b/src/enums/events/keyeventtype.h index 7c96b749a..b04ddab7e 100644 --- a/src/enums/events/keyeventtype.h +++ b/src/enums/events/keyeventtype.h @@ -64,16 +64,13 @@ #ifndef ENUMS_EVENTS_KEYEVENTTYPE_H #define ENUMS_EVENTS_KEYEVENTTYPE_H -namespace KeyEventType +#include "enums/simpletypes/enumdefines.h" + +enumStart(KeyEventType) { - /** - * Key event types. - */ - enum Type - { - PRESSED = 0, - RELEASED - }; -} // namespace KeyEventType + PRESSED = 0, + RELEASED +} +enumEnd(KeyEventType); #endif // ENUMS_EVENTS_KEYEVENTTYPE_H diff --git a/src/events/keyevent.h b/src/events/keyevent.h index 3cad1bce2..9f0a54972 100644 --- a/src/events/keyevent.h +++ b/src/events/keyevent.h @@ -88,7 +88,7 @@ class KeyEvent: public InputGuiEvent * @param key The key of the event. */ KeyEvent(Widget *const source, - KeyEventType::Type type, + KeyEventTypeT type, const int actionId, const Key &key) : InputGuiEvent(source), @@ -111,7 +111,7 @@ class KeyEvent: public InputGuiEvent * * @return The type of the event. */ - KeyEventType::Type getType() const A_WARN_UNUSED + KeyEventTypeT getType() const A_WARN_UNUSED { return mType; } /** @@ -146,7 +146,7 @@ class KeyEvent: public InputGuiEvent /** * Holds the type of the key event. */ - KeyEventType::Type mType; + KeyEventTypeT mType; int mActionId; }; diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 49b6d2774..4cfd83f0f 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -1263,7 +1263,7 @@ void Gui::distributeKeyEvent(KeyEvent &event) const std::list<KeyListener*> keyListeners = widget->getKeyListeners(); - const KeyEventType::Type eventType = event.getType(); + const KeyEventTypeT eventType = event.getType(); // Send the event to all key listeners of the source widget. FOR_EACH (std::list<KeyListener*>::const_iterator, it, keyListeners) @@ -1296,7 +1296,7 @@ void Gui::distributeKeyEvent(KeyEvent &event) const void Gui::distributeKeyEventToGlobalKeyListeners(KeyEvent& event) { BLOCK_START("Gui::distributeKeyEventToGlobalKeyListeners") - const KeyEventType::Type eventType = event.getType(); + const KeyEventTypeT eventType = event.getType(); FOR_EACH (KeyListenerListIterator, it, mKeyListeners) { switch (eventType) diff --git a/src/input/keyinput.h b/src/input/keyinput.h index f308af244..8555d8bbb 100644 --- a/src/input/keyinput.h +++ b/src/input/keyinput.h @@ -85,12 +85,12 @@ class KeyInput final ~KeyInput() { } - void setType(KeyEventType::Type type) + void setType(KeyEventTypeT type) { mType = type; } - KeyEventType::Type getType() const + KeyEventTypeT getType() const { return mType; } @@ -136,7 +136,7 @@ class KeyInput final /** * Holds the type of the key input. */ - KeyEventType::Type mType; + KeyEventTypeT mType; #ifdef USE_SDL2 std::string mText; |