summaryrefslogtreecommitdiff
path: root/src/gui/skilldialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/skilldialog.cpp')
-rw-r--r--src/gui/skilldialog.cpp50
1 files changed, 15 insertions, 35 deletions
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp
index 14e0e5a4..6e7b3e70 100644
--- a/src/gui/skilldialog.cpp
+++ b/src/gui/skilldialog.cpp
@@ -47,7 +47,6 @@
#include "utils/xml.h"
#include <string>
-#include <vector>
class SkillEntry;
@@ -96,7 +95,7 @@ SkillDialog::SkillDialog():
mPointsLabel = new Label("0");
place(0, 0, mTabs, 5, 5);
- place(0, 5, mPointsLabel);
+ place(0, 5, mPointsLabel, 2);
setLocationRelativeTo(getParent());
loadWindowState();
@@ -104,7 +103,8 @@ SkillDialog::SkillDialog():
SkillDialog::~SkillDialog()
{
- //delete_all(mTabs);
+ // Clear gui
+ loadSkills("");
}
void SkillDialog::action(const gcn::ActionEvent &event)
@@ -122,36 +122,6 @@ void SkillDialog::action(const gcn::ActionEvent &event)
}
}
-void SkillDialog::adjustTabSize()
-{
- gcn::Widget *content = mTabs->getCurrentWidget();
- if (content) {
- int width = mTabs->getWidth() - 2 * content->getFrameSize() - 2 * mTabs->getFrameSize();
- int height = mTabs->getContainerHeight() - 2 * content->getFrameSize();
- content->setSize(width, height);
- content->setVisible(true);
- content->logic();
- }
-}
-
-void SkillDialog::widgetResized(const gcn::Event &event)
-{
- Window::widgetResized(event);
-
- adjustTabSize();
-}
-
-void SkillDialog::logic()
-{
- Window::logic();
-
- Tab *tab = dynamic_cast<Tab*>(mTabs->getSelectedTab());
- if (tab != mCurrentTab) {
- mCurrentTab = tab;
- adjustTabSize();
- }
-}
-
std::string SkillDialog::update(int id)
{
SkillMap::iterator i = mSkills.find(id);
@@ -182,9 +152,21 @@ void SkillDialog::update()
void SkillDialog::loadSkills(const std::string &file)
{
// TODO: mTabs->clear();
+ while (mTabs->getSelectedTabIndex() != -1)
+ {
+ mTabs->removeTabWithIndex(mTabs->getSelectedTabIndex());
+ }
+
+ for (SkillMap::iterator it = mSkills.begin(); it != mSkills.end(); it++)
+ {
+ delete (*it).second->display;
+ }
delete_all(mSkills);
mSkills.clear();
+ if (file.length() == 0)
+ return;
+
XML::Document doc(file);
xmlNodePtr root = doc.rootNode();
@@ -236,8 +218,6 @@ void SkillDialog::loadSkills(const std::string &file)
}
}
}
-
- adjustTabSize();
update();
}