diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp index 8a51786d8..4385341be 100644 --- a/src/gui/components/cc_item_infobox.cpp +++ b/src/gui/components/cc_item_infobox.cpp @@ -95,8 +95,11 @@ void CComponentsInfoBox::setPicture(const char* picture_name) void CComponentsInfoBox::paintPicture() { //ensure empty pic object - if (pic) + if (pic){ + if (pic->isPicPainted()) + pic->kill(); delete pic; + } pic = NULL; //exit if no image definied @@ -104,15 +107,13 @@ void CComponentsInfoBox::paintPicture() return; //init pic object and set icon paint position - pic = new CComponentsPicture(x+fr_thickness+x_offset, y+fr_thickness, ""); - - //define icon - pic->setPicture(pic_name); + pic = new CComponentsPicture(x+fr_thickness+x_offset, y+fr_thickness, 0, height-2*fr_thickness, pic_name); //NOTE: icons do not scale! - //fit icon into infobox - pic->setHeight(height-2*fr_thickness); pic->setColorBody(col_body); + //fit icon into frame + pic->setYPos(y+(height/2-pic->getHeight()/2)); + //paint, but set visibility mode pic->allowPaint(cc_allow_paint); pic->paint(CC_SAVE_SCREEN_NO); diff --git a/src/gui/components/cc_item_infobox.h b/src/gui/components/cc_item_infobox.h index da6043757..7a8c5c616 100644 --- a/src/gui/components/cc_item_infobox.h +++ b/src/gui/components/cc_item_infobox.h @@ -57,9 +57,6 @@ class CComponentsInfoBox : public CComponentsText ///property: path or name of displayed image std::string pic_name; - ///set scale mode of image - bool scale_image; - public: ///object: internal used CTextBox object CComponentsText * cctext;