summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-18 16:27:04 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-18 16:27:04 +0300
commit03c74387d37cefcc18e59db203d17d78cda40e8e (patch)
tree74e7291b97b67bb75984f5f5819944f058a9ace7
parent3d7cb45edeb4f75bad321d54d84fe2d13b487db9 (diff)
downloadmv-03c74387d37cefcc18e59db203d17d78cda40e8e.tar.gz
mv-03c74387d37cefcc18e59db203d17d78cda40e8e.tar.bz2
mv-03c74387d37cefcc18e59db203d17d78cda40e8e.tar.xz
mv-03c74387d37cefcc18e59db203d17d78cda40e8e.zip
Move mousebutton into separate file.
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/actionmanager.cpp2
-rw-r--r--src/events/mousebutton.h81
-rw-r--r--src/events/mouseevent.h20
-rw-r--r--src/gui/gui.cpp14
-rw-r--r--src/gui/gui.h7
-rw-r--r--src/gui/sdlinput.cpp28
-rw-r--r--src/gui/sdlinput.h5
-rw-r--r--src/gui/viewport.cpp10
-rw-r--r--src/gui/widgets/avatarlistbox.cpp6
-rw-r--r--src/gui/widgets/button.cpp4
-rw-r--r--src/gui/widgets/checkbox.cpp2
-rw-r--r--src/gui/widgets/dropdown.cpp6
-rw-r--r--src/gui/widgets/dropshortcutcontainer.cpp8
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/guitable.cpp4
-rw-r--r--src/gui/widgets/itemcontainer.cpp2
-rw-r--r--src/gui/widgets/itemlinkhandler.cpp4
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp8
-rw-r--r--src/gui/widgets/listbox.cpp4
-rw-r--r--src/gui/widgets/playerbox.cpp2
-rw-r--r--src/gui/widgets/radiobutton.cpp2
-rw-r--r--src/gui/widgets/scrollarea.cpp4
-rw-r--r--src/gui/widgets/shoplistbox.cpp2
-rw-r--r--src/gui/widgets/skilllistbox.h4
-rw-r--r--src/gui/widgets/slider.cpp2
-rw-r--r--src/gui/widgets/spellshortcutcontainer.cpp12
-rw-r--r--src/gui/widgets/tabbedarea.cpp2
-rw-r--r--src/gui/widgets/textbox.cpp2
-rw-r--r--src/gui/widgets/textfield.cpp4
-rw-r--r--src/gui/widgets/window.cpp4
-rw-r--r--src/gui/windowmenu.cpp2
-rw-r--r--src/gui/windows/chatwindow.cpp4
-rw-r--r--src/gui/windows/equipmentwindow.cpp4
-rw-r--r--src/gui/windows/inventorywindow.cpp12
-rw-r--r--src/gui/windows/minimap.cpp4
-rw-r--r--src/gui/windows/ministatuswindow.cpp2
-rw-r--r--src/gui/windows/npcdialog.cpp2
-rw-r--r--src/gui/windows/outfitwindow.cpp6
-rw-r--r--src/gui/windows/serverdialog.cpp2
-rw-r--r--src/gui/windows/shortcutwindow.cpp2
-rw-r--r--src/gui/windows/whoisonline.cpp4
-rw-r--r--src/input/mouseinput.h21
-rw-r--r--src/input/multitouchmanager.cpp2
45 files changed, 197 insertions, 129 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7b5dc4ef3..3d4c3cbd7 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -913,6 +913,7 @@ SET(SRCS
gui/models/listmodel.h
gui/models/magicschoolmodel.h
events/mouseevent.h
+ events/mousebutton.h
events/mouseeventtype.h
listeners/mouselistener.h
listeners/openurllistener.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 6576b171d..d561cb987 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -180,6 +180,7 @@ manaplus_SOURCES += events/actionevent.h \
gui/models/listmodel.h \
gui/models/magicschoolmodel.h \
events/mouseevent.h \
+ events/mousebutton.h \
events/mouseeventtype.h \
listeners/mouselistener.h \
listeners/openurllistener.h \
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index 52f2c1a97..3213b2e0a 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -222,7 +222,7 @@ impHandler0(mouseClick)
int mouseX, mouseY;
Gui::getMouseState(&mouseX, &mouseY);
- guiInput->simulateMouseClick(mouseX, mouseY, MouseEvent::RIGHT);
+ guiInput->simulateMouseClick(mouseX, mouseY, MouseButton::RIGHT);
return true;
}
diff --git a/src/events/mousebutton.h b/src/events/mousebutton.h
new file mode 100644
index 000000000..29c4548e4
--- /dev/null
+++ b/src/events/mousebutton.h
@@ -0,0 +1,81 @@
+/*
+ * 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 EVENTS_MOUSEBUTTON_H
+#define EVENTS_MOUSEBUTTON_H
+
+namespace MouseButton
+{
+ /**
+ * Mouse button types.
+ */
+ enum Type
+ {
+ EMPTY = 0,
+ LEFT,
+ RIGHT,
+ MIDDLE
+ };
+}
+
+#endif // EVENTS_MOUSEBUTTON_H
diff --git a/src/events/mouseevent.h b/src/events/mouseevent.h
index 213582f47..80267e776 100644
--- a/src/events/mouseevent.h
+++ b/src/events/mouseevent.h
@@ -66,6 +66,7 @@
#include "events/inputguievent.h"
+#include "events/mousebutton.h"
#include "events/mouseeventtype.h"
class Widget;
@@ -91,8 +92,8 @@ class MouseEvent: public InputGuiEvent
* It's set to zero if another button is used.
*/
MouseEvent(Widget *const source,
- MouseEventType::Type type,
- const unsigned int button,
+ const MouseEventType::Type type,
+ const MouseButton::Type button,
const int x,
const int y,
const int clickCount) :
@@ -110,7 +111,7 @@ class MouseEvent: public InputGuiEvent
*
* @return The button of the mouse event.
*/
- unsigned int getButton() const A_WARN_UNUSED
+ MouseButton::Type getButton() const A_WARN_UNUSED
{ return mButton; }
/**
@@ -158,17 +159,6 @@ class MouseEvent: public InputGuiEvent
void setY(int n)
{ mY = n; }
- /**
- * Mouse button types.
- */
- enum
- {
- EMPTY = 0,
- LEFT,
- RIGHT,
- MIDDLE
- };
-
protected:
/**
* Holds the type of the mouse event.
@@ -178,7 +168,7 @@ class MouseEvent: public InputGuiEvent
/**
* Holds the button of the mouse event.
*/
- unsigned int mButton;
+ MouseButton::Type mButton;
/**
* Holds the x-coordinate of the mouse event.
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index c14f6d924..ab4ee5e19 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -116,12 +116,12 @@ Gui::Gui() :
mInput(nullptr),
mFocusHandler(new FocusHandler),
mKeyListeners(),
- mLastMousePressButton(0),
+ mLastMousePressButton(MouseButton::EMPTY),
mLastMousePressTimeStamp(0),
mLastMouseX(0),
mLastMouseY(0),
mClickCount(1),
- mLastMouseDragButton(0),
+ mLastMouseDragButton(MouseButton::EMPTY),
mWidgetWithMouseQueue(),
mConfigListener(new GuiConfigListener(this)),
mGuiFont(),
@@ -581,7 +581,7 @@ void Gui::handleMouseMoved(const MouseInput &mouseInput)
const int mouseX = mouseInput.getX();
const int mouseY = mouseInput.getY();
- const int button = mouseInput.getButton();
+ const MouseButton::Type button = mouseInput.getButton();
// Check if there is a need to send mouse exited events by
// traversing the "widget with mouse" queue.
@@ -724,7 +724,7 @@ void Gui::handleMousePressed(const MouseInput &mouseInput)
{
const int x = mouseInput.getX();
const int y = mouseInput.getY();
- const unsigned int button = mouseInput.getButton();
+ const MouseButton::Type button = mouseInput.getButton();
const int timeStamp = mouseInput.getTimeStamp();
Widget *sourceWidget = getMouseEventSource(x, y);
@@ -793,7 +793,7 @@ void Gui::updateFonts()
void Gui::distributeMouseEvent(Widget *const source,
const MouseEventType::Type type,
- const int button,
+ const MouseButton::Type button,
const int x, const int y,
const bool force,
const bool toSourceOnly)
@@ -936,7 +936,7 @@ MouseEvent *Gui::createMouseEvent(Window *const widget)
return new MouseEvent(widget,
MouseEventType::MOVED,
- 0,
+ MouseButton::EMPTY,
mouseX - x,
mouseY - y,
mClickCount);
@@ -1051,7 +1051,7 @@ void Gui::handleMouseReleased(const MouseInput &mouseInput)
}
else
{
- mLastMousePressButton = 0;
+ mLastMousePressButton = MouseButton::EMPTY;
mClickCount = 0;
}
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 6027625cb..5a1677ff2 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -68,6 +68,7 @@
#include "gui/color.h"
+#include "events/mousebutton.h"
#include "events/mouseeventtype.h"
#include "resources/cursor.h"
@@ -328,7 +329,7 @@ class Gui final
void distributeMouseEvent(Widget *const source,
const MouseEventType::Type type,
- const int button,
+ const MouseButton::Type button,
const int x, const int y,
const bool force = false,
const bool toSourceOnly = false);
@@ -467,7 +468,7 @@ class Gui final
/**
* Holds the last mouse button pressed.
*/
- unsigned int mLastMousePressButton;
+ MouseButton::Type mLastMousePressButton;
/**
* Holds the last mouse press time stamp.
@@ -495,7 +496,7 @@ class Gui final
* was initiated. Used to be able to release a drag
* when the same button is released.
*/
- int mLastMouseDragButton;
+ MouseButton::Type mLastMouseDragButton;
/**
* Holds a stack with all the widgets with the mouse.
diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp
index b10147bc7..aa8824bbd 100644
--- a/src/gui/sdlinput.cpp
+++ b/src/gui/sdlinput.cpp
@@ -75,6 +75,7 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "logger.h"
#include "sdlshared.h"
#include "input/inputmanager.h"
@@ -250,7 +251,7 @@ void SDLInput::pushInput(const SDL_Event &event)
event.motion.realy / scale);
#endif
#endif
- mouseInput.setButton(MouseInput::EMPTY);
+ mouseInput.setButton(MouseButton::EMPTY);
mouseInput.setType(MouseInput::MOVED);
mouseInput.setTimeStamp(SDL_GetTicks());
mMouseInputQueue.push(mouseInput);
@@ -270,7 +271,7 @@ void SDLInput::pushInput(const SDL_Event &event)
{
mouseInput.setX(-1);
mouseInput.setY(-1);
- mouseInput.setButton(MouseInput::EMPTY);
+ mouseInput.setButton(MouseButton::EMPTY);
mouseInput.setType(MouseInput::MOVED);
mMouseInputQueue.push(mouseInput);
}
@@ -293,19 +294,20 @@ void SDLInput::convertKeyEventToKey(const SDL_Event &event, KeyInput &keyInput)
keyInput.setActionId(actionId);
}
-int SDLInput::convertMouseButton(const int button)
+MouseButton::Type SDLInput::convertMouseButton(const int button)
{
switch (button)
{
- case SDL_BUTTON_LEFT:
- return MouseInput::LEFT;
- case SDL_BUTTON_RIGHT:
- return MouseInput::RIGHT;
- case SDL_BUTTON_MIDDLE:
- return MouseInput::MIDDLE;
- default:
- // We have an unknown mouse type which is ignored.
- return button;
+ case SDL_BUTTON_LEFT:
+ return MouseButton::LEFT;
+ case SDL_BUTTON_RIGHT:
+ return MouseButton::RIGHT;
+ case SDL_BUTTON_MIDDLE:
+ return MouseButton::MIDDLE;
+ default:
+ // We have an unknown mouse type which is ignored.
+ logger->log("unknown button type: %u", button);
+ return MouseButton::EMPTY;
}
}
@@ -522,7 +524,7 @@ int SDLInput::convertKeyCharacter(const SDL_Event &event)
}
void SDLInput::simulateMouseClick(const int x, const int y,
- const unsigned int button)
+ const MouseButton::Type button)
{
MouseInput mouseInput;
mouseInput.setX(x);
diff --git a/src/gui/sdlinput.h b/src/gui/sdlinput.h
index 9e7cbccb9..eddfe65a1 100644
--- a/src/gui/sdlinput.h
+++ b/src/gui/sdlinput.h
@@ -120,7 +120,7 @@ public:
MouseInput dequeueMouseInput() A_WARN_UNUSED;
void simulateMouseClick(const int x, const int y,
- const unsigned int button);
+ const MouseButton::Type button);
protected:
/**
@@ -130,7 +130,8 @@ protected:
* @param button an SDL mouse button.
* @return a Guichan mouse button.
*/
- static int convertMouseButton(const int button) A_WARN_UNUSED;
+ static MouseButton::Type convertMouseButton(const int button)
+ A_WARN_UNUSED;
/**
* Converts an SDL event key to a key value.
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 6b6850812..89bf2fcd2 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -290,7 +290,7 @@ void Viewport::followMouse()
// We create a mouse event and send it to mouseDragged.
MouseEvent event(nullptr,
MouseEventType::DRAGGED,
- MouseEvent::LEFT,
+ MouseButton::LEFT,
mMouseX,
mMouseY,
0);
@@ -508,7 +508,7 @@ void Viewport::mousePressed(MouseEvent &event)
const int pixelY = mMousePressY + mPixelViewY;
// Right click might open a popup
- if (eventButton == MouseEvent::RIGHT)
+ if (eventButton == MouseButton::RIGHT)
{
if (openContextMenu(event))
return;
@@ -523,7 +523,7 @@ void Viewport::mousePressed(MouseEvent &event)
}
// Left click can cause different actions
- if (!mLongMouseClick && eventButton == MouseEvent::LEFT)
+ if (!mLongMouseClick && eventButton == MouseButton::LEFT)
{
if (leftMouseAction())
{
@@ -531,7 +531,7 @@ void Viewport::mousePressed(MouseEvent &event)
return;
}
}
- else if (eventButton == MouseEvent::MIDDLE)
+ else if (eventButton == MouseButton::MIDDLE)
{
mPlayerFollowMouse = false;
validateSpeed();
@@ -701,7 +701,7 @@ void Viewport::mouseReleased(MouseEvent &event)
if (event.getSource() != this || event.isConsumed())
return;
const unsigned int eventButton = event.getButton();
- if (eventButton == MouseEvent::LEFT)
+ if (eventButton == MouseButton::LEFT)
{
// long button press
if (gui && gui->isLongPress())
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index e098cda34..4bbc85a94 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -344,7 +344,7 @@ void AvatarListBox::mousePressed(MouseEvent &event)
event.consume();
const unsigned int eventButton = event.getButton();
- if (eventButton == MouseEvent::LEFT)
+ if (eventButton == MouseButton::LEFT)
{
if (ava->getType() == AVATAR_PLAYER)
{
@@ -358,7 +358,7 @@ void AvatarListBox::mousePressed(MouseEvent &event)
player_node->navigateTo(ava->getX(), ava->getY());
}
}
- else if (eventButton == MouseEvent::RIGHT)
+ else if (eventButton == MouseButton::RIGHT)
{
switch (ava->getType())
{
@@ -417,7 +417,7 @@ void AvatarListBox::mousePressed(MouseEvent &event)
}
}
}
- else if (eventButton == MouseEvent::MIDDLE)
+ else if (eventButton == MouseButton::MIDDLE)
{
if (ava->getType() == AVATAR_PLAYER && chatWindow)
{
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index dbed0e4ac..3b3c97911 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -612,7 +612,7 @@ void Button::draw(Graphics *graphics)
void Button::mouseReleased(MouseEvent& event)
{
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
if (mStick)
mPressed = !mPressed;
@@ -716,7 +716,7 @@ void Button::focusLost(const Event& event A_UNUSED)
void Button::mousePressed(MouseEvent& event)
{
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
mMousePressed = true;
event.consume();
diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp
index 71936ab41..b9d74e067 100644
--- a/src/gui/widgets/checkbox.cpp
+++ b/src/gui/widgets/checkbox.cpp
@@ -257,7 +257,7 @@ void CheckBox::adjustSize()
void CheckBox::mouseClicked(MouseEvent& event)
{
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
toggleSelected();
event.consume();
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 1cb7683e9..65a5b10c9 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -360,7 +360,7 @@ void DropDown::mousePressed(MouseEvent& event)
{
event.consume();
// If we have a mouse press on the widget.
- if (event.getButton() == MouseEvent::LEFT
+ if (event.getButton() == MouseButton::LEFT
&& !mDroppedDown && event.getSource() == this)
{
mPushed = true;
@@ -385,12 +385,12 @@ void DropDown::mouseReleased(MouseEvent &event)
// Released outside of widget. Can happen when we have modal
// input focus.
if ((0 > y || y >= mDimension.height || x < 0 || x >= mDimension.width)
- && button == MouseEvent::LEFT)
+ && button == MouseButton::LEFT)
{
if (mIsDragged)
foldUp();
}
- else if (button == MouseEvent::LEFT)
+ else if (button == MouseButton::LEFT)
{
mPushed = false;
}
diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp
index 59528421e..b9ba2fdae 100644
--- a/src/gui/widgets/dropshortcutcontainer.cpp
+++ b/src/gui/widgets/dropshortcutcontainer.cpp
@@ -163,7 +163,7 @@ void DropShortcutContainer::mouseDragged(MouseEvent &event)
if (!dropShortcut)
return;
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
if (dragDrop.isEmpty() && mItemClicked)
{
@@ -210,7 +210,7 @@ void DropShortcutContainer::mousePressed(MouseEvent &event)
event.consume();
const int eventButton = event.getButton();
- if (eventButton == MouseEvent::LEFT)
+ if (eventButton == MouseButton::LEFT)
{
if (dropShortcut->getItem(index) > 0)
{
@@ -226,7 +226,7 @@ void DropShortcutContainer::mousePressed(MouseEvent &event)
}
}
}
- else if (eventButton == MouseEvent::RIGHT)
+ else if (eventButton == MouseButton::RIGHT)
{
const Inventory *const inv = PlayerInfo::getInventory();
if (!inv)
@@ -245,7 +245,7 @@ void DropShortcutContainer::mouseReleased(MouseEvent &event)
if (!dropShortcut)
return;
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
if (dropShortcut->isItemSelected())
dropShortcut->setItemSelected(-1);
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index ad7bf7358..9d9aa8d92 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -182,7 +182,7 @@ void EmoteShortcutContainer::mouseReleased(MouseEvent &event)
if (!emoteShortcut)
return;
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
const int index = getIndexFromGrid(event.getX(), event.getY());
diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp
index e6d3119fb..9aa17c512 100644
--- a/src/gui/widgets/guitable.cpp
+++ b/src/gui/widgets/guitable.cpp
@@ -415,7 +415,7 @@ void GuiTable::mousePressed(MouseEvent& event)
if (!mModel || !mSelectable)
return;
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
const int row = getRowForY(event.getY());
const int column = getColumnForX(event.getX());
@@ -454,7 +454,7 @@ void GuiTable::mouseWheelMovedDown(MouseEvent& event)
void GuiTable::mouseDragged(MouseEvent& event)
{
- if (event.getButton() != MouseEvent::LEFT)
+ if (event.getButton() != MouseButton::LEFT)
return;
// Make table selection update on drag
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 6f8519a3c..fccc21b2f 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -405,7 +405,7 @@ void ItemContainer::mousePressed(MouseEvent &event)
const int button = event.getButton();
mClicks = event.getClickCount();
- if (button == MouseEvent::LEFT || button == MouseEvent::RIGHT)
+ if (button == MouseButton::LEFT || button == MouseButton::RIGHT)
{
event.consume();
const int index = getSlotIndex(event.getX(), event.getY());
diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp
index 8bd46d440..54078a172 100644
--- a/src/gui/widgets/itemlinkhandler.cpp
+++ b/src/gui/widgets/itemlinkhandler.cpp
@@ -70,7 +70,7 @@ void ItemLinkHandler::handleLink(const std::string &link, MouseEvent *event)
replaceAll(url, " ", "");
listener.url = url;
const int button = event->getButton();
- if (button == MouseInput::LEFT)
+ if (button == MouseButton::LEFT)
{
ConfirmDialog *const confirmDlg = new ConfirmDialog(
// TRANSLATORS: dialog message
@@ -78,7 +78,7 @@ void ItemLinkHandler::handleLink(const std::string &link, MouseEvent *event)
confirmDlg->postInit();
confirmDlg->addActionListener(&listener);
}
- else if (button == MouseInput::RIGHT)
+ else if (button == MouseButton::RIGHT)
{
if (viewport)
viewport->showLinkPopup(url);
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index e04b90a4e..a993afcd0 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -241,7 +241,7 @@ void ItemShortcutContainer::mouseDragged(MouseEvent &event)
if (!selShortcut)
return;
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
if (dragDrop.isEmpty() && mItemClicked)
{
@@ -334,7 +334,7 @@ void ItemShortcutContainer::mousePressed(MouseEvent &event)
if (index == -1)
return;
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
event.consume();
// Stores the selected item if theirs one.
@@ -353,7 +353,7 @@ void ItemShortcutContainer::mousePressed(MouseEvent &event)
mItemClicked = true;
}
}
- else if (event.getButton() == MouseEvent::RIGHT)
+ else if (event.getButton() == MouseButton::RIGHT)
{
event.consume();
if (viewport && selShortcut)
@@ -370,7 +370,7 @@ void ItemShortcutContainer::mouseReleased(MouseEvent &event)
if (!selShortcut)
return;
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
if (selShortcut->isItemSelected())
selShortcut->setItemSelected(-1);
diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp
index b0e9f4236..ceb3c1669 100644
--- a/src/gui/widgets/listbox.cpp
+++ b/src/gui/widgets/listbox.cpp
@@ -318,7 +318,7 @@ void ListBox::mouseReleased(MouseEvent &event)
void ListBox::mouseReleased1(const MouseEvent &event)
{
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
setSelected(std::max(0, getSelectionByMouse(event.getY())));
distributeActionEvent();
@@ -327,7 +327,7 @@ void ListBox::mouseReleased1(const MouseEvent &event)
void ListBox::mouseDragged(MouseEvent &event)
{
- if (event.getButton() != MouseEvent::LEFT || getRowHeight() == 0)
+ if (event.getButton() != MouseButton::LEFT || getRowHeight() == 0)
return;
// Make list selection update on drag, but guard against negative y
diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp
index 252f39727..b7b5c8134 100644
--- a/src/gui/widgets/playerbox.cpp
+++ b/src/gui/widgets/playerbox.cpp
@@ -157,7 +157,7 @@ void PlayerBox::drawFrame(Graphics *graphics)
void PlayerBox::mouseReleased(MouseEvent& event)
{
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
if (!mActionEventId.empty())
distributeActionEvent();
diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp
index 5f18d618f..ad1b5d902 100644
--- a/src/gui/widgets/radiobutton.cpp
+++ b/src/gui/widgets/radiobutton.cpp
@@ -275,7 +275,7 @@ void RadioButton::setSelected(const bool selected)
void RadioButton::mouseClicked(MouseEvent& event)
{
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
setSelected(true);
event.consume();
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index 29d185bac..52d3df152 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -803,7 +803,7 @@ void ScrollArea::mousePressed(MouseEvent& event)
event.consume();
}
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
mClickX = event.getX();
mClickY = event.getY();
@@ -812,7 +812,7 @@ void ScrollArea::mousePressed(MouseEvent& event)
void ScrollArea::mouseReleased(MouseEvent& event)
{
- if (event.getButton() == MouseEvent::LEFT && mClickX && mClickY)
+ if (event.getButton() == MouseButton::LEFT && mClickX && mClickY)
{
if (!event.isConsumed())
{
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp
index 9b9a6bba8..c259d187f 100644
--- a/src/gui/widgets/shoplistbox.cpp
+++ b/src/gui/widgets/shoplistbox.cpp
@@ -225,7 +225,7 @@ void ShopListBox::mouseMoved(MouseEvent &event)
void ShopListBox::mouseReleased(MouseEvent& event)
{
ListBox::mouseReleased(event);
- if (event.getButton() == MouseEvent::RIGHT)
+ if (event.getButton() == MouseButton::RIGHT)
{
setSelected(std::max(0, getSelectionByMouse(event.getY())));
diff --git a/src/gui/widgets/skilllistbox.h b/src/gui/widgets/skilllistbox.h
index d2da4b150..c932fc95b 100644
--- a/src/gui/widgets/skilllistbox.h
+++ b/src/gui/widgets/skilllistbox.h
@@ -174,7 +174,7 @@ class SkillListBox final : public ListBox
void mouseDragged(MouseEvent &event)
{
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
if (dragDrop.isEmpty())
{
@@ -199,7 +199,7 @@ class SkillListBox final : public ListBox
void mousePressed(MouseEvent &event)
{
ListBox::mousePressed(event);
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
const SkillInfo *const skill = getSkillByEvent(event);
if (!skill)
diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp
index a08d94440..77ae38931 100644
--- a/src/gui/widgets/slider.cpp
+++ b/src/gui/widgets/slider.cpp
@@ -360,7 +360,7 @@ void Slider::mousePressed(MouseEvent &event)
const int width = mDimension.width;
const int height = mDimension.height;
- if (event.getButton() == MouseEvent::LEFT
+ if (event.getButton() == MouseButton::LEFT
&& x >= 0 && x <= width && y >= 0 && y <= height)
{
event.consume();
diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index 3c57d1034..4a4a5beb5 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -149,7 +149,7 @@ void SpellShortcutContainer::draw(Graphics *graphics)
void SpellShortcutContainer::mouseDragged(MouseEvent &event)
{
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
if (dragDrop.isEmpty() && mSpellClicked)
{
@@ -186,17 +186,17 @@ void SpellShortcutContainer::mousePressed(MouseEvent &event)
return;
const unsigned int eventButton = event.getButton();
- if (eventButton == MouseEvent::LEFT)
+ if (eventButton == MouseButton::LEFT)
{
const int itemId = getItemByIndex(index);
if (itemId > 0)
mSpellClicked = true;
event.consume();
}
- else if (eventButton == MouseEvent::RIGHT)
+ else if (eventButton == MouseButton::RIGHT)
{
}
- else if (eventButton == MouseEvent::MIDDLE)
+ else if (eventButton == MouseButton::MIDDLE)
{
if (!spellShortcut || !spellManager)
return;
@@ -223,7 +223,7 @@ void SpellShortcutContainer::mouseReleased(MouseEvent &event)
const int itemId = getItemByIndex(index);
const unsigned int eventButton = event.getButton();
- if (eventButton == MouseEvent::LEFT)
+ if (eventButton == MouseButton::LEFT)
{
mSpellClicked = false;
@@ -275,7 +275,7 @@ void SpellShortcutContainer::mouseReleased(MouseEvent &event)
}
}
}
- else if (eventButton == MouseEvent::RIGHT)
+ else if (eventButton == MouseButton::RIGHT)
{
TextCommand *spell = nullptr;
if (itemId >= 0)
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index 5596bdd21..f99f6ccc8 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -366,7 +366,7 @@ void TabbedArea::mousePressed(MouseEvent &event)
if (event.isConsumed())
return;
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
Widget *const widget = mTabContainer->getWidgetAt(
event.getX(), event.getY());
diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp
index dcb78b40a..917c613c5 100644
--- a/src/gui/widgets/textbox.cpp
+++ b/src/gui/widgets/textbox.cpp
@@ -586,7 +586,7 @@ void TextBox::addRow(const std::string &row)
void TextBox::mousePressed(MouseEvent& event)
{
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
const int height = getFont()->getHeight();
if (!height)
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index 2369f1c65..7aec5e4fc 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -702,7 +702,7 @@ void TextField::mousePressed(MouseEvent &event)
inputManager.executeAction(Input::KEY_SHOW_KEYBOARD);
#endif
event.consume();
- if (event.getButton() == MouseEvent::RIGHT)
+ if (event.getButton() == MouseButton::RIGHT)
{
if (viewport)
{
@@ -724,7 +724,7 @@ void TextField::mousePressed(MouseEvent &event)
}
}
}
- else if (event.getButton() == MouseEvent::LEFT)
+ else if (event.getButton() == MouseButton::LEFT)
{
mCaretPosition = getFont()->getStringIndexAt(
mText, event.getX() + mXScroll);
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 923999437..74c6d1cfc 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -721,7 +721,7 @@ void Window::mousePressed(MouseEvent &event)
}
const unsigned int button = event.getButton();
- if (button == MouseEvent::LEFT)
+ if (button == MouseButton::LEFT)
{
const int x = event.getX();
const int y = event.getY();
@@ -755,7 +755,7 @@ void Window::mousePressed(MouseEvent &event)
else
mMoved = false;
}
- else if (button == MouseEvent::RIGHT)
+ else if (button == MouseButton::RIGHT)
{
if (viewport)
{
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp
index 3e1d3cb1d..cb8e0c84d 100644
--- a/src/gui/windowmenu.cpp
+++ b/src/gui/windowmenu.cpp
@@ -242,7 +242,7 @@ void WindowMenu::mousePressed(MouseEvent &event)
if (!viewport)
return;
- if (event.getButton() == MouseEvent::RIGHT)
+ if (event.getButton() == MouseButton::RIGHT)
{
if (mSmallWindow)
return;
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 423aa556a..262700fc6 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -653,7 +653,7 @@ void ChatWindow::mousePressed(MouseEvent &event)
if (event.isConsumed())
return;
- if (event.getButton() == MouseEvent::RIGHT)
+ if (event.getButton() == MouseButton::RIGHT)
{
if (viewport)
{
@@ -683,7 +683,7 @@ void ChatWindow::mousePressed(MouseEvent &event)
if (event.isConsumed())
return;
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
const ChatTab *const tab = getFocused();
if (tab)
diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp
index 25cb5f629..0a18cd20f 100644
--- a/src/gui/windows/equipmentwindow.cpp
+++ b/src/gui/windows/equipmentwindow.cpp
@@ -306,7 +306,7 @@ void EquipmentWindow::mousePressed(MouseEvent& event)
const int x = event.getX();
const int y = event.getY();
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
if (mForing)
{
@@ -342,7 +342,7 @@ void EquipmentWindow::mousePressed(MouseEvent& event)
return;
}
}
- else if (event.getButton() == MouseEvent::RIGHT)
+ else if (event.getButton() == MouseButton::RIGHT)
{
if (Item *const item = getItem(x, y))
{
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp
index 14226ee38..ee920f8a1 100644
--- a/src/gui/windows/inventorywindow.cpp
+++ b/src/gui/windows/inventorywindow.cpp
@@ -451,7 +451,7 @@ void InventoryWindow::mouseClicked(MouseEvent &event)
&& inputManager.isActionActive(static_cast<int>(
Input::KEY_STOP_ATTACK)));
- if (!mod && !mod2 && event.getButton() == MouseEvent::RIGHT)
+ if (!mod && !mod2 && event.getButton() == MouseButton::RIGHT)
{
Item *const item = mItems->getSelectedItem();
@@ -471,8 +471,8 @@ void InventoryWindow::mouseClicked(MouseEvent &event)
if (!mInventory)
return;
- if (event.getButton() == MouseEvent::LEFT
- || event.getButton() == MouseEvent::RIGHT)
+ if (event.getButton() == MouseButton::LEFT
+ || event.getButton() == MouseButton::RIGHT)
{
Item *const item = mItems->getSelectedItem();
@@ -483,7 +483,7 @@ void InventoryWindow::mouseClicked(MouseEvent &event)
{
if (mInventory->isMainInventory())
{
- if (event.getButton() == MouseEvent::RIGHT)
+ if (event.getButton() == MouseButton::RIGHT)
{
ItemAmountWindow::showWindow(ItemAmountWindow::StoreAdd,
inventoryWindow, item);
@@ -497,7 +497,7 @@ void InventoryWindow::mouseClicked(MouseEvent &event)
}
else
{
- if (event.getButton() == MouseEvent::RIGHT)
+ if (event.getButton() == MouseButton::RIGHT)
{
ItemAmountWindow::showWindow(ItemAmountWindow::StoreRemove,
inventoryWindow, item);
@@ -514,7 +514,7 @@ void InventoryWindow::mouseClicked(MouseEvent &event)
{
if (PlayerInfo::isItemProtected(item->getId()))
return;
- if (event.getButton() == MouseEvent::RIGHT)
+ if (event.getButton() == MouseButton::RIGHT)
{
ItemAmountWindow::showWindow(ItemAmountWindow::TradeAdd,
tradeWindow, item);
diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp
index 8acbfc5a0..3607d9584 100644
--- a/src/gui/windows/minimap.cpp
+++ b/src/gui/windows/minimap.cpp
@@ -439,7 +439,7 @@ void Minimap::mouseReleased(MouseEvent &event)
if (!player_node || !viewport)
return;
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
int x = event.getX();
int y = event.getY();
@@ -447,7 +447,7 @@ void Minimap::mouseReleased(MouseEvent &event)
player_node->navigateTo(x, y);
}
- else if (event.getButton() == MouseEvent::RIGHT)
+ else if (event.getButton() == MouseButton::RIGHT)
{
int x = event.getX();
int y = event.getY();
diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp
index d9e6e5479..4417ff2fc 100644
--- a/src/gui/windows/ministatuswindow.cpp
+++ b/src/gui/windows/ministatuswindow.cpp
@@ -445,7 +445,7 @@ void MiniStatusWindow::mousePressed(MouseEvent &event)
if (!viewport)
return;
- if (event.getButton() == MouseEvent::RIGHT)
+ if (event.getButton() == MouseButton::RIGHT)
{
const ProgressBar *const bar = dynamic_cast<ProgressBar*>(
event.getSource());
diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp
index a2ac10073..47ad71f32 100644
--- a/src/gui/windows/npcdialog.cpp
+++ b/src/gui/windows/npcdialog.cpp
@@ -947,7 +947,7 @@ void NpcDialog::clearDialogs()
void NpcDialog::mousePressed(MouseEvent &event)
{
Window::mousePressed(event);
- if (event.getButton() == MouseEvent::RIGHT
+ if (event.getButton() == MouseButton::RIGHT
&& event.getSource() == mTextBox)
{
event.consume();
diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp
index 7748ae256..fb2b4a4e7 100644
--- a/src/gui/windows/outfitwindow.cpp
+++ b/src/gui/windows/outfitwindow.cpp
@@ -369,7 +369,7 @@ void OutfitWindow::draw(Graphics *graphics)
void OutfitWindow::mouseDragged(MouseEvent &event)
{
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
if (dragDrop.isEmpty() && mItemClicked)
{
@@ -415,7 +415,7 @@ void OutfitWindow::mousePressed(MouseEvent &event)
const int index = getIndexFromGrid(event.getX(), event.getY());
if (index == -1)
{
- if (event.getButton() == MouseEvent::RIGHT && viewport)
+ if (event.getButton() == MouseButton::RIGHT && viewport)
{
viewport->showOutfitsPopup();
event.consume();
@@ -449,7 +449,7 @@ void OutfitWindow::mousePressed(MouseEvent &event)
void OutfitWindow::mouseReleased(MouseEvent &event)
{
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
if (mCurrentOutfit < 0 || mCurrentOutfit
>= static_cast<signed int>(OUTFITS_COUNT))
diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp
index 25dfff02e..74906dc25 100644
--- a/src/gui/windows/serverdialog.cpp
+++ b/src/gui/windows/serverdialog.cpp
@@ -359,7 +359,7 @@ void ServerDialog::valueChanged(const SelectionEvent &)
void ServerDialog::mouseClicked(MouseEvent &event)
{
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
event.consume();
if (event.getClickCount() == 2 &&
diff --git a/src/gui/windows/shortcutwindow.cpp b/src/gui/windows/shortcutwindow.cpp
index cac23c361..20fcdd0a0 100644
--- a/src/gui/windows/shortcutwindow.cpp
+++ b/src/gui/windows/shortcutwindow.cpp
@@ -188,7 +188,7 @@ void ShortcutWindow::mousePressed(MouseEvent &event)
if (event.isConsumed())
return;
- if (event.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseButton::LEFT)
{
mDragOffsetX = event.getX();
mDragOffsetY = event.getY();
diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp
index 797ba68fe..312eeb129 100644
--- a/src/gui/windows/whoisonline.cpp
+++ b/src/gui/windows/whoisonline.cpp
@@ -168,7 +168,7 @@ WhoIsOnline::~WhoIsOnline()
void WhoIsOnline::handleLink(const std::string& link, MouseEvent *event)
{
- if (!event || event->getButton() == MouseEvent::LEFT)
+ if (!event || event->getButton() == MouseButton::LEFT)
{
if (chatWindow)
{
@@ -184,7 +184,7 @@ void WhoIsOnline::handleLink(const std::string& link, MouseEvent *event)
}
}
}
- else if (event->getButton() == MouseEvent::RIGHT)
+ else if (event->getButton() == MouseButton::RIGHT)
{
if (player_node && link == player_node->getName())
return;
diff --git a/src/input/mouseinput.h b/src/input/mouseinput.h
index a90a1366d..3e24543a8 100644
--- a/src/input/mouseinput.h
+++ b/src/input/mouseinput.h
@@ -66,6 +66,8 @@
#include "input/mouseinput.h"
+#include "events/mousebutton.h"
+
#include "localconsts.h"
class MouseInput final
@@ -73,7 +75,7 @@ class MouseInput final
public:
MouseInput() :
mType(0),
- mButton(0),
+ mButton(MouseButton::EMPTY),
mTimeStamp(0),
mX(0),
mY(0),
@@ -97,17 +99,6 @@ class MouseInput final
WHEEL_MOVED_UP
};
- /**
- * Mouse button types.
- */
- enum
- {
- EMPTY = 0,
- LEFT,
- RIGHT,
- MIDDLE
- };
-
void setType(unsigned int type)
{
mType = type;
@@ -118,12 +109,12 @@ class MouseInput final
return mType;
}
- void setButton(unsigned int button)
+ void setButton(MouseButton::Type button)
{
mButton = button;
}
- unsigned int getButton() const
+ MouseButton::Type getButton() const
{
return mButton;
}
@@ -190,7 +181,7 @@ class MouseInput final
/**
* Holds the button of the mouse input.
*/
- unsigned int mButton;
+ MouseButton::Type mButton;
/**
* Holds the timestamp of the mouse input. Used to
diff --git a/src/input/multitouchmanager.cpp b/src/input/multitouchmanager.cpp
index c1626da41..a05e51709 100644
--- a/src/input/multitouchmanager.cpp
+++ b/src/input/multitouchmanager.cpp
@@ -82,7 +82,7 @@ void MultiTouchManager::checkDevice(const long touchId,
const int w = mainGraphics->mWidth;
const int h = mainGraphics->mHeight;
guiInput->simulateMouseClick(finger0.x * w, finger0.y * h,
- MouseInput::RIGHT);
+ MouseButton::RIGHT);
}
}
}