diff options
Diffstat (limited to 'prev/progressbar_darwin.go')
| -rw-r--r-- | prev/progressbar_darwin.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/prev/progressbar_darwin.go b/prev/progressbar_darwin.go new file mode 100644 index 0000000..51fd41a --- /dev/null +++ b/prev/progressbar_darwin.go @@ -0,0 +1,31 @@ +// 4 november 2014 + +package ui + +import ( + "fmt" +) + +// #include "objc_darwin.h" +import "C" + +type progressbar struct { + *controlSingleObject +} + +func newProgressBar() ProgressBar { + return &progressbar{ + controlSingleObject: newControlSingleObject(C.newProgressBar()), + } +} + +func (p *progressbar) Percent() int { + return int(C.progressbarPercent(p.id)) +} + +func (p *progressbar) SetPercent(percent int) { + if percent < 0 || percent > 100 { + panic(fmt.Errorf("given ProgressBar percentage %d out of range", percent)) + } + C.progressbarSetPercent(p.id, C.intmax_t(percent)) +} |
