summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-08-01 22:20:56 +0200
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-08-12 21:53:54 +0200
commit23db322600556230f59f53a99050491f623308a2 (patch)
tree32524f3fd261e9cfc6f988475de87709a11cd2ac
parentfa7cdef831e160a275c4612a5bd4274a1fe095ea (diff)
downloadmana-23db322600556230f59f53a99050491f623308a2.tar.gz
mana-23db322600556230f59f53a99050491f623308a2.tar.bz2
mana-23db322600556230f59f53a99050491f623308a2.tar.xz
mana-23db322600556230f59f53a99050491f623308a2.zip
Improved the layout of the specials window
And removed the unused TabbedArea. Reviewed-by: Erik Schilling
-rw-r--r--src/gui/specialswindow.cpp27
-rw-r--r--src/gui/specialswindow.h6
2 files changed, 8 insertions, 25 deletions
diff --git a/src/gui/specialswindow.cpp b/src/gui/specialswindow.cpp
index a163562b..3caeded3 100644
--- a/src/gui/specialswindow.cpp
+++ b/src/gui/specialswindow.cpp
@@ -28,12 +28,7 @@
#include "gui/widgets/container.h"
#include "gui/widgets/icon.h"
#include "gui/widgets/label.h"
-#include "gui/widgets/listbox.h"
#include "gui/widgets/progressbar.h"
-#include "gui/widgets/scrollarea.h"
-#include "gui/widgets/tab.h"
-#include "gui/widgets/tabbedarea.h"
-#include "gui/widgets/flowcontainer.h"
#include "gui/widgets/windowcontainer.h"
#include "net/net.h"
@@ -83,13 +78,9 @@ SpecialsWindow::SpecialsWindow():
setCloseButton(true);
setResizable(true);
setSaveVisible(true);
- setDefaultSize(windowContainer->getWidth() - 280, 30, 275, 425);
+ setDefaultSize(windowContainer->getWidth() - 280, 40, SPECIALS_WIDTH + 20, 225);
setupWindow->registerWindowForReset(this);
- mTabs = new TabbedArea();
-
- place(0, 0, mTabs, 5, 5);
-
center();
loadWindowState();
}
@@ -137,8 +128,8 @@ void SpecialsWindow::draw(gcn::Graphics *graphics)
unsigned int found = 0; // number of entries in specialData which match mEntries
for (std::map<int, Special>::iterator i = specialData.begin();
- i != specialData.end();
- i++)
+ i != specialData.end();
+ i++)
{
std::map<int, SpecialEntry *>::iterator e = mEntries.find(i->first);
if (e == mEntries.end())
@@ -153,7 +144,8 @@ void SpecialsWindow::draw(gcn::Graphics *graphics)
}
}
// a rebuild is needed when a) the number of specials changed or b) an existing entry isn't found anymore
- if (foundNew || found != mEntries.size()) rebuild(specialData);
+ if (foundNew || found != mEntries.size())
+ rebuild(specialData);
Window::draw(graphics);
}
@@ -178,7 +170,7 @@ void SpecialsWindow::rebuild(const std::map<int, Special> &specialData)
info->rechargeNeeded = i->second.neededMana;
SpecialEntry* entry = new SpecialEntry(info);
entry->setPosition(0, vPos);
- vPos += entry->getHeight();
+ vPos += entry->getHeight() + 3;
add(entry);
mEntries[i->first] = entry;
} else {
@@ -195,8 +187,6 @@ SpecialEntry::SpecialEntry(SpecialInfo *info) :
mUse(NULL),
mRechargeBar(NULL)
{
- setFrameSize(1);
- setOpaque(false);
setSize(SPECIALS_WIDTH, SPECIALS_HEIGHT);
if (!info->icon.empty())
@@ -213,7 +203,7 @@ SpecialEntry::SpecialEntry(SpecialInfo *info) :
add(mNameLabel);
mUse = new Button("Use", "use", specialsWindow);
- mUse->setPosition(getWidth() - mUse->getWidth(), 13);
+ mUse->setPosition(getWidth() - mUse->getWidth(), 5);
add(mUse);
if (info->rechargeable)
@@ -221,10 +211,9 @@ SpecialEntry::SpecialEntry(SpecialInfo *info) :
float progress = (float)info->rechargeCurrent / (float)info->rechargeNeeded;
mRechargeBar = new ProgressBar(progress, 100, 10, Theme::PROG_MP);
mRechargeBar->setSmoothProgress(false);
- mRechargeBar->setPosition(0, 13);
+ mRechargeBar->setPosition(mNameLabel->getX(), 18);
add(mRechargeBar);
}
-
}
void SpecialEntry::update(int current, int needed)
diff --git a/src/gui/specialswindow.h b/src/gui/specialswindow.h
index d0647fc5..75ad3ef0 100644
--- a/src/gui/specialswindow.h
+++ b/src/gui/specialswindow.h
@@ -31,11 +31,6 @@
#include <map>
-class Label;
-class ScrollArea;
-class Tab;
-class TabbedArea;
-
struct SpecialEntry;
class SpecialsWindow : public Window, public gcn::ActionListener
@@ -59,7 +54,6 @@ class SpecialsWindow : public Window, public gcn::ActionListener
// (re)constructs the list of specials
void rebuild(const std::map<int, Special> &specialData);
- TabbedArea *mTabs;
std::map<int, SpecialEntry *> mEntries;
};