diff options
author | David Athay <ko2fan@gmail.com> | 2009-01-13 12:48:36 +0000 |
---|---|---|
committer | David Athay <ko2fan@gmail.com> | 2009-01-13 12:48:36 +0000 |
commit | db37dcd73f3116917584e81a474f70e0d0786bc4 (patch) | |
tree | e1b03485652de7a129f6c9277a973e1d468b7a16 /src/gui/itemcontainer.cpp | |
parent | 8d6cc0162fec250743e6491fb4b1e2f07c7657c2 (diff) | |
download | mana-client-db37dcd73f3116917584e81a474f70e0d0786bc4.tar.gz mana-client-db37dcd73f3116917584e81a474f70e0d0786bc4.tar.bz2 mana-client-db37dcd73f3116917584e81a474f70e0d0786bc4.tar.xz mana-client-db37dcd73f3116917584e81a474f70e0d0786bc4.zip |
Added WoW style item adding to chat window. Right Ctrl and Left click to put the item in the chat input. Left click the item link to show a popup description, and click the link again to remove the popup.
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); } |