CComponentsText: rework constructor

allows usage of parent parameter without another parameter
This commit is contained in:
2014-03-23 21:59:01 +01:00
parent 6fe7b452c1
commit d21df99ed4
2 changed files with 59 additions and 36 deletions

View File

@@ -72,8 +72,14 @@ class CComponentsText : public CComponentsItem, public CBox
///helper: convert int to string
static std::string iToString(int int_val); //helper to convert int to string
///initialize all required default attributes
void initVarText();
///initialize all required attributes
void initVarText( const int x_pos, const int y_pos, const int w, const int h,
std::string text,
const int mode,
Font* font_text,
CComponentsForm *parent,
bool has_shadow,
fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow);
///destroy current CTextBox and CBox objects
void clearCCText();
@@ -90,6 +96,15 @@ class CComponentsText : public CComponentsItem, public CBox
CComponentsForm *parent = NULL,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_text = COL_MENUCONTENT_TEXT, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
CComponentsText( CComponentsForm *parent,
const int x_pos = 10, const int y_pos = 10, const int w = 150, const int h = 50,
std::string text = "",
const int mode = CTextBox::AUTO_WIDTH,
Font* font_text = NULL,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_text = COL_MENUCONTENT_TEXT, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
virtual ~CComponentsText();
///default members to paint a text box and hide painted text
@@ -158,7 +173,10 @@ class CComponentsLabel : public CComponentsText
Font* font_text = NULL,
CComponentsForm *parent = NULL,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_text = COL_MENUCONTENTINACTIVE_TEXT, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0)
fb_pixel_t color_text = COL_MENUCONTENTINACTIVE_TEXT,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0,
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0)
:CComponentsText(x_pos, y_pos, w, h, text, mode, font_text, parent, has_shadow, color_text, color_frame, color_body, color_shadow)
{
cc_item_type = CC_ITEMTYPE_LABEL;