ComponentsInfoBox: arange text to the left border if no picture is painted

changed isPainted() to isPicPainted(), return of isPicPainted() value was
not marked-down to false and isPainted() means the container frame and
isPicPainted() means the picture itself, so the last state was wrong. Now
it should work fine.

Btw: scope of x_text reduced, is only required in member paintText()
This commit is contained in:
2012-09-25 15:32:33 +02:00
parent 51891e0ccb
commit 28904b79c7
2 changed files with 7 additions and 5 deletions

View File

@@ -222,7 +222,7 @@ class CComponentsInfoBox : public CComponentsContainer
private: private:
const char* text; const char* text;
int text_mode; //see textbox.h for possible modes int text_mode; //see textbox.h for possible modes
int x_text, x_offset; int x_offset;
Font* font; Font* font;
CBox * box; CBox * box;
CTextBox * textbox; CTextBox * textbox;

View File

@@ -325,7 +325,6 @@ void CComponentsInfoBox::initVarInfobox()
textbox = NULL; textbox = NULL;
pic = NULL; pic = NULL;
pic_name = ""; pic_name = "";
x_text = x;
x_offset = 10; x_offset = 10;
} }
@@ -361,8 +360,10 @@ void CComponentsInfoBox::paintText()
box = new CBox(); box = new CBox();
//define text x position //define text x position
x_text = x+fr_thickness+x_offset; int x_text = x+fr_thickness+x_offset;
if (pic->isPainted()){
//set text to the left border if picture not painted
if (pic->isPicPainted()){
int pic_w = pic->getWidth(); int pic_w = pic->getWidth();
x_text += pic_w+x_offset; x_text += pic_w+x_offset;
} }
@@ -383,7 +384,7 @@ void CComponentsInfoBox::paintText()
//set properties //set properties
textbox->setTextFont(font); textbox->setTextFont(font);
textbox->movePosition(box->iX, box->iY); textbox->setWindowPos(box);
textbox->setTextColor(ibox_col_text); textbox->setTextColor(ibox_col_text);
//set text //set text
@@ -765,6 +766,7 @@ void CComponentsPicture::paint(bool do_save_bg)
{ {
initVarPicture(); initVarPicture();
paintInit(do_save_bg); paintInit(do_save_bg);
pic_painted = false;
if (do_paint){ if (do_paint){
if (picMode == CC_PIC_ICON) if (picMode == CC_PIC_ICON)