diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index 3f3b45c6d..6802476d3 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -41,18 +41,19 @@ using namespace std; -CComponentsFrmClock::CComponentsFrmClock() -{ - initVarClock(); -} -CComponentsFrmClock::CComponentsFrmClock( const int x_pos, const int y_pos, const int w, const int h, +CComponentsFrmClock::CComponentsFrmClock( const int& x_pos, const int& y_pos, const int& w, const int& h, const char* format_str, bool activ, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - initVarClock(); + initVarClock(x_pos, y_pos, w, h, format_str, activ, has_shadow, color_frame, color_body, color_shadow); +} +void CComponentsFrmClock::initVarClock( const int& x_pos, const int& y_pos, const int& w, const int& h, + const char* format_str, bool activ, bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +{ x = x_pos; y = y_pos; width = w; @@ -63,15 +64,6 @@ CComponentsFrmClock::CComponentsFrmClock( const int x_pos, const int y_pos, cons col_body = color_body; col_shadow = color_shadow; - cl_format_str = format_str; - paintClock = false; - activeClock = activ; - if (activeClock) - startThread(); -} - -void CComponentsFrmClock::initVarClock() -{ cc_item_type = CC_ITEMTYPE_FRM_CLOCK; corner_rad = RADIUS_SMALL; @@ -80,7 +72,7 @@ void CComponentsFrmClock::initVarClock() dyn_font_size = 0; cl_col_text = COL_MENUCONTENT_TEXT; - cl_format_str = "%H:%M"; + cl_format_str = format_str; cl_align = CC_ALIGN_VER_CENTER | CC_ALIGN_HOR_CENTER; cl_thread = 0; @@ -88,6 +80,11 @@ void CComponentsFrmClock::initVarClock() activeClock = true; cl_blink_str = ""; + paintClock = false; + + activeClock = activ; + if (activeClock) + startThread(); } CComponentsFrmClock::~CComponentsFrmClock() diff --git a/src/gui/components/cc_frm_clock.h b/src/gui/components/cc_frm_clock.h index 44fd7ffe0..d08336310 100644 --- a/src/gui/components/cc_frm_clock.h +++ b/src/gui/components/cc_frm_clock.h @@ -78,7 +78,9 @@ class CComponentsFrmClock : public CComponentsForm int cl_align; ///initialize all attributes and required objects - void initVarClock(); + void initVarClock( const int& x_pos, const int& y_pos, const int& w, const int& h, + const char* format_str, bool activ, bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow); ///initialize clock contents void initCCLockItems(); @@ -91,8 +93,7 @@ class CComponentsFrmClock : public CComponentsForm inline Font** getClockFont(); public: - CComponentsFrmClock(); - CComponentsFrmClock( const int x_pos, const int y_pos, const int w, const int h, + CComponentsFrmClock( const int& x_pos = 1, const int& y_pos = 1, const int& w = 200, const int& h = 48, const char* format_str = "%H:%M", bool activ=true, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); virtual ~CComponentsFrmClock();