diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2006-11-12 20:44:12 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2006-11-12 20:44:12 +0000 |
| commit | 725efb3569ac50ce5dd8affcf19616f24a8150a7 (patch) | |
| tree | f3faa824e468cebd24075d08e8210f3c73d30916 /src/Fl_Progress.cxx | |
| parent | 095ed29a7fe376beac31deae72ce6081c38302d2 (diff) | |
STR #1492: Fl_Progress was using the wrong width to calculate progress
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5540 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Progress.cxx')
| -rw-r--r-- | src/Fl_Progress.cxx | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/Fl_Progress.cxx b/src/Fl_Progress.cxx index 88a8ad773..69e76492c 100644 --- a/src/Fl_Progress.cxx +++ b/src/Fl_Progress.cxx @@ -67,7 +67,7 @@ void Fl_Progress::draw() // Draw the progress bar... if (maximum_ > minimum_) - progress = (int)(tw * (value_ - minimum_) / (maximum_ - minimum_) + 0.5f); + progress = (int)(w() * (value_ - minimum_) / (maximum_ - minimum_) + 0.5f); else progress = 0; @@ -83,12 +83,14 @@ void Fl_Progress::draw() labelcolor(c); - fl_clip(tx + progress, y(), w() - progress, h()); - draw_box(box(), x(), y(), w(), h(), active_r() ? color() : fl_inactive(color())); - draw_label(tx, y() + by, tw, h() - bh); - fl_pop_clip(); + if (progress<w()) { + fl_clip(tx + progress, y(), w() - progress, h()); + draw_box(box(), x(), y(), w(), h(), active_r() ? color() : fl_inactive(color())); + draw_label(tx, y() + by, tw, h() - bh); + fl_pop_clip(); + } } else { - draw_box(box(), x(), y(), w(), h(), color()); + draw_box(box(), x(), y(), w(), h(), active_r() ? color() : fl_inactive(color())); draw_label(tx, y() + by, tw, h() - bh); } } |
