From 20821c26eb32b4f5772cf3e2ba13d36d424731c3 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Thu, 26 Jun 2014 21:54:14 -0400 Subject: Implemented Checkbox.SetChecked() on Mac OS X and updated the README. --- sysdata_darwin.m | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sysdata_darwin.m') diff --git a/sysdata_darwin.m b/sysdata_darwin.m index 1119255..fc1f270 100644 --- a/sysdata_darwin.m +++ b/sysdata_darwin.m @@ -228,3 +228,13 @@ void center(id w) { [toNSWindow(w) center]; } + +void setCheckboxChecked(id checkbox, BOOL check) +{ + // -[NSButton setState:] takes a NSInteger but the state constants are NSCellStateValue which is NSUInteger (despite NSMixedState being -1); let's play it safe here + if (check) { + [toNSButton(checkbox) setState:NSOnState]; + return; + } + [toNSButton(checkbox) setState:NSOffState]; +} -- cgit v1.2.3