summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/listbox.cpp29
-rw-r--r--src/gui/widgets/listbox.h1
2 files changed, 21 insertions, 9 deletions
diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp
index 499d7b07c..259e49972 100644
--- a/src/gui/widgets/listbox.cpp
+++ b/src/gui/widgets/listbox.cpp
@@ -44,7 +44,8 @@ float ListBox::mAlpha = 1.0;
ListBox::ListBox(gcn::ListModel *const listModel):
gcn::ListBox(listModel),
mHighlightColor(Theme::getThemeColor(Theme::HIGHLIGHT)),
- mDistributeMousePressed(true)
+ mDistributeMousePressed(true),
+ mOldSelected(-1)
{
mForegroundColor = Theme::getThemeColor(Theme::LISTBOX);
}
@@ -151,15 +152,25 @@ void ListBox::mousePressed(gcn::MouseEvent &event)
}
else
{
- if (event.getClickCount() == 2)
+ switch (event.getClickCount())
{
- if (gui)
- gui->resetClickCount();
- gcn::ListBox::mousePressed(event);
- }
- else
- {
- mouseDragged(event);
+ case 1:
+ mouseDragged(event);
+ mOldSelected = mSelected;
+ break;
+ case 2:
+ if (gui)
+ gui->resetClickCount();
+ if (mOldSelected == mSelected)
+ gcn::ListBox::mousePressed(event);
+ else
+ mouseDragged(event);
+ mOldSelected = mSelected;
+ break;
+ default:
+ mouseDragged(event);
+ mOldSelected = mSelected;
+ break;
}
}
}
diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h
index f484c8ad0..4a061bd73 100644
--- a/src/gui/widgets/listbox.h
+++ b/src/gui/widgets/listbox.h
@@ -78,6 +78,7 @@ class ListBox : public gcn::ListBox
protected:
gcn::Color mHighlightColor;
bool mDistributeMousePressed;
+ int mOldSelected;
static float mAlpha;
};