From ab678324e3d73e2354cef331624ecef7cfc03203 Mon Sep 17 00:00:00 2001 From: Björn Steinbrink Date: Sat, 18 Mar 2006 14:47:14 +0000 Subject: Added a toString conversion function. --- src/gui/tabbedcontainer.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src/gui/tabbedcontainer.cpp') 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 - #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); } -- cgit v1.2.3-70-g09d2