diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-10 20:29:14 +0200 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-10 21:24:20 +0200 |
commit | 3c912139aef92a3e070ade966c91c297b7a5310c (patch) | |
tree | 2628e66b9cfe3cd494bb33641ac995db949c01fb /src/gui/widgets | |
parent | 6e3a3c345a2cad8308738b8b7b5292b9002c1a6e (diff) | |
download | mana-client-3c912139aef92a3e070ade966c91c297b7a5310c.tar.gz mana-client-3c912139aef92a3e070ade966c91c297b7a5310c.tar.bz2 mana-client-3c912139aef92a3e070ade966c91c297b7a5310c.tar.xz mana-client-3c912139aef92a3e070ade966c91c297b7a5310c.zip |
Fixed the resize grip of the party window
It wasn't re-added after doing a clear. Also, don't leak all the
PartyMember and Avatar instances.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/avatar.cpp | 14 | ||||
-rw-r--r-- | src/gui/widgets/avatar.h | 7 | ||||
-rw-r--r-- | src/gui/widgets/window.cpp | 18 | ||||
-rw-r--r-- | src/gui/widgets/window.h | 9 |
4 files changed, 20 insertions, 28 deletions
diff --git a/src/gui/widgets/avatar.cpp b/src/gui/widgets/avatar.cpp index 43910106..a6434f2e 100644 --- a/src/gui/widgets/avatar.cpp +++ b/src/gui/widgets/avatar.cpp @@ -40,13 +40,12 @@ namespace { int avatarCount = 0; } -Avatar::Avatar(const std::string &name): - mName(name) +Avatar::Avatar(): + mHpState("???"), + mMaxHpState("???") { setOpaque(false); setSize(200, 12); - mHpState = "???"; - mMaxHpState = "???"; if (avatarCount == 0) { @@ -61,12 +60,7 @@ Avatar::Avatar(const std::string &name): mStatus = new Icon(avatarStatusOffline); mStatus->setSize(12, 12); add(mStatus, 1, 0); - mAvatarLabel.str(""); - if (mName != player_node->getName()) - mAvatarLabel << mName << " " << mHpState << "/" + mMaxHpState; - else - mAvatarLabel << mName << " " << player_node->getHp() << "/" << player_node->getMaxHp(); - mLabel = new Label(mAvatarLabel.str()); + mLabel = new Label; mLabel->setSize(174, 12); add(mLabel, 16, 0); } diff --git a/src/gui/widgets/avatar.h b/src/gui/widgets/avatar.h index 69f7ed37..ff718cc6 100644 --- a/src/gui/widgets/avatar.h +++ b/src/gui/widgets/avatar.h @@ -35,12 +35,7 @@ class Icon; class Avatar : public Container { public: - /** - * Constructor. - * @param name Character name - */ - Avatar(const std::string &name); - + Avatar(); ~Avatar(); /** diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 87051686..19d80671 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -683,21 +683,25 @@ int Window::getGuiAlpha() Layout &Window::getLayout() { - if (!mLayout) mLayout = new Layout; + if (!mLayout) + mLayout = new Layout; return *mLayout; } void Window::clearLayout() { - clear(); // This removes widgets from the container + clear(); - while (!mWidgets.empty()) - delete mWidgets.front(); + // Restore the resize grip + if (mGrip) + add(mGrip); - if (!mLayout) + // Recreate layout instance when one is present + if (mLayout) + { delete mLayout; - mLayout = new Layout; - + mLayout = new Layout; + } } LayoutCell &Window::place(int x, int y, gcn::Widget *wg, int w, int h) diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index f980b96a..153602ba 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -295,7 +295,8 @@ class Window : public gcn::Window, gcn::WidgetListener Layout &getLayout(); /** - * Clears the Window's layout (useful for redesigning the window) + * Clears the window's layout (useful for redesigning the window). Does + * not delete the widgets! */ void clearLayout(); @@ -336,9 +337,6 @@ class Window : public gcn::Window, gcn::WidgetListener */ int getGuiAlpha(); - protected: - ResizeGrip *mGrip; /**< Resize grip */ - private: enum ResizeHandles { @@ -357,6 +355,7 @@ class Window : public gcn::Window, gcn::WidgetListener */ int getResizeHandles(gcn::MouseEvent &event); + ResizeGrip *mGrip; /**< Resize grip */ Window *mParent; /**< The parent window */ Layout *mLayout; /**< Layout handler */ std::string mWindowName; /**< Name of the window */ @@ -380,7 +379,7 @@ class Window : public gcn::Window, gcn::WidgetListener static int mouseResize; /**< Active resize handles */ static int instances; /**< Number of Window instances */ - Skin* mSkin; /**< Skin in use by this window */ + Skin *mSkin; /**< Skin in use by this window */ /** * The width of the resize border. Is independent of the actual window |