From 4a0975eb90172cacb9e6da16c88740080e792dab Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 24 Jan 2015 22:48:01 +0100 Subject: [PATCH] CComponentsText: expand setTextColor() methode apply color value direct in text box object --- src/gui/components/cc_item_text.cpp | 9 ++++++++- src/gui/components/cc_item_text.h | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index 0023cd578..5e361fe64 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -187,7 +187,7 @@ void CComponentsText::setText(const std::string& stext, const int mode, Font* fo ct_text_mode = mode; ct_font = font_text; if (color_text != 0) - ct_col_text = color_text; + setTextColor(color_text); dprintf(DEBUG_DEBUG, "[CComponentsText] [%s - %d] ct_text: %s \n", __func__, __LINE__, ct_text.c_str()); } @@ -298,3 +298,10 @@ int CComponentsText::getTextLinesAutoHeight(const int& textMaxHeight, const int& return ret; } + +void CComponentsText::setTextColor(const fb_pixel_t& color_text) +{ + ct_col_text = color_text; + if (ct_textbox) + ct_textbox->setTextColor(ct_col_text); +} diff --git a/src/gui/components/cc_item_text.h b/src/gui/components/cc_item_text.h index feeda5125..3aa99eda2 100644 --- a/src/gui/components/cc_item_text.h +++ b/src/gui/components/cc_item_text.h @@ -116,7 +116,7 @@ class CComponentsText : public CComponentsItem, public CBox ///send options for text font (size and type), color and mode (allignment) virtual inline void setTextFont(Font* font_text){ct_font = font_text;}; ///set text color - virtual inline void setTextColor(fb_pixel_t color_text){ ct_col_text = color_text;}; + virtual void setTextColor(const fb_pixel_t& color_text); ///get text color virtual inline fb_pixel_t getTextColor(){return ct_col_text;}; ///set text alignment, also see textbox.h for possible alignment modes