CComponentsButton, CComponentsFooter: rework bestfit of buttons inside chain

This commit is contained in:
2014-05-01 19:40:59 +02:00
parent 2256c83b98
commit 9ffdb1cb98
4 changed files with 82 additions and 54 deletions

View File

@@ -59,12 +59,13 @@
extern int cs_test_card(int unit, char * str);
#define TestButtonsCount 3
#define TestButtonsCount 4
const struct button_label TestButtons[/*TestButtonsCount*/] =
{
{ NEUTRINO_ICON_BUTTON_RED , LOCALE_STRINGINPUT_CAPS },
{ NEUTRINO_ICON_BUTTON_GREEN , LOCALE_STRINGINPUT_CLEAR },
{ NEUTRINO_ICON_BUTTON_YELLOW , LOCALE_MESSAGEBOX_INFO }
{ NEUTRINO_ICON_BUTTON_YELLOW , LOCALE_MESSAGEBOX_INFO },
{ NEUTRINO_ICON_BUTTON_BLUE , LOCALE_STRINGINPUT_CLEAR }
};
@@ -368,7 +369,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
}
else if (actionKey == "button"){
if (button == NULL)
button = new CComponentsButtonRed(100, 100, 100, 40, "Test");
button = new CComponentsButtonRed(100, 100, 100, 50, "Test");
if (!button->isPainted()){
if (button->isSelected())
@@ -544,10 +545,13 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
if (footer == NULL){
footer = new CComponentsFooter (100, 30, 1000, hh, CComponentsFooter::CC_BTN_HELP | CComponentsFooter::CC_BTN_EXIT | CComponentsFooter::CC_BTN_MENU |CComponentsFooter::CC_BTN_MUTE_ZAP_ACTIVE, NULL, true);
int start = 5, btnw =90, btnh = 37;
footer->showButtonContour();
footer->setButtonFont(g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]);
footer->setIcon(NEUTRINO_ICON_INFO);
//add button labels with conventional button label struct
footer->setButtonLabels(TestButtons, TestButtonsCount, 0, 250);
footer->setButtonLabels(TestButtons, TestButtonsCount, 0, 150);
//also possible: use directly button name and as 2nd parameter string or locale as text
// footer->setButtonLabel(NEUTRINO_ICON_BUTTON_RED, "This is a button label text!", 0, 250);