From cff5dcf9c91d2ce35eec0709e8f89ae2e18fa61b Mon Sep 17 00:00:00 2001 From: emersion Date: Thu, 16 Jun 2016 09:45:08 +0200 Subject: [PATCH] Adds indeterminate progressbar to darwin (not yet tested) --- darwin/progressbar.m | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/darwin/progressbar.m b/darwin/progressbar.m index a26874f1..87a9c8d2 100644 --- a/darwin/progressbar.m +++ b/darwin/progressbar.m @@ -27,10 +27,31 @@ struct uiProgressBar { uiDarwinControlAllDefaults(uiProgressBar, pi) +int uiProgressBarValue(uiProgressBar *p) +{ + if ([p->pi getIndeterminate]) { + return -1; + } + + return (int) [p->pi getDoubleValue]; +} + void uiProgressBarSetValue(uiProgressBar *p, int value) { + if (value == -1) { + [p->pi setIndeterminate:YES]; + [p->pi startAnimation:p->pi]; + return; + } + + if ([p->pi getIndeterminate]) { + [p->pi setIndeterminate:NO]; + [p->pi stopAnimation:p->pi]; + } + if (value < 0 || value > 100) userbug("Value %d out of range for a uiProgressBar.", value); + // on 10.8 there's an animation when the progress bar increases, just like with Aero if (value == 100) { [p->pi setMaxValue:101];