diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index b9a25ca16..4d58d027f 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -174,48 +174,49 @@ void CVolumeBar::initVolumeBarItems() //init current icon object void CVolumeBar::initVolumeBarIcon() { - vb_icon = new CComponentsPicture(vb_icon_x, CC_CENTERED, vb_icon_w, height, NEUTRINO_ICON_VOLUME); + if (!vb_icon){ + vb_icon = new CComponentsPicture(vb_icon_x, CC_CENTERED, vb_icon_w, height, NEUTRINO_ICON_VOLUME); + //add icon to container + addCCItem(vb_icon); + } + vb_icon->setDimensionsAll(vb_icon_x, CC_CENTERED, vb_icon_w, height); vb_icon->setColorBody(col_body); vb_icon->setCorner(corner_rad, CORNER_LEFT); - - //add icon to container - addCCItem(vb_icon); } //create new scale void CVolumeBar::initVolumeBarScale() { - vb_pb = new CProgressBar(); + if (!vb_pb){ + vb_pb = new CProgressBar(); + //add progressbar to container + addCCItem(vb_pb); + } vb_pb->setType(CProgressBar::PB_REDRIGHT); vb_pb->setRgb(85, 75, 100); vb_pb->setFrameThickness(2); vb_pb->setProgress(vb_pbx, vb_pby, vb_pbw, vb_pbh, *vb_vol, 100); - - //add progressbar to container - addCCItem(vb_pb); } //set digit text with current volume value void CVolumeBar::initVolumeBarDigitValue() { + vb_digit->kill(col_body); vb_digit->setText(*vb_vol ,vb_digit_mode, *(CVolumeHelper::getInstance()->vb_font)); } //create digit void CVolumeBar::initVolumeBarDigit() { - vb_digit = new CComponentsLabel(); + if (!vb_digit) + vb_digit = new CComponentsLabel(this); vb_digit->setDimensionsAll(vb_digit_x, 0, vb_digit_w, height); vb_digit->setTextColor(COL_MENUCONTENT_TEXT); vb_digit->setCorner(corner_rad, CORNER_RIGHT); - vb_digit->doPaintTextBoxBg(true); initVolumeBarDigitValue(); - - //add digit label to container - addCCItem(vb_digit); } //refresh and paint digit @@ -244,6 +245,18 @@ void CVolumeBar::paintVolScale() vb_pb->paint(CC_SAVE_SCREEN_NO); } +void CVolumeBar::paint(bool do_save_bg) +{ + //prepare items + initVolumeBarItems(); + + //paint form contents + if (!is_painted) + CComponentsForm::paint(do_save_bg); + else + repaintVolScale(); +} + // CVolumeHelper #################################################################################################### diff --git a/src/gui/volumebar.h b/src/gui/volumebar.h index 9989eded3..cfc201305 100644 --- a/src/gui/volumebar.h +++ b/src/gui/volumebar.h @@ -89,6 +89,7 @@ class CVolumeBar : public CComponentsForm // ~CVolumeBar(); inherited from CComponentsForm void repaintVolScale(); + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); };