mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
CComponentsWindow: add sub class CComponentsWindow
This commit is contained in:
@@ -547,4 +547,31 @@ class CComponentsHeader : public CComponentsForm
|
|||||||
void removeHeaderButtons();
|
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
|
#endif
|
||||||
|
@@ -359,6 +359,7 @@ void CComponentsText::initCCText()
|
|||||||
ct_textbox->setWindowPos(ct_box);
|
ct_textbox->setWindowPos(ct_box);
|
||||||
ct_textbox->setTextBorderWidth(0);
|
ct_textbox->setTextBorderWidth(0);
|
||||||
ct_textbox->enableBackgroundPaint(false);
|
ct_textbox->enableBackgroundPaint(false);
|
||||||
|
ct_textbox->setBackGroundColor(col_body);
|
||||||
ct_textbox->setBackGroundRadius(corner_rad-fr_thickness, corner_type);
|
ct_textbox->setBackGroundRadius(corner_rad-fr_thickness, corner_type);
|
||||||
ct_textbox->setTextColor(ct_col_text);
|
ct_textbox->setTextColor(ct_col_text);
|
||||||
ct_textbox->setWindowMaxDimensions(ct_box->iWidth, ct_box->iHeight);
|
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)
|
void CComponentsText::hide(bool no_restore)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (ct_textbox)
|
if (ct_textbox)
|
||||||
ct_textbox->hide();
|
ct_textbox->hide();
|
||||||
hideCCItem(no_restore);
|
hideCCItem(no_restore);
|
||||||
@@ -1532,7 +1534,9 @@ void CComponentsForm::clearCCItems()
|
|||||||
{
|
{
|
||||||
if (v_cc_items.empty())
|
if (v_cc_items.empty())
|
||||||
return;
|
return;
|
||||||
|
#ifdef DEBUG_CC
|
||||||
|
printf("[CComponentsForm] %s... cleanup %d form cc-items\n", __FUNCTION__, v_cc_items.size());
|
||||||
|
#endif
|
||||||
for(size_t i=0; i<v_cc_items.size(); i++) {
|
for(size_t i=0; i<v_cc_items.size(); i++) {
|
||||||
if (v_cc_items[i])
|
if (v_cc_items[i])
|
||||||
delete v_cc_items[i];
|
delete v_cc_items[i];
|
||||||
@@ -1910,6 +1914,7 @@ void CComponentsHeader::initCCHeaderText()
|
|||||||
cch_text_obj = new CComponentsText(cch_text_x, cch_items_y, width-cch_icon_w-fr_thickness, height-2*fr_thickness, cch_text.c_str());
|
cch_text_obj = new CComponentsText(cch_text_x, cch_items_y, width-cch_icon_w-fr_thickness, height-2*fr_thickness, cch_text.c_str());
|
||||||
cch_text_obj->setTextFont(cch_font);
|
cch_text_obj->setTextFont(cch_font);
|
||||||
cch_text_obj->setTextColor(cch_col_text);
|
cch_text_obj->setTextColor(cch_col_text);
|
||||||
|
cch_text_obj->setColorBody(col_body);
|
||||||
cch_text_obj->doPaintBg(false);
|
cch_text_obj->doPaintBg(false);
|
||||||
|
|
||||||
//corner of text item
|
//corner of text item
|
||||||
@@ -2121,3 +2126,57 @@ void CComponentsIconForm::paint(bool do_save_bg)
|
|||||||
//paint
|
//paint
|
||||||
paintCCItems();
|
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();
|
||||||
|
}
|
||||||
|
@@ -70,6 +70,7 @@ CTestMenu::CTestMenu()
|
|||||||
txt = NULL;
|
txt = NULL;
|
||||||
header = NULL;
|
header = NULL;
|
||||||
iconform = NULL;
|
iconform = NULL;
|
||||||
|
window = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CTestMenu::~CTestMenu()
|
CTestMenu::~CTestMenu()
|
||||||
@@ -82,6 +83,7 @@ CTestMenu::~CTestMenu()
|
|||||||
delete txt;
|
delete txt;
|
||||||
delete header;
|
delete header;
|
||||||
delete iconform;
|
delete iconform;
|
||||||
|
delete window;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
|
int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
|
||||||
@@ -498,6 +500,27 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
|
|||||||
}
|
}
|
||||||
return res;
|
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();
|
showTestMenu();
|
||||||
@@ -546,6 +569,7 @@ void CTestMenu::showCCTests(CMenuWidget *widget)
|
|||||||
widget->addItem(new CMenuForwarderNonLocalized("Text", true, NULL, this, "text"));
|
widget->addItem(new CMenuForwarderNonLocalized("Text", true, NULL, this, "text"));
|
||||||
widget->addItem(new CMenuForwarderNonLocalized("Header", true, NULL, this, "header"));
|
widget->addItem(new CMenuForwarderNonLocalized("Header", true, NULL, this, "header"));
|
||||||
widget->addItem(new CMenuForwarderNonLocalized("Icon-Form", true, NULL, this, "iconform"));
|
widget->addItem(new CMenuForwarderNonLocalized("Icon-Form", true, NULL, this, "iconform"));
|
||||||
|
widget->addItem(new CMenuForwarderNonLocalized("Window", true, NULL, this, "window"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTestMenu::showHWTests(CMenuWidget *widget)
|
void CTestMenu::showHWTests(CMenuWidget *widget)
|
||||||
|
@@ -47,6 +47,7 @@ class CTestMenu : public CMenuTarget
|
|||||||
CComponentsText *txt;
|
CComponentsText *txt;
|
||||||
CComponentsHeader *header;
|
CComponentsHeader *header;
|
||||||
CComponentsIconForm *iconform;
|
CComponentsIconForm *iconform;
|
||||||
|
CComponentsWindow *window;
|
||||||
int width, selected;
|
int width, selected;
|
||||||
|
|
||||||
void showTestMenu();
|
void showTestMenu();
|
||||||
|
Reference in New Issue
Block a user