mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 07:51:19 +02:00
CComponentsItem/CComponentsForm: add property focus
Specifies that some certain operations especially eg. exec events for that item are possible.
This commit is contained in:
@@ -241,6 +241,8 @@ class CComponentsItem : public CComponents
|
|||||||
///property: page number, this defines current item page location, means: this item is embedded in a parent container on page number n, see also setPageNumber()
|
///property: page number, this defines current item page location, means: this item is embedded in a parent container on page number n, see also setPageNumber()
|
||||||
///default value is 0 for page one, any value > 0 causes handling for mutilple pages at parent container
|
///default value is 0 for page one, any value > 0 causes handling for mutilple pages at parent container
|
||||||
uint8_t cc_page_number;
|
uint8_t cc_page_number;
|
||||||
|
///specifies that some certain operations especially eg. exec events for that item are possible, see also setFocus(), hasFocus()
|
||||||
|
bool cc_has_focus;
|
||||||
|
|
||||||
///Pointer to the form object in which this item is embedded.
|
///Pointer to the form object in which this item is embedded.
|
||||||
///Is typically the type CComponentsForm or derived classes, default intialized with NULL
|
///Is typically the type CComponentsForm or derived classes, default intialized with NULL
|
||||||
@@ -269,6 +271,10 @@ class CComponentsItem : public CComponents
|
|||||||
virtual CComponentsForm* getParent(){return cc_parent;};
|
virtual CComponentsForm* getParent(){return cc_parent;};
|
||||||
///property: returns true if item is added to a form
|
///property: returns true if item is added to a form
|
||||||
virtual bool isAdded();
|
virtual bool isAdded();
|
||||||
|
///indicates wether item has focus
|
||||||
|
virtual bool hasFocus(){return cc_has_focus;}
|
||||||
|
///set or unset focus of item, stand alone items without parent have always set focus to true, inside of a parent form object, always the last added item has focus
|
||||||
|
virtual void setFocus(bool focus);
|
||||||
|
|
||||||
///abstract: paint item, arg: do_save_bg see paintInit() above
|
///abstract: paint item, arg: do_save_bg see paintInit() above
|
||||||
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES) = 0;
|
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES) = 0;
|
||||||
|
@@ -111,6 +111,7 @@ void CComponentsForm::addCCItem(CComponentsItem* cc_Item)
|
|||||||
//assign item index
|
//assign item index
|
||||||
int new_index = genIndex();
|
int new_index = genIndex();
|
||||||
cc_Item->setIndex(new_index);
|
cc_Item->setIndex(new_index);
|
||||||
|
cc_Item->setFocus(true);
|
||||||
|
|
||||||
dprintf(DEBUG_DEBUG, "\t%s-%d parent index = %d, assigned index ======> %d\n", __func__, __LINE__, cc_item_index, new_index);
|
dprintf(DEBUG_DEBUG, "\t%s-%d parent index = %d, assigned index ======> %d\n", __func__, __LINE__, cc_item_index, new_index);
|
||||||
|
|
||||||
|
@@ -50,6 +50,7 @@ CComponentsItem::CComponentsItem(CComponentsForm* parent)
|
|||||||
cc_item_enabled = true;
|
cc_item_enabled = true;
|
||||||
cc_item_selected = false;
|
cc_item_selected = false;
|
||||||
cc_page_number = 0;
|
cc_page_number = 0;
|
||||||
|
cc_has_focus = true;
|
||||||
initParent(parent);
|
initParent(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,3 +215,14 @@ void CComponentsItem::setWidthP(const uint8_t& w_percent)
|
|||||||
{
|
{
|
||||||
width = cc_parent ? w_percent*cc_parent->getWidth()/100 : w_percent*frameBuffer->getScreenWidth(true)/100;
|
width = cc_parent ? w_percent*cc_parent->getWidth()/100 : w_percent*frameBuffer->getScreenWidth(true)/100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CComponentsItem::setFocus(bool focus)
|
||||||
|
{
|
||||||
|
if(cc_parent){
|
||||||
|
for(size_t i=0; i<cc_parent->size(); i++){
|
||||||
|
if (focus)
|
||||||
|
cc_parent->getCCItem(i)->setFocus(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cc_has_focus = focus;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user