diff options
Diffstat (limited to 'src/gui/itemcontainer.cpp')
-rw-r--r-- | src/gui/itemcontainer.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index 141b4360..4a90510c 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -20,6 +20,7 @@ */ #include "itemcontainer.h" +#include "chat.h" #include <guichan/mouseinput.hpp> #include <guichan/selectionlistener.hpp> @@ -61,7 +62,8 @@ ItemContainer::ItemContainer(Inventory *inventory, mSelectedItem(NULL), mHighlightedItem(NULL), mSelectionStatus(SEL_NONE), - mSwapItems(false) + mSwapItems(false), + mDescItems(false) { mItemPopup = new ItemPopup(); setFocusable(true); @@ -195,6 +197,10 @@ ItemContainer::keyPressed(gcn::KeyEvent &event) case Key::LEFT_ALT: case Key::RIGHT_ALT: mSwapItems = true; + break; + case Key::RIGHT_CONTROL: + mDescItems = true; + break; } } @@ -206,13 +212,16 @@ ItemContainer::keyReleased(gcn::KeyEvent &event) case Key::LEFT_ALT: case Key::RIGHT_ALT: mSwapItems = false; + break; + case Key::RIGHT_CONTROL: + mDescItems = false; + break; } } void ItemContainer::mousePressed(gcn::MouseEvent &event) { - const int button = event.getButton(); if (button == gcn::MouseEvent::LEFT || button == gcn::MouseEvent::RIGHT) { @@ -223,6 +232,12 @@ ItemContainer::mousePressed(gcn::MouseEvent &event) Item *item = mInventory->getItem(index); + // put item name into chat window + if (mDescItems) + { + chatWindow->addItemText(item->getId(), item->getInfo().getName()); + } + if (mSelectedItem && mSelectedItem == item) { mSelectionStatus = SEL_DESELECTING; @@ -288,7 +303,7 @@ void ItemContainer::mouseMoved(gcn::MouseEvent &event) { mItemPopup->setPosition(getParent()->getParent()->getX() + getParent()->getParent()->getWidth(), getParent()->getParent()->getY()); - mItemPopup->setItem(item); + mItemPopup->setItem(item->getInfo()); mItemPopup->setVisible(true); } |