diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/base/basiccontainer.cpp | 2 | ||||
-rw-r--r-- | src/gui/base/gui.cpp | 2 | ||||
-rw-r--r-- | src/gui/base/gui.hpp | 2 | ||||
-rw-r--r-- | src/gui/base/input.hpp | 3 | ||||
-rw-r--r-- | src/gui/base/mouseinput.cpp | 136 | ||||
-rw-r--r-- | src/gui/base/mouseinput.hpp | 260 | ||||
-rw-r--r-- | src/gui/base/widget.cpp | 2 | ||||
-rw-r--r-- | src/gui/base/widget.hpp | 2 | ||||
-rw-r--r-- | src/gui/base/widgets/button.cpp | 3 | ||||
-rw-r--r-- | src/gui/base/widgets/checkbox.cpp | 3 | ||||
-rw-r--r-- | src/gui/base/widgets/listbox.cpp | 3 | ||||
-rw-r--r-- | src/gui/base/widgets/radiobutton.cpp | 3 | ||||
-rw-r--r-- | src/gui/base/widgets/slider.cpp | 3 | ||||
-rw-r--r-- | src/gui/base/widgets/textbox.cpp | 3 | ||||
-rw-r--r-- | src/gui/base/widgets/textfield.cpp | 3 | ||||
-rw-r--r-- | src/gui/base/widgets/window.cpp | 2 | ||||
-rw-r--r-- | src/gui/gui.cpp | 19 | ||||
-rw-r--r-- | src/gui/gui.h | 6 | ||||
-rw-r--r-- | src/gui/sdlinput.cpp | 34 | ||||
-rw-r--r-- | src/gui/sdlinput.h | 8 | ||||
-rw-r--r-- | src/gui/widgets/itemlinkhandler.cpp | 11 |
21 files changed, 60 insertions, 450 deletions
diff --git a/src/gui/base/basiccontainer.cpp b/src/gui/base/basiccontainer.cpp index 4a745dc63..82ef1c025 100644 --- a/src/gui/base/basiccontainer.cpp +++ b/src/gui/base/basiccontainer.cpp @@ -70,7 +70,7 @@ #include <algorithm> #include "gui/base/focushandler.hpp" -#include "gui/base/mouseinput.hpp" +#include "input/mouseinput.h" #include "render/graphics.h" diff --git a/src/gui/base/gui.cpp b/src/gui/base/gui.cpp index 56e40291a..e5291cb60 100644 --- a/src/gui/base/gui.cpp +++ b/src/gui/base/gui.cpp @@ -70,10 +70,10 @@ #include "gui/base/basiccontainer.hpp" #include "gui/base/focushandler.hpp" #include "gui/base/input.hpp" -#include "gui/base/mouseinput.hpp" #include "gui/base/widget.hpp" #include "input/keyinput.h" +#include "input/mouseinput.h" #include "listeners/keylistener.h" #include "listeners/mouselistener.h" diff --git a/src/gui/base/gui.hpp b/src/gui/base/gui.hpp index b853a4210..2ec5d7082 100644 --- a/src/gui/base/gui.hpp +++ b/src/gui/base/gui.hpp @@ -70,7 +70,7 @@ #include "events/keyevent.h" #include "events/mouseevent.h" -#include "gui/base/mouseinput.hpp" +#include "input/mouseinput.h" class Graphics; class KeyListener; diff --git a/src/gui/base/input.hpp b/src/gui/base/input.hpp index 40aed4d84..1643482d3 100644 --- a/src/gui/base/input.hpp +++ b/src/gui/base/input.hpp @@ -67,11 +67,10 @@ #include "localconsts.h" class KeyInput; +class MouseInput; namespace gcn { - class MouseInput; - /** * Abstract class for providing functions for user input. * diff --git a/src/gui/base/mouseinput.cpp b/src/gui/base/mouseinput.cpp deleted file mode 100644 index bc5d6c8e0..000000000 --- a/src/gui/base/mouseinput.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2014 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * For comments regarding functions please see the header file. - */ - -#include "gui/base/mouseinput.hpp" - -#include "debug.h" - -namespace gcn -{ - MouseInput::MouseInput(const unsigned int button, - const unsigned int type, - const int x, - const int y, - const int timeStamp) : - mType(type), - mButton(button), - mTimeStamp(timeStamp), - mX(x), - mY(y) - { - } - - void MouseInput::setType(unsigned int type) - { - mType = type; - } - - unsigned int MouseInput::getType() const - { - return mType; - } - - void MouseInput::setButton(unsigned int button) - { - mButton = button; - } - - unsigned int MouseInput::getButton() const - { - return mButton; - } - - int MouseInput::getTimeStamp() const - { - return mTimeStamp; - } - - void MouseInput::setTimeStamp(int timeStamp) - { - mTimeStamp = timeStamp; - } - - void MouseInput::setX(int x) - { - mX = x; - } - - int MouseInput::getX() const - { - return mX; - } - - void MouseInput::setY(int y) - { - mY = y; - } - - int MouseInput::getY() const - { - return mY; - } -} // namespace gcn diff --git a/src/gui/base/mouseinput.hpp b/src/gui/base/mouseinput.hpp deleted file mode 100644 index 018205740..000000000 --- a/src/gui/base/mouseinput.hpp +++ /dev/null @@ -1,260 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2014 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef GCN_MOUSEINPUT_HPP -#define GCN_MOUSEINPUT_HPP - -#include "localconsts.h" - -namespace gcn -{ - - /** - * Internal class that represents mouse input. Generally you won't have to - * bother using this class unless you implement an Input class for - * a back end. - * - * @author Olof Naessén - * @author Per Larsson - * @since 0.1.0 - */ - class MouseInput - { - public: - /** - * Constructor. - */ - MouseInput() : - mType(0), - mButton(0), - mTimeStamp(0), - mX(0), - mY(0) - { } - - /** - * Constructor. - * - * @param button The button pressed. - * @param type The type of mouse input. - * @param x The mouse x coordinate. - * @param y The mouse y coordinate. - * @param timeStamp The timestamp of the mouse input. Used to - * check for double clicks. - */ - MouseInput(const unsigned int button, - const unsigned int type, - const int x, - const int y, - const int timeStamp); - - /** - * Sets the type of the mouse input. - * - * @param type The type of the mouse input. Should be a value from the - * mouse event type enum - * @see getType - * @since 0.1.0 - */ - void setType(unsigned int type); - - /** - * Gets the type of the mouse input. - * - * @return The type of the mouse input. A value from the mouse event - * type enum. - * @see setType - * @since 0.1.0 - */ - unsigned int getType() const A_WARN_UNUSED; - - /** - * Sets the button pressed. - * - * @param button The button pressed. Should be one of the values - * in the mouse event button enum. - * @see getButton. - * @since 0.1.0 - */ - void setButton(unsigned int button); - - /** - * Gets the button pressed. - * - * @return The button pressed. A value from the mouse event - * button enum. - * @see setButton - * @since 0.1.0 - */ - unsigned int getButton() const A_WARN_UNUSED; - - /** - * Sets the timestamp for the mouse input. - * Used to check for double clicks. - * - * @param timeStamp The timestamp of the mouse input. - * @see getTimeStamp - * @since 0.1.0 - */ - void setTimeStamp(int timeStamp); - - /** - * Gets the time stamp of the input. - * Used to check for double clicks. - * - * @return The time stamp of the mouse input. - * @see setTimeStamp - * @since 0.1.0 - */ - int getTimeStamp() const A_WARN_UNUSED; - - /** - * Sets the x coordinate of the mouse input. - * - * @param x The x coordinate of the mouse input. - * @see getX - * @since 0.6.0 - */ - void setX(int x); - - /** - * Gets the x coordinate of the mouse input. - * - * @return The x coordinate of the mouse input. - * @see setX - * @since 0.6.0 - */ - int getX() const A_WARN_UNUSED; - - /** - * Sets the y coordinate of the mouse input. - * - * @param y The y coordinate of the mouse input. - * @see getY - * @since 0.6.0 - */ - void setY(int y); - - /** - * Gets the y coordinate of the mouse input. - * - * @return The y coordinate of the mouse input. - * @see setY - * @since 0.6.0 - */ - int getY() const A_WARN_UNUSED; - - /** - * Mouse input event types. This enum partially corresponds - * to the enum with event types in MouseEvent for easy mapping. - */ - enum - { - MOVED = 0, - PRESSED, - RELEASED, - WHEEL_MOVED_DOWN, - WHEEL_MOVED_UP - }; - - /** - * Mouse button types. - */ - enum - { - EMPTY = 0, - LEFT, - RIGHT, - MIDDLE - }; - - protected: - /** - * Holds the type of the mouse input. - */ - unsigned int mType; - - /** - * Holds the button of the mouse input. - */ - unsigned int mButton; - - /** - * Holds the timestamp of the mouse input. Used to - * check for double clicks. - */ - int mTimeStamp; - - /** - * Holds the x coordinate of the mouse input. - */ - int mX; - - /** - * Holds the y coordinate of the mouse input. - */ - int mY; - }; -} // namespace gcn - -#endif // end GCN_MOUSEINPUT_HPP diff --git a/src/gui/base/widget.cpp b/src/gui/base/widget.cpp index cf3605446..5b4ada76e 100644 --- a/src/gui/base/widget.cpp +++ b/src/gui/base/widget.cpp @@ -73,9 +73,9 @@ #include "gui/base/basiccontainer.hpp" #include "gui/base/focushandler.hpp" -#include "gui/base/mouseinput.hpp" #include "input/keyinput.h" +#include "input/mouseinput.h" #include "listeners/actionlistener.h" #include "listeners/deathlistener.h" diff --git a/src/gui/base/widget.hpp b/src/gui/base/widget.hpp index 4043c959a..f2718697e 100644 --- a/src/gui/base/widget.hpp +++ b/src/gui/base/widget.hpp @@ -80,6 +80,7 @@ class Font; class Graphics; class KeyInput; class KeyListener; +class MouseInput; class MouseListener; class WidgetListener; @@ -87,7 +88,6 @@ namespace gcn { class BasicContainer; class FocusHandler; - class MouseInput; /** * Abstract class for widgets of Guichan. It contains basic functions diff --git a/src/gui/base/widgets/button.cpp b/src/gui/base/widgets/button.cpp index 9b7473293..56ba72590 100644 --- a/src/gui/base/widgets/button.cpp +++ b/src/gui/base/widgets/button.cpp @@ -70,7 +70,8 @@ #include "gui/font.h" #include "gui/base/key.hpp" -#include "gui/base/mouseinput.hpp" + +#include "input/mouseinput.h" #include "events/mouseevent.h" diff --git a/src/gui/base/widgets/checkbox.cpp b/src/gui/base/widgets/checkbox.cpp index 0a3171fe8..18f635052 100644 --- a/src/gui/base/widgets/checkbox.cpp +++ b/src/gui/base/widgets/checkbox.cpp @@ -70,7 +70,8 @@ #include "gui/font.h" #include "gui/base/key.hpp" -#include "gui/base/mouseinput.hpp" + +#include "input/mouseinput.h" #include "render/graphics.h" diff --git a/src/gui/base/widgets/listbox.cpp b/src/gui/base/widgets/listbox.cpp index 6c6472636..f13a96e39 100644 --- a/src/gui/base/widgets/listbox.cpp +++ b/src/gui/base/widgets/listbox.cpp @@ -72,7 +72,8 @@ #include "gui/base/basiccontainer.hpp" #include "gui/base/key.hpp" #include "gui/base/listmodel.hpp" -#include "gui/base/mouseinput.hpp" + +#include "input/mouseinput.h" #include "listeners/selectionlistener.h" diff --git a/src/gui/base/widgets/radiobutton.cpp b/src/gui/base/widgets/radiobutton.cpp index f0430c7a2..ff6a39db0 100644 --- a/src/gui/base/widgets/radiobutton.cpp +++ b/src/gui/base/widgets/radiobutton.cpp @@ -70,7 +70,8 @@ #include "gui/font.h" #include "gui/base/key.hpp" -#include "gui/base/mouseinput.hpp" + +#include "input/mouseinput.h" #include "render/graphics.h" diff --git a/src/gui/base/widgets/slider.cpp b/src/gui/base/widgets/slider.cpp index 91c054e7d..d61f2766c 100644 --- a/src/gui/base/widgets/slider.cpp +++ b/src/gui/base/widgets/slider.cpp @@ -68,7 +68,8 @@ #include "gui/base/widgets/slider.hpp" #include "gui/base/key.hpp" -#include "gui/base/mouseinput.hpp" + +#include "input/mouseinput.h" #include "render/graphics.h" diff --git a/src/gui/base/widgets/textbox.cpp b/src/gui/base/widgets/textbox.cpp index e994804d8..db5d91b92 100644 --- a/src/gui/base/widgets/textbox.cpp +++ b/src/gui/base/widgets/textbox.cpp @@ -71,7 +71,8 @@ #include "gui/base/basiccontainer.hpp" #include "gui/base/key.hpp" -#include "gui/base/mouseinput.hpp" + +#include "input/mouseinput.h" #include "render/graphics.h" diff --git a/src/gui/base/widgets/textfield.cpp b/src/gui/base/widgets/textfield.cpp index 1514d3afb..891e7e86b 100644 --- a/src/gui/base/widgets/textfield.cpp +++ b/src/gui/base/widgets/textfield.cpp @@ -70,7 +70,8 @@ #include "gui/font.h" #include "gui/base/key.hpp" -#include "gui/base/mouseinput.hpp" + +#include "input/mouseinput.h" #include "render/graphics.h" diff --git a/src/gui/base/widgets/window.cpp b/src/gui/base/widgets/window.cpp index fbd42aff2..8d33c1dd5 100644 --- a/src/gui/base/widgets/window.cpp +++ b/src/gui/base/widgets/window.cpp @@ -69,7 +69,7 @@ #include "gui/font.h" -#include "gui/base/mouseinput.hpp" +#include "input/mouseinput.h" #include "render/graphics.h" diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 85aeb15f5..243b3817e 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -20,8 +20,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "mouseinput.h" - #include "gui/gui.h" #include "gui/focushandler.h" @@ -44,6 +42,7 @@ #include "input/keydata.h" #include "input/keyinput.h" +#include "input/mouseinput.h" #include "resources/cursor.h" #include "resources/image.h" @@ -524,13 +523,13 @@ void Gui::setUseCustomCursor(const bool customCursor) } } -void Gui::handleMouseMoved(const gcn::MouseInput &mouseInput) +void Gui::handleMouseMoved(const MouseInput &mouseInput) { gcn::Gui::handleMouseMoved(mouseInput); mMouseInactivityTimer = 0; } -void Gui::handleMousePressed(const gcn::MouseInput &mouseInput) +void Gui::handleMousePressed(const MouseInput &mouseInput) { const int x = mouseInput.getX(); const int y = mouseInput.getY(); @@ -781,19 +780,19 @@ void Gui::handleMouseInput() #endif switch (mouseInput.getType()) { - case gcn::MouseInput::PRESSED: + case MouseInput::PRESSED: handleMousePressed(mouseInput); break; - case gcn::MouseInput::RELEASED: + case MouseInput::RELEASED: handleMouseReleased(mouseInput); break; - case gcn::MouseInput::MOVED: + case MouseInput::MOVED: handleMouseMoved(mouseInput); break; - case gcn::MouseInput::WHEEL_MOVED_DOWN: + case MouseInput::WHEEL_MOVED_DOWN: handleMouseWheelMovedDown(mouseInput); break; - case gcn::MouseInput::WHEEL_MOVED_UP: + case MouseInput::WHEEL_MOVED_UP: handleMouseWheelMovedUp(mouseInput); break; default: @@ -803,7 +802,7 @@ void Gui::handleMouseInput() BLOCK_END("Gui::handleMouseInput") } -void Gui::handleMouseReleased(const gcn::MouseInput &mouseInput) +void Gui::handleMouseReleased(const MouseInput &mouseInput) { gcn::Widget *sourceWidget = getMouseEventSource( mouseInput.getX(), mouseInput.getY()); diff --git a/src/gui/gui.h b/src/gui/gui.h index 1660fcfbf..b790d4d2c 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -169,11 +169,11 @@ class Gui final : public gcn::Gui static uint32_t getMouseState(int *const x, int *const y); protected: - void handleMouseMoved(const gcn::MouseInput &mouseInput); + void handleMouseMoved(const MouseInput &mouseInput); - void handleMouseReleased(const gcn::MouseInput &mouseInput); + void handleMouseReleased(const MouseInput &mouseInput); - void handleMousePressed(const gcn::MouseInput &mouseInput); + void handleMousePressed(const MouseInput &mouseInput); void handleMouseInput(); diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index b61f858e8..21a8d3957 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -119,9 +119,9 @@ bool SDLInput::isMouseQueueEmpty() return mMouseInputQueue.empty(); } -gcn::MouseInput SDLInput::dequeueMouseInput() +MouseInput SDLInput::dequeueMouseInput() { - gcn::MouseInput mouseInput; + MouseInput mouseInput; if (mMouseInputQueue.empty()) return MouseInput(); @@ -189,9 +189,9 @@ void SDLInput::pushInput(const SDL_Event &event) #endif mouseInput.setButton(-1); if (y > 0) - mouseInput.setType(gcn::MouseInput::WHEEL_MOVED_UP); + mouseInput.setType(MouseInput::WHEEL_MOVED_UP); else - mouseInput.setType(gcn::MouseInput::WHEEL_MOVED_DOWN); + mouseInput.setType(MouseInput::WHEEL_MOVED_DOWN); mouseInput.setTimeStamp(SDL_GetTicks()); mMouseInputQueue.push(mouseInput); } @@ -227,12 +227,12 @@ void SDLInput::pushInput(const SDL_Event &event) #ifndef USE_SDL2 if (event.button.button == SDL_BUTTON_WHEELDOWN) - mouseInput.setType(gcn::MouseInput::WHEEL_MOVED_DOWN); + mouseInput.setType(MouseInput::WHEEL_MOVED_DOWN); else if (event.button.button == SDL_BUTTON_WHEELUP) - mouseInput.setType(gcn::MouseInput::WHEEL_MOVED_UP); + mouseInput.setType(MouseInput::WHEEL_MOVED_UP); else #endif - mouseInput.setType(gcn::MouseInput::PRESSED); + mouseInput.setType(MouseInput::PRESSED); mouseInput.setTimeStamp(SDL_GetTicks()); mMouseInputQueue.push(mouseInput); break; @@ -254,7 +254,7 @@ void SDLInput::pushInput(const SDL_Event &event) #endif #endif mouseInput.setButton(convertMouseButton(event.button.button)); - mouseInput.setType(gcn::MouseInput::RELEASED); + mouseInput.setType(MouseInput::RELEASED); mouseInput.setTimeStamp(SDL_GetTicks()); mMouseInputQueue.push(mouseInput); break; @@ -274,8 +274,8 @@ void SDLInput::pushInput(const SDL_Event &event) event.motion.realy / scale); #endif #endif - mouseInput.setButton(gcn::MouseInput::EMPTY); - mouseInput.setType(gcn::MouseInput::MOVED); + mouseInput.setButton(MouseInput::EMPTY); + mouseInput.setType(MouseInput::MOVED); mouseInput.setTimeStamp(SDL_GetTicks()); mMouseInputQueue.push(mouseInput); break; @@ -295,8 +295,8 @@ void SDLInput::pushInput(const SDL_Event &event) { mouseInput.setX(-1); mouseInput.setY(-1); - mouseInput.setButton(gcn::MouseInput::EMPTY); - mouseInput.setType(gcn::MouseInput::MOVED); + mouseInput.setButton(MouseInput::EMPTY); + mouseInput.setType(MouseInput::MOVED); mMouseInputQueue.push(mouseInput); } } @@ -338,11 +338,11 @@ int SDLInput::convertMouseButton(const int button) switch (button) { case SDL_BUTTON_LEFT: - return gcn::MouseInput::LEFT; + return MouseInput::LEFT; case SDL_BUTTON_RIGHT: - return gcn::MouseInput::RIGHT; + return MouseInput::RIGHT; case SDL_BUTTON_MIDDLE: - return gcn::MouseInput::MIDDLE; + return MouseInput::MIDDLE; default: // We have an unknown mouse type which is ignored. return button; @@ -569,10 +569,10 @@ void SDLInput::simulateMouseClick(const int x, const int y, mouseInput.setY(y); mouseInput.setReal(x, y); mouseInput.setButton(button); - mouseInput.setType(gcn::MouseInput::PRESSED); + mouseInput.setType(MouseInput::PRESSED); mouseInput.setTimeStamp(SDL_GetTicks()); mMouseInputQueue.push(mouseInput); - mouseInput.setType(gcn::MouseInput::RELEASED); + mouseInput.setType(MouseInput::RELEASED); mouseInput.setTimeStamp(SDL_GetTicks()); mMouseInputQueue.push(mouseInput); } diff --git a/src/gui/sdlinput.h b/src/gui/sdlinput.h index 73e2896d5..1a19e8790 100644 --- a/src/gui/sdlinput.h +++ b/src/gui/sdlinput.h @@ -79,13 +79,13 @@ #define GUI_SDLINPUT_H #include "input/keyinput.h" - -#include "mouseinput.h" +#include "input/mouseinput.h" #include <SDL_events.h> #include "gui/base/input.hpp" -#include "gui/base/mouseinput.hpp" + +#include "input/mouseinput.h" #include <queue> @@ -184,7 +184,7 @@ public: bool isMouseQueueEmpty() override final A_WARN_UNUSED; - gcn::MouseInput dequeueMouseInput() override final A_WARN_UNUSED; + MouseInput dequeueMouseInput() override final A_WARN_UNUSED; MouseInput dequeueMouseInput2() A_WARN_UNUSED; diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp index deb3b4451..3e9a99a2a 100644 --- a/src/gui/widgets/itemlinkhandler.cpp +++ b/src/gui/widgets/itemlinkhandler.cpp @@ -35,10 +35,11 @@ #include "resources/db/itemdb.h" -#include <string> - #include "listeners/actionlistener.h" -#include "gui/base/mouseinput.hpp" + +#include "input/mouseinput.h" + +#include <string> #include "debug.h" @@ -85,7 +86,7 @@ void ItemLinkHandler::handleLink(const std::string &link, MouseEvent *event) replaceAll(url, " ", ""); listener.url = url; const int button = event->getButton(); - if (button == gcn::MouseInput::LEFT) + if (button == MouseInput::LEFT) { ConfirmDialog *const confirmDlg = new ConfirmDialog( // TRANSLATORS: dialog message @@ -93,7 +94,7 @@ void ItemLinkHandler::handleLink(const std::string &link, MouseEvent *event) confirmDlg->postInit(); confirmDlg->addActionListener(&listener); } - else if (button == gcn::MouseInput::RIGHT) + else if (button == MouseInput::RIGHT) { if (viewport) viewport->showLinkPopup(url); |