mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 00:41:17 +02:00
CComponents: paint picture in Infobox
This commit is contained in:
@@ -162,6 +162,30 @@ class CComponentsContainer : public CComponents
|
|||||||
virtual void syncSysColors();
|
virtual void syncSysColors();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CComponentsPicture : public CComponentsContainer
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
std::string pic_name;
|
||||||
|
unsigned char pic_offset;
|
||||||
|
bool pic_paint, pic_paintBg, pic_painted, do_paint;
|
||||||
|
int pic_align, pic_x, pic_y, pic_width, pic_height;
|
||||||
|
|
||||||
|
void initDimensions();
|
||||||
|
|
||||||
|
public:
|
||||||
|
CComponentsPicture( const int x_pos, const int y_pos, const std::string& picture_name, const int alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER, bool has_shadow = CC_SHADOW_OFF,
|
||||||
|
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_background = 0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||||
|
void setPictureOffset(const unsigned char offset){pic_offset = offset;};
|
||||||
|
void setPicturePaint(bool paint_p){pic_paint = paint_p;};
|
||||||
|
void setPicturePaintBackground(bool paintBg){pic_paintBg = paintBg;};
|
||||||
|
void setPicture(const std::string& picture_name);
|
||||||
|
void setPictureAlign(const int alignment);
|
||||||
|
|
||||||
|
bool isPainted(){return pic_painted;};
|
||||||
|
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
||||||
|
void getPictureSize(int *pwidth, int *pheight){*pwidth=pic_width; *pheight=pic_height;};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
#define INFO_BOX_Y_OFFSET 2
|
#define INFO_BOX_Y_OFFSET 2
|
||||||
class CComponentsInfoBox : public CComponentsContainer
|
class CComponentsInfoBox : public CComponentsContainer
|
||||||
@@ -169,29 +193,35 @@ class CComponentsInfoBox : public CComponentsContainer
|
|||||||
private:
|
private:
|
||||||
const char* text;
|
const char* text;
|
||||||
int text_mode; //see textbox.h for possible modes
|
int text_mode; //see textbox.h for possible modes
|
||||||
|
int x_text;
|
||||||
Font* font;
|
Font* font;
|
||||||
CBox * box;
|
CBox * box;
|
||||||
CTextBox * textbox;
|
CTextBox * textbox;
|
||||||
|
CComponentsPicture * pic;
|
||||||
|
|
||||||
|
void paintPicture();
|
||||||
void paintText();
|
void paintText();
|
||||||
void initVarInfobox();
|
void initVarInfobox();
|
||||||
|
std::string pic_name;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h,
|
CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h,
|
||||||
const char* info_text = NULL, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL,
|
const char* info_text = NULL, const int mode = CTextBox::AUTO_WIDTH | CTextBox::AUTO_HIGH, Font* font_text = NULL,
|
||||||
bool has_shadow = CC_SHADOW_OFF,
|
bool has_shadow = CC_SHADOW_OFF,
|
||||||
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);
|
||||||
|
|
||||||
~CComponentsInfoBox();
|
~CComponentsInfoBox();
|
||||||
|
|
||||||
void setText(const char* info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text; text_mode = mode, font = font_text;};
|
void setText(const char* info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text; text_mode = mode, font = font_text;};
|
||||||
void setText(const std::string info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text.c_str(); text_mode = mode, font = font_text;};
|
void setText(const std::string& info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text.c_str(); text_mode = mode, font = font_text;};
|
||||||
void setText(neutrino_locale_t locale_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL);
|
void setText(neutrino_locale_t locale_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL);
|
||||||
void setTextMode(const int mode){text_mode = mode;};
|
void setTextMode(const int mode){text_mode = mode;};
|
||||||
void setTextFont(Font* font_text){font = font_text;};
|
void setTextFont(Font* font_text){font = font_text;};
|
||||||
|
void setPicture(const std::string& picture_name){pic_name = picture_name;};
|
||||||
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class CComponentsShapeCircle : public CComponentsContainer
|
class CComponentsShapeCircle : public CComponentsContainer
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@@ -242,29 +272,4 @@ class CComponentsDetailLine : public CComponents
|
|||||||
void setHMarkDown(const int& h_mark_down_){h_mark_down = h_mark_down_;};
|
void setHMarkDown(const int& h_mark_down_){h_mark_down = h_mark_down_;};
|
||||||
};
|
};
|
||||||
|
|
||||||
class CComponentsPicture : public CComponentsContainer
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
std::string pic_name;
|
|
||||||
unsigned char pic_offset;
|
|
||||||
bool pic_paint, pic_paintBg, pic_painted, do_paint;
|
|
||||||
int pic_align, pic_x, pic_y, pic_width, pic_height;
|
|
||||||
|
|
||||||
void initDimensions();
|
|
||||||
|
|
||||||
public:
|
|
||||||
CComponentsPicture( const int x_pos, const int y_pos, const std::string& picture_name, const int alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER, bool has_shadow = CC_SHADOW_OFF,
|
|
||||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_background = 0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
|
||||||
void setPictureOffset(const unsigned char offset){pic_offset = offset;};
|
|
||||||
void setPicturePaint(bool paint_p){pic_paint = paint_p;};
|
|
||||||
void setPicturePaintBackground(bool paintBg){pic_paintBg = paintBg;};
|
|
||||||
void setPicture(const std::string& picture_name);
|
|
||||||
void setPictureAlign(const int alignment);
|
|
||||||
|
|
||||||
bool isPainted(){return pic_painted;};
|
|
||||||
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
|
||||||
void getPictureSize(int *pwidth, int *pheight){*pwidth=pic_width; *pheight=pic_height;};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -291,6 +291,7 @@ CComponentsInfoBox::~CComponentsInfoBox()
|
|||||||
// delete[] saved_screen.pixbuf;
|
// delete[] saved_screen.pixbuf;
|
||||||
delete textbox;
|
delete textbox;
|
||||||
delete box;
|
delete box;
|
||||||
|
delete pic;
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -309,6 +310,9 @@ void CComponentsInfoBox::initVarInfobox()
|
|||||||
//CComponentsInfoBox
|
//CComponentsInfoBox
|
||||||
box = NULL;
|
box = NULL;
|
||||||
textbox = NULL;
|
textbox = NULL;
|
||||||
|
pic = NULL;
|
||||||
|
pic_name = "";
|
||||||
|
x_text = x;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,9 +323,22 @@ void CComponentsInfoBox::setText(neutrino_locale_t locale_text, int mode, Font*
|
|||||||
font = font_text;
|
font = font_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CComponentsInfoBox::paintPicture()
|
||||||
|
{
|
||||||
|
if (pic == NULL)
|
||||||
|
pic = new CComponentsPicture(x+fr_thickness+corner_rad, y+fr_thickness+corner_rad, "");
|
||||||
|
pic->setPicture(pic_name);
|
||||||
|
int pic_w = pic->getWidth();
|
||||||
|
pic->setHeight(height-2*fr_thickness-2*corner_rad);
|
||||||
|
pic->setColorBody(col_body);
|
||||||
|
pic->paint();
|
||||||
|
if (pic->isPainted())
|
||||||
|
x_text = x+fr_thickness+pic_w+corner_rad;
|
||||||
|
}
|
||||||
|
|
||||||
void CComponentsInfoBox::paintText()
|
void CComponentsInfoBox::paintText()
|
||||||
{
|
{
|
||||||
box = new CBox( x+fr_thickness, y+fr_thickness, width-2*fr_thickness, height-2*fr_thickness);
|
box = new CBox( x_text+fr_thickness, y+fr_thickness, width-2*fr_thickness-(x_text-x), height-2*fr_thickness);
|
||||||
textbox = new CTextBox(text, font, text_mode, box, col_body);
|
textbox = new CTextBox(text, font, text_mode, box, col_body);
|
||||||
textbox->enableBackgroundPaint(false);
|
textbox->enableBackgroundPaint(false);
|
||||||
textbox->paint();
|
textbox->paint();
|
||||||
@@ -330,6 +347,7 @@ void CComponentsInfoBox::paintText()
|
|||||||
void CComponentsInfoBox::paint(bool do_save_bg)
|
void CComponentsInfoBox::paint(bool do_save_bg)
|
||||||
{
|
{
|
||||||
paintInit(do_save_bg);
|
paintInit(do_save_bg);
|
||||||
|
paintPicture();
|
||||||
if (text != NULL)
|
if (text != NULL)
|
||||||
paintText();
|
paintText();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user