mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-30 00:41:09 +02:00
CComponentsButton: fix alignment of button items
Origin commit data
------------------
Branch: ni/coolstream
Commit: b18741efc7
Author: Thilo Graf <dbt@novatux.de>
Date: 2013-06-16 (Sun, 16 Jun 2013)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -86,25 +86,27 @@ void CComponentsButton::initIcon()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//initialize icon object
|
||||||
if (cc_btn_icon_obj == NULL){
|
if (cc_btn_icon_obj == NULL){
|
||||||
cc_btn_icon_obj = new CComponentsPicture(0, 0, 0, 0, cc_btn_icon);
|
cc_btn_icon_obj = new CComponentsPicture(0, 0, 0, 0, cc_btn_icon);
|
||||||
|
|
||||||
addCCItem(cc_btn_icon_obj);
|
addCCItem(cc_btn_icon_obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
//get first icon dimensions
|
//get first icon dimensions
|
||||||
int icon_w = 0, icon_h = 0;
|
int icon_w = cc_btn_icon_obj->getWidth();
|
||||||
frameBuffer->getIconSize(cc_btn_icon.c_str(), &icon_w, &icon_h);
|
int icon_h = cc_btn_icon_obj->getHeight();
|
||||||
|
|
||||||
//position of icon default centered
|
//position of icon default centered
|
||||||
int icon_x = width/2-icon_w/2;
|
int icon_x = width/2-icon_w/2;
|
||||||
|
int icon_y = height/2-icon_h/2;
|
||||||
|
|
||||||
//set properties to picture object
|
//set properties to picture object
|
||||||
if (cc_btn_icon_obj){
|
if (cc_btn_icon_obj){
|
||||||
cc_btn_icon_obj->setDimensionsAll(icon_x, 0, icon_w, height);
|
cc_btn_icon_obj->setPos(icon_x, icon_y);
|
||||||
cc_btn_icon_obj->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER);
|
cc_btn_icon_obj->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER);
|
||||||
cc_btn_icon_obj->doPaintBg(false);
|
cc_btn_icon_obj->doPaintBg(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CComponentsButton::initCaption()
|
void CComponentsButton::initCaption()
|
||||||
@@ -115,9 +117,9 @@ void CComponentsButton::initCaption()
|
|||||||
addCCItem(cc_btn_capt_obj);
|
addCCItem(cc_btn_capt_obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
int cap_x = (width/2)-(cc_btn_text_w/2); //text position is default centered
|
//text position is default centere
|
||||||
int cap_h = height;
|
int cap_x = (width/2)-(cc_btn_text_w/2);
|
||||||
int cap_y = 0 ;
|
int cap_y = (height/2)-(cc_btn_text_h/2);
|
||||||
|
|
||||||
//if we have a icon, then we must calculate centered position for booth items together
|
//if we have a icon, then we must calculate centered position for booth items together
|
||||||
if (cc_btn_icon_obj){
|
if (cc_btn_icon_obj){
|
||||||
@@ -129,7 +131,7 @@ void CComponentsButton::initCaption()
|
|||||||
|
|
||||||
//set properties to label object
|
//set properties to label object
|
||||||
if (cc_btn_capt_obj){
|
if (cc_btn_capt_obj){
|
||||||
cc_btn_capt_obj->setDimensionsAll(cap_x, cap_y, width-cap_x, cap_h);
|
cc_btn_capt_obj->setDimensionsAll(cap_x, cap_y, width-cap_x, height);
|
||||||
cc_btn_capt_obj->setTextColor(this->cc_item_enabled ? COL_MENUCONTENT : COL_MENUCONTENTINACTIVE);
|
cc_btn_capt_obj->setTextColor(this->cc_item_enabled ? COL_MENUCONTENT : COL_MENUCONTENTINACTIVE);
|
||||||
cc_btn_capt_obj->setText(cc_btn_capt, CTextBox::NO_AUTO_LINEBREAK, cc_btn_font);
|
cc_btn_capt_obj->setText(cc_btn_capt, CTextBox::NO_AUTO_LINEBREAK, cc_btn_font);
|
||||||
cc_btn_capt_obj->forceTextPaint(); //here required;
|
cc_btn_capt_obj->forceTextPaint(); //here required;
|
||||||
|
Reference in New Issue
Block a user