From 11f10affa92d3868a4a91d45fe4915d36e1400a9 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 16 Jun 2013 18:53:29 +0300 Subject: improve spellshortcutcontainer. --- src/gui/widgets/spellshortcutcontainer.cpp | 18 +++++++----------- src/gui/widgets/spellshortcutcontainer.h | 2 +- 2 files changed, 8 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index 78c3cec23..ef92ba09c 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -147,10 +147,6 @@ void SpellShortcutContainer::draw(gcn::Graphics *graphics) } } - if (mSpellMoved) - { - // Draw the item image being dragged by the cursor. - } BLOCK_END("SpellShortcutContainer::draw") } @@ -186,14 +182,14 @@ void SpellShortcutContainer::mousePressed(gcn::MouseEvent &event) if (index == -1) return; - if (event.getButton() == gcn::MouseEvent::LEFT) + const unsigned int eventButton = event.getButton(); + if (eventButton == gcn::MouseEvent::LEFT) { - // Stores the selected item if theirs one. } - else if (event.getButton() == gcn::MouseEvent::RIGHT) + else if (eventButton == gcn::MouseEvent::RIGHT) { } - else if (event.getButton() == gcn::MouseEvent::MIDDLE) + else if (eventButton == gcn::MouseEvent::MIDDLE) { if (!spellShortcut || !spellManager) return; @@ -216,8 +212,9 @@ void SpellShortcutContainer::mouseReleased(gcn::MouseEvent &event) const int itemId = spellShortcut->getItem( (mNumber * SPELL_SHORTCUT_ITEMS) + index); + const unsigned int eventButton = event.getButton(); - if (event.getButton() == gcn::MouseEvent::LEFT) + if (eventButton == gcn::MouseEvent::LEFT) { if (itemId < 0) return; @@ -250,7 +247,7 @@ void SpellShortcutContainer::mouseReleased(gcn::MouseEvent &event) spellShortcut->setItemSelected(-1); } } - else if (event.getButton() == gcn::MouseEvent::RIGHT) + else if (eventButton == gcn::MouseEvent::RIGHT) { TextCommand *spell = nullptr; if (itemId >= 0) @@ -288,7 +285,6 @@ void SpellShortcutContainer::mouseMoved(gcn::MouseEvent &event) } } -// Hide SpellTooltip void SpellShortcutContainer::mouseExited(gcn::MouseEvent &event A_UNUSED) { if (mSpellPopup) diff --git a/src/gui/widgets/spellshortcutcontainer.h b/src/gui/widgets/spellshortcutcontainer.h index de1572d1a..c880a2d0c 100644 --- a/src/gui/widgets/spellshortcutcontainer.h +++ b/src/gui/widgets/spellshortcutcontainer.h @@ -77,7 +77,7 @@ class SpellShortcutContainer final : public ShortcutContainer void mouseMoved(gcn::MouseEvent &event) override; - void setWidget2(const Widget2 *const widget); + void setWidget2(const Widget2 *const widget) override; private: TextCommand *mSpellMoved; -- cgit v1.2.3-70-g09d2