From 0d9e6234bb893ec45dc2c357cdc5529be0976689 Mon Sep 17 00:00:00 2001 From: Tametomo Date: Tue, 12 May 2009 14:20:25 -0600 Subject: Allow handling drag events in tables as well. Signed-off-by: Tametomo --- src/gui/widgets/table.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/gui') 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 -- cgit v1.2.3-70-g09d2