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

@@ -38,6 +38,17 @@
using namespace std;
//sub class CComponentsText from CComponentsItem
CComponentsText::CComponentsText( CComponentsForm *parent,
const int x_pos, const int y_pos, const int w, const int h,
std::string text,
const int mode,
Font* font_text,
bool has_shadow,
fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
{
initVarText(x_pos, y_pos, w, h, text, mode, font_text, parent, has_shadow, color_text, color_frame, color_body, color_shadow);
}
CComponentsText::CComponentsText( const int x_pos, const int y_pos, const int w, const int h,
std::string text,
const int mode,
@@ -46,31 +57,9 @@ CComponentsText::CComponentsText( const int x_pos, const int y_pos, const int w,
bool has_shadow,
fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
{
//CComponentsText
initVarText();
//CComponents
x = x_pos,
y = y_pos,
width = w;
height = h;
col_frame = color_frame;
col_body = color_body;
col_shadow = color_shadow;
shadow = has_shadow;
ct_font = font_text;
ct_text = text;
ct_text_mode = mode;
ct_col_text = color_text;
initCCText();
initParent(parent);
initVarText(x_pos, y_pos, w, h, text, mode, font_text, parent, has_shadow, color_text, color_frame, color_body, color_shadow);
}
CComponentsText::~CComponentsText()
{
hide();
@@ -78,18 +67,26 @@ CComponentsText::~CComponentsText()
}
void CComponentsText::initVarText()
void CComponentsText::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)
{
//CComponents, CComponentsItem
cc_item_type = CC_ITEMTYPE_TEXT;
//CComponentsText
ct_font = NULL;
cc_item_type = CC_ITEMBOX_TEXT;
ct_font = font_text;
ct_textbox = NULL;
ct_text = "";
ct_text = text;
ct_old_text = ct_text;
ct_text_mode = CTextBox::AUTO_WIDTH;
ct_text_mode = mode;
x = x_pos;
y = y_pos;
width = w;
height = h;
pX = &x;
pY = &y;
pHeight = &height;
@@ -101,11 +98,19 @@ void CComponentsText::initVarText()
ct_text_Hborder = 1;
ct_text_Vborder = 0;
ct_col_text = COL_MENUCONTENT_TEXT;
shadow = has_shadow;
ct_col_text = color_text;
ct_old_col_text = 0;
col_frame = color_frame;
col_body = color_body;
col_shadow = color_shadow;
ct_text_sent = false;
ct_paint_textbg = false;
ct_force_text_paint = false;
initCCText();
initParent(parent);
}
@@ -280,7 +285,7 @@ string CComponentsText::iToString(int int_val)
//helper, get lines per textbox page
int CComponentsText::getTextLinesAutoHeight(const int& textMaxHeight, const int& textWidth, const int& mode)
{
CComponentsText box;
CBox box;
box.iX = 0;
box.iY = 0;
box.iWidth = textWidth;