diff options
Diffstat (limited to 'src/gui/widgets/popup.cpp')
-rw-r--r-- | src/gui/widgets/popup.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index 1bfd7fd2..970b21ec 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -29,6 +29,8 @@ #include "gui/skin.h" #include "gui/viewport.h" +#include "gui/widgets/windowcontainer.h" + #include "resources/image.h" #include <guichan/exception.hpp> @@ -43,16 +45,16 @@ Popup::Popup(const std::string &name, const std::string &skin): { logger->log("Popup::Popup(\"%s\")", name.c_str()); - if (!viewport) - throw GCN_EXCEPTION("Popup::Popup(): no viewport set"); + if (!windowContainer) + throw GCN_EXCEPTION("Popup::Popup(): no windowContainer set"); setPadding(3); // Loads the skin mSkin = SkinLoader::instance()->load(skin, mDefaultSkinPath); - // Add this window to the viewport - viewport->add(this); + // Add this window to the window container + windowContainer->add(this); // Popups are invisible by default setVisible(false); @@ -67,6 +69,11 @@ Popup::~Popup() mSkin->instances--; } +void Popup::setWindowContainer(WindowContainer *wc) +{ + windowContainer = wc; +} + void Popup::loadPopupConfiguration() { if (mPopupName.empty()) @@ -161,7 +168,7 @@ void Popup::setMaxHeight(int height) void Popup::scheduleDelete() { - viewport->scheduleDelete(this); + windowContainer->scheduleDelete(this); } void Popup::position(int x, int y) @@ -180,3 +187,9 @@ void Popup::position(int x, int y) setVisible(true); requestMoveToTop(); } + +void Popup::mouseMoved(gcn::MouseEvent &event) +{ + if (viewport) + viewport->hideBeingPopup(); +} |