summaryrefslogtreecommitdiff
path: root/src/gui/tabbedcontainer.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-18 14:47:14 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-18 14:47:14 +0000
commitab678324e3d73e2354cef331624ecef7cfc03203 (patch)
tree29394a5aca6e59f817f7cfa3b9281891a273d259 /src/gui/tabbedcontainer.cpp
parent32badd4b6f843cb74fdc3238fe92119518c8c0ab (diff)
downloadmana-ab678324e3d73e2354cef331624ecef7cfc03203.tar.gz
mana-ab678324e3d73e2354cef331624ecef7cfc03203.tar.bz2
mana-ab678324e3d73e2354cef331624ecef7cfc03203.tar.xz
mana-ab678324e3d73e2354cef331624ecef7cfc03203.zip
Added a toString conversion function.
Diffstat (limited to 'src/gui/tabbedcontainer.cpp')
-rw-r--r--src/gui/tabbedcontainer.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/gui/tabbedcontainer.cpp b/src/gui/tabbedcontainer.cpp
index f19524e1..f1927c6f 100644
--- a/src/gui/tabbedcontainer.cpp
+++ b/src/gui/tabbedcontainer.cpp
@@ -23,10 +23,10 @@
#include "tabbedcontainer.h"
-#include <sstream>
-
#include "button.h"
+#include "../utils/tostring.h"
+
#define TABWIDTH 60
#define TABHEIGHT 20
@@ -48,12 +48,9 @@ TabbedContainer::~TabbedContainer()
void TabbedContainer::addTab(gcn::Widget *widget, const std::string &caption)
{
- std::stringstream ss;
int tabNumber = mTabs.size();
- ss << tabNumber;
-
- Button *tab = new Button(caption, ss.str(), this);
+ Button *tab = new Button(caption, toString(tabNumber), this);
tab->setSize(TABWIDTH, TABHEIGHT);
add(tab, TABWIDTH * tabNumber, 0);
@@ -83,14 +80,12 @@ void TabbedContainer::logic()
void TabbedContainer::action(const std::string &event)
{
+ std::stringstream ss(event);
int tabNo;
- std::stringstream ss;
- gcn::Widget *newContent;
-
- ss << event;
ss >> tabNo;
- if ((newContent = mContents[tabNo])) {
+ gcn::Widget *newContent = mContents[tabNo];
+ if (newContent) {
if (mActiveContent) {
remove(mActiveContent);
}