mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 08:21:12 +02:00
CTestMenu: add samples for new button handling in cc footer
This commit is contained in:
@@ -55,9 +55,18 @@
|
|||||||
#include <zapit/femanager.h>
|
#include <zapit/femanager.h>
|
||||||
#include <gui/widget/messagebox.h>
|
#include <gui/widget/messagebox.h>
|
||||||
#include <gui/buildinfo.h>
|
#include <gui/buildinfo.h>
|
||||||
|
#include <gui/widget/buttons.h>
|
||||||
|
|
||||||
extern int cs_test_card(int unit, char * str);
|
extern int cs_test_card(int unit, char * str);
|
||||||
|
|
||||||
|
#define TestButtonsCount 3
|
||||||
|
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 }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
CTestMenu::CTestMenu()
|
CTestMenu::CTestMenu()
|
||||||
{
|
{
|
||||||
@@ -533,12 +542,21 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
|
|||||||
else if (actionKey == "footer"){
|
else if (actionKey == "footer"){
|
||||||
int hh = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
|
int hh = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
|
||||||
if (footer == NULL){
|
if (footer == NULL){
|
||||||
footer = new CComponentsFooter (100, 50, 500, hh, CComponentsHeader::CC_BTN_HELP | CComponentsHeader::CC_BTN_EXIT | CComponentsHeader::CC_BTN_MENU, NULL, true);
|
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;
|
int start = 5, btnw =90, btnh = 37;
|
||||||
footer->addCCItem(new CComponentsButtonRed(start, 0, btnw, btnh, "Button1"));
|
footer->setIcon(NEUTRINO_ICON_INFO);
|
||||||
footer->addCCItem(new CComponentsButtonGreen(start+=btnw, 0, btnw, btnh, "Button2"));
|
|
||||||
footer->addCCItem(new CComponentsButtonYellow(start+=btnw, 0, btnw, btnh, "Button3"));
|
//add button labels with conventional button label struct
|
||||||
footer->addCCItem(new CComponentsButtonBlue(start+=btnw, 0, btnw, btnh, "Button4"));
|
footer->setButtonLabels(TestButtons, TestButtonsCount, 0, 250);
|
||||||
|
|
||||||
|
//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);
|
||||||
|
|
||||||
|
//also possible: use Button objects
|
||||||
|
// footer->addCCItem(new CComponentsButtonRed(start, 0, btnw, btnh, "Button1"));
|
||||||
|
// footer->addCCItem(new CComponentsButtonGreen(start+=btnw, 0, btnw, btnh, "Button2"));
|
||||||
|
// footer->addCCItem(new CComponentsButtonYellow(start+=btnw, 0, btnw, btnh, "Button3"));
|
||||||
|
// footer->addCCItem(new CComponentsButtonBlue(start+=btnw, 0, btnw, btnh, "Button4"));
|
||||||
}
|
}
|
||||||
if (!footer->isPainted())
|
if (!footer->isPainted())
|
||||||
footer->paint();
|
footer->paint();
|
||||||
|
Reference in New Issue
Block a user