mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 17:01:15 +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.
This commit is contained in:
@@ -199,20 +199,35 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns current primary event msg value of button object.
|
* Returns current primary event msg value of button object.
|
||||||
* @return neutrino_msg_t
|
* @return neutrino_msg_t \n
|
||||||
* @note This method returns only the first existant message value from cc_directKeys container \n
|
* If no key is avaliable return value = RC_NOKEY.
|
||||||
* Other existant keys ar ignored. If a certain value is required, \n
|
* @param[in] id
|
||||||
* use hasButtonDirectKey().
|
* @li expects type size_t as item id from cc_directKeys container of the button object \n
|
||||||
* @see bool hasButtonDirectKey(), driver/rcinput.h for possible values
|
* 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++)
|
for (size_t i= 0; i< cc_directKeys.size(); i++){
|
||||||
if (cc_directKeys[i] != RC_NOKEY)
|
if (i == 0){
|
||||||
return cc_directKeys[i];
|
if (cc_directKeys[i] != RC_NOKEY)
|
||||||
|
return cc_directKeys[i];
|
||||||
|
}else{
|
||||||
|
if (cc_directKeys[i] == id)
|
||||||
|
return cc_directKeys[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
return RC_NOKEY;
|
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.
|
* Returns true if defined parameter event msg value of button object is found in cc_directKeys container.
|
||||||
* @return bool
|
* @return bool
|
||||||
|
Reference in New Issue
Block a user