From b21cc64ca8f5a9d936d6ece7da120bc0bc65b49f Mon Sep 17 00:00:00 2001 From: Dees Troy Date: Tue, 10 Sep 2013 17:36:41 +0000 Subject: Pull ROM info from build.prop for backup names Change-Id: I7847fca22b5d4f0a35da41625b15bd677a1e9768 --- gui/button.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'gui/button.cpp') diff --git a/gui/button.cpp b/gui/button.cpp index 9fc85a052..3f9c2df1f 100644 --- a/gui/button.cpp +++ b/gui/button.cpp @@ -110,10 +110,11 @@ GUIButton::GUIButton(xml_node<>* node) } int x, y, w, h; + TextPlacement = TOP_LEFT; if (mButtonImg) { mButtonImg->GetRenderPos(x, y, w, h); } else if (hasFill) { - LoadPlacement(node->first_node("placement"), &x, &y, &w, &h); + LoadPlacement(node->first_node("placement"), &x, &y, &w, &h, &TextPlacement); } SetRenderPos(x, y, w, h); return; @@ -150,14 +151,12 @@ int GUIButton::Render(void) mButtonLabel->GetCurrentBounds(w, h); if (w != mTextW) { mTextW = w; - // As a special case, we'll allow large text which automatically moves it to the right. - if (mTextW > mRenderW) - { + if (TextPlacement == CENTER_X_ONLY) { + mTextX = ((mRenderW - mRenderX) / 2); + } else if (mTextW > mRenderW) { // As a special case, we'll allow large text which automatically moves it to the right. mTextX = mRenderW + mRenderX + 5; mRenderW += mTextW + 5; - } - else - { + } else { mTextX = mRenderX + ((mRenderW - mTextW) / 2); } mButtonLabel->SetRenderPos(mTextX, mTextY); @@ -231,14 +230,12 @@ int GUIButton::SetRenderPos(int x, int y, int w, int h) if (mButtonLabel) mButtonLabel->GetCurrentBounds(mTextW, mTextH); if (mTextW) { - // As a special case, we'll allow large text which automatically moves it to the right. - if (mTextW > mRenderW) - { + if (TextPlacement == CENTER_X_ONLY) { + mTextX = ((mRenderW - mRenderX) / 2); + } else if (mTextW > mRenderW) { // As a special case, we'll allow large text which automatically moves it to the right. mTextX = mRenderW + mRenderX + 5; mRenderW += mTextW + 5; - } - else - { + } else { mTextX = mRenderX + ((mRenderW - mTextW) / 2); } } -- cgit v1.2.3