mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 23:42:58 +02:00
cc_frm_footer/cc_frm_button: fix some arangement errors
This commit is contained in:
@@ -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.id = CC_ITEMTYPE_BUTTON;
|
||||||
cc_item_type.name = "cc_base_button";
|
cc_item_type.name = "cc_base_button";
|
||||||
|
|
||||||
x = x_pos;
|
x = cc_xr = cc_xr_old = x_old = x_pos;
|
||||||
y = y_pos;
|
y = cc_yr = cc_yr_old = y_old = y_pos;
|
||||||
width = w;
|
width = w;
|
||||||
height = h;
|
height = h;
|
||||||
shadow = shadow_mode;
|
shadow = shadow_mode;
|
||||||
@@ -143,31 +143,26 @@ void CComponentsButton::initIcon()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//initialize icon object
|
//init icon file
|
||||||
string::size_type pos = cc_btn_icon.find("/", 0);
|
string::size_type pos = cc_btn_icon.find("/", 0);
|
||||||
if (pos == string::npos)
|
if (pos == string::npos)
|
||||||
cc_btn_icon = frameBuffer->getIconPath(cc_btn_icon);
|
cc_btn_icon = frameBuffer->getIconPath(cc_btn_icon);
|
||||||
|
|
||||||
int y_icon = 0;
|
//get required icon height and position
|
||||||
int h_icon = 0;
|
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){
|
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->SetTransparent(CFrameBuffer::TM_BLACK);
|
||||||
cc_btn_icon_obj->doPaintBg(false);
|
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()
|
void CComponentsButton::initCaption()
|
||||||
|
@@ -66,8 +66,8 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const
|
|||||||
cc_item_type.id = CC_ITEMTYPE_FOOTER;
|
cc_item_type.id = CC_ITEMTYPE_FOOTER;
|
||||||
cc_item_type.name = "cc_footer";
|
cc_item_type.name = "cc_footer";
|
||||||
|
|
||||||
x = x_old = x_pos;
|
x = cc_xr = cc_xr_old = x_old = x_pos;
|
||||||
y = y_old = y_pos;
|
y = cc_yr = cc_yr_old = y_old = y_pos;
|
||||||
|
|
||||||
//init footer width
|
//init footer width
|
||||||
width = width_old = w == 0 ? frameBuffer->getScreenWidth(true) : w;
|
width = width_old = w == 0 ? frameBuffer->getScreenWidth(true) : w;
|
||||||
@@ -174,12 +174,15 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con
|
|||||||
*/
|
*/
|
||||||
int dist = height/2-cch_offset;
|
int dist = height/2-cch_offset;
|
||||||
int h_container = ccf_btn_font->getHeight() > height+dist ? height-dist : ccf_btn_font->getHeight()+dist;
|
int h_container = ccf_btn_font->getHeight() > height+dist ? height-dist : ccf_btn_font->getHeight()+dist;
|
||||||
|
h_container -= cc_parent ? (cc_parent->getFrameThickness()/2 - shadow_w) : 0; // if footer is embedded then consider possible frame around parent object (e.g. window)
|
||||||
int x_container = width/2 - w_container/2; //FIXME: only centered position, other items will be overpainted
|
int x_container = width/2 - w_container/2; //FIXME: only centered position, other items will be overpainted
|
||||||
int y_container = height/2 - h_container/2;
|
int y_container = height/2 - h_container/2;
|
||||||
|
|
||||||
if (cch_icon_obj)
|
if (cch_icon_obj)
|
||||||
x_container = cch_offset+cch_icon_obj->getWidth()+cch_offset;
|
x_container = cch_offset+cch_icon_obj->getWidth()+cch_offset;
|
||||||
if (btn_container == NULL){
|
if (btn_container == NULL){
|
||||||
btn_container = new CComponentsFrmChain(x_container, y_container, w_container, h_container, 0, CC_DIR_X, this, CC_SHADOW_OFF, COL_MENUCONTENT_PLUS_6, col_body);
|
btn_container = new CComponentsFrmChain(x_container, y_container, w_container, h_container, 0, CC_DIR_X, this, CC_SHADOW_OFF, COL_MENUCONTENT_PLUS_6, col_body);
|
||||||
|
btn_container->setItemName(cc_parent ? cc_parent->getItemName() + ":" + getItemName() + ":btn_container" : "");
|
||||||
btn_container->setAppendOffset(0, 0);
|
btn_container->setAppendOffset(0, 0);
|
||||||
//btn_container->setCorner(this->corner_rad, this->corner_type);
|
//btn_container->setCorner(this->corner_rad, this->corner_type);
|
||||||
btn_container->doPaintBg(false);
|
btn_container->doPaintBg(false);
|
||||||
@@ -310,6 +313,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label * const conten
|
|||||||
}
|
}
|
||||||
setButtonLabels(buttons, label_count, chain_width, label_width);
|
setButtonLabels(buttons, label_count, chain_width, label_width);
|
||||||
delete[] buttons;
|
delete[] buttons;
|
||||||
|
buttons = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CComponentsFooter::setButtonLabels(const vector<button_label_cc> &v_content, const int& chain_width, const int& label_width)
|
void CComponentsFooter::setButtonLabels(const vector<button_label_cc> &v_content, const int& chain_width, const int& label_width)
|
||||||
@@ -329,6 +333,7 @@ void CComponentsFooter::setButtonLabels(const vector<button_label_cc> &v_content
|
|||||||
|
|
||||||
setButtonLabels(buttons, label_count, chain_width, label_width);
|
setButtonLabels(buttons, label_count, chain_width, label_width);
|
||||||
delete[] buttons;
|
delete[] buttons;
|
||||||
|
buttons = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CComponentsFooter::setButtonLabel( const char *button_icon,
|
void CComponentsFooter::setButtonLabel( const char *button_icon,
|
||||||
|
Reference in New Issue
Block a user