CTestMenu: add sample code for removeHeaderButtons()

This commit is contained in:
2012-11-25 15:42:21 +01:00
parent 9150088088
commit 14393b36d9

View File

@@ -424,8 +424,10 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
} }
else if (actionKey == "header"){ else if (actionKey == "header"){
int hh = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); int hh = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
if (header == NULL) if (header == NULL){
header = new CComponentsHeader (100, 50, 500, hh, "Test-Header", NEUTRINO_ICON_INFO, CComponentsHeader::CC_BTN_HELP | CComponentsHeader::CC_BTN_EXIT | CComponentsHeader::CC_BTN_MENU); header = new CComponentsHeader (100, 50, 500, hh, "Test-Header", NEUTRINO_ICON_INFO, CComponentsHeader::CC_BTN_HELP | CComponentsHeader::CC_BTN_EXIT | CComponentsHeader::CC_BTN_MENU);
// header->addHeaderButton(NEUTRINO_ICON_BUTTON_RED);
}
// else //For existing instances it's recommended // else //For existing instances it's recommended
// //to remove old button icons before add new buttons, otherwise icons will be appended. // //to remove old button icons before add new buttons, otherwise icons will be appended.
// header->removeHeaderButtons(); // header->removeHeaderButtons();
@@ -434,16 +436,18 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
// header->setFrameThickness(5); // header->setFrameThickness(5);
// header->setColorFrame(COL_WHITE); // header->setColorFrame(COL_WHITE);
// header->setCornerType(CORNER_TOP); // header->setCornerType(CORNER_TOP);
// change text of header
// header->setHeaderText("Test"); // header->setHeaderText("Test");
// add any other button icon
// header->addHeaderButton(NEUTRINO_ICON_BUTTON_RED); // header->addHeaderButton(NEUTRINO_ICON_BUTTON_RED);
// header->addHeaderButton(NEUTRINO_ICON_BUTTON_HELP);
// header->addHeaderButton(NEUTRINO_ICON_BUTTON_MENU);
// example to replace the text item with an image item // example to replace the text item with an image item
// get text x position // get text x position
int logo_x = header->getCCItem(1)->getXPos(); int logo_x = header->getCCItem(CComponentsHeader::CC_HEADER_ITEM_TEXT)->getXPos();
// remove text item // remove text item
header->removeCCItem(1); //then remove text item header->removeCCItem(CComponentsHeader::CC_HEADER_ITEM_TEXT); //then remove text item
// create picture object with the last x position of text // create picture object with the last x position of text
CComponentsPicture *logo = new CComponentsPicture(logo_x, 0, 100, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(), "/share/tuxbox/neutrino/icons/hint_tvmode.png"); CComponentsPicture *logo = new CComponentsPicture(logo_x, 0, 100, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(), "/share/tuxbox/neutrino/icons/hint_tvmode.png");
// set the transparent background for picture item // set the transparent background for picture item