diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-12 00:02:00 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-12 00:02:00 +0300 |
commit | e4883337848c708cc344eb94bac005b500d73e01 (patch) | |
tree | 97d4c06d193950338d883779b42cbd004d51ff47 /src/gui/widgets | |
parent | 4dbda55f670866db29a64ca7a79500efbe6f8d00 (diff) | |
download | manaplus-e4883337848c708cc344eb94bac005b500d73e01.tar.gz manaplus-e4883337848c708cc344eb94bac005b500d73e01.tar.bz2 manaplus-e4883337848c708cc344eb94bac005b500d73e01.tar.xz manaplus-e4883337848c708cc344eb94bac005b500d73e01.zip |
Disallow double click in lists into two differnt selected items at same time.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/listbox.cpp | 29 | ||||
-rw-r--r-- | src/gui/widgets/listbox.h | 1 |
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; }; |