src/gui/components/cc_frm_footer.cpp: add member getButtonLabel()

Allows to get button label object from button collection.
This commit is contained in:
2018-08-18 11:22:23 +02:00
parent 3955da6893
commit 5d212fc401
3 changed files with 17 additions and 2 deletions

View File

@@ -205,10 +205,16 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen
* use hasButtonDirectKey(). * use hasButtonDirectKey().
* @see bool hasButtonDirectKey(), driver/rcinput.h for possible values * @see bool hasButtonDirectKey(), driver/rcinput.h for possible values
*/ */
neutrino_msg_t getButtonDirectKey(){return cc_directKeys[0];} neutrino_msg_t getButtonDirectKey()
{
for (size_t i= 0; i< cc_directKeys.size(); i++)
if (cc_directKeys[i] != RC_NOKEY)
return cc_directKeys[i];
return RC_NOKEY;
}
/** /**
* Returns true if filtered event msg value of button object is found in cc_directKeys container. * Returns true if defined parameter event msg value of button object is found in cc_directKeys container.
* @return bool * @return bool
* @param[in] msg * @param[in] msg
* @li expects type neutrino_msg_t as filter for searched message * @li expects type neutrino_msg_t as filter for searched message

View File

@@ -417,3 +417,10 @@ void CComponentsFooter::initDefaultFonts()
l_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; l_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE];
s_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]; s_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT];
} }
CComponentsButton* CComponentsFooter::getButtonLabel(const uint& item_id)
{
if (btn_container)
return static_cast<CComponentsButton*>(btn_container->getCCItem(item_id));
return NULL;
}

View File

@@ -155,6 +155,8 @@ class CComponentsFooter : public CComponentsHeader, public CCButtonSelect
void enableButtonShadow(int mode = CC_SHADOW_ON, const int& shadow_width = OFFSET_SHADOW/2, bool force_paint = false); void enableButtonShadow(int mode = CC_SHADOW_ON, const int& shadow_width = OFFSET_SHADOW/2, bool force_paint = false);
///disable shadow for embedded buttons ///disable shadow for embedded buttons
void disbaleButtonShadow(){enableButtonShadow(CC_SHADOW_OFF);} void disbaleButtonShadow(){enableButtonShadow(CC_SHADOW_OFF);}
///get button label object with defined item id
CComponentsButton* getButtonLabel(const uint& item_id);
}; };