CComponentsHeader: add member initCCButtonFormSize()

This moves caclulation from initCCHeaderButtons() to its own
member.
This commit is contained in:
2012-11-24 22:31:00 +01:00
parent 62f44d7a8c
commit 41165d7cb2
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);