CComponentsItem/CComponentsForm: add property focus

Specifies that some certain operations especially eg. exec events for
that item are possible.
This commit is contained in:
2014-09-02 08:35:12 +02:00
committed by [CST] Focus
parent 5ae495716e
commit 0c0e0e85ff
3 changed files with 19 additions and 0 deletions

View File

@@ -50,6 +50,7 @@ CComponentsItem::CComponentsItem(CComponentsForm* parent)
cc_item_enabled = true;
cc_item_selected = false;
cc_page_number = 0;
cc_has_focus = true;
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;
}
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;
}