diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 320a6294d..2be90bf75 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -547,4 +547,31 @@ class CComponentsHeader : public CComponentsForm void removeHeaderButtons(); }; +class CComponentsWindow : public CComponentsForm +{ + private: + CComponentsHeader * ccw_head; + std::string ccw_caption; + const char* ccw_icon_name; + + void initHeader(); + void initCCWItems(); + + protected: + void initVarWindow(); + + public: + enum + { + CC_WINDOW_ITEM_HEADER = 0 + }; + CComponentsWindow(); + ~CComponentsWindow(); + + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); + void refresh(){initCCWItems();}; + void setWindowCaption(const std::string& text){ccw_caption = text;}; + void setWindowIcon(const char* iconname){ccw_icon_name = iconname;}; +}; + #endif diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index eebefe7ad..03319238e 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -359,6 +359,7 @@ void CComponentsText::initCCText() ct_textbox->setWindowPos(ct_box); ct_textbox->setTextBorderWidth(0); ct_textbox->enableBackgroundPaint(false); + ct_textbox->setBackGroundColor(col_body); ct_textbox->setBackGroundRadius(corner_rad-fr_thickness, corner_type); ct_textbox->setTextColor(ct_col_text); ct_textbox->setWindowMaxDimensions(ct_box->iWidth, ct_box->iHeight); @@ -404,6 +405,7 @@ void CComponentsText::paint(bool do_save_bg) void CComponentsText::hide(bool no_restore) { + if (ct_textbox) ct_textbox->hide(); hideCCItem(no_restore); @@ -1532,7 +1534,9 @@ void CComponentsForm::clearCCItems() { if (v_cc_items.empty()) return; - +#ifdef DEBUG_CC + printf("[CComponentsForm] %s... cleanup %d form cc-items\n", __FUNCTION__, v_cc_items.size()); +#endif for(size_t i=0; isetTextFont(cch_font); cch_text_obj->setTextColor(cch_col_text); + cch_text_obj->setColorBody(col_body); cch_text_obj->doPaintBg(false); //corner of text item @@ -1920,10 +1925,10 @@ void CComponentsHeader::initCCHeaderText() void CComponentsHeader::initCCHItems() { #if 0 - //clean up first possible old item objects, includes delete and clean up vector - clearCCItems(); + //clean up first possible old item objects, includes delete and clean up vector + clearCCItems(); #endif - + //init icon initCCHeaderIcon(); @@ -1942,7 +1947,7 @@ void CComponentsHeader::initCCHItems() addCCItem(cch_btn_obj); //buttons } - + void CComponentsHeader::paint(bool do_save_bg) { //paint body @@ -2121,3 +2126,57 @@ void CComponentsIconForm::paint(bool do_save_bg) //paint paintCCItems(); } + +//------------------------------------------------------------------------------------------------------- +//sub class CComponentsWindow inherit from CComponentsForm +CComponentsWindow::CComponentsWindow() +{ + initVarWindow(); +} + +void CComponentsWindow::initVarWindow() +{ + //CComponentsForm + initVarForm(); + + ccw_head = NULL; + ccw_caption = ""; + ccw_icon_name = NULL; + + setShadowOnOff(true); +} + +CComponentsWindow::~CComponentsWindow() +{ + if (ccw_head) + delete ccw_head; +} + +void CComponentsWindow::initHeader() +{ + if (ccw_head == NULL) + ccw_head = new CComponentsHeader(); + + ccw_head->setXPos(0); + ccw_head->setYPos(0); + ccw_head->setWidth(width); + ccw_head->setHeaderIcon(ccw_icon_name); + ccw_head->setHeaderText(ccw_caption); +} + +void CComponentsWindow::initCCWItems() +{ + initHeader(); + + if (ccw_head) + addCCItem(ccw_head); +} + +void CComponentsWindow::paint(bool do_save_bg) +{ + //paint body + paintInit(do_save_bg); + + //paint + paintCCItems(); +} diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index b27014f4b..ecdef3651 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -70,6 +70,7 @@ CTestMenu::CTestMenu() txt = NULL; header = NULL; iconform = NULL; + window = NULL; } CTestMenu::~CTestMenu() @@ -82,6 +83,7 @@ CTestMenu::~CTestMenu() delete txt; delete header; delete iconform; + delete window; } int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) @@ -498,6 +500,27 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) } return res; } + else if (actionKey == "window"){ + if (window == NULL){ + window = new CComponentsWindow(); + window->setWindowCaption("|.....................|"); + window->setDimensionsAll(50, 50, 800, 480); + window->setWindowIcon(NEUTRINO_ICON_INFO); + } + else{ +// window->setDimensionsAll(50, 50, 800, 480); + window->setWindowIcon(NEUTRINO_ICON_LOCK); + window->setWindowCaption("Test"); + } + window->refresh(); + + if (!window->isPainted()) + window->paint(); + else + window->hide(); + + return res; + } showTestMenu(); @@ -546,6 +569,7 @@ void CTestMenu::showCCTests(CMenuWidget *widget) widget->addItem(new CMenuForwarderNonLocalized("Text", true, NULL, this, "text")); widget->addItem(new CMenuForwarderNonLocalized("Header", true, NULL, this, "header")); widget->addItem(new CMenuForwarderNonLocalized("Icon-Form", true, NULL, this, "iconform")); + widget->addItem(new CMenuForwarderNonLocalized("Window", true, NULL, this, "window")); } void CTestMenu::showHWTests(CMenuWidget *widget) diff --git a/src/gui/test_menu.h b/src/gui/test_menu.h index c6f30a865..7b582286e 100644 --- a/src/gui/test_menu.h +++ b/src/gui/test_menu.h @@ -47,6 +47,7 @@ class CTestMenu : public CMenuTarget CComponentsText *txt; CComponentsHeader *header; CComponentsIconForm *iconform; + CComponentsWindow *window; int width, selected; void showTestMenu();