2015-07-11 15:56:37 -05:00
|
|
|
// 11 june 2015
|
2015-07-11 16:02:01 -05:00
|
|
|
#include "uipriv_darwin.h"
|
2015-07-11 15:56:37 -05:00
|
|
|
|
|
|
|
struct progressbar {
|
|
|
|
uiProgressBar p;
|
2015-07-28 10:47:05 -05:00
|
|
|
NSProgressIndicator *pi;
|
2015-07-11 15:56:37 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
uiDefineControlType(uiProgressBar, uiTypeProgressBar, struct progressbar)
|
|
|
|
|
|
|
|
static uintptr_t progressbarHandle(uiControl *c)
|
|
|
|
{
|
|
|
|
struct progressbar *p = (struct progressbar *) c;
|
|
|
|
|
2015-07-28 10:47:05 -05:00
|
|
|
return (uintptr_t) (p->pi);
|
2015-07-11 15:56:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void progressbarSetValue(uiProgressBar *pp, int value)
|
|
|
|
{
|
|
|
|
struct progressbar *p = (struct progressbar *) pp;
|
|
|
|
|
|
|
|
if (value < 0 || value > 100)
|
|
|
|
complain("value %d out of range in progressbarSetValue()", value);
|
|
|
|
PUT_CODE_HERE;
|
|
|
|
}
|
|
|
|
|
|
|
|
uiProgressBar *uiNewProgressBar(void)
|
|
|
|
{
|
|
|
|
struct progressbar *p;
|
|
|
|
|
2015-07-28 13:14:41 -05:00
|
|
|
p = (struct progressbar *) uiNewControl(uiTypeProgressBar());
|
2015-07-11 15:56:37 -05:00
|
|
|
|
2015-07-28 10:47:05 -05:00
|
|
|
p->pi = [[NSProgressIndicator alloc] initWithFrame:NSZeroRect];
|
2015-07-28 13:14:41 -05:00
|
|
|
NSLog(@"TEST thread %d tint %d stopped %d", (int) [p->pi usesThreadedAnimation], [p->pi controlTint], (int) [p->pi isDisplayedWhenStopped]);
|
2015-07-28 10:47:05 -05:00
|
|
|
[p->pi setControlSize:NSRegularControlSize];
|
|
|
|
[p->pi setBezeled:YES];
|
|
|
|
[p->pi setStyle:NSProgressIndicatorBarStyle];
|
|
|
|
[p->pi setIndeterminate:NO];
|
2015-07-28 13:14:41 -05:00
|
|
|
NSLog(@"TEST thread %d tint %d stopped %d", (int) [p->pi usesThreadedAnimation], [p->pi controlTint], (int) [p->pi isDisplayedWhenStopped]);
|
2015-07-28 10:47:05 -05:00
|
|
|
uiDarwinMakeSingleViewControl(uiControl(p), p->pi, NO);
|
2015-07-11 15:56:37 -05:00
|
|
|
|
|
|
|
uiControl(p)->Handle = progressbarHandle;
|
|
|
|
|
|
|
|
uiProgressBar(p)->SetValue = progressbarSetValue;
|
|
|
|
|
|
|
|
return uiProgressBar(p);
|
|
|
|
}
|