src/Menu/CCLabel.cpp

Go to the documentation of this file.
00001 /* Crown and Cutlass
00002  * Crown and Cutlass Label Code
00003  */
00004 
00005 #include <guichan.hpp>
00006 #include <string>
00007 #include <sstream>
00008 #include "CCFont.h"
00009 #include "CCLabel.h"
00010 
00011 using namespace std;
00012 
00013 CCLabel::CCLabel(const string& caption, const string mainFontName): gcn::Label(caption) {
00014   SetMainFont(mainFontName);
00015 
00016   adjustSize();
00017 
00018   stream.setf(ios::fixed, ios::floatfield);
00019 }
00020 
00021 CCLabel::~CCLabel() {
00022 }
00023 
00024 void CCLabel::SetMainFont(string fontName) {
00025   m_mainFont.reset(new CCFont(fontName));
00026   setFont(m_mainFont->GetImageFont());
00027 }
00028 
00029 void CCLabel::SetCaption(int i) {
00030   stream.str("");
00031   stream << i;
00032   setCaption(stream.str());
00033 }
00034 
00035 void CCLabel::SetCaption(unsigned int i) {
00036   stream.str("");
00037   stream << i;
00038   setCaption(stream.str());
00039 }
00040 
00041 void CCLabel::SetCaption(double f, int places) {
00042   stream.str("");
00043   stream.precision(places);
00044   stream << f;
00045   setCaption(stream.str());
00046 }

Generated on Mon Jan 8 22:34:12 2007 for CrownandCutlass by  doxygen 1.4.7