diff options
| author | Pietro Gagliardi <[email protected]> | 2014-07-22 23:32:32 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-07-22 23:32:32 -0400 |
| commit | 300835a1b45b0b59951baa28e69e886aa72fc38f (patch) | |
| tree | be22611cf09874055a031c14cbb62eb1429d40ae /redo/controls_darwin.m | |
| parent | f21fdfd7dc1b1345832c1c05c2f1c0c3c8674141 (diff) | |
Implemented Checkbox on Mac OS X. Also untested; will test next.
Diffstat (limited to 'redo/controls_darwin.m')
| -rw-r--r-- | redo/controls_darwin.m | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/redo/controls_darwin.m b/redo/controls_darwin.m index 5233129..85de6c8 100644 --- a/redo/controls_darwin.m +++ b/redo/controls_darwin.m @@ -49,7 +49,7 @@ static inline void setStandardControlFont(id control) @end -id newButton(char *text) +id newButton(void) { NSButton *b; @@ -57,11 +57,10 @@ id newButton(char *text) b = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)]; // TODO verify all of these against Interface Builder [b setButtonType:NSMomentaryLightButton]; - [b setTitle:[NSString stringWithUTF8String:text]]; [b setBordered:YES]; [b setBezelStyle:NSRoundedBezelStyle]; setStandardControlFont(b); - return b; + return (id) b; } void buttonSetDelegate(id button, void *b) @@ -83,3 +82,32 @@ void buttonSetText(id button, char *text) { [toNSButton(button) setTitle:[NSString stringWithUTF8String:text]]; } + +id newCheckbox(void) +{ + NSButton *c; + + c = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)]; + // TODO verify all of these against Interface Builder + [c setButtonType:NSSwitchButton]; + [c setBordered:NO]; + setStandardControlFont(c); + return (id) c; +} + +BOOL checkboxChecked(id c) +{ + if ([toNSButton(c) state] == NSOnState) + return YES; + return NO; +} + +void checkboxSetChecked(id c, BOOL checked) +{ + NSInteger state; + + state = NSOnState; + if (checked == NO) + state = NSOffState; + [toNSButton(c) setState:state]; +} |
