CComponentsInfoBox: inherit setTextFont and setTextMode

This commit is contained in:
2012-10-24 16:26:54 +02:00
parent c4ef839ad4
commit ac94ad0d3b
2 changed files with 11 additions and 12 deletions

View File

@@ -224,16 +224,15 @@ class CComponentsText : public CComponentsItem
Font * ct_font; Font * ct_font;
fb_pixel_t ct_col_text; fb_pixel_t ct_col_text;
int ct_text_mode; //see textbox.h for possible modes
void initVarText(); void initVarText();
void clearCCText(); void clearCCText();
private: private:
const char* ct_text; const char* ct_text;
int ct_text_mode; //see textbox.h for possible modes
bool ct_text_sended; bool ct_text_sended;
void initCCText(); void initCCText();
public: public:
@@ -244,8 +243,9 @@ class CComponentsText : public CComponentsItem
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);
inline void setTextFont(Font* font_text){ct_font = font_text;}; virtual inline void setTextFont(Font* font_text){ct_font = font_text;};
virtual inline void setTextColor(fb_pixel_t color_text){ ct_col_text = color_text;}; virtual inline void setTextColor(fb_pixel_t color_text){ ct_col_text = color_text;};
virtual inline void setTextMode(const int mode){ct_text_mode = mode;};//see textbox.h for possible modes
}; };
#define INFO_BOX_Y_OFFSET 2 #define INFO_BOX_Y_OFFSET 2
@@ -253,7 +253,6 @@ class CComponentsInfoBox : public CComponentsText
{ {
private: private:
const char* text; const char* text;
int text_mode; //see textbox.h for possible modes
int x_text, x_offset; int x_text, x_offset;
CComponentsPicture * pic; CComponentsPicture * pic;
@@ -273,11 +272,11 @@ class CComponentsInfoBox : public CComponentsText
~CComponentsInfoBox(); ~CComponentsInfoBox();
inline void setText(const char* info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text; text_mode = mode, ct_font = font_text;}; inline void setText(const char* info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text; ct_text_mode = mode, ct_font = font_text;};
inline 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, ct_font = font_text;}; inline void setText(const std::string& info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text.c_str(); ct_text_mode = mode, ct_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);
inline void setTextMode(const int mode){text_mode = mode;};//see textbox.h for possible modes // inline void setTextMode(const int mode){text_mode = mode;};//see textbox.h for possible modes
inline void setTextFont(Font* font_text){ct_font = font_text;}; // inline void setTextFont(Font* font_text){ct_font = font_text;};
// inline void setTextColor(fb_pixel_t color_text){ ibox_col_text = color_text;}; // inline void setTextColor(fb_pixel_t color_text){ ibox_col_text = color_text;};
inline void setSpaceOffset(const int offset){x_offset = offset;}; inline void setSpaceOffset(const int offset){x_offset = offset;};
inline void setPicture(const std::string& picture_name){pic_name = picture_name;}; inline void setPicture(const std::string& picture_name){pic_name = picture_name;};

View File

@@ -367,7 +367,7 @@ CComponentsInfoBox::CComponentsInfoBox()
//CComponentsInfoBox //CComponentsInfoBox
initVarInfobox(); initVarInfobox();
text = NULL; text = NULL;
text_mode = CTextBox::AUTO_WIDTH; ct_text_mode = CTextBox::AUTO_WIDTH;
} }
CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const int w, const int h, CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const int w, const int h,
@@ -390,7 +390,7 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i
//CComponentsInfoBox //CComponentsInfoBox
initVarInfobox(); initVarInfobox();
text = info_text; text = info_text;
text_mode = mode; ct_text_mode = mode;
ct_font = font_text; ct_font = font_text;
ct_col_text = color_text; ct_col_text = color_text;
} }
@@ -420,7 +420,7 @@ void CComponentsInfoBox::initVarInfobox()
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)
{ {
text = g_Locale->getText(locale_text); text = g_Locale->getText(locale_text);
text_mode = mode; ct_text_mode = mode;
ct_font = font_text; ct_font = font_text;
} }
@@ -456,7 +456,7 @@ void CComponentsInfoBox::paintText()
//init textbox //init textbox
if (ct_textbox == NULL) { if (ct_textbox == NULL) {
ct_textbox = new CTextBox(text, ct_font, text_mode, ct_box, col_body); ct_textbox = new CTextBox(text, ct_font, ct_text_mode, ct_box, col_body);
ct_textbox->setTextBorderWidth(0); ct_textbox->setTextBorderWidth(0);
ct_textbox->enableBackgroundPaint(false); ct_textbox->enableBackgroundPaint(false);
} }