CComponentsHeader: add member initCCButtonFormSize()

This moves caclulation from initCCHeaderButtons() to its own
member.


Origin commit data
------------------
Branch: ni/coolstream
Commit: 41165d7cb2
Author: Thilo Graf <dbt@novatux.de>
Date: 2012-11-24 (Sat, 24 Nov 2012)



------------------
This commit was generated by Migit
This commit is contained in:
2012-11-24 22:31:00 +01:00
parent 63a7996e10
commit 1366a261dd
2 changed files with 14 additions and 9 deletions

View File

@@ -506,6 +506,7 @@ class CComponentsHeader : public CComponentsForm
void initCCHeaderButtons();
void initCCHItems();
void initCCHDefaultButtons();
void initCCButtonFormSize();
protected:
void initVarHeader();

View File

@@ -1831,6 +1831,17 @@ void CComponentsHeader::initCCHDefaultButtons()
v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_MENU);
}
// calculate minimal width of icon form
void CComponentsHeader::initCCButtonFormSize()
{
ccif_width = 0;
for(size_t i=0; i<v_cch_btn.size(); i++){
int bw, bh;
frameBuffer->getIconSize(v_cch_btn[i].c_str(), &bw, &bh);
ccif_width += (bw + cch_btn_offset);
}
}
void CComponentsHeader::initCCHeaderButtons()
{
initCCHDefaultButtons();
@@ -1839,14 +1850,7 @@ void CComponentsHeader::initCCHeaderButtons()
if (v_cch_btn.empty())
return;
// calculate minimal width of icon form
size_t btncnt = v_cch_btn.size();
ccif_width = 0;
for(size_t i=0; i<btncnt; i++){
int bw, bh;
frameBuffer->getIconSize(v_cch_btn[i].c_str(), &bw, &bh);
ccif_width += (bw + cch_btn_offset);
}
initCCButtonFormSize();
cch_btn_obj = new CComponentsIconForm();
cch_btn_obj->setDimensionsAll(0+width-ccif_width, 0, ccif_width-cch_btn_offset, height);