diff options
author | Dees Troy <dees_troy@teamw.in> | 2013-09-10 19:36:41 +0200 |
---|---|---|
committer | Gerrit Code Review <gerrit@198.50.184.117> | 2013-09-12 16:11:13 +0200 |
commit | b21cc64ca8f5a9d936d6ece7da120bc0bc65b49f (patch) | |
tree | 47e1443a2b0591117a6ce5e20a5c3f05f61cca62 /gui/button.cpp | |
parent | Merge "Kang in older minzip for building in CM9 & CM7" into twrp2.7 (diff) | |
download | android_bootable_recovery-b21cc64ca8f5a9d936d6ece7da120bc0bc65b49f.tar android_bootable_recovery-b21cc64ca8f5a9d936d6ece7da120bc0bc65b49f.tar.gz android_bootable_recovery-b21cc64ca8f5a9d936d6ece7da120bc0bc65b49f.tar.bz2 android_bootable_recovery-b21cc64ca8f5a9d936d6ece7da120bc0bc65b49f.tar.lz android_bootable_recovery-b21cc64ca8f5a9d936d6ece7da120bc0bc65b49f.tar.xz android_bootable_recovery-b21cc64ca8f5a9d936d6ece7da120bc0bc65b49f.tar.zst android_bootable_recovery-b21cc64ca8f5a9d936d6ece7da120bc0bc65b49f.zip |
Diffstat (limited to '')
-rw-r--r-- | gui/button.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
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); } } |