summaryrefslogtreecommitdiff
path: root/AAA_GOFILES/progressbar.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2018-08-11 16:18:01 -0400
committerPietro Gagliardi <[email protected]>2018-08-11 16:18:01 -0400
commit308e253e0f7873710bf77312d7a12c576aaa9781 (patch)
treefd20704da886ce82a3621ec1502897a8766b11be /AAA_GOFILES/progressbar.go
parent0f75ebb5fa7a12bd1df26622ed3f5544a9d1d32b (diff)
Moved the existing .go files out of the way and replaced ui.h with the alpha4 ui.h.
Diffstat (limited to 'AAA_GOFILES/progressbar.go')
-rw-r--r--AAA_GOFILES/progressbar.go77
1 files changed, 77 insertions, 0 deletions
diff --git a/AAA_GOFILES/progressbar.go b/AAA_GOFILES/progressbar.go
new file mode 100644
index 0000000..ef5116c
--- /dev/null
+++ b/AAA_GOFILES/progressbar.go
@@ -0,0 +1,77 @@
+// 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 {
+ c *C.uiControl
+ p *C.uiProgressBar
+}
+
+// NewProgressBar creates a new ProgressBar.
+func NewProgressBar() *ProgressBar {
+ p := new(ProgressBar)
+
+ p.p = C.uiNewProgressBar()
+ p.c = (*C.uiControl)(unsafe.Pointer(p.p))
+
+ return p
+}
+
+// Destroy destroys the ProgressBar.
+func (p *ProgressBar) Destroy() {
+ C.uiControlDestroy(p.c)
+}
+
+// LibuiControl returns the libui uiControl pointer that backs
+// the Window. This is only used by package ui itself and should
+// not be called by programs.
+func (p *ProgressBar) LibuiControl() uintptr {
+ return uintptr(unsafe.Pointer(p.c))
+}
+
+// Handle returns the OS-level handle associated with this ProgressBar.
+// On Windows this is an HWND of a standard Windows API
+// PROGRESS_CLASS class (as provided by Common Controls
+// version 6).
+// On GTK+ this is a pointer to a GtkProgressBar.
+// On OS X this is a pointer to a NSProgressIndicator.
+func (p *ProgressBar) Handle() uintptr {
+ return uintptr(C.uiControlHandle(p.c))
+}
+
+// Show shows the ProgressBar.
+func (p *ProgressBar) Show() {
+ C.uiControlShow(p.c)
+}
+
+// Hide hides the ProgressBar.
+func (p *ProgressBar) Hide() {
+ C.uiControlHide(p.c)
+}
+
+// Enable enables the ProgressBar.
+func (p *ProgressBar) Enable() {
+ C.uiControlEnable(p.c)
+}
+
+// Disable disables the ProgressBar.
+func (p *ProgressBar) Disable() {
+ C.uiControlDisable(p.c)
+}
+
+// TODO Value
+
+// SetValue sets the ProgressBar's currently displayed percentage
+// to value. value must be between 0 and 100 inclusive.
+func (p *ProgressBar) SetValue(value int) {
+ C.uiProgressBarSetValue(p.p, C.int(value))
+}