summaryrefslogtreecommitdiff
path: root/prevlib/progressbar.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-07-02 22:53:03 -0400
committerPietro Gagliardi <[email protected]>2014-07-02 22:53:03 -0400
commit8a81650b3da7ce00725336df9e03b38e935c5a65 (patch)
tree08af843f0460e7226f305cf7162021ef54e8c3f7 /prevlib/progressbar.go
parent4dd5ceb11d62bd6b9af4847936314a9d8c45707f (diff)
Moved it all back; the preemptive multitaksing during an event handler kills us on all platforms. Going to have to restrict ALL GUI accss to happening from one t hread, so going to need to drop uitask entirely and have just a start() callback for startup code and a post() function for posting requests to windows (like channel sends but into a perpetual buffer).
Diffstat (limited to 'prevlib/progressbar.go')
-rw-r--r--prevlib/progressbar.go68
1 files changed, 0 insertions, 68 deletions
diff --git a/prevlib/progressbar.go b/prevlib/progressbar.go
deleted file mode 100644
index 875a262..0000000
--- a/prevlib/progressbar.go
+++ /dev/null
@@ -1,68 +0,0 @@
-// 25 february 2014
-
-package ui
-
-// 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 represented by an integer within the range [0,100], representing a percentage.
-// Alternatively, a progressbar can show an animation indicating that progress is being made but how much is indeterminate.
-// Newly-created ProgressBars default to showing 0% progress.
-type ProgressBar struct {
- created bool
- sysData *sysData
- initProg int
-}
-
-// NewProgressBar creates a new ProgressBar.
-func NewProgressBar() *ProgressBar {
- return &ProgressBar{
- sysData: mksysdata(c_progressbar),
- }
-}
-
-// SetProgress sets the currently indicated progress amount on the ProgressBar.
-// If percent is in the range [0,100], the progressBar shows that much percent complete.
-// If percent is -1, the ProgressBar is made indeterminate.
-// Otherwise, SetProgress panics.
-// Calling SetProgress(-1) repeatedly will neither leave indeterminate mode nor stop any animation involved in indeterminate mode indefinitely; any other side-effect of doing so is implementation-defined.
-func (p *ProgressBar) SetProgress(percent int) {
- if percent < -1 || percent > 100 {
- panic("percent value out of range")
- }
- if p.created {
- p.sysData.setProgress(percent)
- return
- }
- p.initProg = percent
-}
-
-func (p *ProgressBar) make(window *sysData) error {
- err := p.sysData.make(window)
- if err != nil {
- return err
- }
- p.sysData.setProgress(p.initProg)
- p.created = true
- return nil
-}
-
-func (p *ProgressBar) allocate(x int, y int, width int, height int, d *sysSizeData) []*allocation {
- return []*allocation{&allocation{
- x: x,
- y: y,
- width: width,
- height: height,
- this: p,
- }}
-}
-
-func (p *ProgressBar) preferredSize(d *sysSizeData) (width int, height int) {
- return p.sysData.preferredSize(d)
-}
-
-func (p *ProgressBar) commitResize(a *allocation, d *sysSizeData) {
- p.sysData.commitResize(a, d)
-}
-
-func (p *ProgressBar) getAuxResizeInfo(d *sysSizeData) {
- p.sysData.getAuxResizeInfo(d)
-}