diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-07-08 10:41:59 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-07-08 17:37:52 -0600 |
commit | 8963ef3e6d0ede6a3e22687642bbc39c24f21dad (patch) | |
tree | c97bf3d8b575297bcf92af7f223d6eb6a3e8bb69 /src/gui/skilldialog.cpp | |
parent | 50d5ab8ddf9e99fcd74ea75483af05cb0d42aedc (diff) | |
download | mana-8963ef3e6d0ede6a3e22687642bbc39c24f21dad.tar.gz mana-8963ef3e6d0ede6a3e22687642bbc39c24f21dad.tar.bz2 mana-8963ef3e6d0ede6a3e22687642bbc39c24f21dad.tar.xz mana-8963ef3e6d0ede6a3e22687642bbc39c24f21dad.zip |
Make SkillEntries update their width
Diffstat (limited to 'src/gui/skilldialog.cpp')
-rw-r--r-- | src/gui/skilldialog.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index a0b8f569..d9e2c5bb 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -56,11 +56,13 @@ struct SkillInfo SkillEntry *display; }; -class SkillEntry : public Container +class SkillEntry : public Container, gcn::WidgetListener { public: SkillEntry(struct SkillInfo *info); + void widgetResized(const gcn::Event &event); + void update(); private: @@ -110,7 +112,7 @@ void SkillDialog::adjustTabSize() { gcn::Widget *content = mTabs->getCurrentWidget(); if (content) { - int width = mTabs->getWidth() - 2 * content->getFrameSize(); + int width = mTabs->getWidth() - 2 * content->getFrameSize() - 2 * mTabs->getFrameSize(); int height = mTabs->getContainerHeight() - 2 * content->getFrameSize(); content->setSize(width, height); content->setVisible(true); @@ -217,20 +219,14 @@ SkillEntry::SkillEntry(struct SkillInfo *info) : mInfo(info), mProgress(new ProgressBar(0.0f, 200, 20, gcn::Color(150, 150, 150))), mLevelLabel(new Label("999")) { + setFrameSize(1); setOpaque(false); + addWidgetListener(this); + if (!info->icon.empty()) mIcon = new Icon(info->icon); - /*LayoutHelper h(this); - ContainerPlacer place = h.getPlacer(0, 0); - - if (mIcon) - place(0, 0, mIcon, 1, 2); - place(1, 0, mNameLabel, 3); - place(4, 0, mLevelLabel); - place(1, 1, mProgress, 4);*/ - if (mIcon) { mIcon->setPosition(1, 0); @@ -249,6 +245,14 @@ SkillEntry::SkillEntry(struct SkillInfo *info) : mInfo(info), update(); } +void SkillEntry::widgetResized(const gcn::Event &event) +{ + gcn::Rectangle size = getChildrenArea(); + + mLevelLabel->setPosition(size.width - mLevelLabel->getWidth(), 0); + mProgress->setWidth(size.width - 35); +} + void SkillEntry::update() { int baseLevel = player_node->getAttributeBase(mInfo->id); |