CVolumeBar: add missing paint() methode, avoid multiple iitem instances

Origin commit data
------------------
Branch: ni/coolstream
Commit: 54e8802397
Author: Thilo Graf <dbt@novatux.de>
Date: 2017-01-29 (Sun, 29 Jan 2017)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
2017-01-29 20:24:50 +01:00
parent a7b397545f
commit a380ba56e7
2 changed files with 27 additions and 13 deletions

View File

@@ -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 ####################################################################################################

View File

@@ -89,6 +89,7 @@ class CVolumeBar : public CComponentsForm
// ~CVolumeBar(); inherited from CComponentsForm
void repaintVolScale();
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
};