summaryrefslogtreecommitdiff
path: root/displayvolume.c
diff options
context:
space:
mode:
Diffstat (limited to 'displayvolume.c')
-rw-r--r--displayvolume.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/displayvolume.c b/displayvolume.c
index f67bd30..d9b2546 100644
--- a/displayvolume.c
+++ b/displayvolume.c
@@ -3,13 +3,16 @@
cFlatDisplayVolume::cFlatDisplayVolume(void) {
muted = false;
- progressBarHeight = 20;
labelHeight = fontHeight;
CreateFullOsd();
TopBarCreate();
-
- progressBarPixmap = osd->CreatePixmap(1, cRect(0, osdHeight - 50 - progressBarHeight, osdWidth, progressBarHeight));
+ int width = osdWidth / 4 * 3;
+ int left = osdWidth - width;
+ left /= 2;
+
+ ProgressBarCreate(left, osdHeight - 50 - ProgressBarHeight(), width,
+ Theme.Color(clrVolumeProgressFg), Theme.Color(clrVolumeProgressBarFg), Theme.Color(clrVolumeProgressBg));
labelPixmap = osd->CreatePixmap(1, cRect(0, osdHeight - 50 - progressBarHeight - labelHeight - marginItem, osdWidth, labelHeight));
}
@@ -32,23 +35,7 @@ void cFlatDisplayVolume::SetVolume(int Current, int Total, bool Mute) {
labelPixmap->DrawImage( cPoint(left + maxlabelWidth + marginItem, 0), imgLoader.GetImage() );
}
}
- DrawProgressBar(Current, Total);
-}
-
-void cFlatDisplayVolume::DrawProgressBar(int Current, int Total) {
- int top = progressBarHeight / 2 - 3;
- int barFullWidth = osdWidth * 3 / 4;
- int left = osdWidth - barFullWidth;
- left /= 2;
- double percentLeft = ((double)Current) / (double)Total;
-
- progressBarPixmap->Fill( clrTransparent );
- progressBarPixmap->DrawRectangle(cRect( left, 0, barFullWidth, progressBarHeight), Theme.Color(clrVolumeBg));
-
- if (Current > 0) {
- progressBarPixmap->DrawRectangle(cRect( left, top + 2, barFullWidth, 2), Theme.Color(clrVolumeProgressBg));
- progressBarPixmap->DrawRectangle(cRect( left, top, (barFullWidth * percentLeft), 6), Theme.Color(clrVolumeProgressFg));
- }
+ ProgressBarDraw(Current, Total);
}
void cFlatDisplayVolume::Flush(void) {