summaryrefslogtreecommitdiff
path: root/src/gui/itempopup.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-01-20 12:35:38 -0700
committerIra Rice <irarice@gmail.com>2009-01-20 12:35:38 -0700
commit7db9e03f34bf150dbcfec981cc3b4105bda92ada (patch)
tree906e18e622f6965822ceaaa191bdebc9d236cef3 /src/gui/itempopup.cpp
parentf404997629d9a34f5a15261073536903a59a604c (diff)
downloadmana-7db9e03f34bf150dbcfec981cc3b4105bda92ada.tar.gz
mana-7db9e03f34bf150dbcfec981cc3b4105bda92ada.tar.bz2
mana-7db9e03f34bf150dbcfec981cc3b4105bda92ada.tar.xz
mana-7db9e03f34bf150dbcfec981cc3b4105bda92ada.zip
Changed item popup drawing to be based on the mouse position, not window
position. Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui/itempopup.cpp')
-rw-r--r--src/gui/itempopup.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index c0a75193..81e4607b 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -24,6 +24,7 @@
#include "gui.h"
#include "itempopup.h"
+#include "windowcontainer.h"
#include "widgets/layout.h"
@@ -116,3 +117,16 @@ unsigned int ItemPopup::getNumRows()
{
return mItemDesc->getNumberOfRows(), mItemEffect->getNumberOfRows();
}
+
+void ItemPopup::view(int x, int y)
+{
+ if (windowContainer->getWidth() < (x + getWidth() + 5))
+ x = windowContainer->getWidth() - getWidth();
+ if (windowContainer->getHeight() < (y + getHeight() + 5))
+ y = windowContainer->getHeight() - getHeight();
+ else
+ y = y - getHeight() - 5;
+ setPosition(x, y);
+ setVisible(true);
+ requestMoveToTop();
+}