From 5d212fc401d09c2f8559ae339404f862f26f1382 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 18 Aug 2018 11:22:23 +0200 Subject: [PATCH] src/gui/components/cc_frm_footer.cpp: add member getButtonLabel() Allows to get button label object from button collection. --- src/gui/components/cc_frm_button.h | 10 ++++++++-- src/gui/components/cc_frm_footer.cpp | 7 +++++++ src/gui/components/cc_frm_footer.h | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_frm_button.h b/src/gui/components/cc_frm_button.h index 0a78dcf4c..fd70ae75b 100644 --- a/src/gui/components/cc_frm_button.h +++ b/src/gui/components/cc_frm_button.h @@ -205,10 +205,16 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen * use hasButtonDirectKey(). * @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 * @param[in] msg * @li expects type neutrino_msg_t as filter for searched message diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index edc4c320a..458b39f0f 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -417,3 +417,10 @@ void CComponentsFooter::initDefaultFonts() l_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; s_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]; } + +CComponentsButton* CComponentsFooter::getButtonLabel(const uint& item_id) +{ + if (btn_container) + return static_cast(btn_container->getCCItem(item_id)); + return NULL; +} diff --git a/src/gui/components/cc_frm_footer.h b/src/gui/components/cc_frm_footer.h index f8d097272..3b90a21a8 100644 --- a/src/gui/components/cc_frm_footer.h +++ b/src/gui/components/cc_frm_footer.h @@ -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); ///disable shadow for embedded buttons void disbaleButtonShadow(){enableButtonShadow(CC_SHADOW_OFF);} + ///get button label object with defined item id + CComponentsButton* getButtonLabel(const uint& item_id); };