From 6bd78334dc40d64a34e45640cee48d9f2d15d758 Mon Sep 17 00:00:00 2001 From: micha-bbg Date: Mon, 23 Jan 2012 18:00:02 +0000 Subject: [PATCH] * CMessageBox: Buttons draw better - Paint the default button corrected. git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@2074 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/gui/widget/messagebox.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/gui/widget/messagebox.cpp b/src/gui/widget/messagebox.cpp index ee8a4f52b..8670fda04 100644 --- a/src/gui/widget/messagebox.cpp +++ b/src/gui/widget/messagebox.cpp @@ -83,19 +83,16 @@ void CMessageBox::Init(const CMessageBox::result_ Default, const uint32_t ShowBu ButtonCount = 0; if (showbuttons & mbYes) { - Buttons[ButtonCount].def = (result == mbrYes) ? true : false; Buttons[ButtonCount].icon = NEUTRINO_ICON_BUTTON_RED; Buttons[ButtonCount].text = g_Locale->getText(LOCALE_MESSAGEBOX_YES); ButtonCount++; } if (showbuttons & mbNo) { - Buttons[ButtonCount].def = (result == mbrNo) ? true : false; Buttons[ButtonCount].icon = NEUTRINO_ICON_BUTTON_GREEN; Buttons[ButtonCount].text = g_Locale->getText(LOCALE_MESSAGEBOX_NO); ButtonCount++; } if (showbuttons & (mbCancel | mbBack | mbOk)) { - Buttons[ButtonCount].def = (result >= mbrCancel) ? true : false; Buttons[ButtonCount].icon = NEUTRINO_ICON_BUTTON_HOME; Buttons[ButtonCount].text = g_Locale->getText((showbuttons & mbCancel) ? LOCALE_MESSAGEBOX_CANCEL : (showbuttons & mbOk) ? LOCALE_MESSAGEBOX_OK : LOCALE_MESSAGEBOX_BACK); ButtonCount++; @@ -129,8 +126,8 @@ void CMessageBox::paintButtons() { fb_pixel_t color; fb_pixel_t bgcolor; + int iw, ih, i; - int iw, ih; int xpos = (m_width - bb_width) / 2; if (mbBtnAlign == CMessageBox::mbBtnAlignCenter1) xpos = ButtonDistance; @@ -145,7 +142,19 @@ void CMessageBox::paintButtons() m_window->paintBoxRel(0, m_height - bb_height, m_width, bb_height, COL_MENUCONTENT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); - for (int i = 0; i < ButtonCount; i++) { + i = 0; + if (showbuttons & mbYes) { + Buttons[i].def = (result == mbrYes) ? true : false; + i++; + } + if (showbuttons & mbNo) { + Buttons[i].def = (result == mbrNo) ? true : false; + i++; + } + if (showbuttons & (mbCancel | mbBack | mbOk)) + Buttons[i].def = (result >= mbrCancel) ? true : false; + + for (i = 0; i < ButtonCount; i++) { if (Buttons[i].def) { color = COL_MENUCONTENTSELECTED; bgcolor = COL_MENUCONTENTSELECTED_PLUS_0;