CComponents: rename Container onto Item, make void paint() abstract

CComponentsItem is shorter then CComponentsContainer, but also
plausible and appropriately.
paint() is required in all sub classes and useful for coming functions.
This commit is contained in:
2012-10-21 13:54:33 +02:00
parent 28904b79c7
commit e1c9749730
2 changed files with 165 additions and 170 deletions

View File

@@ -124,66 +124,66 @@ class CComponents
std::vector<comp_fbdata_t> v_fbdata; std::vector<comp_fbdata_t> v_fbdata;
fb_pixel_t col_body, col_shadow, col_frame; fb_pixel_t col_body, col_shadow, col_frame;
bool firstPaint, shadow, is_painted; bool firstPaint, shadow, is_painted;
void initVarBasic(); void initVarBasic();
void paintFbItems(bool do_save_bg = true); void paintFbItems(bool do_save_bg = true);
fb_pixel_t* getScreen(int ax, int ay, int dx, int dy); fb_pixel_t* getScreen(int ax, int ay, int dx, int dy);
comp_screen_data_t saved_screen; comp_screen_data_t saved_screen;
void clearSavedScreen(); void clearSavedScreen();
void clear(); void clear();
public: public:
CComponents(); CComponents();
virtual~CComponents(); virtual~CComponents();
inline virtual void setXPos(const int& xpos){x = xpos;}; inline virtual void setXPos(const int& xpos){x = xpos;};
inline virtual void setYPos(const int& ypos){y = ypos;}; inline virtual void setYPos(const int& ypos){y = ypos;};
inline virtual void setHeight(const int& h){height = h;}; inline virtual void setHeight(const int& h){height = h;};
inline virtual void setWidth(const int& w){width = w;}; inline virtual void setWidth(const int& w){width = w;};
inline virtual void setDimensionsAll(const int& xpos, const int& ypos, const int& w, const int& h){x = xpos; y = ypos; width = w; height = h;}; inline virtual void setDimensionsAll(const int& xpos, const int& ypos, const int& w, const int& h){x = xpos; y = ypos; width = w; height = h;};
inline virtual int getXPos(){return x;}; inline virtual int getXPos(){return x;};
inline virtual int getYPos(){return y;}; inline virtual int getYPos(){return y;};
inline virtual int getHeight(){return height;}; inline virtual int getHeight(){return height;};
inline virtual int getWidth(){return width;}; inline virtual int getWidth(){return width;};
inline virtual void getDimensions(int* xpos, int* ypos, int* w, int* h){*xpos=x; *ypos=y; *w=width; *h=height;}; inline virtual void getDimensions(int* xpos, int* ypos, int* w, int* h){*xpos=x; *ypos=y; *w=width; *h=height;};
/// set colors: Possible color values are defined in "gui/color.h" and "gui/customcolor.h" /// set colors: Possible color values are defined in "gui/color.h" and "gui/customcolor.h"
inline virtual void setColorFrame(fb_pixel_t color){col_frame = color;}; inline virtual void setColorFrame(fb_pixel_t color){col_frame = color;};
inline virtual void setColorBody(fb_pixel_t color){col_body = color;}; inline virtual void setColorBody(fb_pixel_t color){col_body = color;};
inline virtual void setColorShadow(fb_pixel_t color){col_shadow = color;}; inline virtual void setColorShadow(fb_pixel_t color){col_shadow = color;};
inline virtual void setColorAll(fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow){col_frame = color_frame; col_body = color_body; col_shadow = color_shadow;}; inline virtual void setColorAll(fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow){col_frame = color_frame; col_body = color_body; col_shadow = color_shadow;};
virtual void hide(); virtual void hide();
virtual bool isPainted(){return is_painted;}; virtual bool isPainted(){return is_painted;};
}; };
class CComponentsContainer : public CComponents class CComponentsItem : public CComponents
{ {
protected: protected:
int corner_rad, fr_thickness; int corner_rad, fr_thickness;
void hideContainer(bool no_restore = false); void hideContainer(bool no_restore = false);
void paintInit(bool do_save_bg); void paintInit(bool do_save_bg);
void initVarContainer(); void initVarItem();
public: public:
CComponentsContainer(); CComponentsItem();
/// set corner types: Possible corner types are defined in CFrameBuffer (see: driver/framebuffer.h). /// set corner types: Possible corner types are defined in CFrameBuffer (see: driver/framebuffer.h).
inline virtual void setCornerType(const int& type){corner_type = type;}; inline virtual void setCornerType(const int& type){corner_type = type;};
inline virtual void setCornerRadius(const int& radius){corner_rad = radius;}; inline virtual void setCornerRadius(const int& radius){corner_rad = radius;};
inline virtual void setFrameThickness(const int& thickness){fr_thickness = thickness;}; inline virtual void setFrameThickness(const int& thickness){fr_thickness = thickness;};
inline virtual void setShadowOnOff(bool has_shadow){shadow = has_shadow;}; inline virtual void setShadowOnOff(bool has_shadow){shadow = has_shadow;};
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES) = 0;
virtual void hide(bool no_restore = false); virtual void hide(bool no_restore = false);
virtual void kill(); virtual void kill();
virtual void syncSysColors(); virtual void syncSysColors();
}; };
class CComponentsPicture : public CComponentsContainer class CComponentsPicture : public CComponentsItem
{ {
private: private:
std::string pic_name; std::string pic_name;
@@ -208,7 +208,7 @@ class CComponentsPicture : public CComponentsContainer
inline void setPicturePaintBackground(bool paintBg){pic_paintBg = paintBg;}; inline void setPicturePaintBackground(bool paintBg){pic_paintBg = paintBg;};
inline void setPicture(const std::string& picture_name); inline void setPicture(const std::string& picture_name);
void setPictureAlign(const int alignment); void setPictureAlign(const int alignment);
inline bool isPicPainted(){return pic_painted;}; inline bool isPicPainted(){return pic_painted;};
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
void hide(bool no_restore = false); void hide(bool no_restore = false);
@@ -217,7 +217,7 @@ class CComponentsPicture : public CComponentsContainer
}; };
#define INFO_BOX_Y_OFFSET 2 #define INFO_BOX_Y_OFFSET 2
class CComponentsInfoBox : public CComponentsContainer class CComponentsInfoBox : public CComponentsItem
{ {
private: private:
const char* text; const char* text;
@@ -257,33 +257,33 @@ class CComponentsInfoBox : public CComponentsContainer
}; };
class CComponentsShapeCircle : public CComponentsContainer class CComponentsShapeCircle : public CComponentsItem
{ {
private: private:
int d; int d;
public: public:
CComponentsShapeCircle( const int x_pos, const int y_pos, const int diam, bool has_shadow = CC_SHADOW_ON, CComponentsShapeCircle( const int x_pos, const int y_pos, const int diam, bool has_shadow = CC_SHADOW_ON,
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_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
inline void setDiam(const int& diam){d=width=height=diam, corner_rad=d/2;}; inline void setDiam(const int& diam){d=width=height=diam, corner_rad=d/2;};
inline int getDiam(){return d;}; inline int getDiam(){return d;};
}; };
class CComponentsShapeSquare : public CComponentsContainer class CComponentsShapeSquare : public CComponentsItem
{ {
public: public:
CComponentsShapeSquare( const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = CC_SHADOW_ON, CComponentsShapeSquare( const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = CC_SHADOW_ON,
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_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
}; };
class CComponentsPIP : public CComponentsContainer class CComponentsPIP : public CComponentsItem
{ {
private: private:
int screen_w, screen_h; int screen_w, screen_h;
public: public:
CComponentsPIP( const int x_pos, const int y_pos, const int percent, bool has_shadow = CC_SHADOW_OFF); CComponentsPIP( const int x_pos, const int y_pos, const int percent, bool has_shadow = CC_SHADOW_OFF);
~CComponentsPIP(); ~CComponentsPIP();
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
void hide(bool no_restore = false); void hide(bool no_restore = false);
}; };
@@ -295,14 +295,14 @@ class CComponentsDetailLine : public CComponents
int thickness, y_down, h_mark_top, h_mark_down; int thickness, y_down, h_mark_top, h_mark_down;
void initVarDline(); void initVarDline();
public: public:
CComponentsDetailLine(); CComponentsDetailLine();
CComponentsDetailLine( const int x_pos,const int y_pos_top, const int y_pos_down, CComponentsDetailLine( const int x_pos,const int y_pos_top, const int y_pos_down,
const int h_mark_up = CC_HEIGHT_MIN , const int h_mark_down = CC_HEIGHT_MIN, const int h_mark_up = CC_HEIGHT_MIN , const int h_mark_down = CC_HEIGHT_MIN,
fb_pixel_t color_line = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); fb_pixel_t color_line = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
~CComponentsDetailLine(); ~CComponentsDetailLine();
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
void kill(); void kill();
inline void setColors(fb_pixel_t color_line, fb_pixel_t color_shadow){col_body = color_line; col_shadow = color_shadow;}; inline void setColors(fb_pixel_t color_line, fb_pixel_t color_shadow){col_body = color_line; col_shadow = color_shadow;};
@@ -314,7 +314,7 @@ class CComponentsDetailLine : public CComponents
#define FIRST_ELEMENT_INIT 10000 #define FIRST_ELEMENT_INIT 10000
#define LOGO_MAX_WIDTH width/4 #define LOGO_MAX_WIDTH width/4
class CComponentsItemBox : public CComponentsContainer class CComponentsItemBox : public CComponentsItem
{ {
protected: protected:
int hSpacer; int hSpacer;
@@ -333,7 +333,7 @@ class CComponentsItemBox : public CComponentsContainer
size_t prevElementRight; size_t prevElementRight;
std::vector<comp_element_data_t> v_element_data; std::vector<comp_element_data_t> v_element_data;
bool isCalculated; bool isCalculated;
void clearElements(); void clearElements();
void initVarItemBox(); void initVarItemBox();
void calSizeOfElements(); void calSizeOfElements();
@@ -343,14 +343,14 @@ class CComponentsItemBox : public CComponentsContainer
bool addElement(int align, int type, const std::string& element="", size_t *index=NULL); bool addElement(int align, int type, const std::string& element="", size_t *index=NULL);
void paintImage(size_t index, bool newElement); void paintImage(size_t index, bool newElement);
void paintText(size_t index, bool newElement); void paintText(size_t index, bool newElement);
public: public:
CComponentsItemBox(); CComponentsItemBox();
virtual ~CComponentsItemBox(); virtual ~CComponentsItemBox();
inline virtual void setTextFont(Font* font){font_text = font;}; inline virtual void setTextFont(Font* font){font_text = font;};
inline virtual void setTextColor(fb_pixel_t color_text){ it_col_text = color_text;}; inline virtual void setTextColor(fb_pixel_t color_text){ it_col_text = color_text;};
virtual void refreshElement(size_t index, const std::string& element); virtual void refreshElement(size_t index, const std::string& element);
virtual void paintElement(size_t index, bool newElement= false); virtual void paintElement(size_t index, bool newElement= false);
virtual bool addLogoOrText(int align, const std::string& logo, const std::string& text, size_t *index=NULL); virtual bool addLogoOrText(int align, const std::string& logo, const std::string& text, size_t *index=NULL);
@@ -370,12 +370,12 @@ class CComponentsTitleBar : public CComponentsItemBox
std::string tb_s_text, tb_icon_name; std::string tb_s_text, tb_icon_name;
neutrino_locale_t tb_locale_text; neutrino_locale_t tb_locale_text;
int tb_text_align, tb_icon_align; int tb_text_align, tb_icon_align;
void initText(); void initText();
void initIcon(); void initIcon();
void initElements(); void initElements();
void initVarTitleBar(); void initVarTitleBar();
public: public:
CComponentsTitleBar(); CComponentsTitleBar();
CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, const char* c_text = NULL, const std::string& s_icon ="", CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, const char* c_text = NULL, const std::string& s_icon ="",
@@ -384,25 +384,25 @@ class CComponentsTitleBar : public CComponentsItemBox
fb_pixel_t color_text = COL_MENUHEAD, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0); fb_pixel_t color_text = COL_MENUHEAD, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0);
CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t locale_text = NONEXISTANT_LOCALE, const std::string& s_icon ="", CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t locale_text = NONEXISTANT_LOCALE, const std::string& s_icon ="",
fb_pixel_t color_text = COL_MENUHEAD, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0); fb_pixel_t color_text = COL_MENUHEAD, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0);
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
}; };
class CComponentsForm : public CComponentsContainer class CComponentsForm : public CComponentsItem
{ {
private: private:
CComponentsTitleBar *tb; CComponentsTitleBar *tb;
std::string tb_text, tb_icon; std::string tb_text, tb_icon;
void initVarForm(); void initVarForm();
void paintHead(); void paintHead();
public: public:
CComponentsForm(); CComponentsForm();
~CComponentsForm(); ~CComponentsForm();
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
void hide(bool no_restore = false); void hide(bool no_restore = false);
void setCaption(const std::string& text); void setCaption(const std::string& text);
@@ -410,27 +410,27 @@ class CComponentsForm : public CComponentsContainer
void setIcon(const std::string& icon_name){tb_icon = icon_name;}; void setIcon(const std::string& icon_name){tb_icon = icon_name;};
}; };
class CComponentsText : public CComponentsContainer class CComponentsText : public CComponentsItem
{ {
private: private:
Font* ct_font; Font* ct_font;
CBox * ct_box; CBox * ct_box;
CTextBox * ct_textbox; CTextBox * ct_textbox;
const char* ct_text; const char* ct_text;
int ct_text_mode; //see textbox.h for possible modes int ct_text_mode; //see textbox.h for possible modes
fb_pixel_t ct_col_text; fb_pixel_t ct_col_text;
bool ct_text_sended; bool ct_text_sended;
void initVarText(); void initVarText();
void initText(); void initText();
public: public:
CComponentsText(); CComponentsText();
~CComponentsText(); ~CComponentsText();
inline void setText(const char* text, const int text_mode=~CTextBox::AUTO_WIDTH, Font* font_text=NULL){ct_text = text; ct_text_mode = text_mode, ct_font = font_text;}; inline void setText(const char* text, const int text_mode=~CTextBox::AUTO_WIDTH, Font* font_text=NULL){ct_text = text; ct_text_mode = text_mode, ct_font = font_text;};
void hide(bool no_restore = false); void hide(bool no_restore = false);
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
void setTextFont(Font* font_text){ct_font = font_text;}; void setTextFont(Font* font_text){ct_font = font_text;};

View File

@@ -94,21 +94,21 @@ void CComponents::paintFbItems(bool do_save_bg)
saved_screen.dy = v_fbdata[i].dy; saved_screen.dy = v_fbdata[i].dy;
clearSavedScreen(); clearSavedScreen();
saved_screen.pixbuf = getScreen(saved_screen.x, saved_screen.y, saved_screen.dx, saved_screen.dy); saved_screen.pixbuf = getScreen(saved_screen.x, saved_screen.y, saved_screen.dx, saved_screen.dy);
firstPaint = false; firstPaint = false;
break; break;
} }
} }
} }
for(size_t i=0; i< v_fbdata.size() ;i++){ for(size_t i=0; i< v_fbdata.size() ;i++){
int fbtype = v_fbdata[i].fbdata_type; int fbtype = v_fbdata[i].fbdata_type;
if (firstPaint){ if (firstPaint){
if (do_save_bg && fbtype == CC_FBDATA_TYPE_LINE) if (do_save_bg && fbtype == CC_FBDATA_TYPE_LINE)
v_fbdata[i].pixbuf = getScreen(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy); v_fbdata[i].pixbuf = getScreen(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy);
//ensure painting of all line fb items with saved screens //ensure painting of all line fb items with saved screens
if (fbtype == CC_FBDATA_TYPE_LINE) if (fbtype == CC_FBDATA_TYPE_LINE)
firstPaint = true; firstPaint = true;
@@ -124,7 +124,7 @@ void CComponents::paintFbItems(bool do_save_bg)
frameBuffer->paintBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].color, v_fbdata[i].r, corner_type); frameBuffer->paintBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].color, v_fbdata[i].r, corner_type);
} }
} }
is_painted = true; is_painted = true;
} }
@@ -161,11 +161,11 @@ inline void CComponents::clear()
//------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------
//abstract sub class CComponentsContainer from CComponents //abstract sub class CComponentsItem from CComponents
CComponentsContainer::CComponentsContainer() CComponentsItem::CComponentsItem()
{ {
//CComponentsContainer //CComponentsItem
initVarContainer(); initVarItem();
} }
// y // y
@@ -175,23 +175,23 @@ CComponentsContainer::CComponentsContainer()
// | | // | |
// +--------width---------+ // +--------width---------+
void CComponentsContainer::initVarContainer() void CComponentsItem::initVarItem()
{ {
//CComponents //CComponents
initVarBasic(); initVarBasic();
//ComponentsContainer //CComponentsItem
corner_rad = 0; corner_rad = 0;
fr_thickness = 0; fr_thickness = 0;
} }
void CComponentsContainer::paintInit(bool do_save_bg) void CComponentsItem::paintInit(bool do_save_bg)
{ {
clear(); clear();
int sw = shadow ? shadow_w : 0; int sw = shadow ? shadow_w : 0;
int th = fr_thickness; int th = fr_thickness;
comp_fbdata_t fbdata[] = comp_fbdata_t fbdata[] =
{ {
{CC_FBDATA_TYPE_BGSCREEN, x, y, width+sw, height+sw, 0, 0, 0, NULL, NULL}, {CC_FBDATA_TYPE_BGSCREEN, x, y, width+sw, height+sw, 0, 0, 0, NULL, NULL},
@@ -199,25 +199,20 @@ void CComponentsContainer::paintInit(bool do_save_bg)
{CC_FBDATA_TYPE_FRAME, x, y, width, height, col_frame, corner_rad, th, NULL, NULL}, {CC_FBDATA_TYPE_FRAME, x, y, width, height, col_frame, corner_rad, th, NULL, NULL},
{CC_FBDATA_TYPE_BOX, x+th, y+th, width-2*th, height-2*th, col_body, corner_rad-th, 0, NULL, NULL}, {CC_FBDATA_TYPE_BOX, x+th, y+th, width-2*th, height-2*th, col_body, corner_rad-th, 0, NULL, NULL},
}; };
for(size_t i =0; i< (sizeof(fbdata) / sizeof(fbdata[0])) ;i++) for(size_t i =0; i< (sizeof(fbdata) / sizeof(fbdata[0])) ;i++)
v_fbdata.push_back(fbdata[i]); v_fbdata.push_back(fbdata[i]);
paintFbItems(do_save_bg);
}
void CComponentsContainer::paint(bool do_save_bg) paintFbItems(do_save_bg);
{
paintInit(do_save_bg);
} }
//restore last saved screen behind form box, //restore last saved screen behind form box,
//Do use parameter 'no restore' to override temporarly the restore funtionality. //Do use parameter 'no restore' to override temporarly the restore funtionality.
//This could help to avoid ugly flicker efffects if it is necessary e.g. on often repaints, without changed contents. //This could help to avoid ugly flicker efffects if it is necessary e.g. on often repaints, without changed contents.
void CComponentsContainer::hideContainer(bool no_restore) void CComponentsItem::hideContainer(bool no_restore)
{ {
is_painted = false; is_painted = false;
if (saved_screen.pixbuf) { if (saved_screen.pixbuf) {
frameBuffer->RestoreScreen(saved_screen.x, saved_screen.y, saved_screen.dx, saved_screen.dy, saved_screen.pixbuf); frameBuffer->RestoreScreen(saved_screen.x, saved_screen.y, saved_screen.dx, saved_screen.dy, saved_screen.pixbuf);
if (no_restore) { if (no_restore) {
@@ -228,14 +223,14 @@ void CComponentsContainer::hideContainer(bool no_restore)
} }
} }
void CComponentsContainer::hide(bool no_restore) void CComponentsItem::hide(bool no_restore)
{ {
hideContainer(no_restore); hideContainer(no_restore);
} }
//hide rendered objects //hide rendered objects
void CComponentsContainer::kill() void CComponentsItem::kill()
{ {
//save current colors //save current colors
fb_pixel_t c_tmp1, c_tmp2, c_tmp3; fb_pixel_t c_tmp1, c_tmp2, c_tmp3;
@@ -258,7 +253,7 @@ void CComponentsContainer::kill()
//synchronize colors for forms //synchronize colors for forms
//This is usefull if the system colors are changed during runtime //This is usefull if the system colors are changed during runtime
//so you can ensure correct applied system colors in relevant objects with unchanged instances. //so you can ensure correct applied system colors in relevant objects with unchanged instances.
void CComponentsContainer::syncSysColors() void CComponentsItem::syncSysColors()
{ {
col_body = COL_MENUCONTENT_PLUS_0; col_body = COL_MENUCONTENT_PLUS_0;
col_shadow = COL_MENUCONTENTDARK_PLUS_0; col_shadow = COL_MENUCONTENTDARK_PLUS_0;
@@ -266,12 +261,12 @@ void CComponentsContainer::syncSysColors()
} }
//------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------
//sub class CComponentsInfoBox from CComponentsContainer //sub class CComponentsInfoBox from CComponentsItem
CComponentsInfoBox::CComponentsInfoBox() CComponentsInfoBox::CComponentsInfoBox()
{ {
//CComponents, ComponentsContainer //CComponents, CComponentsItem
initVarContainer(); initVarItem();
//CComponentsInfoBox //CComponentsInfoBox
initVarInfobox(); initVarInfobox();
text = NULL; text = NULL;
@@ -285,9 +280,9 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i
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)
{ {
//CComponents, ComponentsContainer //CComponents, CComponentsItem
initVarContainer(); initVarItem();
x = x_pos; x = x_pos;
y = y_pos; y = y_pos;
width = w; width = w;
@@ -296,7 +291,7 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i
col_frame = color_frame; col_frame = color_frame;
col_body = color_body; col_body = color_body;
col_shadow = color_shadow; col_shadow = color_shadow;
//CComponentsInfoBox //CComponentsInfoBox
initVarInfobox(); initVarInfobox();
text = info_text; text = info_text;
@@ -317,16 +312,16 @@ CComponentsInfoBox::~CComponentsInfoBox()
void CComponentsInfoBox::initVarInfobox() void CComponentsInfoBox::initVarInfobox()
{ {
//CComponents, ComponentsContainer //CComponents, CComponentsItem
initVarContainer(); initVarItem();
//CComponentsInfoBox //CComponentsInfoBox
box = NULL; box = NULL;
textbox = NULL; textbox = NULL;
pic = NULL; pic = NULL;
pic_name = ""; pic_name = "";
x_offset = 10; x_offset = 10;
} }
void CComponentsInfoBox::setText(neutrino_locale_t locale_text, int mode, Font* font_text) void CComponentsInfoBox::setText(neutrino_locale_t locale_text, int mode, Font* font_text)
@@ -350,7 +345,7 @@ void CComponentsInfoBox::paintPicture()
//fit icon into infobox //fit icon into infobox
pic->setHeight(height-2*fr_thickness); pic->setHeight(height-2*fr_thickness);
pic->setColorBody(col_body); pic->setColorBody(col_body);
pic->paint(); pic->paint();
} }
@@ -358,15 +353,15 @@ void CComponentsInfoBox::paintText()
{ {
if (box == NULL) if (box == NULL)
box = new CBox(); box = new CBox();
//define text x position //define text x position
int x_text = x+fr_thickness+x_offset; int x_text = x+fr_thickness+x_offset;
//set text to the left border if picture not painted //set text to the left border if picture not painted
if (pic->isPicPainted()){ if (pic->isPicPainted()){
int pic_w = pic->getWidth(); int pic_w = pic->getWidth();
x_text += pic_w+x_offset; x_text += pic_w+x_offset;
} }
box->iX = x_text; box->iX = x_text;
box->iY = y+fr_thickness; box->iY = y+fr_thickness;
@@ -413,12 +408,12 @@ void CComponentsInfoBox::removeLineBreaks(std::string& str)
//------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------
//sub class CComponentsShapeSquare from CComponentsContainer //sub class CComponentsShapeSquare from CComponentsItem
CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
{ {
//ComponentsContainer //CComponentsItem
initVarContainer(); initVarItem();
x = x_pos; x = x_pos;
y = y_pos; y = y_pos;
width = w; width = w;
@@ -431,12 +426,12 @@ CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos,
} }
//------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------
//sub class CComponentsShapeCircle from CComponentsContainer //sub class CComponentsShapeCircle from CComponentsItem
CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, bool has_shadow, CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, bool has_shadow,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
{ {
//CComponents, CComponentsContainer //CComponents, CComponentsItem
initVarContainer(); initVarItem();
//CComponents //CComponents
x = x_pos; x = x_pos;
@@ -447,23 +442,23 @@ CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam,
col_frame = color_frame; col_frame = color_frame;
col_body = color_body; col_body = color_body;
col_shadow = color_shadow; col_shadow = color_shadow;
//CComponentsShapeCircle //CComponentsShapeCircle
width = height = d = diam; width = height = d = diam;
//CComponentsContainer //CComponentsItem
corner_rad = d/2; corner_rad = d/2;
} }
// y // y
// x+ - + // x+ - +
// //
// //
// //
// |----d-i-a-m----| // |----d-i-a-m----|
// //
// //
// //
// + - + // + - +
@@ -472,13 +467,13 @@ CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam,
CComponentsDetailLine::CComponentsDetailLine() CComponentsDetailLine::CComponentsDetailLine()
{ {
initVarDline(); initVarDline();
//CComponents //CComponents
x = 0; x = 0;
y = 0; y = 0;
col_shadow = COL_MENUCONTENTDARK_PLUS_0; col_shadow = COL_MENUCONTENTDARK_PLUS_0;
col_body = COL_MENUCONTENT_PLUS_6; col_body = COL_MENUCONTENT_PLUS_6;
//CComponentsDetailLine //CComponentsDetailLine
y_down = 0; y_down = 0;
h_mark_top = CC_HEIGHT_MIN; h_mark_top = CC_HEIGHT_MIN;
@@ -488,13 +483,13 @@ CComponentsDetailLine::CComponentsDetailLine()
CComponentsDetailLine::CComponentsDetailLine(const int x_pos, const int y_pos_top, const int y_pos_down, const int h_mark_top_, const int h_mark_down_, fb_pixel_t color_line, fb_pixel_t color_shadow) CComponentsDetailLine::CComponentsDetailLine(const int x_pos, const int y_pos_top, const int y_pos_down, const int h_mark_top_, const int h_mark_down_, fb_pixel_t color_line, fb_pixel_t color_shadow)
{ {
initVarDline(); initVarDline();
//CComponents //CComponents
x = x_pos; x = x_pos;
y = y_pos_top; y = y_pos_top;
col_shadow = color_shadow; col_shadow = color_shadow;
col_body = color_line; col_body = color_line;
//CComponentsDetailLine //CComponentsDetailLine
y_down = y_pos_down; y_down = y_pos_down;
h_mark_top = h_mark_top_; h_mark_top = h_mark_top_;
@@ -505,9 +500,9 @@ void CComponentsDetailLine::initVarDline()
{ {
//CComponents //CComponents
initVarBasic(); initVarBasic();
shadow_w = 1; shadow_w = 1;
//CComponentsDetailLine //CComponentsDetailLine
thickness = 4; thickness = 4;
} }
@@ -537,40 +532,40 @@ CComponentsDetailLine::~CComponentsDetailLine()
void CComponentsDetailLine::paint(bool do_save_bg) void CComponentsDetailLine::paint(bool do_save_bg)
{ {
clear(); clear();
int y_mark_top = y-h_mark_top/2+thickness/2; int y_mark_top = y-h_mark_top/2+thickness/2;
int y_mark_down = y_down-h_mark_down/2+thickness/2; int y_mark_down = y_down-h_mark_down/2+thickness/2;
int sw = shadow_w; int sw = shadow_w;
comp_fbdata_t fbdata[] = comp_fbdata_t fbdata[] =
{ {
/* vertical item mark | */ /* vertical item mark | */
{CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_top, thickness, h_mark_top, col_body, 0, 0, NULL, NULL}, {CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_top, thickness, h_mark_top, col_body, 0, 0, NULL, NULL},
{CC_FBDATA_TYPE_LINE, x+width-sw, y_mark_top, sw, h_mark_top, col_shadow, 0, 0, NULL, NULL}, {CC_FBDATA_TYPE_LINE, x+width-sw, y_mark_top, sw, h_mark_top, col_shadow, 0, 0, NULL, NULL},
{CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_top+h_mark_top, thickness+sw, sw , col_shadow, 0, 0, NULL, NULL}, {CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_top+h_mark_top, thickness+sw, sw , col_shadow, 0, 0, NULL, NULL},
/* horizontal item line - */ /* horizontal item line - */
{CC_FBDATA_TYPE_LINE, x, y, width-thickness-sw, thickness, col_body, 0, 0, NULL, NULL}, {CC_FBDATA_TYPE_LINE, x, y, width-thickness-sw, thickness, col_body, 0, 0, NULL, NULL},
{CC_FBDATA_TYPE_LINE, x+thickness, y+thickness, width-2*thickness-sw, sw, col_shadow, 0, 0, NULL, NULL}, {CC_FBDATA_TYPE_LINE, x+thickness, y+thickness, width-2*thickness-sw, sw, col_shadow, 0, 0, NULL, NULL},
/* vertical connect line [ */ /* vertical connect line [ */
{CC_FBDATA_TYPE_LINE, x, y+thickness, thickness, y_down-y-thickness, col_body, 0, 0, NULL, NULL}, {CC_FBDATA_TYPE_LINE, x, y+thickness, thickness, y_down-y-thickness, col_body, 0, 0, NULL, NULL},
{CC_FBDATA_TYPE_LINE, x+thickness, y+thickness+sw, sw, y_down-y-thickness-sw, col_shadow, 0, 0, NULL, NULL}, {CC_FBDATA_TYPE_LINE, x+thickness, y+thickness+sw, sw, y_down-y-thickness-sw, col_shadow, 0, 0, NULL, NULL},
/* horizontal info line - */ /* horizontal info line - */
{CC_FBDATA_TYPE_LINE, x, y_down, width-thickness-sw, thickness, col_body, 0, 0, NULL, NULL}, {CC_FBDATA_TYPE_LINE, x, y_down, width-thickness-sw, thickness, col_body, 0, 0, NULL, NULL},
{CC_FBDATA_TYPE_LINE, x, y_down+thickness, width-thickness-sw, sw, col_shadow, 0, 0, NULL, NULL}, {CC_FBDATA_TYPE_LINE, x, y_down+thickness, width-thickness-sw, sw, col_shadow, 0, 0, NULL, NULL},
/* vertical info mark | */ /* vertical info mark | */
{CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_down, thickness, h_mark_down, col_body, 0, 0, NULL, NULL}, {CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_down, thickness, h_mark_down, col_body, 0, 0, NULL, NULL},
{CC_FBDATA_TYPE_LINE, x+width-sw, y_mark_down, sw, h_mark_down, col_shadow, 0, 0, NULL, NULL}, {CC_FBDATA_TYPE_LINE, x+width-sw, y_mark_down, sw, h_mark_down, col_shadow, 0, 0, NULL, NULL},
{CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_down+h_mark_down,thickness+sw, sw, col_shadow, 0, 0, NULL, NULL}, {CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_down+h_mark_down,thickness+sw, sw, col_shadow, 0, 0, NULL, NULL},
}; };
for(size_t i =0; i< (sizeof(fbdata) / sizeof(fbdata[0])) ;i++) for(size_t i =0; i< (sizeof(fbdata) / sizeof(fbdata[0])) ;i++)
v_fbdata.push_back(fbdata[i]); v_fbdata.push_back(fbdata[i]);
paintFbItems(do_save_bg); paintFbItems(do_save_bg);
} }
@@ -603,12 +598,12 @@ void CComponentsDetailLine::syncSysColors()
//------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------
//sub class CComponentsPIP from CComponentsContainer //sub class CComponentsPIP from CComponentsItem
CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int percent, bool has_shadow) CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int percent, bool has_shadow)
{ {
//CComponents, CComponentsContainer //CComponents, CComponentsItem
initVarContainer(); initVarItem();
//CComponentsPIP //CComponentsPIP
screen_w = frameBuffer->getScreenWidth(true); screen_w = frameBuffer->getScreenWidth(true);
screen_h = frameBuffer->getScreenHeight(true); screen_h = frameBuffer->getScreenHeight(true);
@@ -648,7 +643,7 @@ void CComponentsPIP::hide(bool no_restore)
//------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------
//sub class CComponentsPicture from CComponentsContainer //sub class CComponentsPicture from CComponentsItem
CComponentsPicture::CComponentsPicture( const int x_pos, const int y_pos, CComponentsPicture::CComponentsPicture( const int x_pos, const int y_pos,
const std::string& picture_name, const int alignment, bool has_shadow, const std::string& picture_name, const int alignment, bool has_shadow,
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow) fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow)
@@ -678,9 +673,9 @@ CComponentsPicture::CComponentsPicture( const int x_pos, const int y_pos, const
void CComponentsPicture::init( int x_pos, int y_pos, const string& picture_name, const int alignment, bool has_shadow, void CComponentsPicture::init( int x_pos, int y_pos, const string& picture_name, const int alignment, bool has_shadow,
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow) fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow)
{ {
//CComponents, CComponentsContainer //CComponents, CComponentsItem
initVarContainer(); initVarItem();
//CComponentsPicture //CComponentsPicture
pic_name = picture_name; pic_name = picture_name;
pic_align = alignment; pic_align = alignment;
@@ -691,7 +686,7 @@ void CComponentsPicture::init( int x_pos, int y_pos, const string& picture_name,
do_paint = false; do_paint = false;
if (pic_name.empty()) if (pic_name.empty())
pic_width = pic_height = 0; pic_width = pic_height = 0;
//CComponents //CComponents
x = pic_x = x_pos; x = pic_x = x_pos;
y = pic_y = y_pos; y = pic_y = y_pos;
@@ -731,15 +726,15 @@ void CComponentsPicture::initVarPicture()
if((pic_width > maxWidth) || (pic_height > maxHeight)) if((pic_width > maxWidth) || (pic_height > maxHeight))
g_PicViewer->rescaleImageDimensions(&pic_width, &pic_height, maxWidth, maxHeight); g_PicViewer->rescaleImageDimensions(&pic_width, &pic_height, maxWidth, maxHeight);
} }
#ifdef DEBUG #ifdef DEBUG
if (pic_width == 0 || pic_height == 0) if (pic_width == 0 || pic_height == 0)
printf("CComponentsPicture: %s file: %s, no icon dimensions found! width = %d, height = %d\n", __FUNCTION__, pic_name.c_str(), pic_width, pic_height); printf("CComponentsPicture: %s file: %s, no icon dimensions found! width = %d, height = %d\n", __FUNCTION__, pic_name.c_str(), pic_width, pic_height);
#endif #endif
pic_x += fr_thickness; pic_x += fr_thickness;
pic_y += fr_thickness; pic_y += fr_thickness;
if (pic_height>0 && pic_width>0){ if (pic_height>0 && pic_width>0){
if (pic_align & CC_ALIGN_LEFT) if (pic_align & CC_ALIGN_LEFT)
pic_x = x+fr_thickness; pic_x = x+fr_thickness;
@@ -753,7 +748,7 @@ void CComponentsPicture::initVarPicture()
pic_x = x+width/2-pic_width/2; pic_x = x+width/2-pic_width/2;
if (pic_align & CC_ALIGN_VER_CENTER) if (pic_align & CC_ALIGN_VER_CENTER)
pic_y = y+height/2-pic_height/2; pic_y = y+height/2-pic_height/2;
do_paint = true; do_paint = true;
} }
@@ -767,7 +762,7 @@ void CComponentsPicture::paint(bool do_save_bg)
initVarPicture(); initVarPicture();
paintInit(do_save_bg); paintInit(do_save_bg);
pic_painted = false; pic_painted = false;
if (do_paint){ if (do_paint){
if (picMode == CC_PIC_ICON) if (picMode == CC_PIC_ICON)
pic_painted = frameBuffer->paintIcon(pic_name, pic_x, pic_y, 0, pic_offset, pic_paint, pic_paintBg, col_body); pic_painted = frameBuffer->paintIcon(pic_name, pic_x, pic_y, 0, pic_offset, pic_paint, pic_paintBg, col_body);
@@ -785,7 +780,7 @@ void CComponentsPicture::hide(bool no_restore)
//------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------
//sub class CComponentsItemBox from CComponentsContainer //sub class CComponentsItemBox from CComponentsItem
CComponentsItemBox::CComponentsItemBox() CComponentsItemBox::CComponentsItemBox()
{ {
//CComponentsItemBox //CComponentsItemBox
@@ -802,8 +797,8 @@ CComponentsItemBox::~CComponentsItemBox()
void CComponentsItemBox::initVarItemBox() void CComponentsItemBox::initVarItemBox()
{ {
//CComponents, CComponentsContainer //CComponents, CComponentsItem
initVarContainer(); initVarItem();
//CComponentsItemBox //CComponentsItemBox
it_col_text = COL_MENUCONTENT; it_col_text = COL_MENUCONTENT;
@@ -986,9 +981,9 @@ void CComponentsItemBox::paintImage(size_t index, bool newElement)
{ {
CComponentsPicture* pic = NULL; CComponentsPicture* pic = NULL;
pic = static_cast<CComponentsPicture*>(v_element_data[index].handler1); pic = static_cast<CComponentsPicture*>(v_element_data[index].handler1);
int pw = 0, ph = 0; int pw = 0, ph = 0;
if ((newElement) || (pic == NULL)) { if ((newElement) || (pic == NULL)) {
if (pic != NULL) { if (pic != NULL) {
pic->hide(); pic->hide();
@@ -1002,7 +997,7 @@ void CComponentsItemBox::paintImage(size_t index, bool newElement)
pic = new CComponentsPicture( v_element_data[index].x, v_element_data[index].y, v_element_data[index].element); pic = new CComponentsPicture( v_element_data[index].x, v_element_data[index].y, v_element_data[index].element);
v_element_data[index].handler1 = (void*)pic; v_element_data[index].handler1 = (void*)pic;
} }
pic->getPictureSize(&pw, &ph); pic->getPictureSize(&pw, &ph);
pic->setHeight(ph); pic->setHeight(ph);
pic->setWidth(pw); pic->setWidth(pw);
@@ -1016,7 +1011,7 @@ void CComponentsItemBox::paintText(size_t index, bool newElement)
//prepare textbox dimension instances //prepare textbox dimension instances
CBox* box = NULL; CBox* box = NULL;
box = static_cast<CBox*>(v_element_data[index].handler1); box = static_cast<CBox*>(v_element_data[index].handler1);
if ((newElement) || (box == NULL)) { if ((newElement) || (box == NULL)) {
if (box != NULL) { if (box != NULL) {
delete box; delete box;
@@ -1025,17 +1020,17 @@ void CComponentsItemBox::paintText(size_t index, bool newElement)
box = new CBox(); box = new CBox();
v_element_data[index].handler1 = (void*)box; v_element_data[index].handler1 = (void*)box;
} }
box->iX = v_element_data[index].x; box->iX = v_element_data[index].x;
box->iY = v_element_data[index].y; box->iY = v_element_data[index].y;
box->iWidth = v_element_data[index].width; box->iWidth = v_element_data[index].width;
box->iHeight = v_element_data[index].height; box->iHeight = v_element_data[index].height;
//prepare text //prepare text
CTextBox* textbox = NULL; CTextBox* textbox = NULL;
textbox = static_cast<CTextBox*>(v_element_data[index].handler2); textbox = static_cast<CTextBox*>(v_element_data[index].handler2);
if ((newElement) || (textbox == NULL)) { if ((newElement) || (textbox == NULL)) {
if (textbox != NULL) { if (textbox != NULL) {
textbox->hide(); textbox->hide();
@@ -1045,13 +1040,13 @@ void CComponentsItemBox::paintText(size_t index, bool newElement)
textbox = new CTextBox(v_element_data[index].element.c_str(), font_text, CTextBox::AUTO_WIDTH|CTextBox::AUTO_HIGH, box, col_body); textbox = new CTextBox(v_element_data[index].element.c_str(), font_text, CTextBox::AUTO_WIDTH|CTextBox::AUTO_HIGH, box, col_body);
v_element_data[index].handler2 = (void*)textbox; v_element_data[index].handler2 = (void*)textbox;
} }
textbox->setTextBorderWidth(0); textbox->setTextBorderWidth(0);
textbox->enableBackgroundPaint(false); textbox->enableBackgroundPaint(false);
textbox->setTextFont(font_text); textbox->setTextFont(font_text);
textbox->movePosition(box->iX, box->iY); textbox->movePosition(box->iX, box->iY);
textbox->setTextColor(it_col_text); textbox->setTextColor(it_col_text);
if (textbox->setText(&v_element_data[index].element)) if (textbox->setText(&v_element_data[index].element))
textbox->paint(); textbox->paint();
} }
@@ -1069,7 +1064,7 @@ void CComponentsItemBox::paintElement(size_t index, bool newElement)
paintText(index,newElement); paintText(index,newElement);
break; break;
case CC_ITEMBOX_CLOCK: case CC_ITEMBOX_CLOCK:
font_text->RenderString(v_element_data[index].x, v_element_data[index].y, v_element_data[index].width, font_text->RenderString(v_element_data[index].x, v_element_data[index].y, v_element_data[index].width,
v_element_data[index].element.c_str(), it_col_text); v_element_data[index].element.c_str(), it_col_text);
break; break;
default: default:
@@ -1275,18 +1270,18 @@ CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const
//CComponentsItemBox //CComponentsItemBox
initVarTitleBar(); initVarTitleBar();
it_col_text = color_text; it_col_text = color_text;
//CComponents //CComponents
x = x_pos; x = x_pos;
y = y_pos; y = y_pos;
height = h; height = h;
width = w; width = w;
col_body = color_body; col_body = color_body;
//CComponentsTitleBar //CComponentsTitleBar
tb_c_text = c_text; tb_c_text = c_text;
tb_icon_name = s_icon; tb_icon_name = s_icon;
initElements(); initElements();
} }
@@ -1296,18 +1291,18 @@ CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const
//CComponentsItemBox //CComponentsItemBox
initVarTitleBar(); initVarTitleBar();
it_col_text = color_text; it_col_text = color_text;
//CComponents //CComponents
x = x_pos; x = x_pos;
y = y_pos; y = y_pos;
height = h; height = h;
width = w; width = w;
col_body = color_body; col_body = color_body;
//CComponentsTitleBar //CComponentsTitleBar
tb_s_text = s_text; tb_s_text = s_text;
tb_icon_name = s_icon; tb_icon_name = s_icon;
initElements(); initElements();
} }
@@ -1317,19 +1312,19 @@ CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const
//CComponentsItemBox //CComponentsItemBox
initVarTitleBar(); initVarTitleBar();
it_col_text = color_text; it_col_text = color_text;
//CComponents //CComponents
x = x_pos; x = x_pos;
y = y_pos; y = y_pos;
height = h; height = h;
width = w; width = w;
col_body = color_body; col_body = color_body;
//CComponentsTitleBar //CComponentsTitleBar
tb_locale_text = locale_text; tb_locale_text = locale_text;
tb_s_text = g_Locale->getText(tb_locale_text); tb_s_text = g_Locale->getText(tb_locale_text);
tb_icon_name = s_icon; tb_icon_name = s_icon;
initElements(); initElements();
} }
@@ -1362,7 +1357,7 @@ void CComponentsTitleBar::initElements()
void CComponentsTitleBar::paint(bool do_save_bg) void CComponentsTitleBar::paint(bool do_save_bg)
{ {
calculateElements(); calculateElements();
paintItemBox(do_save_bg); paintItemBox(do_save_bg);
} }
@@ -1384,9 +1379,9 @@ CComponentsForm::~CComponentsForm()
void CComponentsForm::initVarForm() void CComponentsForm::initVarForm()
{ {
//CComponentsContainer //CComponentsItem
initVarContainer(); initVarItem();
//simple default dimensions //simple default dimensions
x = 0; x = 0;
y = 0; y = 0;
@@ -1410,7 +1405,7 @@ void CComponentsForm::paint(bool do_save_bg)
{ {
//paint body //paint body
paintInit(do_save_bg); paintInit(do_save_bg);
//paint header //paint header
paintHead(); paintHead();
} }
@@ -1420,7 +1415,7 @@ void CComponentsForm::paintHead()
//init header //init header
if (tb == NULL){ if (tb == NULL){
tb = new CComponentsTitleBar(); tb = new CComponentsTitleBar();
//init icon //init icon
if (!tb_icon.empty()) if (!tb_icon.empty())
tb->addIcon(tb_icon, CC_ALIGN_LEFT); tb->addIcon(tb_icon, CC_ALIGN_LEFT);
@@ -1432,7 +1427,7 @@ void CComponentsForm::paintHead()
int tbh = tb->getHeight(); int tbh = tb->getHeight();
tb->setDimensionsAll(x, y, width, tbh); tb->setDimensionsAll(x, y, width, tbh);
} }
//paint titlebar //paint titlebar
tb->paint(CC_SAVE_SCREEN_NO); tb->paint(CC_SAVE_SCREEN_NO);
} }
@@ -1459,7 +1454,7 @@ void CComponentsForm::hide(bool no_restore)
} }
//sub class CComponentsText from CComponentsContainer //sub class CComponentsText from CComponentsItem
CComponentsText::CComponentsText() CComponentsText::CComponentsText()
{ {
//CComponentsText //CComponentsText
@@ -1480,9 +1475,9 @@ CComponentsText::~CComponentsText()
void CComponentsText::initVarText() void CComponentsText::initVarText()
{ {
//CComponents, CComponentsContainer //CComponents, CComponentsItem
initVarContainer(); initVarItem();
//CComponentsText //CComponentsText
ct_font = NULL; ct_font = NULL;
ct_box = NULL; ct_box = NULL;
@@ -1499,11 +1494,11 @@ void CComponentsText::initText()
//set default font, if is no font definied //set default font, if is no font definied
if (ct_font == NULL) if (ct_font == NULL)
ct_font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]; ct_font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL];
//define height and width from font size //define height and width from font size
height = max(height, ct_font->getHeight() ); height = max(height, ct_font->getHeight() );
width = max(width, ct_font->getRenderWidth(ct_text, true) ); width = max(width, ct_font->getRenderWidth(ct_text, true) );
//text box dimensions //text box dimensions
if (ct_box == NULL) if (ct_box == NULL)
ct_box = new CBox(); ct_box = new CBox();
@@ -1511,11 +1506,11 @@ void CComponentsText::initText()
ct_box->iY = y+fr_thickness; ct_box->iY = y+fr_thickness;
ct_box->iWidth = width-2*fr_thickness; ct_box->iWidth = width-2*fr_thickness;
ct_box->iHeight = height-2*fr_thickness; ct_box->iHeight = height-2*fr_thickness;
//init textbox //init textbox
if (ct_textbox == NULL) if (ct_textbox == NULL)
ct_textbox = new CTextBox(ct_text); ct_textbox = new CTextBox(ct_text);
//set text box properties //set text box properties
ct_textbox->setTextBorderWidth(0); ct_textbox->setTextBorderWidth(0);
ct_textbox->enableBackgroundPaint(false); ct_textbox->enableBackgroundPaint(false);
@@ -1523,7 +1518,7 @@ void CComponentsText::initText()
ct_textbox->setTextMode(ct_text_mode); ct_textbox->setTextMode(ct_text_mode);
ct_textbox->movePosition(ct_box->iX, ct_box->iY); ct_textbox->movePosition(ct_box->iX, ct_box->iY);
ct_textbox->setTextColor(ct_col_text); ct_textbox->setTextColor(ct_col_text);
//set text //set text
string new_text = static_cast <string> (ct_text); string new_text = static_cast <string> (ct_text);
ct_text_sended = ct_textbox->setText(&new_text, width); ct_text_sended = ct_textbox->setText(&new_text, width);