summaryrefslogtreecommitdiff
path: root/src/gui/widgets/table.cpp
diff options
context:
space:
mode:
authorTametomo <irarice@gmail.com>2009-05-12 14:20:25 -0600
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-02-14 20:54:02 +0100
commit0d9e6234bb893ec45dc2c357cdc5529be0976689 (patch)
tree531fde86538d5148a4c2986b9bf50a3e07aead20 /src/gui/widgets/table.cpp
parent6f1947e0d468ca59404b4bbaeafd29be136b99ac (diff)
downloadmana-0d9e6234bb893ec45dc2c357cdc5529be0976689.tar.gz
mana-0d9e6234bb893ec45dc2c357cdc5529be0976689.tar.bz2
mana-0d9e6234bb893ec45dc2c357cdc5529be0976689.tar.xz
mana-0d9e6234bb893ec45dc2c357cdc5529be0976689.zip
Allow handling drag events in tables as well.
Signed-off-by: Tametomo <irarice@gmail.com>
Diffstat (limited to 'src/gui/widgets/table.cpp')
-rw-r--r--src/gui/widgets/table.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gui/widgets/table.cpp b/src/gui/widgets/table.cpp
index 66ee3857..f353c6fe 100644
--- a/src/gui/widgets/table.cpp
+++ b/src/gui/widgets/table.cpp
@@ -462,6 +462,15 @@ void GuiTable::mouseWheelMovedDown(gcn::MouseEvent& mouseEvent)
void GuiTable::mouseDragged(gcn::MouseEvent& mouseEvent)
{
+ if (mouseEvent.getButton() != gcn::MouseEvent::LEFT)
+ return;
+
+ // Make table selection update on drag
+ const int x = std::max(0, mouseEvent.getX());
+ const int y = std::max(0, mouseEvent.getY());
+
+ setSelectedRow(getRowForY(y));
+ setSelectedColumn(getColumnForX(x));
}
// -- TableModelListener notifications