diff --git a/src/guiengine/event_handler.cpp b/src/guiengine/event_handler.cpp index ae7c05193..871756b9d 100644 --- a/src/guiengine/event_handler.cpp +++ b/src/guiengine/event_handler.cpp @@ -95,9 +95,19 @@ bool EventHandler::OnEvent (const SEvent &event) // ----------------------------------------------------------------------------- -void EventHandler::processGUIAction(const PlayerAction action, const unsigned int value, - Input::InputType type, const int playerID) +void EventHandler::processGUIAction(const PlayerAction action, + const unsigned int value, + Input::InputType type, + const int playerID) { + Screen* screen = GUIEngine::getCurrentScreen(); + if (screen != NULL) + { + EventPropagation propg = screen->filterActions(action, value, + type, playerID); + if (propg == EVENT_BLOCK) return; + } + const bool pressedDown = value > Input::MAX_VALUE*2/3; if (!pressedDown && type == Input::IT_STICKMOTION) return; diff --git a/src/guiengine/screen.hpp b/src/guiengine/screen.hpp index a1857f8e5..24414fe45 100644 --- a/src/guiengine/screen.hpp +++ b/src/guiengine/screen.hpp @@ -28,6 +28,7 @@ #include "config/stk_config.hpp" #include "guiengine/abstract_top_level_container.hpp" #include "guiengine/engine.hpp" +#include "guiengine/event_handler.hpp" #include "guiengine/layout_manager.hpp" #include "guiengine/widget.hpp" #include "input/input.hpp" @@ -254,10 +255,18 @@ namespace GUIEngine * \brief Implementing method from AbstractTopLevelContainer */ virtual int getWidth(); + /** * \brief Implementing method from AbstractTopLevelContainer */ virtual int getHeight(); + + /** + * \brief override this if you need to be notified of player actions in subclasses + */ + virtual EventPropagation filterActions(PlayerAction action, const unsigned int value, + Input::InputType type, int playerId) { return EVENT_LET; } + }; }