cc_frm_footer/cc_frm_button: fix some arangement errors

This commit is contained in:
2019-10-27 16:24:47 +01:00
parent ed701f450a
commit 31b73a4e35
2 changed files with 21 additions and 21 deletions

View File

@@ -97,8 +97,8 @@ void CComponentsButton::initVarButton( const int& x_pos, const int& y_pos, const
cc_item_type.id = CC_ITEMTYPE_BUTTON;
cc_item_type.name = "cc_base_button";
x = x_pos;
y = y_pos;
x = cc_xr = cc_xr_old = x_old = x_pos;
y = cc_yr = cc_yr_old = y_old = y_pos;
width = w;
height = h;
shadow = shadow_mode;
@@ -143,31 +143,26 @@ void CComponentsButton::initIcon()
return;
}
//initialize icon object
//init icon file
string::size_type pos = cc_btn_icon.find("/", 0);
if (pos == string::npos)
cc_btn_icon = frameBuffer->getIconPath(cc_btn_icon);
int y_icon = 0;
int h_icon = 0;
//get required icon height and position
int h_icon = height-2*fr_thickness - 2*OFFSET_INNER_MIN;
int dx_tmp, dy_tmp = 0;
frameBuffer->getIconSize(cc_btn_icon.c_str(), &dx_tmp, &dy_tmp);
h_icon = min(h_icon, dy_tmp);
h_icon -= h_icon % 2;
int y_icon = height/2 - h_icon/2;
//init icon object
if (cc_btn_icon_obj == NULL){
cc_btn_icon_obj = new CComponentsPicture(fr_thickness, 0, cc_btn_icon, this);
cc_btn_icon_obj = new CComponentsPicture(fr_thickness, y_icon, cc_btn_icon, this);
cc_btn_icon_obj->SetTransparent(CFrameBuffer::TM_BLACK);
cc_btn_icon_obj->doPaintBg(false);
cc_btn_icon_obj->setHeight(h_icon, true);
}
h_icon = cc_btn_icon_obj->getHeight();
//get required icon height
int h_max = height-2*fr_thickness;
//get current icon dimensions
if (h_icon > h_max)
cc_btn_icon_obj->setHeight(h_max, true);
y_icon = h_max/2 - cc_btn_icon_obj->getHeight()/2;
cc_btn_icon_obj->setYPos(y_icon);
}
void CComponentsButton::initCaption()