reinstate font scale backup in SimpleButton, to fix the bug I introduced recently.

This commit is contained in:
wagic.the.homebrew
2012-03-24 02:47:14 +00:00
parent 41e608785f
commit 7a18996bee

View File

@@ -199,8 +199,11 @@ void SimpleButton::setText( const string& text)
float SimpleButton::GetWidth()
{
WFont * mFont = WResourceManager::Instance()->GetWFont(mFontId);
float backup = mFont->GetScale();
mFont->SetScale(1.0);
return mFont->GetStringWidth(mText.c_str());
float result = mFont->GetStringWidth(mText.c_str());
mFont->SetScale(backup);
return result;
}
float SimpleButton::GetEnlargedWidth()
@@ -210,7 +213,9 @@ float SimpleButton::GetEnlargedWidth()
mFont->SetScale(SCALE_SELECTED);
if(mText.size() < 20)
mFont->SetScale(SCALE_SELECTED_LARGE);
return mFont->GetStringWidth(mText.c_str());
float result = mFont->GetStringWidth(mText.c_str());
mFont->SetScale(backup);
return result;
}
ostream& SimpleButton::toString(ostream& out) const