CTestMenu: add sample code for CComponentsForm

This commit is contained in:
2012-11-01 16:47:25 +01:00
parent cda02273ea
commit 1cbe655513

View File

@@ -346,7 +346,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
} }
else if (actionKey == "picture"){ else if (actionKey == "picture"){
if (pic == NULL) if (pic == NULL)
pic = new CComponentsPicture (100, 100, 200, 200, "/share/tuxbox/neutrino/icons/mp3-5.jpg"); pic = new CComponentsPicture (100, 100, 200, 200, "/share/tuxbox/neutrino/icons/mp3-5.jpg", CC_PIC_IMAGE_MODE_AUTO);
if (!pic->isPainted() && !pic->isPicPainted()) if (!pic->isPainted() && !pic->isPicPainted())
pic->paint(); pic->paint();
@@ -367,12 +367,32 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
else if (actionKey == "form"){ else if (actionKey == "form"){
if (form == NULL) if (form == NULL)
form = new CComponentsForm(); form = new CComponentsForm();
form->setDimensionsAll(100, 100, 250, 300); form->setColorBody(COL_LIGHT_GRAY);
form->setCaption(NONEXISTANT_LOCALE); form->setDimensionsAll(100, 100, 250, 100);
form->setIcon(NEUTRINO_ICON_INFO);
if (form->isPainted()) CComponentsPicture *ptmp = new CComponentsPicture(0, 0, 0, 0, NEUTRINO_ICON_BUTTON_YELLOW);
ptmp->setWidth(28);
ptmp->setHeight(28);
ptmp->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER);
ptmp->setColorBody(COL_BLUE);
ptmp->setCornerRadius(RADIUS_MID);
ptmp->setCornerType(CORNER_TOP_LEFT);
form->addCCItem(ptmp);
CComponentsText *t1 = new CComponentsText(28, 0, 100, 28, "Text1", CTextBox::NO_AUTO_LINEBREAK);
CComponentsText *t2 = new CComponentsText(t1->getXPos()+t1->getWidth(), 0, 100, 28, "Text2", CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT);
form->addCCItem(t1);
form->addCCItem(t2);
// form->setCaption(NONEXISTANT_LOCALE);
// form->setIcon(NEUTRINO_ICON_INFO);
if (form->isPainted()) {
form->hide(); form->hide();
delete form;
form = NULL;
}
else else
form->paint(); form->paint();
return res; return res;