From 3a1d2a18fbbd8648900fa1e4409ab55ef3c9b572 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Wed, 2 May 2012 15:17:00 +0200 Subject: [PATCH] buttons.cpp:workaround for to small screen Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/4be74a3fac3cbaf94865d6f5300e49ea2da96d80 Author: Jacek Jendrzej Date: 2012-05-02 (Wed, 02 May 2012) --- src/gui/widget/buttons.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gui/widget/buttons.cpp b/src/gui/widget/buttons.cpp index b04e3cef6..c2a02c0a0 100644 --- a/src/gui/widget/buttons.cpp +++ b/src/gui/widget/buttons.cpp @@ -129,7 +129,13 @@ int paintButtons( const int &x, } //calculate button width w_button = buttonwidth == 0 ? (w_max_icon + w_space + w_max_text) : buttonwidth; - + + //workaround for to small screen (1) + int skip_last_button_txt = false; + if((w_button*cnt) >(uint) w_footer){ + w_button= ((w_footer+w_max_icon)/(cnt)); + skip_last_button_txt = true; + } //calculate button heigth h_button = std::max(h_max_icon, h_max_text); //calculate optimal button height @@ -156,7 +162,11 @@ int paintButtons( const int &x, caption = alt_buttontext; //...with an alternate buttontext else caption = content[j].locale ? g_Locale->getText(content[j].locale) : ""; - + + //workaround for to small screen (2) + if(skip_last_button_txt && j == cnt-1) + caption=""; + const char * icon = content[j].button ? content[j].button : ""; //get height/width of icon