mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 07:51:19 +02:00
CComponentsText: add parameter for text color in member function setText()
This commit is contained in:
@@ -176,31 +176,33 @@ void CComponentsText::clearCCText()
|
||||
ct_textbox = NULL;
|
||||
}
|
||||
|
||||
void CComponentsText::setText(const std::string& stext, const int mode, Font* font_text)
|
||||
void CComponentsText::setText(const std::string& stext, const int mode, Font* font_text, const fb_pixel_t& color_text)
|
||||
{
|
||||
ct_old_text = ct_text;
|
||||
ct_text = stext;
|
||||
ct_text_mode = mode;
|
||||
ct_font = font_text;
|
||||
if (color_text != 0)
|
||||
ct_col_text = color_text;
|
||||
|
||||
dprintf(DEBUG_DEBUG, "[CComponentsText] [%s - %d] ct_text: %s \n", __func__, __LINE__, ct_text.c_str());
|
||||
}
|
||||
|
||||
void CComponentsText::setText(neutrino_locale_t locale_text, int mode, Font* font_text)
|
||||
void CComponentsText::setText(neutrino_locale_t locale_text, int mode, Font* font_text, const fb_pixel_t& color_text)
|
||||
{
|
||||
string stext = g_Locale->getText(locale_text);
|
||||
setText(stext, mode, font_text);
|
||||
setText(stext, mode, font_text, color_text);
|
||||
}
|
||||
|
||||
void CComponentsText::setText(const char* ctext, const int mode, Font* font_text)
|
||||
void CComponentsText::setText(const char* ctext, const int mode, Font* font_text, const fb_pixel_t& color_text)
|
||||
{
|
||||
setText((string)ctext, mode, font_text);
|
||||
setText((string)ctext, mode, font_text, color_text);
|
||||
}
|
||||
|
||||
void CComponentsText::setText(const int digit, const int mode, Font* font_text)
|
||||
void CComponentsText::setText(const int digit, const int mode, Font* font_text, const fb_pixel_t& color_text)
|
||||
{
|
||||
string s_digit = iToString(digit);
|
||||
setText(s_digit, mode, font_text);
|
||||
setText(s_digit, mode, font_text, color_text);
|
||||
}
|
||||
|
||||
string CComponentsText::getTextFromFile(const string& path_to_textfile)
|
||||
@@ -224,14 +226,14 @@ string CComponentsText::getTextFromFile(const string& path_to_textfile)
|
||||
}
|
||||
|
||||
//set text lines directly from a file, returns true on succsess
|
||||
bool CComponentsText::setTextFromFile(const string& path_to_textfile, const int mode, Font* font_text)
|
||||
bool CComponentsText::setTextFromFile(const string& path_to_textfile, const int mode, Font* font_text, const fb_pixel_t& color_text)
|
||||
{
|
||||
string txt = getTextFromFile(path_to_textfile);
|
||||
|
||||
if (txt.empty())
|
||||
return false;
|
||||
|
||||
setText(txt, mode, font_text);
|
||||
setText(txt, mode, font_text, color_text);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -128,15 +128,15 @@ class CComponentsText : public CComponentsItem, public CBox
|
||||
virtual inline void doPaintTextBoxBg(bool do_paintbox_bg){ ct_paint_textbg = do_paintbox_bg;};
|
||||
|
||||
///set text as string also possible with overloades members for loacales, const char and text file
|
||||
virtual void setText(const std::string& stext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL);
|
||||
virtual void setText(const std::string& stext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL, const fb_pixel_t& color_text = 0);
|
||||
///set text with const char*
|
||||
virtual void setText(const char* ctext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL);
|
||||
virtual void setText(const char* ctext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL, const fb_pixel_t& color_text = 0);
|
||||
///set text from locale
|
||||
virtual void setText(neutrino_locale_t locale_text, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL);
|
||||
virtual void setText(neutrino_locale_t locale_text, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL, const fb_pixel_t& color_text = 0);
|
||||
///set text from digit, digit is integer
|
||||
virtual void setText(const int digit, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL);
|
||||
virtual void setText(const int digit, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL, const fb_pixel_t& color_text = 0);
|
||||
///set text directly from a textfile, path as string is required
|
||||
virtual bool setTextFromFile(const std::string& path_to_textfile, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL);
|
||||
virtual bool setTextFromFile(const std::string& path_to_textfile, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL, const fb_pixel_t& color_text = 0);
|
||||
///get text directly from a textfile, path as string is required
|
||||
virtual std::string getTextFromFile(const std::string& path_to_textfile);
|
||||
|
||||
|
Reference in New Issue
Block a user