summaryrefslogtreecommitdiff
path: root/src/gui/widgets
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 /src/gui/widgets
parent3d7cb45edeb4f75bad321d54d84fe2d13b487db9 (diff)
downloadmv-03c74387d37cefcc18e59db203d17d78cda40e8e.tar.gz
mv-03c74387d37cefcc18e59db203d17d78cda40e8e.tar.bz2
mv-03c74387d37cefcc18e59db203d17d78cda40e8e.tar.xz
mv-03c74387d37cefcc18e59db203d17d78cda40e8e.zip
Move mousebutton into separate file.
Diffstat (limited to 'src/gui/widgets')
-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
22 files changed, 45 insertions, 45 deletions
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)
{