From 091af659e0e4f960125c063586af2ed71a6e1bfe Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 17 May 2014 00:39:45 +0200 Subject: [PATCH] CComponentsFooter: use dynamic font on too small footer width If required width of evaluated buttons larger than footer width, then use dynamic font for caption, and try to fit buttons into chain container. Dynamic font is used if ccf_btn_font==NULL NOTE: user should not use too small window size and not select too large fontsize. At some point this possibility will be depleted and it's no more space for readable caption. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/6aecdf3b5ad1af4be3b839a8b1314a693b5a1b6e Author: Thilo Graf Date: 2014-05-17 (Sat, 17 May 2014) ------------------ This commit was generated by Migit --- src/gui/components/cc_frm_footer.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 5d2411fe1..6e4d9249f 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -169,6 +169,14 @@ void CComponentsFooter::setButtonLabels(const struct button_label_s * const cont //set x position of 1st button object inside chain, this is centering button objects inside chain int x_1st_btn = btn_offset/2; chain->getCCItem(0)->setXPos(x_1st_btn); + + //check used width of generated buttons, if required then use dynamic font, and try to fit buttons into chain container, dynamic font is used if ccf_btn_font==NULL + //NOTE: user should be set not too small window size and not too large fontsize, at some point this possibility will be depleted and it's no more space for readable caption + if (w_used > width && ccf_btn_font != NULL){ + chain->clear(); + ccf_btn_font = NULL; + setButtonLabels(content, label_count, chain_width, label_width); + } } void CComponentsFooter::setButtonLabels(const struct button_label_l * const content, const size_t& label_count, const int& chain_width, const int& label_width)