summaryrefslogtreecommitdiff
path: root/basicctrls_darwin.m
diff options
context:
space:
mode:
Diffstat (limited to 'basicctrls_darwin.m')
-rw-r--r--basicctrls_darwin.m29
1 files changed, 29 insertions, 0 deletions
diff --git a/basicctrls_darwin.m b/basicctrls_darwin.m
index c4b90c6..873882e 100644
--- a/basicctrls_darwin.m
+++ b/basicctrls_darwin.m
@@ -10,6 +10,7 @@
#define toNSWindow(x) ((NSWindow *) (x))
#define toNSBox(x) ((NSBox *) (x))
#define toNSTextView(x) ((NSTextView *) (x))
+#define toNSProgressIndicator(x) ((NSProgressIndicator *) (x))
@interface goControlDelegate : NSObject <NSTextFieldDelegate> {
@public
@@ -271,3 +272,31 @@ void textboxSetText(id tv, char *text)
{
[toNSTextView(tv) setString:[NSString stringWithUTF8String:text]];
}
+
+id newProgressBar(void)
+{
+ NSProgressIndicator *pi;
+
+ pi = [[NSProgressIndicator alloc] initWithFrame:NSZeroRect];
+ [pi setStyle:NSProgressIndicatorBarStyle];
+ [pi setControlSize:NSRegularControlSize];
+ [pi setControlTint:NSDefaultControlTint];
+ [pi setBezeled:YES];
+ [pi setDisplayedWhenStopped:YES];
+ [pi setUsesThreadedAnimation:YES];
+ [pi setIndeterminate:NO];
+ [pi setMinValue:0];
+ [pi setMaxValue:100];
+ [pi setDoubleValue:0];
+ return (id) pi;
+}
+
+intmax_t progressbarPercent(id pbar)
+{
+ return (intmax_t) [toNSProgressIndicator(pbar) doubleValue];
+}
+
+void progressbarSetPercent(id pbar, intmax_t percent)
+{
+ [toNSProgressIndicator(pbar) setDoubleValue:((double) percent)];
+}