summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-03-21 17:32:27 +0300
committerAndrei Karas <akaras@inbox.ru>2014-03-21 18:51:45 +0300
commit3ed0b5f6edce152fa2eca9c84d64cbeec8ac0173 (patch)
tree8791e88608a737b0cb56997743a1404f982eecc8 /src/gui/widgets
parent1dd71a1f8489b35d1c989fb0477122224d981853 (diff)
downloadmv-3ed0b5f6edce152fa2eca9c84d64cbeec8ac0173.tar.gz
mv-3ed0b5f6edce152fa2eca9c84d64cbeec8ac0173.tar.bz2
mv-3ed0b5f6edce152fa2eca9c84d64cbeec8ac0173.tar.xz
mv-3ed0b5f6edce152fa2eca9c84d64cbeec8ac0173.zip
Add consume calls into mouse press / click handlers.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/avatarlistbox.cpp1
-rw-r--r--src/gui/widgets/characterdisplay.cpp1
-rw-r--r--src/gui/widgets/checkbox.cpp3
-rw-r--r--src/gui/widgets/dropdown.cpp1
-rw-r--r--src/gui/widgets/dropshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/emotepage.cpp1
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp1
-rw-r--r--src/gui/widgets/guitable.cpp1
-rw-r--r--src/gui/widgets/itemcontainer.cpp1
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/listbox.cpp2
-rw-r--r--src/gui/widgets/popuplist.cpp1
-rw-r--r--src/gui/widgets/radiobutton.cpp1
-rw-r--r--src/gui/widgets/scrollarea.cpp9
-rw-r--r--src/gui/widgets/slider.cpp1
-rw-r--r--src/gui/widgets/spellshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/tabbedarea.cpp1
-rw-r--r--src/gui/widgets/textbox.cpp1
-rw-r--r--src/gui/widgets/textfield.cpp1
-rw-r--r--src/gui/widgets/window.cpp4
20 files changed, 36 insertions, 1 deletions
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index 01126f8ac..5ce74bfca 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -332,6 +332,7 @@ void AvatarListBox::mousePressed(MouseEvent &event)
if (!ava)
return;
+ event.consume();
const unsigned int eventButton = event.getButton();
if (eventButton == MouseEvent::LEFT)
{
diff --git a/src/gui/widgets/characterdisplay.cpp b/src/gui/widgets/characterdisplay.cpp
index 7bfc938de..db2f2e2de 100644
--- a/src/gui/widgets/characterdisplay.cpp
+++ b/src/gui/widgets/characterdisplay.cpp
@@ -145,6 +145,7 @@ void CharacterDisplay::mouseMoved(MouseEvent &event A_UNUSED)
void CharacterDisplay::mousePressed(MouseEvent &event)
{
+ event.consume();
if (event.getClickCount() == 2)
distributeActionEvent();
}
diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp
index 3816fe436..0cba673b5 100644
--- a/src/gui/widgets/checkbox.cpp
+++ b/src/gui/widgets/checkbox.cpp
@@ -256,7 +256,10 @@ void CheckBox::adjustSize()
void CheckBox::mouseClicked(MouseEvent& mouseEvent)
{
if (mouseEvent.getButton() == MouseEvent::LEFT)
+ {
toggleSelected();
+ mouseEvent.consume();
+ }
}
void CheckBox::mouseDragged(MouseEvent& mouseEvent)
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 7173e04b4..a4580f596 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -356,6 +356,7 @@ void DropDown::hideDrop(bool event)
void DropDown::mousePressed(MouseEvent& mouseEvent)
{
+ mouseEvent.consume();
// If we have a mouse press on the widget.
if (mouseEvent.getButton() == MouseEvent::LEFT
&& !mDroppedDown && mouseEvent.getSource() == this)
diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp
index c8e4bc2d9..d85bcccf4 100644
--- a/src/gui/widgets/dropshortcutcontainer.cpp
+++ b/src/gui/widgets/dropshortcutcontainer.cpp
@@ -206,6 +206,8 @@ void DropShortcutContainer::mousePressed(MouseEvent &event)
if (index == -1)
return;
+ event.consume();
+
const int eventButton = event.getButton();
if (eventButton == MouseEvent::LEFT)
{
diff --git a/src/gui/widgets/emotepage.cpp b/src/gui/widgets/emotepage.cpp
index 9000c147b..ebf504f54 100644
--- a/src/gui/widgets/emotepage.cpp
+++ b/src/gui/widgets/emotepage.cpp
@@ -119,6 +119,7 @@ void EmotePage::draw(Graphics *graphics)
void EmotePage::mousePressed(MouseEvent &mouseEvent)
{
mSelectedIndex = getIndexFromGrid(mouseEvent.getX(), mouseEvent.getY());
+ mouseEvent.consume();
distributeActionEvent();
}
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index 296f21126..c731e86d8 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -163,6 +163,7 @@ void EmoteShortcutContainer::mousePressed(MouseEvent &event)
if (index == -1)
return;
+ event.consume();
// Stores the selected emote if there is one.
if (emoteShortcut->isEmoteSelected())
{
diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp
index c7964d3c6..08da80322 100644
--- a/src/gui/widgets/guitable.cpp
+++ b/src/gui/widgets/guitable.cpp
@@ -480,6 +480,7 @@ void GuiTable::mousePressed(MouseEvent& mouseEvent)
{
mSelectedColumn = column;
mSelectedRow = row;
+ mouseEvent.consume();
}
distributeActionEvent();
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 3fba41750..1c6cf9ec3 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -403,6 +403,7 @@ void ItemContainer::mousePressed(MouseEvent &event)
if (button == MouseEvent::LEFT || button == MouseEvent::RIGHT)
{
+ event.consume();
const int index = getSlotIndex(event.getX(), event.getY());
if (index == Inventory::NO_SLOT_INDEX)
return;
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index b9dc3bec8..33ae1890d 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -334,6 +334,7 @@ void ItemShortcutContainer::mousePressed(MouseEvent &event)
if (event.getButton() == MouseEvent::LEFT)
{
+ event.consume();
// Stores the selected item if theirs one.
if (selShortcut->isItemSelected() && inventoryWindow &&
(inventoryWindow->isWindowVisible()
@@ -352,6 +353,7 @@ void ItemShortcutContainer::mousePressed(MouseEvent &event)
}
else if (event.getButton() == MouseEvent::RIGHT)
{
+ event.consume();
if (viewport && selShortcut)
{
viewport->showItemPopup(selShortcut->getItem(index),
diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp
index f2a23253e..27cc29ed1 100644
--- a/src/gui/widgets/listbox.cpp
+++ b/src/gui/widgets/listbox.cpp
@@ -275,6 +275,8 @@ void ListBox::mouseWheelMovedDown(MouseEvent &mouseEvent A_UNUSED)
void ListBox::mousePressed(MouseEvent &event)
{
mPressedIndex = getSelectionByMouse(event.getY());
+ if (mPressedIndex != -1)
+ event.consume();
}
void ListBox::mouseReleased(MouseEvent &event)
diff --git a/src/gui/widgets/popuplist.cpp b/src/gui/widgets/popuplist.cpp
index 2636dac38..c657cdde5 100644
--- a/src/gui/widgets/popuplist.cpp
+++ b/src/gui/widgets/popuplist.cpp
@@ -133,6 +133,7 @@ void PopupList::mousePressed(MouseEvent& mouseEvent)
{
mPressedIndex = mListBox->getSelectionByMouse(
mouseEvent.getY() + mPadding);
+ mouseEvent.consume();
}
void PopupList::mouseReleased(MouseEvent& mouseEvent)
diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp
index 8abac91cf..e83e9229a 100644
--- a/src/gui/widgets/radiobutton.cpp
+++ b/src/gui/widgets/radiobutton.cpp
@@ -276,6 +276,7 @@ void RadioButton::mouseClicked(MouseEvent& mouseEvent)
if (mouseEvent.getButton() == MouseEvent::LEFT)
{
setSelected(true);
+ mouseEvent.consume();
distributeActionEvent();
}
}
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index 571297ace..4aeef8efb 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -739,24 +739,28 @@ void ScrollArea::mousePressed(MouseEvent& event)
setVerticalScrollAmount(mVScroll
- mUpButtonScrollAmount);
mUpButtonPressed = true;
+ event.consume();
}
else if (getDownButtonDimension().isPointInRect(x, y))
{
setVerticalScrollAmount(mVScroll
+ mDownButtonScrollAmount);
mDownButtonPressed = true;
+ event.consume();
}
else if (getLeftButtonDimension().isPointInRect(x, y))
{
setHorizontalScrollAmount(mHScroll
- mLeftButtonScrollAmount);
mLeftButtonPressed = true;
+ event.consume();
}
else if (getRightButtonDimension().isPointInRect(x, y))
{
setHorizontalScrollAmount(mHScroll
+ mRightButtonScrollAmount);
mRightButtonPressed = true;
+ event.consume();
}
else if (getVerticalMarkerDimension().isPointInRect(x, y))
{
@@ -764,6 +768,7 @@ void ScrollArea::mousePressed(MouseEvent& event)
mIsVerticalMarkerDragged = true;
mVerticalMarkerDragOffset = y - getVerticalMarkerDimension().y;
+ event.consume();
}
else if (getVerticalBarDimension().isPointInRect(x, y))
{
@@ -777,13 +782,14 @@ void ScrollArea::mousePressed(MouseEvent& event)
setVerticalScrollAmount(mVScroll
+ static_cast<int>(getChildrenArea().height * 0.95));
}
+ event.consume();
}
else if (getHorizontalMarkerDimension().isPointInRect(x, y))
{
mIsHorizontalMarkerDragged = true;
mIsVerticalMarkerDragged = false;
-
mHorizontalMarkerDragOffset = x - getHorizontalMarkerDimension().x;
+ event.consume();
}
else if (getHorizontalBarDimension().isPointInRect(x, y))
{
@@ -797,6 +803,7 @@ void ScrollArea::mousePressed(MouseEvent& event)
setHorizontalScrollAmount(mHScroll
+ static_cast<int>(getChildrenArea().width * 0.95));
}
+ event.consume();
}
if (event.getButton() == MouseEvent::LEFT)
diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp
index 6de889249..e7f046422 100644
--- a/src/gui/widgets/slider.cpp
+++ b/src/gui/widgets/slider.cpp
@@ -362,6 +362,7 @@ void Slider::mousePressed(MouseEvent &mouseEvent)
if (mouseEvent.getButton() == MouseEvent::LEFT
&& x >= 0 && x <= width && y >= 0 && y <= height)
{
+ mouseEvent.consume();
if (mOrientation == HORIZONTAL)
setValue(markerPositionToValue(x - mMarkerLength / 2));
else
diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index ed92b62e1..add394a64 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -189,6 +189,7 @@ void SpellShortcutContainer::mousePressed(MouseEvent &event)
const int itemId = getItemByIndex(index);
if (itemId > 0)
mSpellClicked = true;
+ event.consume();
}
else if (eventButton == MouseEvent::RIGHT)
{
@@ -198,6 +199,7 @@ void SpellShortcutContainer::mousePressed(MouseEvent &event)
if (!spellShortcut || !spellManager)
return;
+ event.consume();
const int itemId = getItemByIndex(index);
spellManager->invoke(itemId);
}
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index 445f17982..554bdfc66 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -379,6 +379,7 @@ void TabbedArea::mousePressed(MouseEvent &mouseEvent)
if (tab)
{
+ mouseEvent.consume();
setSelectedTab(tab);
requestFocus();
}
diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp
index 5008da6ea..50e423de8 100644
--- a/src/gui/widgets/textbox.cpp
+++ b/src/gui/widgets/textbox.cpp
@@ -590,6 +590,7 @@ void TextBox::mousePressed(MouseEvent& mouseEvent)
if (!height)
return;
+ mouseEvent.consume();
mCaretRow = mouseEvent.getY() / height;
const int sz = static_cast<int>(mTextRows.size());
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index 98a308e37..b822996a4 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -699,6 +699,7 @@ void TextField::mousePressed(MouseEvent &mouseEvent)
if (!client->isKeyboardVisible())
inputManager.executeAction(Input::KEY_SHOW_KEYBOARD);
#endif
+ mouseEvent.consume();
if (mouseEvent.getButton() == MouseEvent::RIGHT)
{
if (viewport)
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index dda03a438..8d457e599 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -724,6 +724,7 @@ void Window::mousePressed(MouseEvent &event)
{
mouseResize = 0;
mMoved = 0;
+ event.consume();
close();
return;
}
@@ -735,11 +736,14 @@ void Window::mousePressed(MouseEvent &event)
mouseResize = 0;
mMoved = 0;
mRedraw = true;
+ event.consume();
return;
}
// Handle window resizing
mouseResize = getResizeHandles(event) & resizeMask;
+ if (mouseResize != 0)
+ event.consume();
if (canMove())
mMoved = !mouseResize;
else