summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-02-25 00:31:48 -0500
committerPietro Gagliardi <[email protected]>2014-02-25 00:31:48 -0500
commitd721e8f61ba06672effd321720f25c748b295c81 (patch)
treedbc5278d9d1c28a2a8027f4b83b983cf676d6384
parentbfc9f7e339740da57bb9d1e4b4926c6641814cd9 (diff)
"Note This message [PBM_SETMARQUEE] requires ComCtl32.dll version 6.00 or later." blah, no more indeterminate progress bars (Windows 2000 has 5.something)
-rw-r--r--progressbar.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/progressbar.go b/progressbar.go
index b40a53c..cad08e3 100644
--- a/progressbar.go
+++ b/progressbar.go
@@ -7,8 +7,6 @@ import (
// A ProgressBar is a horizontal rectangle that fills up from left to right to indicate the progress of a long-running task.
// This progress is typically a percentage, so within the range [0,100].
-// Alternatively, a progress bar can be "indeterminate": it indicates progress is being made, but is unclear as to how much.
-// The presentation of indeterminate progress bars is system-specific (for instance, on Windows and many GTK+ skins, this is represented by a small chunk of progress going back and forth across the width of the bar).
type ProgressBar struct {
lock sync.Mutex
created bool
@@ -23,11 +21,14 @@ func NewProgressBar() *ProgressBar {
}
}
-// SetProgress sets the currently indicated progress amount on the ProgressBar. If this amount is outside the range [0,100] (ideally -1), the progress bar is indeterminate.
+// SetProgress sets the currently indicated progress amount on the ProgressBar. If this amount is outside the range [0,100] (ideally -1), the function will panic (it should allow indeterminate progress bars, alas those are not supported on Windows 2000).
func (p *ProgressBar) SetProgress(percent int) {
p.lock.Lock()
defer p.lock.Unlock()
+ if percent < 0 || percent > 100 {
+ panic("invalid percent") // TODO
+ }
if p.created {
p.sysData.setProgress(percent)
return