mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-27 15:32:52 +02:00
cc_frm_button.h: expand getButtonDirectKey() for item id
With this parameter it is possible to get any existing directkey
inside button object. For compatibility the old behavior is untouched.
Origin commit data
------------------
Commit: c16e5e6626
Author: Thilo Graf <dbt@novatux.de>
Date: 2018-08-19 (Sun, 19 Aug 2018)
This commit is contained in:
@@ -199,20 +199,35 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen
|
||||
|
||||
/**
|
||||
* Returns current primary event msg value of button object.
|
||||
* @return neutrino_msg_t
|
||||
* @note This method returns only the first existant message value from cc_directKeys container \n
|
||||
* Other existant keys ar ignored. If a certain value is required, \n
|
||||
* use hasButtonDirectKey().
|
||||
* @see bool hasButtonDirectKey(), driver/rcinput.h for possible values
|
||||
* @return neutrino_msg_t \n
|
||||
* If no key is avaliable return value = RC_NOKEY.
|
||||
* @param[in] id
|
||||
* @li expects type size_t as item id from cc_directKeys container of the button object \n
|
||||
* Default parameter is 0. This returns the first existant message value from cc_directKeys container. \n
|
||||
* If required use getKeySize() to get current count of avalable keys.
|
||||
* @see bool hasButtonDirectKey(), size_t getKeySize(), driver/rcinput.h for possible values
|
||||
*/
|
||||
neutrino_msg_t getButtonDirectKey()
|
||||
neutrino_msg_t getButtonDirectKey(const size_t& id = 0)
|
||||
{
|
||||
for (size_t i= 0; i< cc_directKeys.size(); i++)
|
||||
if (cc_directKeys[i] != RC_NOKEY)
|
||||
return cc_directKeys[i];
|
||||
for (size_t i= 0; i< cc_directKeys.size(); i++){
|
||||
if (i == 0){
|
||||
if (cc_directKeys[i] != RC_NOKEY)
|
||||
return cc_directKeys[i];
|
||||
}else{
|
||||
if (cc_directKeys[i] == id)
|
||||
return cc_directKeys[i];
|
||||
}
|
||||
}
|
||||
return RC_NOKEY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns count of existant direct keys of cc_directKeys container.
|
||||
* @return size_t
|
||||
* @see getButtonDirectKey(), driver/rcinput.h for possible values
|
||||
*/
|
||||
size_t getKeySize() {return cc_directKeys.size();}
|
||||
|
||||
/**
|
||||
* Returns true if defined parameter event msg value of button object is found in cc_directKeys container.
|
||||
* @return bool
|
||||
|
Reference in New Issue
Block a user