mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 23:42:58 +02:00
CComponentsText: rework constructor
allows usage of parent parameter without another parameter
This commit is contained in:
@@ -38,6 +38,17 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
//sub class CComponentsText from CComponentsItem
|
//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,
|
CComponentsText::CComponentsText( const int x_pos, const int y_pos, const int w, const int h,
|
||||||
std::string text,
|
std::string text,
|
||||||
const int mode,
|
const int mode,
|
||||||
@@ -46,31 +57,9 @@ CComponentsText::CComponentsText( const int x_pos, const int y_pos, const int w,
|
|||||||
bool has_shadow,
|
bool has_shadow,
|
||||||
fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
||||||
{
|
{
|
||||||
//CComponentsText
|
initVarText(x_pos, y_pos, w, h, text, mode, font_text, parent, has_shadow, color_text, color_frame, color_body, color_shadow);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CComponentsText::~CComponentsText()
|
CComponentsText::~CComponentsText()
|
||||||
{
|
{
|
||||||
hide();
|
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_ITEMBOX_TEXT;
|
||||||
cc_item_type = CC_ITEMTYPE_TEXT;
|
ct_font = font_text;
|
||||||
|
|
||||||
//CComponentsText
|
|
||||||
ct_font = NULL;
|
|
||||||
ct_textbox = NULL;
|
ct_textbox = NULL;
|
||||||
ct_text = "";
|
ct_text = text;
|
||||||
ct_old_text = ct_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;
|
pX = &x;
|
||||||
pY = &y;
|
pY = &y;
|
||||||
pHeight = &height;
|
pHeight = &height;
|
||||||
@@ -101,11 +98,19 @@ void CComponentsText::initVarText()
|
|||||||
ct_text_Hborder = 1;
|
ct_text_Hborder = 1;
|
||||||
ct_text_Vborder = 0;
|
ct_text_Vborder = 0;
|
||||||
|
|
||||||
ct_col_text = COL_MENUCONTENT_TEXT;
|
shadow = has_shadow;
|
||||||
|
ct_col_text = color_text;
|
||||||
ct_old_col_text = 0;
|
ct_old_col_text = 0;
|
||||||
|
col_frame = color_frame;
|
||||||
|
col_body = color_body;
|
||||||
|
col_shadow = color_shadow;
|
||||||
|
|
||||||
ct_text_sent = false;
|
ct_text_sent = false;
|
||||||
ct_paint_textbg = false;
|
ct_paint_textbg = false;
|
||||||
ct_force_text_paint = 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
|
//helper, get lines per textbox page
|
||||||
int CComponentsText::getTextLinesAutoHeight(const int& textMaxHeight, const int& textWidth, const int& mode)
|
int CComponentsText::getTextLinesAutoHeight(const int& textMaxHeight, const int& textWidth, const int& mode)
|
||||||
{
|
{
|
||||||
CComponentsText box;
|
CBox box;
|
||||||
box.iX = 0;
|
box.iX = 0;
|
||||||
box.iY = 0;
|
box.iY = 0;
|
||||||
box.iWidth = textWidth;
|
box.iWidth = textWidth;
|
||||||
|
@@ -72,8 +72,14 @@ class CComponentsText : public CComponentsItem, public CBox
|
|||||||
///helper: convert int to string
|
///helper: convert int to string
|
||||||
static std::string iToString(int int_val); //helper to convert int to string
|
static std::string iToString(int int_val); //helper to convert int to string
|
||||||
|
|
||||||
///initialize all required default attributes
|
///initialize all required attributes
|
||||||
void initVarText();
|
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
|
///destroy current CTextBox and CBox objects
|
||||||
void clearCCText();
|
void clearCCText();
|
||||||
@@ -90,6 +96,15 @@ class CComponentsText : public CComponentsItem, public CBox
|
|||||||
CComponentsForm *parent = NULL,
|
CComponentsForm *parent = NULL,
|
||||||
bool has_shadow = CC_SHADOW_OFF,
|
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);
|
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();
|
virtual ~CComponentsText();
|
||||||
|
|
||||||
///default members to paint a text box and hide painted text
|
///default members to paint a text box and hide painted text
|
||||||
@@ -158,7 +173,10 @@ class CComponentsLabel : public CComponentsText
|
|||||||
Font* font_text = NULL,
|
Font* font_text = NULL,
|
||||||
CComponentsForm *parent = NULL,
|
CComponentsForm *parent = NULL,
|
||||||
bool has_shadow = CC_SHADOW_OFF,
|
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)
|
: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;
|
cc_item_type = CC_ITEMTYPE_LABEL;
|
||||||
|
Reference in New Issue
Block a user