mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 00:41:17 +02:00
CComponentsInfoBox: fix centering of image
This commit is contained in:
@@ -95,8 +95,11 @@ void CComponentsInfoBox::setPicture(const char* picture_name)
|
|||||||
void CComponentsInfoBox::paintPicture()
|
void CComponentsInfoBox::paintPicture()
|
||||||
{
|
{
|
||||||
//ensure empty pic object
|
//ensure empty pic object
|
||||||
if (pic)
|
if (pic){
|
||||||
|
if (pic->isPicPainted())
|
||||||
|
pic->kill();
|
||||||
delete pic;
|
delete pic;
|
||||||
|
}
|
||||||
pic = NULL;
|
pic = NULL;
|
||||||
|
|
||||||
//exit if no image definied
|
//exit if no image definied
|
||||||
@@ -104,15 +107,13 @@ void CComponentsInfoBox::paintPicture()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//init pic object and set icon paint position
|
//init pic object and set icon paint position
|
||||||
pic = new CComponentsPicture(x+fr_thickness+x_offset, y+fr_thickness, "");
|
pic = new CComponentsPicture(x+fr_thickness+x_offset, y+fr_thickness, 0, height-2*fr_thickness, pic_name); //NOTE: icons do not scale!
|
||||||
|
|
||||||
//define icon
|
|
||||||
pic->setPicture(pic_name);
|
|
||||||
|
|
||||||
//fit icon into infobox
|
|
||||||
pic->setHeight(height-2*fr_thickness);
|
|
||||||
pic->setColorBody(col_body);
|
pic->setColorBody(col_body);
|
||||||
|
|
||||||
|
//fit icon into frame
|
||||||
|
pic->setYPos(y+(height/2-pic->getHeight()/2));
|
||||||
|
|
||||||
//paint, but set visibility mode
|
//paint, but set visibility mode
|
||||||
pic->allowPaint(cc_allow_paint);
|
pic->allowPaint(cc_allow_paint);
|
||||||
pic->paint(CC_SAVE_SCREEN_NO);
|
pic->paint(CC_SAVE_SCREEN_NO);
|
||||||
|
@@ -57,9 +57,6 @@ class CComponentsInfoBox : public CComponentsText
|
|||||||
///property: path or name of displayed image
|
///property: path or name of displayed image
|
||||||
std::string pic_name;
|
std::string pic_name;
|
||||||
|
|
||||||
///set scale mode of image
|
|
||||||
bool scale_image;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
///object: internal used CTextBox object
|
///object: internal used CTextBox object
|
||||||
CComponentsText * cctext;
|
CComponentsText * cctext;
|
||||||
|
Reference in New Issue
Block a user