diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-09-28 23:00:20 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-09-28 23:09:33 +0300 |
commit | 739fd277e28120cd643ac443a013b482698427ba (patch) | |
tree | 3f2a154ce26753f5d2014ea50e440499ab8f9305 /src | |
parent | 727808b197394912f212641fb2e39088eab82060 (diff) | |
download | mv-739fd277e28120cd643ac443a013b482698427ba.tar.gz mv-739fd277e28120cd643ac443a013b482698427ba.tar.bz2 mv-739fd277e28120cd643ac443a013b482698427ba.tar.xz mv-739fd277e28120cd643ac443a013b482698427ba.zip |
Hide popups in different hidden windows.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/inventorywindow.h | 2 | ||||
-rw-r--r-- | src/gui/shortcutwindow.cpp | 19 | ||||
-rw-r--r-- | src/gui/shortcutwindow.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/dropshortcutcontainer.cpp | 9 | ||||
-rw-r--r-- | src/gui/widgets/dropshortcutcontainer.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/emoteshortcutcontainer.cpp | 8 | ||||
-rw-r--r-- | src/gui/widgets/emoteshortcutcontainer.h | 8 | ||||
-rw-r--r-- | src/gui/widgets/itemshortcutcontainer.cpp | 14 | ||||
-rw-r--r-- | src/gui/widgets/itemshortcutcontainer.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/spellshortcutcontainer.cpp | 9 | ||||
-rw-r--r-- | src/gui/widgets/spellshortcutcontainer.h | 2 |
11 files changed, 71 insertions, 6 deletions
diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h index 959f65d7c..9dadeb5a8 100644 --- a/src/gui/inventorywindow.h +++ b/src/gui/inventorywindow.h @@ -87,7 +87,7 @@ class InventoryWindow : public Window, /** * Handles closing of the window */ - virtual void widgetHidden(const gcn::Event &event); + void widgetHidden(const gcn::Event &event); /** * Handles the mouse clicks. diff --git a/src/gui/shortcutwindow.cpp b/src/gui/shortcutwindow.cpp index df21488a5..6d48da197 100644 --- a/src/gui/shortcutwindow.cpp +++ b/src/gui/shortcutwindow.cpp @@ -159,3 +159,22 @@ int ShortcutWindow::getTabIndex() return 0; return mTabs->getSelectedTabIndex(); } + +void ShortcutWindow::widgetHidden(const gcn::Event &event) +{ + if (mItems) + mItems->widgetHidden(event); + if (mTabs) + { + ScrollArea *scroll = static_cast<ScrollArea*>( + mTabs->getCurrentWidget()); + if (scroll) + { + ShortcutContainer *content = static_cast<ShortcutContainer*>( + scroll->getContent()); + + if (content) + content->widgetHidden(event); + } + } +} diff --git a/src/gui/shortcutwindow.h b/src/gui/shortcutwindow.h index 1c91835e8..8627a5dce 100644 --- a/src/gui/shortcutwindow.h +++ b/src/gui/shortcutwindow.h @@ -56,6 +56,8 @@ class ShortcutWindow : public Window int getTabIndex(); + void widgetHidden(const gcn::Event &event); + private: ShortcutWindow(); ShortcutContainer *mItems; diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index b628cf2d4..1fa272448 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -306,5 +306,12 @@ void DropShortcutContainer::mouseMoved(gcn::MouseEvent &event) // Hide ItemTooltip void DropShortcutContainer::mouseExited(gcn::MouseEvent &event A_UNUSED) { - mItemPopup->setVisible(false); + if (mItemPopup) + mItemPopup->setVisible(false); +} + +void DropShortcutContainer::widgetHidden(const gcn::Event &event A_UNUSED) +{ + if (mItemPopup) + mItemPopup->setVisible(false); } diff --git a/src/gui/widgets/dropshortcutcontainer.h b/src/gui/widgets/dropshortcutcontainer.h index b2d63a7dd..348f48567 100644 --- a/src/gui/widgets/dropshortcutcontainer.h +++ b/src/gui/widgets/dropshortcutcontainer.h @@ -76,6 +76,8 @@ class DropShortcutContainer : public ShortcutContainer */ void mouseReleased(gcn::MouseEvent &event); + void widgetHidden(const gcn::Event &event); + private: void mouseExited(gcn::MouseEvent &event); void mouseMoved(gcn::MouseEvent &event); diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index 5aced193f..cc9e8badf 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -252,4 +252,10 @@ void EmoteShortcutContainer::mouseExited(gcn::MouseEvent &event A_UNUSED) { if (mEmotePopup) mEmotePopup->setVisible(false); -}
\ No newline at end of file +} + +void EmoteShortcutContainer::widgetHidden(const gcn::Event &event A_UNUSED) +{ + if (mEmotePopup) + mEmotePopup->setVisible(false); +} diff --git a/src/gui/widgets/emoteshortcutcontainer.h b/src/gui/widgets/emoteshortcutcontainer.h index b1cc866d2..06c009f0b 100644 --- a/src/gui/widgets/emoteshortcutcontainer.h +++ b/src/gui/widgets/emoteshortcutcontainer.h @@ -27,6 +27,12 @@ #include <vector> +#ifdef __GNUC__ +#define A_UNUSED __attribute__ ((unused)) +#else +#define A_UNUSED +#endif + class AnimatedSprite; class Image; class TextPopup; @@ -73,6 +79,8 @@ class EmoteShortcutContainer : public ShortcutContainer void mouseExited(gcn::MouseEvent &event); + void widgetHidden(const gcn::Event &event); + private: std::vector<const EmoteSprite*> mEmoteImg; diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index 79685fe45..560045a29 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -378,6 +378,16 @@ void ItemShortcutContainer::mouseMoved(gcn::MouseEvent &event) // Hide ItemTooltip void ItemShortcutContainer::mouseExited(gcn::MouseEvent &event A_UNUSED) { - mItemPopup->setVisible(false); - mSpellPopup->setVisible(false); + if (mItemPopup) + mItemPopup->setVisible(false); + if (mSpellPopup) + mSpellPopup->setVisible(false); +} + +void ItemShortcutContainer::widgetHidden(const gcn::Event &event A_UNUSED) +{ + if (mItemPopup) + mItemPopup->setVisible(false); + if (mSpellPopup) + mSpellPopup->setVisible(false); } diff --git a/src/gui/widgets/itemshortcutcontainer.h b/src/gui/widgets/itemshortcutcontainer.h index e6b32c6f8..473cef350 100644 --- a/src/gui/widgets/itemshortcutcontainer.h +++ b/src/gui/widgets/itemshortcutcontainer.h @@ -78,6 +78,8 @@ class ItemShortcutContainer : public ShortcutContainer */ void mouseReleased(gcn::MouseEvent &event); + void widgetHidden(const gcn::Event &event); + private: void mouseExited(gcn::MouseEvent &event); void mouseMoved(gcn::MouseEvent &event); diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index 8abe727b5..6317dd56f 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -290,5 +290,12 @@ void SpellShortcutContainer::mouseMoved(gcn::MouseEvent &event) // Hide SpellTooltip void SpellShortcutContainer::mouseExited(gcn::MouseEvent &event A_UNUSED) { - mSpellPopup->setVisible(false); + if (mSpellPopup) + mSpellPopup->setVisible(false); +} + +void SpellShortcutContainer::widgetHidden(const gcn::Event &event A_UNUSED) +{ + if (mSpellPopup) + mSpellPopup->setVisible(false); } diff --git a/src/gui/widgets/spellshortcutcontainer.h b/src/gui/widgets/spellshortcutcontainer.h index 2155e2a8b..88b00338a 100644 --- a/src/gui/widgets/spellshortcutcontainer.h +++ b/src/gui/widgets/spellshortcutcontainer.h @@ -77,6 +77,8 @@ class SpellShortcutContainer : public ShortcutContainer */ void mouseReleased(gcn::MouseEvent &event); + void widgetHidden(const gcn::Event &event); + private: void mouseExited(gcn::MouseEvent &event); void mouseMoved(gcn::MouseEvent &event); |