summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-12 00:02:00 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-12 00:02:00 +0300
commite4883337848c708cc344eb94bac005b500d73e01 (patch)
tree97d4c06d193950338d883779b42cbd004d51ff47 /src
parent4dbda55f670866db29a64ca7a79500efbe6f8d00 (diff)
downloadplus-e4883337848c708cc344eb94bac005b500d73e01.tar.gz
plus-e4883337848c708cc344eb94bac005b500d73e01.tar.bz2
plus-e4883337848c708cc344eb94bac005b500d73e01.tar.xz
plus-e4883337848c708cc344eb94bac005b500d73e01.zip
Disallow double click in lists into two differnt selected items at same time.
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;
};