diff options
| author | Pietro Gagliardi <[email protected]> | 2018-08-11 21:29:20 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2018-08-11 21:29:20 -0400 |
| commit | 68ffb808678159b8810c8ed093c0458316d3f8f2 (patch) | |
| tree | 5bda3855b4b6cafc1f39bdbc66204a44493896e3 /progressbar.go | |
| parent | 5ab5777d4cbfe6490760ef4e618bd5fe80a20bea (diff) | |
More control migration.
Diffstat (limited to 'progressbar.go')
| -rw-r--r-- | progressbar.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/progressbar.go b/progressbar.go new file mode 100644 index 0000000..f58976f --- /dev/null +++ b/progressbar.go @@ -0,0 +1,39 @@ +// 12 december 2015 + +package ui + +import ( + "unsafe" +) + +// #include "ui.h" +import "C" + +// ProgressBar is a Control that represents a horizontal bar that +// is filled in progressively over time as a process completes. +type ProgressBar struct { + ControlBase + p *C.uiProgressBar +} + +// NewProgressBar creates a new ProgressBar. +func NewProgressBar() *ProgressBar { + p := new(ProgressBar) + + p.p = C.uiNewProgressBar() + + p.ControlBase = NewControlBase(p, uintptr(unsafe.Pointer(p.p))) + return p +} + +// Value returns the value currently shown in the ProgressBar. +func (p *ProgressBar) Value() int { + return int(C.uiProgressBarValue(p.p)) +} + +// SetValue sets the ProgressBar's currently displayed percentage +// to value. value must be between 0 and 100 inclusive, or -1 for +// an indeterminate progressbar. +func (p *ProgressBar) SetValue(value int) { + C.uiProgressBarSetValue(p.p, C.int(value)) +} |
