2 Copyright 2008 Chris Tallon
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include "wprogressbar.h"
25 WProgressBar::WProgressBar()
30 WProgressBar::~WProgressBar()
34 void WProgressBar::setPercent(UINT tpercent)
37 if (percent > 100) percent = 0;
40 void WProgressBar::draw()
42 if (area.w < 5) return;
43 if (area.h < 5) return;
45 printf("progress bar: %u\n", percent);
47 // Hmm, can't draw two boxes because should not paint on areas
48 // not needing it - this class does not know the background colour
50 rectangle(0, 0, area.w, 2, Colour::LIGHTTEXT); // top
51 rectangle(0, area.h - 2, area.w, 2, Colour::LIGHTTEXT); // bottom
52 rectangle(0, 0, 2, area.h, Colour::LIGHTTEXT); // left
53 rectangle(area.w - 2, 0, 2, area.h, Colour::LIGHTTEXT); // right
55 int progressWidth = (int)((area.w - 4) * (float)percent / 100);
56 rectangle(2, 2, progressWidth, area.h - 4, Colour::SELECTHIGHLIGHT);