summaryrefslogtreecommitdiff
path: root/src/gui/tabbedcontainer.cpp
diff options
context:
space:
mode:
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);
}