summaryrefslogtreecommitdiff
path: root/src/gui/widgets/skilllistbox.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-07-05 23:34:33 +0300
committerAndrei Karas <akaras@inbox.ru>2016-07-06 00:07:18 +0300
commitbcdbc39b6efe7391866c81ef82a2e9358b6c3ff4 (patch)
treec296c08021c602687e3632b1f4c3f87033c99d34 /src/gui/widgets/skilllistbox.h
parent8b392d9c4a1c177c1207d297c75c1a4a06142245 (diff)
downloadmv-bcdbc39b6efe7391866c81ef82a2e9358b6c3ff4.tar.gz
mv-bcdbc39b6efe7391866c81ef82a2e9358b6c3ff4.tar.bz2
mv-bcdbc39b6efe7391866c81ef82a2e9358b6c3ff4.tar.xz
mv-bcdbc39b6efe7391866c81ef82a2e9358b6c3ff4.zip
Add menu for selected skill for now with item only "set skill level".s20160706
Also add chat command /showskilllevels SKILL
Diffstat (limited to 'src/gui/widgets/skilllistbox.h')
-rw-r--r--src/gui/widgets/skilllistbox.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/gui/widgets/skilllistbox.h b/src/gui/widgets/skilllistbox.h
index 8415e0cab..b6feb194f 100644
--- a/src/gui/widgets/skilllistbox.h
+++ b/src/gui/widgets/skilllistbox.h
@@ -232,21 +232,29 @@ class SkillListBox final : public ListBox
void mousePressed(MouseEvent &event) override final
{
ListBox::mousePressed(event);
- if (event.getButton() == MouseButton::LEFT)
+ const MouseButtonT button = event.getButton();
+ if (button == MouseButton::LEFT ||
+ button == MouseButton::RIGHT)
{
const SkillInfo *const skill = getSkillByEvent(event);
if (!skill)
return;
event.consume();
mSkillClicked = true;
- if (event.getX() >
- getWidth() - mPadding - skill->skillLevelWidth)
+ SkillModel *const model = static_cast<SkillModel*>(
+ mListModel);
+ if (model &&
+ mSelected >= 0 &&
+ model->getSkillAt(mSelected) == skill)
{
- SkillModel *const model = static_cast<SkillModel*>(
- mListModel);
- if (model &&
- mSelected >= 0 &&
- model->getSkillAt(mSelected) == skill)
+ skillPopup->hide();
+ if (button == MouseButton::LEFT &&
+ event.getX() >
+ getWidth() - mPadding - skill->skillLevelWidth)
+ {
+ popupMenu->showSkillLevelPopup(skill);
+ }
+ else if (button == MouseButton::RIGHT)
{
popupMenu->showSkillPopup(skill);
}