CComponentsIconForm: rework constructors

This commit is contained in:
2014-01-30 17:44:07 +01:00
parent 7151608c8b
commit 59723d89f0
2 changed files with 26 additions and 21 deletions

View File

@@ -35,36 +35,34 @@ using namespace std;
//sub class CComponentsIconForm inherit from CComponentsForm //sub class CComponentsIconForm inherit from CComponentsForm
CComponentsIconForm::CComponentsIconForm() CComponentsIconForm::CComponentsIconForm()
{ {
initVarIconForm(); initVarIconForm(1, 1, 0, 0, vector<string>());
} }
CComponentsIconForm::CComponentsIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h,
CComponentsIconForm::CComponentsIconForm(const int x_pos, const int y_pos, const int w, const int h, const std::vector<std::string> &v_icon_names, bool has_shadow, const std::vector<std::string> &v_icon_names,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) bool has_shadow,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
{ {
initVarIconForm(); initVarIconForm(x_pos, y_pos, w, h, v_icon_names, has_shadow, color_frame, color_body, color_shadow);
}
void CComponentsIconForm::initVarIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h,
const std::vector<std::string> &v_icon_names,
bool has_shadow,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
{
cc_item_type = CC_ITEMTYPE_FRM_ICONFORM;
x = x_pos; x = x_pos;
y = y_pos; y = y_pos;
width = w; width = w;
height = h; height = h;
v_icons = v_icon_names;
shadow = has_shadow; shadow = has_shadow;
col_frame = color_frame; col_frame = color_frame;
col_body = color_body; col_body = color_body;
col_shadow = color_shadow; col_shadow = color_shadow;
v_icons = v_icon_names;
}
void CComponentsIconForm::initVarIconForm()
{
cc_item_type = CC_ITEMTYPE_FRM_ICONFORM;
//set default width and height to 0, this causes a dynamic adaptation of width and height of form
width = 0;
height = 0;
v_icons.clear();
ccif_offset = 2; ccif_offset = 2;
ccif_icon_align = CC_ICONS_FRM_ALIGN_LEFT; ccif_icon_align = CC_ICONS_FRM_ALIGN_LEFT;
} }

View File

@@ -25,7 +25,6 @@
#define __CC_FORM_ICONS_H__ #define __CC_FORM_ICONS_H__
#include "cc_frm.h" #include "cc_frm.h"
#include "cc_frm_icons.h"
class CComponentsIconForm : public CComponentsForm class CComponentsIconForm : public CComponentsForm
{ {
@@ -35,12 +34,20 @@ class CComponentsIconForm : public CComponentsForm
void initMaxHeight(int *pheight); void initMaxHeight(int *pheight);
protected: protected:
void initVarIconForm(); void initVarIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h,
const std::vector<std::string> &v_icon_names,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
fb_pixel_t color_body = COL_MENUHEAD_PLUS_0,
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
public: public:
CComponentsIconForm(); CComponentsIconForm();
CComponentsIconForm(const int x_pos, const int y_pos, const int w, const int h, const std::vector<std::string> &v_icon_names, bool has_shadow = CC_SHADOW_OFF, CComponentsIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); const std::vector<std::string> &v_icon_names,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
// ~CComponentsIconForm(); //inherited from CComponentsForm // ~CComponentsIconForm(); //inherited from CComponentsForm
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);