From 59723d89f0077cc16ada6a52adfd2673f501b521 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 30 Jan 2014 17:44:07 +0100 Subject: [PATCH] CComponentsIconForm: rework constructors --- src/gui/components/cc_frm_icons.cpp | 32 ++++++++++++++--------------- src/gui/components/cc_frm_icons.h | 15 ++++++++++---- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/src/gui/components/cc_frm_icons.cpp b/src/gui/components/cc_frm_icons.cpp index 1092491f2..aa6b84d92 100644 --- a/src/gui/components/cc_frm_icons.cpp +++ b/src/gui/components/cc_frm_icons.cpp @@ -35,36 +35,34 @@ using namespace std; //sub class CComponentsIconForm inherit from CComponentsForm CComponentsIconForm::CComponentsIconForm() { - initVarIconForm(); + initVarIconForm(1, 1, 0, 0, vector()); } - -CComponentsIconForm::CComponentsIconForm(const int x_pos, const int y_pos, const int w, const int h, const std::vector &v_icon_names, bool has_shadow, - fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +CComponentsIconForm::CComponentsIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h, + const std::vector &v_icon_names, + 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 &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; y = y_pos; width = w; height = h; + v_icons = v_icon_names; shadow = has_shadow; col_frame = color_frame; col_body = color_body; 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_icon_align = CC_ICONS_FRM_ALIGN_LEFT; } diff --git a/src/gui/components/cc_frm_icons.h b/src/gui/components/cc_frm_icons.h index c33755719..83b86c5f8 100644 --- a/src/gui/components/cc_frm_icons.h +++ b/src/gui/components/cc_frm_icons.h @@ -25,7 +25,6 @@ #define __CC_FORM_ICONS_H__ #include "cc_frm.h" -#include "cc_frm_icons.h" class CComponentsIconForm : public CComponentsForm { @@ -35,12 +34,20 @@ class CComponentsIconForm : public CComponentsForm void initMaxHeight(int *pheight); protected: - void initVarIconForm(); + void initVarIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h, + const std::vector &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: CComponentsIconForm(); - CComponentsIconForm(const int x_pos, const int y_pos, const int w, const int h, const std::vector &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( const int &x_pos, const int &y_pos, const int &w, const int &h, + const std::vector &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 void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);