mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 08:51:10 +02:00
CComponentsExtTextForm: use inherited class for localized version
Removed simple constructor and used default values in constructor has same effect, this reduces some code parts. Usage is unchanged.
This commit is contained in:
@@ -364,27 +364,17 @@ class CComponentsExtTextForm : public CComponentsForm
|
||||
|
||||
protected:
|
||||
///initialize basic variables
|
||||
void initVarExtTextForm(const int x_pos = 1, const int y_pos = 1, const int w = 300, const int h = 27,
|
||||
bool has_shadow = CC_SHADOW_OFF,
|
||||
fb_pixel_t label_color = COL_MENUCONTENTINACTIVE_TEXT,
|
||||
fb_pixel_t text_color = 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);
|
||||
void initVarExtTextForm(const int& x_pos, const int& y_pos, const int& w, const int& h,
|
||||
const std::string& label_text, const std::string& text,
|
||||
bool has_shadow,
|
||||
fb_pixel_t label_color,
|
||||
fb_pixel_t text_color,
|
||||
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow);
|
||||
|
||||
public:
|
||||
///simple constructor for CComponentsExtTextForm
|
||||
CComponentsExtTextForm();
|
||||
|
||||
///advanced constructor for CComponentsExtTextForm, provides parameters for the most required properties, and caption as string
|
||||
CComponentsExtTextForm( const int x_pos, const int y_pos, const int w, const int h,
|
||||
const std::string& label_text, const std::string& text,
|
||||
bool has_shadow = CC_SHADOW_OFF,
|
||||
fb_pixel_t label_color = COL_MENUCONTENTINACTIVE_TEXT,
|
||||
fb_pixel_t text_color = 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);
|
||||
|
||||
///advanced constructor for CComponentsExtTextForm, provides parameters for the most required properties, and caption as locales
|
||||
CComponentsExtTextForm( const int x_pos, const int y_pos, const int w, const int h,
|
||||
const neutrino_locale_t& locale_label_text, const neutrino_locale_t& locale_text,
|
||||
CComponentsExtTextForm( const int& x_pos = 1, const int& y_pos = 1, const int& w = 300, const int& h = 48,
|
||||
const std::string& label_text = "", const std::string& text = "",
|
||||
bool has_shadow = CC_SHADOW_OFF,
|
||||
fb_pixel_t label_color = COL_MENUCONTENTINACTIVE_TEXT,
|
||||
fb_pixel_t text_color = COL_MENUCONTENT_TEXT,
|
||||
@@ -421,4 +411,16 @@ class CComponentsExtTextForm : public CComponentsForm
|
||||
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
||||
};
|
||||
|
||||
class CComponentsExtTextFormLocalized : public CComponentsExtTextForm
|
||||
{
|
||||
public:
|
||||
///advanced constructor for CComponentsExtTextForm, provides parameters for the most required properties, and caption as locales
|
||||
CComponentsExtTextFormLocalized(const int& x_pos = 1, const int& y_pos = 1, const int& w = 300, const int& h = 48,
|
||||
const neutrino_locale_t& locale_label_text = NONEXISTANT_LOCALE, const neutrino_locale_t& locale_text = NONEXISTANT_LOCALE,
|
||||
bool has_shadow = CC_SHADOW_OFF,
|
||||
fb_pixel_t label_color = COL_MENUCONTENTINACTIVE_TEXT,
|
||||
fb_pixel_t text_color = 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);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -34,44 +34,33 @@
|
||||
|
||||
#define DEF_HEIGHT 27
|
||||
#define DEF_LABEL_WIDTH_PERCENT 30
|
||||
#define DEF_WIDTH 300
|
||||
|
||||
using namespace std;
|
||||
|
||||
CComponentsExtTextForm::CComponentsExtTextForm()
|
||||
{
|
||||
initVarExtTextForm();
|
||||
initCCTextItems();
|
||||
}
|
||||
|
||||
CComponentsExtTextForm::CComponentsExtTextForm( const int x_pos, const int y_pos, const int w, const int h,
|
||||
CComponentsExtTextForm::CComponentsExtTextForm( const int& x_pos, const int& y_pos, const int& w, const int& h,
|
||||
const std::string& label_text, const std::string& text,
|
||||
bool has_shadow,
|
||||
fb_pixel_t label_color,
|
||||
fb_pixel_t text_color,
|
||||
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
||||
{
|
||||
initVarExtTextForm(x_pos, y_pos, w, h, has_shadow, label_color, text_color, color_frame, color_body, color_shadow);
|
||||
ccx_label_text = label_text;
|
||||
ccx_text = text;
|
||||
initVarExtTextForm(x_pos, y_pos, w, h, label_text, text, has_shadow, label_color, text_color, color_frame, color_body, color_shadow);
|
||||
initCCTextItems();
|
||||
}
|
||||
|
||||
CComponentsExtTextForm::CComponentsExtTextForm( const int x_pos, const int y_pos, const int w, const int h,
|
||||
const neutrino_locale_t& locale_label_text, const neutrino_locale_t& locale_text,
|
||||
bool has_shadow,
|
||||
fb_pixel_t label_color,
|
||||
fb_pixel_t text_color,
|
||||
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
||||
{
|
||||
initVarExtTextForm(x_pos, y_pos, w, h, has_shadow, label_color, text_color, color_frame, color_body, color_shadow);
|
||||
ccx_label_text = g_Locale->getText(locale_label_text);
|
||||
ccx_text = g_Locale->getText(locale_text);
|
||||
CComponentsExtTextFormLocalized::CComponentsExtTextFormLocalized(const int& x_pos, const int& y_pos, const int& w, const int& h,
|
||||
const neutrino_locale_t& locale_label_text, const neutrino_locale_t& locale_text,
|
||||
bool has_shadow,
|
||||
fb_pixel_t label_color,
|
||||
fb_pixel_t text_color,
|
||||
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
||||
: CComponentsExtTextForm( x_pos, y_pos, w, h,
|
||||
g_Locale->getText(locale_label_text), g_Locale->getText(locale_text),
|
||||
has_shadow,
|
||||
label_color, text_color, color_frame, color_body, color_shadow){};
|
||||
|
||||
initCCTextItems();
|
||||
}
|
||||
|
||||
void CComponentsExtTextForm::initVarExtTextForm(const int x_pos, const int y_pos, const int w, const int h,
|
||||
void CComponentsExtTextForm::initVarExtTextForm(const int& x_pos, const int& y_pos, const int& w, const int& h,
|
||||
const std::string& label_text, const std::string& text,
|
||||
bool has_shadow,
|
||||
fb_pixel_t label_color,
|
||||
fb_pixel_t text_color,
|
||||
@@ -90,8 +79,8 @@ void CComponentsExtTextForm::initVarExtTextForm(const int x_pos, const int y_pos
|
||||
|
||||
height = h;
|
||||
|
||||
ccx_label_text = "";
|
||||
ccx_text = "";
|
||||
ccx_label_text = label_text;
|
||||
ccx_text = text;
|
||||
shadow = has_shadow;
|
||||
ccx_label_color = label_color;
|
||||
ccx_text_color = text_color;
|
||||
|
Reference in New Issue
Block a user