summaryrefslogtreecommitdiff
path: root/src/gui/listbox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/listbox.cpp')
-rw-r--r--src/gui/listbox.cpp33
1 files changed, 6 insertions, 27 deletions
diff --git a/src/gui/listbox.cpp b/src/gui/listbox.cpp
index d4a2c6cb..a7f6df8d 100644
--- a/src/gui/listbox.cpp
+++ b/src/gui/listbox.cpp
@@ -31,8 +31,7 @@
#include <guichan/mouseinput.hpp>
ListBox::ListBox(gcn::ListModel *listModel):
- gcn::ListBox(listModel),
- mMousePressed(false)
+ gcn::ListBox(listModel)
{
}
@@ -61,39 +60,19 @@ void ListBox::draw(gcn::Graphics *graphics)
}
}
-void ListBox::setSelected(int selected)
+void
+ListBox::setSelected(int selected)
{
gcn::ListBox::setSelected(selected);
fireSelectionChangedEvent();
}
-void ListBox::mousePress(int x, int y, int button)
+void
+ListBox::mouseDragged(gcn::MouseEvent &event)
{
- gcn::ListBox::mousePress(x, y, button);
-
- if (button == gcn::MouseInput::LEFT && hasMouse())
- {
- mMousePressed = true;
- }
-}
-
-void ListBox::mouseRelease(int x, int y, int button)
-{
- gcn::ListBox::mouseRelease(x, y, button);
-
- mMousePressed = false;
-}
-
-void ListBox::mouseMotion(int x, int y)
-{
- gcn::ListBox::mouseMotion(x, y);
-
// Pretend mouse is pressed continuously while dragged. Causes list
// selection to be updated as is default in many GUIs.
- if (mMousePressed)
- {
- mousePress(x, y, gcn::MouseInput::LEFT);
- }
+ mousePressed(event);
}
void ListBox::fireSelectionChangedEvent()