From c482dd139f26e5db804e022921fd21a9b75c653b Mon Sep 17 00:00:00 2001 From: TangoCash Date: Mon, 1 May 2017 16:18:53 +0200 Subject: [PATCH] -cc_form_header: add max caption width picked from: https://github.com/TangoCash/neutrino-mp-cst-next commit: 4ff6c9f89b194c5fffdc4ee4e4eb744829be975f Signed-off-by: Thilo Graf review reqiured --- src/gui/components/cc_frm_header.cpp | 3 +++ src/gui/components/cc_frm_header.h | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index fff49031a..c633c74b9 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -144,6 +144,8 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const cch_cl_sec_format = cch_cl_format; cch_cl_enable_run = false; + cch_text_max_w = width; + addContextButton(buttons); initCCItems(); initParent(parent); @@ -562,6 +564,7 @@ void CComponentsHeader::initCaption() cch_cl_obj->allowPaint(cch_cl_enable); } + cc_text_w = min(cc_text_w,cch_text_max_w); //create cch_text_obj and add to collection if (cch_text_obj == NULL){ diff --git a/src/gui/components/cc_frm_header.h b/src/gui/components/cc_frm_header.h index 9550d1134..16fa2ddd1 100644 --- a/src/gui/components/cc_frm_header.h +++ b/src/gui/components/cc_frm_header.h @@ -106,6 +106,8 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen int cch_icon_w; ///property: internal width for clock object int cch_clock_w; + ///property: internal max width for text object + int cch_text_max_w; ///property: internal x-position for caption object int cch_text_x; ///property: internal offset of context button icons within context button object @@ -191,6 +193,8 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen virtual Font* getCaptionFont(){return cch_font;} ///set text color for caption virtual void setCaptionColor(fb_pixel_t text_color){cch_col_text = text_color;} + ///set max width for caption + virtual void setCaptionMaxWidth(int max_width){cch_text_max_w = max_width;} enum {