diff --git a/src/gui/buildinfo.cpp b/src/gui/buildinfo.cpp index 5bbadcbe5..3cc1ed0b9 100644 --- a/src/gui/buildinfo.cpp +++ b/src/gui/buildinfo.cpp @@ -174,11 +174,10 @@ void CBuildInfo::InitInfoItems() //init info texts for(size_t i=0; igetText(v_info[i].caption), v_info[i].info_text); + CComponentsExtTextForm *info = new CComponentsExtTextForm(10, CC_APPEND, w_info, h_info, g_Locale->getText(v_info[i].caption), v_info[i].info_text, ccw_body); info->setLabelAndTextFont(font); info->setTextModes(CTextBox::TOP , CTextBox::AUTO_HIGH | CTextBox::TOP | CTextBox::AUTO_LINEBREAK_NO_BREAKCHARS); info->doPaintBg(false); - ccw_body->addCCItem(info); } } diff --git a/src/gui/components/cc_base.cpp b/src/gui/components/cc_base.cpp index 2e8a06b82..f140cf0ad 100644 --- a/src/gui/components/cc_base.cpp +++ b/src/gui/components/cc_base.cpp @@ -36,25 +36,6 @@ using namespace std; //abstract basic class CComponents CComponents::CComponents() -{ - initVarBasic(); -} - -CComponents::~CComponents() -{ - hide(); - clearSavedScreen(); - clearFbData(); -} - -void CComponents::clearSavedScreen() -{ - if (saved_screen.pixbuf) - delete[] saved_screen.pixbuf; - saved_screen.pixbuf = NULL; -} - -void CComponents::initVarBasic() { x = saved_screen.x = 0; y = saved_screen.y = 0; @@ -73,7 +54,7 @@ void CComponents::initVarBasic() shadow_w = SHADOW_OFFSET; fr_thickness = 0; fr_thickness_sel = 3; - + firstPaint = true; is_painted = false; paint_bg = true; @@ -83,6 +64,20 @@ void CComponents::initVarBasic() saved_screen.pixbuf = NULL; } +CComponents::~CComponents() +{ + hide(); + clearSavedScreen(); + clearFbData(); +} + +void CComponents::clearSavedScreen() +{ + if (saved_screen.pixbuf) + delete[] saved_screen.pixbuf; + saved_screen.pixbuf = NULL; +} + bool CComponents::CheckFbData(const comp_fbdata_t& fbdata) { if ( (fbdata.x <= 0 || fbdata.y <= 0) || diff --git a/src/gui/components/cc_base.h b/src/gui/components/cc_base.h index 5bb3741ca..4abd9cb1b 100644 --- a/src/gui/components/cc_base.h +++ b/src/gui/components/cc_base.h @@ -33,8 +33,6 @@ #include #include - - /// Basic component class. /*! Basic attributes and member functions for component sub classes @@ -45,9 +43,7 @@ class CComponents private: ///pixel buffer handling, returns pixel buffer depends of given parameters fb_pixel_t* getScreen(int ax, int ay, int dx, int dy); - ///initialize of basic attributes, no parameters required - void initVarBasic(); - + protected: ///object: framebuffer object, usable in all sub classes CFrameBuffer * frameBuffer; @@ -221,9 +217,6 @@ class CComponents class CComponentsItem : public CComponents { - private: - ///initialize all required attributes - void initVarItem(); protected: ///property: define of item type, see cc_types.h for possible types int cc_item_type; @@ -238,7 +231,7 @@ class CComponentsItem : public CComponents ///Pointer to the form object in which this item is embedded. ///Is typically the type CComponentsForm or derived classes, default intialized with NULL - CComponentsItem *cc_parent; + CComponentsForm *cc_parent; ///hides item, arg: no_restore=true causes no restore of background, but clean up pixel buffer if required void hideCCItem(bool no_restore = false); @@ -250,14 +243,17 @@ class CComponentsItem : public CComponents ///an item will be hide or overpainted with other methods, or it's embedded (bound) in a parent form. void paintInit(bool do_save_bg); + ///add "this" current item to parent + void initParent(CComponentsForm* parent); + public: - CComponentsItem(); + CComponentsItem(CComponentsForm *parent = NULL); ///sets pointer to the form object in which this item is embedded. - virtual void setParent(CComponentsItem *parent){cc_parent = parent;}; + virtual void setParent(CComponentsForm *parent){cc_parent = parent;}; ///returns pointer to the form object in which this item is embedded. - virtual CComponentsItem * getParent(){return cc_parent;}; + virtual CComponentsForm* getParent(){return cc_parent;}; ///property: returns true if item is added to a form virtual bool isAdded(); diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 37bda8853..25ed839a4 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -36,19 +36,16 @@ using namespace std; //------------------------------------------------------------------------------------------------------- //sub class CComponentsForm from CComponentsItem -CComponentsForm::CComponentsForm() +CComponentsForm::CComponentsForm( const int x_pos, const int y_pos, const int w, const int h, + CComponentsForm* parent, + bool has_shadow, + fb_pixel_t color_frame, + fb_pixel_t color_body, + fb_pixel_t color_shadow) + :CComponentsItem(parent) { - //CComponentsForm - initVarForm(); -} + cc_item_type = CC_ITEMTYPE_FRM; -CComponentsForm::CComponentsForm(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow, - fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) -{ - //CComponentsForm - initVarForm(); - - //CComponents x = x_pos; y = y_pos; cc_xr = x; @@ -60,6 +57,16 @@ CComponentsForm::CComponentsForm(const int x_pos, const int y_pos, const int w, col_frame = color_frame; col_body = color_body; col_shadow = color_shadow; + + shadow_w = SHADOW_OFFSET; + corner_rad = RADIUS_LARGE; + corner_type = CORNER_ALL; + cc_item_index = 0; + + v_cc_items.clear(); + + append_x_offset = 0; + append_y_offset = 0; } CComponentsForm::~CComponentsForm() @@ -89,31 +96,6 @@ void CComponentsForm::clear() } -void CComponentsForm::initVarForm() -{ - - - //simple default dimensions - x = 0; - y = 0; - width = 150; - height = 150; - shadow = CC_SHADOW_OFF; - shadow_w = SHADOW_OFFSET; - col_frame = COL_MENUCONTENT_PLUS_6; - col_body = COL_MENUCONTENT_PLUS_0; - col_shadow = COL_MENUCONTENTDARK_PLUS_0; - corner_rad = RADIUS_LARGE; - corner_type = CORNER_ALL; - cc_item_index = 0; - - //CComponentsForm - v_cc_items.clear(); - cc_item_type = CC_ITEMTYPE_FRM; - append_x_offset = 0; - append_y_offset = 0; -} - void CComponentsForm::addCCItem(CComponentsItem* cc_Item) { if (cc_Item){ @@ -177,7 +159,7 @@ void CComponentsForm::replaceCCItem(const uint& cc_item_id, CComponentsItem* new if (!v_cc_items.empty()){ CComponentsItem* old_Item = v_cc_items[cc_item_id]; if (old_Item){ - CComponentsItem * old_parent = old_Item->getParent(); + CComponentsForm * old_parent = old_Item->getParent(); new_cc_Item->setParent(old_parent); new_cc_Item->setIndex(old_parent->getIndex()); delete old_Item; diff --git a/src/gui/components/cc_frm.h b/src/gui/components/cc_frm.h index d532cdbfc..fc5b21dcd 100644 --- a/src/gui/components/cc_frm.h +++ b/src/gui/components/cc_frm.h @@ -31,8 +31,6 @@ class CComponentsForm : public CComponentsItem { - private: - void initVarForm(); protected: std::vector v_cc_items; void paintForm(bool do_save_bg); @@ -42,10 +40,12 @@ class CComponentsForm : public CComponentsItem int append_x_offset; int append_y_offset; public: - - CComponentsForm(); - CComponentsForm(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = CC_SHADOW_OFF, - 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); + CComponentsForm( const int x_pos = 0, const int y_pos = 0, const int w = 800, const int h = 600, + CComponentsForm *parent = NULL, + bool has_shadow = CC_SHADOW_OFF, + 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); virtual ~CComponentsForm(); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); diff --git a/src/gui/components/cc_frm_button.cpp b/src/gui/components/cc_frm_button.cpp index 005455d5a..69d25ed65 100644 --- a/src/gui/components/cc_frm_button.cpp +++ b/src/gui/components/cc_frm_button.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' License: GPL @@ -37,41 +37,41 @@ using namespace std; -CComponentsButton::CComponentsButton( const int x_pos, const int y_pos, const int w, const int h, +CComponentsButton::CComponentsButton( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption, const std::string& icon_name, - bool selected, bool enabled, bool has_shadow, + CComponentsForm* parent, + bool selected, + bool enabled, + bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - initVarButton(); - cc_btn_icon = icon_name; - cc_btn_capt = caption; - cc_btn_capt_col = COL_MENUCONTENT_TEXT; - - x = x_pos; - y = y_pos; - width = w; - height = h; - shadow = has_shadow; - shadow_w = SHADOW_OFFSET; - col_frame = color_frame; - col_body = color_body; - col_shadow = color_shadow; - cc_item_enabled = enabled; - cc_item_selected = selected; - fr_thickness = FRAME_TH; + cc_btn_capt_locale = NONEXISTANT_LOCALE; + initVarButton(x_pos, y_pos, w, h, caption, icon_name, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow); } -CComponentsButton::CComponentsButton( const int x_pos, const int y_pos, const int w, const int h, +CComponentsButton::CComponentsButton( const int& x_pos, const int& y_pos, const int& w, const int& h, const neutrino_locale_t& caption_locale, const std::string& icon_name, - bool selected, bool enabled, bool has_shadow, + CComponentsForm* parent, + bool selected, + bool enabled, + bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - initVarButton(); - cc_btn_icon = icon_name; cc_btn_capt_locale = caption_locale; - cc_btn_capt = g_Locale->getText(cc_btn_capt_locale); - cc_btn_capt_col = COL_MENUCONTENT_TEXT; - + initVarButton(x_pos, y_pos, w, h, g_Locale->getText(cc_btn_capt_locale), icon_name, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow); +} + +void CComponentsButton::initVarButton( const int& x_pos, const int& y_pos, const int& w, const int& h, + const std::string& caption, + const std::string& icon_name, + CComponentsForm* parent, + bool selected, + bool enabled, + bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +{ + cc_item_type = CC_ITEMTYPE_BUTTON; + x = x_pos; y = y_pos; width = w; @@ -84,18 +84,16 @@ CComponentsButton::CComponentsButton( const int x_pos, const int y_pos, const i cc_item_enabled = enabled; cc_item_selected = selected; fr_thickness = FRAME_TH; -} - -void CComponentsButton::initVarButton() -{ - cc_item_type = CC_ITEMTYPE_BUTTON; + + cc_btn_capt_col = COL_MENUCONTENT_TEXT; cc_btn_icon_obj = NULL; cc_btn_capt_obj = NULL; cc_btn_dy_font = CNeutrinoFonts::getInstance(); cc_btn_font = NULL; - cc_btn_icon = ""; - cc_btn_capt = ""; - cc_btn_capt_locale = NONEXISTANT_LOCALE; + cc_btn_icon = icon_name; + cc_btn_capt = caption; + + initParent(parent); } void CComponentsButton::initIcon() @@ -195,7 +193,7 @@ void CComponentsButton::setCaption(const std::string& text) void CComponentsButton::setCaption(const neutrino_locale_t locale_text) { cc_btn_capt_locale = locale_text; - cc_btn_capt = g_Locale->getText(cc_btn_capt_locale); + setCaption(g_Locale->getText(cc_btn_capt_locale)); } void CComponentsButton::initCCBtnItems() diff --git a/src/gui/components/cc_frm_button.h b/src/gui/components/cc_frm_button.h index 976433e81..5df275521 100644 --- a/src/gui/components/cc_frm_button.h +++ b/src/gui/components/cc_frm_button.h @@ -45,7 +45,14 @@ class CComponentsButton : public CComponentsForm CComponentsLabel *cc_btn_capt_obj; ///initialize all required attributes and objects - void initVarButton(); + void initVarButton( const int& x_pos, const int& y_pos, const int& w, const int& h, + const std::string& caption, + const std::string& icon_name, + CComponentsForm* parent, + bool selected, + bool enabled, + bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow); ///property: button text as string, see also setCaption() and getCaptionString() std::string cc_btn_capt; @@ -72,13 +79,21 @@ class CComponentsButton : public CComponentsForm public: ///basic constructor for button object with most needed params, no button icon is definied here - CComponentsButton( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButton( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption, const std::string& icon_name = "", - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = 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); - CComponentsButton( const int x_pos, const int y_pos, const int w, const int h, - const neutrino_locale_t& caption_locale, const std::string& icon_name = "", - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + + CComponentsButton( const int& x_pos, const int& y_pos, const int& w, const int& h, + const neutrino_locale_t& caption_locale, + const std::string& icon_name = "", + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = 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); ///set text color @@ -108,19 +123,25 @@ Shows a button box with caption and prepared red icon. class CComponentsButtonRed : public CComponentsButton { public: - CComponentsButtonRed( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButtonRed( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption, - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = 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) - :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_RED, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_RED, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_RED; }; - CComponentsButtonRed( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButtonRed( const int& x_pos, const int& y_pos, const int& w, const int& h, const neutrino_locale_t& caption_locale, - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = 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) - :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_RED, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_RED, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_RED; }; @@ -133,19 +154,25 @@ Shows a button box with caption and prepared green icon. class CComponentsButtonGreen : public CComponentsButton { public: - CComponentsButtonGreen( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButtonGreen( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption, - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = 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) - :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_GREEN, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_GREEN, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_GREEN; }; - CComponentsButtonGreen( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButtonGreen( const int& x_pos, const int& y_pos, const int& w, const int& h, const neutrino_locale_t& caption_locale, - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = 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) - :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_GREEN, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_GREEN, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_GREEN; }; @@ -158,19 +185,25 @@ Shows a button box with caption and prepared yellow icon. class CComponentsButtonYellow : public CComponentsButton { public: - CComponentsButtonYellow( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButtonYellow( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption, - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = 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) - :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_YELLOW, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_YELLOW, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_YELLOW; }; - CComponentsButtonYellow( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButtonYellow( const int& x_pos, const int& y_pos, const int& w, const int& h, const neutrino_locale_t& caption_locale, - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = 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) - :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_YELLOW, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_YELLOW, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_YELLOW; }; @@ -183,19 +216,25 @@ Shows a button box with caption and prepared blue icon. class CComponentsButtonBlue : public CComponentsButton { public: - CComponentsButtonBlue( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButtonBlue( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption, - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = 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) - :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_BLUE, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_BLUE, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_BLUE; }; - CComponentsButtonBlue( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButtonBlue( const int& x_pos, const int& y_pos, const int& w, const int& h, const neutrino_locale_t& caption_locale, - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = 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) - :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_BLUE, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_BLUE, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_BLUE; }; diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index b40e34601..35add9f8a 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -41,16 +41,12 @@ using namespace std; 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, + const char* format_str, + bool activ, + CComponentsForm* parent, + bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) -{ - 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; @@ -80,6 +76,9 @@ void CComponentsFrmClock::initVarClock( const int& x_pos, const int& y_pos, cons paintClock = false; activeClock = activ; + + initParent(parent); + if (activeClock) startThread(); } diff --git a/src/gui/components/cc_frm_clock.h b/src/gui/components/cc_frm_clock.h index c0a21bdbe..f8725cd4a 100644 --- a/src/gui/components/cc_frm_clock.h +++ b/src/gui/components/cc_frm_clock.h @@ -77,11 +77,6 @@ class CComponentsFrmClock : public CComponentsForm ///time string align, default allign is ver and hor centered int cl_align; - ///initialize all attributes and required objects - 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(); ///initialize timestring, called in initCCLockItems() @@ -94,7 +89,10 @@ class CComponentsFrmClock : public CComponentsForm public: 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=false, bool has_shadow = CC_SHADOW_OFF, + const char* format_str = "%H:%M", + bool activ=false, + CComponentsForm *parent = NULL, + 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(); diff --git a/src/gui/components/cc_frm_ext_text.cpp b/src/gui/components/cc_frm_ext_text.cpp index 05196bd78..b3e3e263e 100644 --- a/src/gui/components/cc_frm_ext_text.cpp +++ b/src/gui/components/cc_frm_ext_text.cpp @@ -36,28 +36,32 @@ using namespace std; 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, + CComponentsForm* parent, 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, label_text, text, has_shadow, label_color, text_color, color_frame, color_body, color_shadow); + initVarExtTextForm(x_pos, y_pos, w, h, label_text, text, parent, has_shadow, label_color, text_color, color_frame, color_body, color_shadow); initCCTextItems(); } 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, + CComponentsForm* parent, 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), + parent, has_shadow, label_color, text_color, color_frame, color_body, color_shadow){}; 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, + CComponentsForm* parent, bool has_shadow, fb_pixel_t label_color, fb_pixel_t text_color, @@ -90,7 +94,8 @@ void CComponentsExtTextForm::initVarExtTextForm(const int& x_pos, const int& y_p int dx = 0, dy = DEF_HEIGHT; ccx_font = *(CNeutrinoFonts::getInstance()->getDynFont(dx, dy)); ccx_label_align = ccx_text_align = CTextBox::NO_AUTO_LINEBREAK; - + + initParent(parent); } diff --git a/src/gui/components/cc_frm_ext_text.h b/src/gui/components/cc_frm_ext_text.h index 59a837b97..66a2172fb 100644 --- a/src/gui/components/cc_frm_ext_text.h +++ b/src/gui/components/cc_frm_ext_text.h @@ -68,6 +68,7 @@ class CComponentsExtTextForm : public CComponentsForm ///initialize basic variables 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, + CComponentsForm* parent, bool has_shadow, fb_pixel_t label_color, fb_pixel_t text_color, @@ -77,10 +78,13 @@ class CComponentsExtTextForm : public CComponentsForm ///advanced constructor for CComponentsExtTextForm, provides parameters for the most required properties, and caption as string 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 = "", + CComponentsForm *parent = NULL, 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); + 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); // ~CComponentsExtTextForm(); //inherited from CComponentsForm ///assigns texts for label and text, parameter as string, parameter Font is optional for required font type, default font is dependently from defined item height @@ -119,6 +123,7 @@ class CComponentsExtTextFormLocalized : public CComponentsExtTextForm ///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, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t label_color = COL_MENUCONTENTINACTIVE_TEXT, fb_pixel_t text_color = COL_MENUCONTENT_TEXT, diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 59d5c6154..a3332d764 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2013, Thilo Graf 'dbt' + Copyright (C) 2013-2014, Thilo Graf 'dbt' License: GPL @@ -33,25 +33,27 @@ using namespace std; //------------------------------------------------------------------------------------------------------- //sub class CComponentsFooter inherit from CComponentsHeader -CComponentsFooter::CComponentsFooter() +CComponentsFooter::CComponentsFooter(CComponentsForm* parent) { //CComponentsFooter - initVarFooter(1, 1, 0, 0); + initVarFooter(1, 1, 0, 0, 0, parent); } CComponentsFooter::CComponentsFooter( const int& x_pos, const int& y_pos, const int& w, const int& h, const int& buttons, + CComponentsForm* parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow ) { //CComponentsFooter - initVarFooter(x_pos, y_pos, w, h, buttons, has_shadow, color_frame, color_body, color_shadow); + initVarFooter(x_pos, y_pos, w, h, buttons, parent, has_shadow, color_frame, color_body, color_shadow); } void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const int& w, const int& h, const int& buttons, + CComponentsForm* parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, @@ -82,4 +84,5 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const initDefaultButtons(); initCCItems(); + initParent(parent); } diff --git a/src/gui/components/cc_frm_footer.h b/src/gui/components/cc_frm_footer.h index dd96a02bd..f0fad0646 100644 --- a/src/gui/components/cc_frm_footer.h +++ b/src/gui/components/cc_frm_footer.h @@ -36,14 +36,16 @@ class CComponentsFooter : public CComponentsHeader protected: void initVarFooter( const int& x_pos, const int& y_pos, const int& w, const int& h = 0, const int& buttons = 0, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_INFOBAR_SHADOW_PLUS_1, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); public: - CComponentsFooter(); + CComponentsFooter(CComponentsForm *parent = NULL); CComponentsFooter( const int& x_pos, const int& y_pos, const int& w, const int& h = 0, const int& buttons = 0, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_INFOBAR_SHADOW_PLUS_1, diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 4c1cc4c4b..8152c37ac 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -34,28 +34,30 @@ using namespace std; //------------------------------------------------------------------------------------------------------- //sub class CComponentsHeader inherit from CComponentsForm -CComponentsHeader::CComponentsHeader() +CComponentsHeader::CComponentsHeader(CComponentsForm* parent) { //CComponentsHeader - initVarHeader(1, 1, 0, 0, "", "", 0); + initVarHeader(1, 1, 0, 0, "", "", 0, parent); } CComponentsHeader::CComponentsHeader( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption, const std::string& icon_name, const int& buttons, + CComponentsForm* parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - initVarHeader(x_pos, y_pos, w, h, caption, icon_name, buttons, has_shadow, color_frame, color_body, color_shadow); + initVarHeader(x_pos, y_pos, w, h, caption, icon_name, buttons, parent, has_shadow, color_frame, color_body, color_shadow); } CComponentsHeaderLocalized::CComponentsHeaderLocalized( const int& x_pos, const int& y_pos, const int& w, const int& h, neutrino_locale_t caption_locale, const std::string& icon_name, const int& buttons, + CComponentsForm* parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, @@ -63,6 +65,7 @@ CComponentsHeaderLocalized::CComponentsHeaderLocalized( const int& x_pos, const :CComponentsHeader( x_pos, y_pos, w, h, g_Locale->getText(caption_locale), icon_name, buttons, + parent, has_shadow, color_frame, color_body, color_shadow){}; @@ -70,6 +73,7 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const const std::string& caption, const std::string& icon_name, const int& buttons, + CComponentsForm* parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, @@ -117,6 +121,7 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const initDefaultButtons(); initCCItems(); + initParent(parent); } CComponentsHeader::~CComponentsHeader() diff --git a/src/gui/components/cc_frm_header.h b/src/gui/components/cc_frm_header.h index 7756b269e..e4bad26c0 100644 --- a/src/gui/components/cc_frm_header.h +++ b/src/gui/components/cc_frm_header.h @@ -42,6 +42,7 @@ class CComponentsHeader : public CComponentsForm const std::string& caption = "header", const std::string& = "", const int& buttons = 0, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, @@ -110,11 +111,12 @@ class CComponentsHeader : public CComponentsForm CC_HEADER_ITEM_BUTTONS = 2 }; - CComponentsHeader(); + CComponentsHeader(CComponentsForm *parent = NULL); CComponentsHeader( const int& x_pos, const int& y_pos, const int& w, const int& h = 0, const std::string& caption = "", const std::string& = "", const int& buttons = 0, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, @@ -188,6 +190,7 @@ class CComponentsHeaderLocalized : public CComponentsHeader neutrino_locale_t caption_locale = NONEXISTANT_LOCALE, const std::string& = "", const int& buttons = 0, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, diff --git a/src/gui/components/cc_frm_icons.cpp b/src/gui/components/cc_frm_icons.cpp index aa6b84d92..926f25544 100644 --- a/src/gui/components/cc_frm_icons.cpp +++ b/src/gui/components/cc_frm_icons.cpp @@ -33,21 +33,23 @@ using namespace std; //sub class CComponentsIconForm inherit from CComponentsForm -CComponentsIconForm::CComponentsIconForm() +CComponentsIconForm::CComponentsIconForm(CComponentsForm* parent) { - initVarIconForm(1, 1, 0, 0, vector()); + initVarIconForm(1, 1, 0, 0, vector(), parent); } CComponentsIconForm::CComponentsIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h, const std::vector &v_icon_names, + CComponentsForm* parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - initVarIconForm(x_pos, y_pos, w, h, v_icon_names, has_shadow, color_frame, color_body, color_shadow); + initVarIconForm(x_pos, y_pos, w, h, v_icon_names, parent, 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, + CComponentsForm* parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { @@ -65,6 +67,7 @@ void CComponentsIconForm::initVarIconForm( const int &x_pos, const int &y_pos, c ccif_offset = 2; ccif_icon_align = CC_ICONS_FRM_ALIGN_LEFT; + initParent(parent); } void CComponentsIconForm::addIcon(const std::string& icon_name) diff --git a/src/gui/components/cc_frm_icons.h b/src/gui/components/cc_frm_icons.h index 83b86c5f8..6f48c195e 100644 --- a/src/gui/components/cc_frm_icons.h +++ b/src/gui/components/cc_frm_icons.h @@ -36,15 +36,17 @@ class CComponentsIconForm : public CComponentsForm protected: void initVarIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h, const std::vector &v_icon_names, + CComponentsForm* parent, 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(CComponentsForm *parent = NULL); CComponentsIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h, const std::vector &v_icon_names, + CComponentsForm *parent = NULL, 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); diff --git a/src/gui/components/cc_frm_signalbars.cpp b/src/gui/components/cc_frm_signalbars.cpp index 1b2d21295..7b44dee5b 100644 --- a/src/gui/components/cc_frm_signalbars.cpp +++ b/src/gui/components/cc_frm_signalbars.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Class for signalbar based up CComponent classes. - Copyright (C) 2013, Thilo Graf 'dbt' + Copyright (C) 2013-1014, Thilo Graf 'dbt' License: GPL @@ -37,16 +37,17 @@ using namespace std; -CSignalBar::CSignalBar() +CSignalBar::CSignalBar(CComponentsForm *parent) { initVarSigBar(); sb_name = "SIG"; initDimensions(); initSBItems(); + initParent(parent); } -CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const string& sbname) +CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const string& sbname, CComponentsForm *parent) { initVarSigBar(); sb_frontend = frontend_ref; @@ -58,6 +59,7 @@ CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int initDimensions(); initSBItems(); + initParent(parent); } void CSignalBar::initDimensions() @@ -256,7 +258,7 @@ void CSignalNoiseRatioBar::Refresh() //********************************************************************************************************************** -CSignalBox::CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const bool vert) +CSignalBox::CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const bool vert, CComponentsForm *parent) { initVarSigBox(); vertical = vert; @@ -284,6 +286,7 @@ CSignalBox::CSignalBox(const int& xpos, const int& ypos, const int& w, const int addCCItem(snrbar); initSignalItems(); + initParent(parent); } void CSignalBox::initVarSigBox() diff --git a/src/gui/components/cc_frm_signalbars.h b/src/gui/components/cc_frm_signalbars.h index c7474ffa7..a5cb7dcd9 100644 --- a/src/gui/components/cc_frm_signalbars.h +++ b/src/gui/components/cc_frm_signalbars.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Class for signalbar based up CComponent classes. - Copyright (C) 2013, Thilo Graf 'dbt' + Copyright (C) 2013-2014, Thilo Graf 'dbt' License: GPL @@ -110,9 +110,9 @@ class CSignalBar : public CComponentsForm std::string sb_name; public: - CSignalBar(); + CSignalBar(CComponentsForm *parent = NULL); ///basic component class constructor for signal. - CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const std::string& sb_name = "SIG"); + CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const std::string& sb_name = "SIG", CComponentsForm *parent = NULL); ///assigns the current used frontend, simplified a tuner object, see frontend_c.h virtual void setFrontEnd(CFrontend *frontend_ref){sb_frontend = frontend_ref;}; @@ -157,10 +157,11 @@ class CSignalNoiseRatioBar : public CSignalBar void Refresh(); public: - CSignalNoiseRatioBar(){}; + CSignalNoiseRatioBar(CComponentsForm *parent = NULL) + : CSignalBar(parent){}; ///basic component class constructor for signal noise ratio. - CSignalNoiseRatioBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref) - : CSignalBar(xpos, ypos, w, h, frontend_ref, "SNR"){}; + CSignalNoiseRatioBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, CComponentsForm *parent = NULL) + : CSignalBar(xpos, ypos, w, h, frontend_ref, "SNR", parent){}; }; /// Class CSignalBox() provides CSignalBar(), CSignalNoiseRatioBar() scales at once. @@ -268,7 +269,7 @@ class CSignalBox : public CComponentsForm public: ///class constructor for signal noise ratio. - CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref = NULL, const bool vertical = true); + CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref = NULL, const bool vertical = true, CComponentsForm *parent = NULL); ///returns the signal object, type = CSignalBar* CSignalBar* getScaleObject(){return sbar;}; diff --git a/src/gui/components/cc_frm_slider.cpp b/src/gui/components/cc_frm_slider.cpp index f61b37fa6..bed4cbd64 100644 --- a/src/gui/components/cc_frm_slider.cpp +++ b/src/gui/components/cc_frm_slider.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2013, Thilo Graf 'dbt' + Copyright (C) 2013-2014, Thilo Graf 'dbt' License: GPL @@ -33,20 +33,7 @@ CComponentsSlider::CComponentsSlider( const int& x_pos, const int& y_pos, const const int& current_value, const int& min_value, const int& max_value, - bool has_shadow, - fb_pixel_t& color_frame, - fb_pixel_t& color_body, - fb_pixel_t& color_shadow) -{ - initVarSlider(x_pos, y_pos, w, h, current_value, min_value, max_value, has_shadow, color_frame, color_body, color_shadow); - initCCSlItems(); -} - - -void CComponentsSlider::initVarSlider( const int& x_pos, const int& y_pos, const int& w, const int& h, - const int& current_value, - const int& min_value, - const int& max_value, + CComponentsForm *parent, bool has_shadow, fb_pixel_t& color_frame, fb_pixel_t& color_body, @@ -74,6 +61,9 @@ void CComponentsSlider::initVarSlider( const int& x_pos, const int& y_pos, const csl_body_icon = NEUTRINO_ICON_VOLUMEBODY; csl_slider_icon =NEUTRINO_ICON_VOLUMESLIDER2; + + initCCSlItems(); + initParent(parent); } //set current value diff --git a/src/gui/components/cc_frm_slider.h b/src/gui/components/cc_frm_slider.h index 9241dc49c..08395d759 100644 --- a/src/gui/components/cc_frm_slider.h +++ b/src/gui/components/cc_frm_slider.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2013, Thilo Graf 'dbt' + Copyright (C) 2013-2014, Thilo Graf 'dbt' License: GPL @@ -60,23 +60,12 @@ class CComponentsSlider : public CComponentsForm ///init all items at once void initCCSlItems(); - ///init all required variables - void initVarSlider( const int& x_pos, const int& y_pos, const int& w, const int& h, - const int& current_value, - const int& min_value, - const int& max_value, - bool has_shadow, - fb_pixel_t& color_frame, - fb_pixel_t& color_body, - fb_pixel_t& color_shadow); - protected: - - public: - CComponentsSlider( const int& x_pos = 1, const int& y_pos = 1, const int& w = 120+16, const int& h = 32, + CComponentsSlider( const int& x_pos = 0, const int& y_pos = 0, const int& w = 120+16, const int& h = 32, const int& current_value = 0, const int& min_value = 0, const int& max_value = 100, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t& color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t& color_body = COL_MENUHEAD_PLUS_0, diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index 629b3386a..013315ff8 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, 2014 Thilo Graf 'dbt' + Copyright (C) 2012-2014 Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -34,56 +34,61 @@ using namespace std; //------------------------------------------------------------------------------------------------------- //sub class CComponentsWindow inherit from CComponentsForm -CComponentsWindow::CComponentsWindow() +CComponentsWindow::CComponentsWindow(CComponentsForm *parent) { - initVarWindow(); + initVarWindow(0, 0, 800, 600, "", "", parent); } CComponentsWindow::CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, neutrino_locale_t locale_caption, const string& iconname, + CComponentsForm *parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { string s_caption = locale_caption != NONEXISTANT_LOCALE ? g_Locale->getText(locale_caption) : ""; - initVarWindow(x_pos, y_pos, w, h, s_caption, iconname, has_shadow, color_frame, color_body, color_shadow); + initVarWindow(x_pos, y_pos, w, h, s_caption, iconname, parent, has_shadow, color_frame, color_body, color_shadow); } CComponentsWindow::CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, const string& caption, const string& iconname, + CComponentsForm *parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - initVarWindow(x_pos, y_pos, w, h, caption, iconname, has_shadow, color_frame, color_body, color_shadow); + initVarWindow(x_pos, y_pos, w, h, caption, iconname, parent, has_shadow, color_frame, color_body, color_shadow); } CComponentsWindowMax::CComponentsWindowMax( const string& caption, const string& iconname, + CComponentsForm *parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) :CComponentsWindow(0, 0, 0, 0, caption, - iconname, has_shadow, color_frame, color_body, color_shadow){}; + iconname, parent, has_shadow, color_frame, color_body, color_shadow){}; CComponentsWindowMax::CComponentsWindowMax( neutrino_locale_t locale_caption, const string& iconname, + CComponentsForm *parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) :CComponentsWindow(0, 0, 0, 0, locale_caption != NONEXISTANT_LOCALE ? g_Locale->getText(locale_caption) : "", - iconname, has_shadow, color_frame, color_body, color_shadow){}; + iconname, parent, has_shadow, color_frame, color_body, color_shadow){}; void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, const string& caption, const string& iconname, + CComponentsForm *parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, @@ -121,6 +126,7 @@ void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const ccw_align_mode = CTextBox::NO_AUTO_LINEBREAK; initCCWItems(); + initParent(parent); } void CComponentsWindow::initWindowSize() diff --git a/src/gui/components/cc_frm_window.h b/src/gui/components/cc_frm_window.h index de4761f0d..30838c1c2 100644 --- a/src/gui/components/cc_frm_window.h +++ b/src/gui/components/cc_frm_window.h @@ -86,6 +86,7 @@ class CComponentsWindow : public CComponentsForm void initVarWindow( const int& x_pos = CC_CENTERED, const int& y_pos = CC_CENTERED, const int& w = 0, const int& h = 0, const std::string& caption = "", const std::string& iconname = "", + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, @@ -101,12 +102,13 @@ class CComponentsWindow : public CComponentsForm CC_WINDOW_ITEM_HEADER = 0 }; ///simple constructor for CComponentsWindow, this shows a window over full screen - CComponentsWindow(); + CComponentsWindow(CComponentsForm *parent = NULL); ///advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption as string, x_pos or y_pos = 0 will center window CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption = "", const std::string& iconname = "", + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, @@ -116,6 +118,7 @@ class CComponentsWindow : public CComponentsForm CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, neutrino_locale_t locale_text = NONEXISTANT_LOCALE, const std::string& iconname = "", + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, @@ -163,6 +166,7 @@ class CComponentsWindowMax : public CComponentsWindow public: ///simple constructor for CComponentsWindow, provides parameters for caption as string and icon, this shows a centered window based up current screen settings CComponentsWindowMax( const std::string& caption, const std::string& iconname = "", + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, @@ -170,6 +174,7 @@ class CComponentsWindowMax : public CComponentsWindow ///simple constructor for CComponentsWindow, provides parameters for caption from locales and icon, this shows a centered window based up current screen settings CComponentsWindowMax( neutrino_locale_t locale_caption, const std::string& iconname = "", + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index 400560666..b88c43165 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -35,14 +35,6 @@ using namespace std; -//abstract sub class CComponentsItem from CComponents -CComponentsItem::CComponentsItem() -{ - //CComponentsItem - initVarItem(); - cc_item_type = CC_ITEMTYPE_BASE; -} - // y // x+------f-r-a-m-e-------+ // | | @@ -50,13 +42,21 @@ CComponentsItem::CComponentsItem() // | | // +--------width---------+ -void CComponentsItem::initVarItem() +//abstract sub class CComponentsItem from CComponents +CComponentsItem::CComponentsItem(CComponentsForm* parent) { - //CComponents + cc_item_type = CC_ITEMTYPE_BASE; cc_item_index = CC_NO_INDEX; cc_item_enabled = true; cc_item_selected = false; - cc_parent = NULL; + initParent(parent); +} + +void CComponentsItem::initParent(CComponentsForm* parent) +{ + cc_parent = parent; + if (cc_parent) + cc_parent->addCCItem(this); } // Paint container background in cc-items with shadow, background and frame. diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp index 1a9490aab..30e41c234 100644 --- a/src/gui/components/cc_item_infobox.cpp +++ b/src/gui/components/cc_item_infobox.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -35,20 +35,16 @@ using namespace std; //sub class CComponentsInfoBox from CComponentsItem -CComponentsInfoBox::CComponentsInfoBox() +CComponentsInfoBox::CComponentsInfoBox( const int& x_pos, const int& y_pos, const int& w, const int& h, + std::string info_text, + const int mode, + Font* font_text, + CComponentsForm *parent, + bool has_shadow, + fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - //CComponentsInfoBox - initVarInfobox(); -} + cc_item_type = CC_ITEMTYPE_TEXT_INFOBOX; -CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const int w, const int h, - std::string info_text, const int mode, Font* font_text, - bool has_shadow, - fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) -{ - //CComponentsInfoBox - initVarInfobox(); - x = x_pos; y = y_pos; width = w; @@ -62,23 +58,19 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i ct_text_mode = mode; ct_font = font_text; ct_col_text = color_text; -} - -CComponentsInfoBox::~CComponentsInfoBox() -{ - delete pic; - delete cctext; -} - -void CComponentsInfoBox::initVarInfobox() -{ - cc_item_type = CC_ITEMTYPE_TEXT_INFOBOX; //CComponentsInfoBox pic = NULL; cctext = NULL; pic_name = ""; x_offset = 10; + initParent(parent); +} + +CComponentsInfoBox::~CComponentsInfoBox() +{ + delete pic; + delete cctext; } void CComponentsInfoBox::setPicture(const std::string& picture_name) diff --git a/src/gui/components/cc_item_infobox.h b/src/gui/components/cc_item_infobox.h index 362ab03a8..4e22c97ca 100644 --- a/src/gui/components/cc_item_infobox.h +++ b/src/gui/components/cc_item_infobox.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' License: GPL @@ -52,8 +52,6 @@ class CComponentsInfoBox : public CComponentsText ///property: path or default name of displayed image std::string pic_default_name; - ///initialize all needed default attributes - void initVarInfobox(); ///paint picture, used in initVarInfobox() void paintPicture(); ///property: path or name of displayed image @@ -63,9 +61,11 @@ class CComponentsInfoBox : public CComponentsText ///object: internal used CTextBox object CComponentsText * cctext; - CComponentsInfoBox(); - CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h, - std::string info_text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, + CComponentsInfoBox( const int& x_pos = 0, const int& y_pos = 0, const int& w = 800, const int& h = 600, + std::string info_text = "", + const int mode = CTextBox::AUTO_WIDTH, + Font* font_text = NULL, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_text = 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); diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index f7ea5f2b8..af793f0a7 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -41,13 +41,20 @@ using namespace std; //------------------------------------------------------------------------------------------------------- //sub class CComponentsPicture from CComponentsItem CComponentsPicture::CComponentsPicture( const int &x_pos, const int &y_pos, const int &w, const int &h, - const std::string& image_name, const int &alignment, bool has_shadow, + const std::string& image_name, + const int &alignment, + CComponentsForm *parent, + bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow) { - init(x_pos, y_pos, w, h, image_name, alignment, has_shadow, color_frame, color_background, color_shadow); + init(x_pos, y_pos, w, h, image_name, alignment, parent, has_shadow, color_frame, color_background, color_shadow); } -void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w, const int &h, const string& image_name, const int &alignment, bool has_shadow, +void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w, const int &h, + const string& image_name, + const int &alignment, + CComponentsForm *parent, + bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow) { //CComponents, CComponentsItem @@ -79,6 +86,7 @@ void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w, pic_width = pic_height = 0; initCCItem(); + initParent(parent); } void CComponentsPicture::setPicture(const std::string& picture_name) @@ -217,11 +225,14 @@ void CComponentsPicture::hide(bool no_restore) CComponentsChannelLogo::CComponentsChannelLogo( const int &x_pos, const int &y_pos, const int &w, const int &h, - const uint64_t& channelId, const std::string& channelName, - const int &alignment, bool has_shadow, + const uint64_t& channelId, + const std::string& channelName, + const int &alignment, + CComponentsForm *parent, + bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow) :CComponentsPicture(x_pos, y_pos, w, h, - "", alignment, has_shadow, + "", alignment, parent, has_shadow, color_frame, color_background, color_shadow) { channel_id = channelId; diff --git a/src/gui/components/cc_item_picture.h b/src/gui/components/cc_item_picture.h index 06c9bec27..149174e3d 100644 --- a/src/gui/components/cc_item_picture.h +++ b/src/gui/components/cc_item_picture.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -63,6 +63,7 @@ class CComponentsPicture : public CComponentsItem void init( const int &x_pos, const int &y_pos, const int &w, const int &h, const std::string& image_name, const int &alignment, + CComponentsForm *parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_background, @@ -78,6 +79,7 @@ class CComponentsPicture : public CComponentsItem CComponentsPicture( const int &x_pos, const int &y_pos, const int &w, const int &h, const std::string& image_name, const int &alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_background = 0, @@ -116,6 +118,7 @@ class CComponentsChannelLogo : public CComponentsPicture, CPictureViewer const uint64_t& channelId =0, const std::string& channelName = "", const int &alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_background = 0, diff --git a/src/gui/components/cc_item_progressbar.cpp b/src/gui/components/cc_item_progressbar.cpp index 8c5944a41..3aefc7363 100644 --- a/src/gui/components/cc_item_progressbar.cpp +++ b/src/gui/components/cc_item_progressbar.cpp @@ -2,7 +2,7 @@ Based up Neutrino-GUI - Tuxbox-Project Copyright (C) 2001 by Steffen Hehn 'McClean' - (C) 2008, 2013 by Thilo Graf + (C) 2008,2013,2014 by Thilo Graf (C) 2009,2010,2013 Stefan Seyfried License: GPL @@ -39,19 +39,16 @@ #define GREEN 0x00FF00 #define YELLOW 0xFFFF00 -CProgressBar::CProgressBar() -{ - initVarProgressbar(); -} - CProgressBar::CProgressBar( const int x_pos, const int y_pos, const int w, const int h, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow, const fb_pixel_t active_col, const fb_pixel_t passive_col, const bool blinkenlights, const int r, const int g, const int b, - const bool inv) + const bool inv, + CComponentsForm *parent) { - initVarProgressbar(); + //CComponentsItem + cc_item_type = CC_ITEMTYPE_PROGRESSBAR; //CComponents x = x_pos; @@ -70,24 +67,9 @@ CProgressBar::CProgressBar( const int x_pos, const int y_pos, const int w, const pb_yellow = b; pb_active_col = active_col; pb_passive_col = passive_col; -} - -void CProgressBar::initVarProgressbar() -{ - //CComponentsItem - cc_item_type = CC_ITEMTYPE_PROGRESSBAR; - - //CProgressBar - pb_blink = false; - pb_invert = false; pb_bl_changed = g_settings.progressbar_color; pb_last_width = -1; - pb_red = 40; - pb_green = 100; - pb_yellow = 70; - pb_active_col = COL_INFOBAR_PLUS_7; - pb_passive_col = COL_INFOBAR_PLUS_3; pb_value = 0; pb_max_value = 0; pb_paint_zero = false; @@ -100,7 +82,8 @@ void CProgressBar::initVarProgressbar() pb_height = 0; pb_start_x_passive = 0; pb_passive_width = width; -} + initParent(parent); +} //calculate bar dimensions void CProgressBar::initDimensions() @@ -138,7 +121,7 @@ void CProgressBar::initDimensions() void CProgressBar::paintShapes(int &shx, int ­, int &shw, int &shh, fb_pixel_t &col) { - CComponentsShapeSquare shape(shx, shy, shw, shh, false); + CComponentsShapeSquare shape(shx, shy, shw, shh, NULL, false); shape.setColorBody(col); shape.allowPaint(cc_allow_paint); shape.paint(false); diff --git a/src/gui/components/cc_item_progressbar.h b/src/gui/components/cc_item_progressbar.h index ecc074eee..515761b24 100644 --- a/src/gui/components/cc_item_progressbar.h +++ b/src/gui/components/cc_item_progressbar.h @@ -2,7 +2,7 @@ Based up Neutrino-GUI - Tuxbox-Project Copyright (C) 2001 by Steffen Hehn 'McClean' - (C) 2008, 2013 by Thilo Graf + (C) 2008,2013,2014 by Thilo Graf (C) 2009,2010,2013 Stefan Seyfried License: GPL @@ -50,7 +50,8 @@ #define __CC_PROGRESSBAR_H__ #include "config.h" -#include +#include "cc_base.h" + #include class CProgressBar : public CComponentsItem @@ -110,14 +111,14 @@ class CProgressBar : public CComponentsItem ///inv: false => red on the left side, true: red on right side. ///active_col, passive_col: sets colors for displayed values, activ_col means the the displayed progress ///color_frame, color_body, color_shadow: colores of progressbar for frame, body and shadow, Note: color of frame is ineffective on fr_thickness = 0 - CProgressBar(); - CProgressBar( const int x_pos, const int y_pos, + CProgressBar( const int x_pos = 0, const int y_pos = 0, const int w = -1, const int h = -1, fb_pixel_t color_frame = 0, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0, const fb_pixel_t active_col = COL_INFOBAR_PLUS_7, const fb_pixel_t passive_col = COL_INFOBAR_PLUS_3, const bool blinkenlights = false, const int r = 40, const int g = 100, const int b =70, - const bool inv = false ); + const bool inv = false, + CComponentsForm *parent = NULL); ///set up to display available values diff --git a/src/gui/components/cc_item_shapes.cpp b/src/gui/components/cc_item_shapes.cpp index 14393b610..c4acb6514 100644 --- a/src/gui/components/cc_item_shapes.cpp +++ b/src/gui/components/cc_item_shapes.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -35,7 +35,10 @@ using namespace std; //sub class CComponentsShapeSquare from CComponentsItem -CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +CComponentsShapeSquare::CComponentsShapeSquare( const int x_pos, const int y_pos, const int w, const int h, + CComponentsForm *parent, + bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { //CComponentsItem cc_item_type = CC_ITEMTYPE_SHAPE_SQUARE; @@ -49,6 +52,7 @@ CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos, col_frame = color_frame; col_body = color_body; col_shadow = color_shadow; + initParent(parent); } void CComponentsShapeSquare::paint(bool do_save_bg) @@ -59,8 +63,10 @@ void CComponentsShapeSquare::paint(bool do_save_bg) //------------------------------------------------------------------------------------------------------- //sub class CComponentsShapeCircle from CComponentsItem -CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, bool has_shadow, - fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, + CComponentsForm *parent, + bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { //CComponents, CComponentsItem cc_item_type = CC_ITEMTYPE_SHAPE_CIRCLE; @@ -80,6 +86,7 @@ CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, //CComponentsItem corner_rad = d/2; + initParent(parent); } // y diff --git a/src/gui/components/cc_item_shapes.h b/src/gui/components/cc_item_shapes.h index e9e879033..db53d66ec 100644 --- a/src/gui/components/cc_item_shapes.h +++ b/src/gui/components/cc_item_shapes.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014 Thilo Graf 'dbt' License: GPL @@ -43,7 +43,9 @@ class CComponentsShapeCircle : public CComponentsItem ///property: diam int d; public: - CComponentsShapeCircle( const int x_pos, const int y_pos, const int diam, bool has_shadow = CC_SHADOW_ON, + CComponentsShapeCircle( const int x_pos, const int y_pos, const int diam, + CComponentsForm *parent = NULL, + bool has_shadow = CC_SHADOW_ON, 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); ///set property: diam @@ -58,7 +60,9 @@ class CComponentsShapeCircle : public CComponentsItem class CComponentsShapeSquare : public CComponentsItem { public: - CComponentsShapeSquare( const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = CC_SHADOW_ON, + CComponentsShapeSquare( const int x_pos, const int y_pos, const int w, const int h, + CComponentsForm *parent = NULL, + bool has_shadow = CC_SHADOW_ON, 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 paint(bool do_save_bg = CC_SAVE_SCREEN_YES); diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index e681dbca5..f8aeb48de 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -38,16 +38,11 @@ using namespace std; //sub class CComponentsText from CComponentsItem -CComponentsText::CComponentsText() -{ - //CComponentsText - initVarText(); - - initCCText(); -} - CComponentsText::CComponentsText( const int x_pos, const int y_pos, const int w, const int h, - std::string text, const int mode, Font* font_text, + std::string text, + const int mode, + Font* font_text, + CComponentsForm *parent, bool has_shadow, fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { @@ -71,6 +66,7 @@ CComponentsText::CComponentsText( const int x_pos, const int y_pos, const int w, ct_col_text = color_text; initCCText(); + initParent(parent); } diff --git a/src/gui/components/cc_item_text.h b/src/gui/components/cc_item_text.h index 8d44d7f55..51e667337 100644 --- a/src/gui/components/cc_item_text.h +++ b/src/gui/components/cc_item_text.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' License: GPL @@ -83,9 +83,11 @@ class CComponentsText : public CComponentsItem, public CBox ///paint CCItem backckrond (if paint_bg=true), apply initCCText() and send paint() to the CTextBox object void paintText(bool do_save_bg = CC_SAVE_SCREEN_YES); public: - CComponentsText(); - CComponentsText( const int x_pos, const int y_pos, const int w, const int h, - std::string text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, + CComponentsText( const int x_pos = 10, const int y_pos = 10, const int w = 150, const int h = 50, + std::string text = "", + const int mode = CTextBox::AUTO_WIDTH, + Font* font_text = NULL, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_text = 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); virtual ~CComponentsText(); @@ -151,10 +153,13 @@ class CComponentsLabel : public CComponentsText { public: CComponentsLabel( const int x_pos = 10, const int y_pos = 10, const int w = 150, const int h = 50, - std::string text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, + std::string text = "", + const int mode = CTextBox::AUTO_WIDTH, + Font* font_text = NULL, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_text = COL_MENUCONTENTINACTIVE_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) - :CComponentsText(x_pos, y_pos, w, h, text, mode, font_text, has_shadow, color_text, color_frame, color_body, color_shadow) + :CComponentsText(x_pos, y_pos, w, h, text, mode, font_text, parent, has_shadow, color_text, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_LABEL; }; diff --git a/src/gui/components/cc_item_tvpic.cpp b/src/gui/components/cc_item_tvpic.cpp index 19dc1faa0..731b826a8 100644 --- a/src/gui/components/cc_item_tvpic.cpp +++ b/src/gui/components/cc_item_tvpic.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -40,7 +40,10 @@ using namespace std; //------------------------------------------------------------------------------------------------------- //sub class CComponentsPIP from CComponentsItem -CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int percent, bool has_shadow) +CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int percent, + CComponentsForm *parent, + bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { //CComponents, CComponentsItem cc_item_type = CC_ITEMTYPE_PIP; @@ -58,9 +61,10 @@ CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int perc height = percent*screen_h/100; shadow = has_shadow; shadow_w = SHADOW_OFFSET; - col_frame = COL_BACKGROUND; - col_body = COL_BACKGROUND; - col_shadow = COL_MENUCONTENTDARK_PLUS_0; + col_frame = color_frame; + col_body = color_body; + col_shadow = color_shadow; + initParent(parent); } CComponentsPIP::~CComponentsPIP() diff --git a/src/gui/components/cc_item_tvpic.h b/src/gui/components/cc_item_tvpic.h index fef5a23b8..9b881f60f 100644 --- a/src/gui/components/cc_item_tvpic.h +++ b/src/gui/components/cc_item_tvpic.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' License: GPL @@ -50,7 +50,10 @@ class CComponentsPIP : public CComponentsItem std::string pic_name; public: ///constructor: initialize of position like all other items with x and y values, but dimensions in percent - CComponentsPIP( const int x_pos, const int y_pos, const int percent = 30, bool has_shadow = CC_SHADOW_OFF); + CComponentsPIP( const int x_pos = 0, const int y_pos = 0, const int percent = 30, + CComponentsForm *parent = NULL, + bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_frame = COL_BACKGROUND, fb_pixel_t color_body = COL_BACKGROUND, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); ~CComponentsPIP(); ///set property: width of tv box in pixel diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index 297334d67..8675636e0 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -181,12 +181,11 @@ void CImageInfo::ShowWindow() { CComponentsFooter *footer = NULL; if (cc_win == NULL){ - cc_win = new CComponentsWindowMax(LOCALE_IMAGEINFO_HEAD, NEUTRINO_ICON_INFO, CC_SHADOW_ON); + cc_win = new CComponentsWindowMax(LOCALE_IMAGEINFO_HEAD, NEUTRINO_ICON_INFO, 0, CC_SHADOW_ON); cc_win->setWindowHeaderButtons(CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT); footer = cc_win->getFooterObject(); footer->setColorBody(COL_INFOBAR_SHADOW_PLUS_1); - btn_red = new CComponentsButtonRed(10, CC_CENTERED, 250, footer->getHeight(), LOCALE_BUILDINFO_MENU, false , true, false, footer->getColorBody(), footer->getColorBody()); - footer->addCCItem(btn_red); + btn_red = new CComponentsButtonRed(10, CC_CENTERED, 250, footer->getHeight(), LOCALE_BUILDINFO_MENU, footer, false , true, false, footer->getColorBody(), footer->getColorBody()); } //prepare minitv diff --git a/src/gui/infoclock.cpp b/src/gui/infoclock.cpp index 0a96fad82..769276713 100644 --- a/src/gui/infoclock.cpp +++ b/src/gui/infoclock.cpp @@ -36,7 +36,7 @@ -CInfoClock::CInfoClock():CComponentsFrmClock( 0, 0, 0, 50, "%H:%M:%S", true, CC_SHADOW_ON, COL_LIGHT_GRAY, COL_MENUCONTENT_PLUS_0,COL_MENUCONTENTDARK_PLUS_0) +CInfoClock::CInfoClock():CComponentsFrmClock( 0, 0, 0, 50, "%H:%M:%S", true, NULL, CC_SHADOW_ON, COL_LIGHT_GRAY, COL_MENUCONTENT_PLUS_0,COL_MENUCONTENTDARK_PLUS_0) { initVarInfoClock(); } diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index 0b1dd8cb7..f5a4456c2 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -1337,7 +1337,7 @@ int CLuaInstance::CWindowNew(lua_State *L) CLuaCWindow **udata = (CLuaCWindow **) lua_newuserdata(L, sizeof(CLuaCWindow *)); *udata = new CLuaCWindow(); - (*udata)->w = new CComponentsWindow(x, y, dx, dy, name.c_str(), icon.c_str(), has_shadow, (fb_pixel_t)color_frame, (fb_pixel_t)color_body, (fb_pixel_t)color_shadow); + (*udata)->w = new CComponentsWindow(x, y, dx, dy, name.c_str(), icon.c_str(), 0, has_shadow, (fb_pixel_t)color_frame, (fb_pixel_t)color_body, (fb_pixel_t)color_shadow); CComponentsFooter* footer = (*udata)->w->getFooterObject(); if (footer) { @@ -1352,13 +1352,13 @@ int CLuaInstance::CWindowNew(lua_State *L) int btnh = footer->getHeight(); int start = 10; if (btnRed != "") - footer->addCCItem(new CComponentsButtonRed(start, CC_CENTERED, btnw, btnh, btnRed, false , true, false, col, col)); + footer->addCCItem(new CComponentsButtonRed(start, CC_CENTERED, btnw, btnh, btnRed, 0, false , true, false, col, col)); if (btnGreen != "") - footer->addCCItem(new CComponentsButtonGreen(start+=btnw, CC_CENTERED, btnw, btnh, btnGreen, false , true, false, col, col)); + footer->addCCItem(new CComponentsButtonGreen(start+=btnw, CC_CENTERED, btnw, btnh, btnGreen, 0, false , true, false, col, col)); if (btnYellow != "") - footer->addCCItem(new CComponentsButtonYellow(start+=btnw, CC_CENTERED, btnw, btnh, btnYellow, false , true, false, col, col)); + footer->addCCItem(new CComponentsButtonYellow(start+=btnw, CC_CENTERED, btnw, btnh, btnYellow, 0, false , true, false, col, col)); if (btnBlue != "") - footer->addCCItem(new CComponentsButtonBlue(start+=btnw, CC_CENTERED, btnw, btnh, btnBlue, false , true, false, col, col)); + footer->addCCItem(new CComponentsButtonBlue(start+=btnw, CC_CENTERED, btnw, btnh, btnBlue, 0, false , true, false, col, col)); } } @@ -1591,7 +1591,7 @@ int CLuaInstance::ComponentsTextNew(lua_State *L) CLuaComponentsText **udata = (CLuaComponentsText **) lua_newuserdata(L, sizeof(CLuaComponentsText *)); *udata = new CLuaComponentsText(); - (*udata)->ct = new CComponentsText(x, y, dx, dy, text, mode, g_Font[font_text], has_shadow, (fb_pixel_t)color_text, (fb_pixel_t)color_frame, (fb_pixel_t)color_body, (fb_pixel_t)color_shadow); + (*udata)->ct = new CComponentsText(x, y, dx, dy, text, mode, g_Font[font_text], NULL, has_shadow, (fb_pixel_t)color_text, (fb_pixel_t)color_frame, (fb_pixel_t)color_body, (fb_pixel_t)color_shadow); luaL_getmetatable(L, "ctext"); lua_setmetatable(L, -2); return 1; diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index b6a8efcba..5b758e3b8 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -374,7 +374,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) } else if (actionKey == "circle"){ if (circle == NULL) - circle = new CComponentsShapeCircle (100, 100, 100, false); + circle = new CComponentsShapeCircle (100, 100, 100, NULL, false); if (!circle->isPainted()) circle->paint(); @@ -384,7 +384,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) } else if (actionKey == "square"){ if (sq == NULL) - sq = new CComponentsShapeSquare (100, 220, 100, 100, false); + sq = new CComponentsShapeSquare (100, 220, 100, 100, NULL, false); if (!sq->isPainted()) sq->paint(); @@ -433,7 +433,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) CComponentsText *t2 = new CComponentsText(t1->getXPos()+t1->getWidth(), 0, 200, 50, "Text2", CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT); t2->setCorner(RADIUS_MID, CORNER_TOP_RIGHT); - form->addCCItem(t2); + form->addCCItem(t2); CComponentsShapeCircle *c1 = new CComponentsShapeCircle(28, 40, 28); c1->setColorBody(COL_RED); @@ -523,7 +523,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) else if (actionKey == "footer"){ int hh = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); if (footer == NULL){ - footer = new CComponentsFooter (100, 50, 500, hh, CComponentsHeader::CC_BTN_HELP | CComponentsHeader::CC_BTN_EXIT | CComponentsHeader::CC_BTN_MENU, true); + footer = new CComponentsFooter (100, 50, 500, hh, CComponentsHeader::CC_BTN_HELP | CComponentsHeader::CC_BTN_EXIT | CComponentsHeader::CC_BTN_MENU, NULL, true); int start = 5, btnw =90, btnh = 37; footer->addCCItem(new CComponentsButtonRed(start, 0, btnw, btnh, "Button1")); footer->addCCItem(new CComponentsButtonGreen(start+=btnw, 0, btnw, btnh, "Button2")); diff --git a/src/gui/timeosd.cpp b/src/gui/timeosd.cpp index e08164061..74af715f2 100644 --- a/src/gui/timeosd.cpp +++ b/src/gui/timeosd.cpp @@ -36,7 +36,7 @@ -CTimeOSD::CTimeOSD():CComponentsFrmClock( 0, 0, 0, 50, "%H:%M:%S", true, CC_SHADOW_ON, COL_LIGHT_GRAY, COL_MENUCONTENT_PLUS_0,COL_MENUCONTENTDARK_PLUS_0) +CTimeOSD::CTimeOSD():CComponentsFrmClock( 0, 0, 0, 50, "%H:%M:%S", true, NULL, CC_SHADOW_ON, COL_LIGHT_GRAY, COL_MENUCONTENT_PLUS_0,COL_MENUCONTENTDARK_PLUS_0) { Init(); } diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index c68ceae61..a0e154bad 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -181,7 +181,7 @@ void CMenuItem::paintItemCaption(const bool select_mode, const int &item_height, right_bg_col = COL_MENUCONTENTINACTIVE_TEXT; right_frame_col = COL_MENUCONTENTINACTIVE_TEXT; } - CComponentsShapeSquare col(stringstartposOption, y + 2, dx - stringstartposOption + x - 2, item_height - 4, false, right_frame_col, right_bg_col); + CComponentsShapeSquare col(stringstartposOption, y + 2, dx - stringstartposOption + x - 2, item_height - 4, NULL, false, right_frame_col, right_bg_col); col.setFrameThickness(3); col.setCorner(RADIUS_LARGE); col.paint(false);