Implemented uiCheckbox(Set)Checked() on Mac OS X.

This commit is contained in:
Pietro Gagliardi 2015-04-09 13:01:23 -04:00
parent ca607f8fb7
commit 6d93fce5b5
3 changed files with 22 additions and 2 deletions

View File

@ -76,3 +76,23 @@ void uiCheckboxOnToggled(uiControl *c, void (*f)(uiControl *, void *), void *dat
cc.uiOnToggled = f;
cc.uiOnToggledData = data;
}
int uiCheckboxChecked(uiControl *c)
{
uiCheckboxNSButton *cc;
cc = (uiCheckboxNSButton *) uiControlHandle(c);
return [cc state] == NSOnState;
}
void uiCheckboxSetChecked(uiControl *c, int checked)
{
uiCheckboxNSButton *cc;
NSInteger state;
cc = (uiCheckboxNSButton *) uiControlHandle(c);
state = NSOnState;
if (!checked)
state = NSOffState;
[cc setState:state];
}

View File

@ -71,7 +71,7 @@ uiControl *spaced;
static void setSpaced(uiControl *c, void *data)
{
// TODO
printf("toggled %d\n", uiCheckboxCheked(spaced));
printf("toggled %d\n", uiCheckboxChecked(spaced));
}
// these will also be used to test if setting checks will trigger events

View File

@ -51,6 +51,6 @@ void uiCheckboxSetText(uiControl *, const char *);
void uiCheckboxOnToggled(uiControl *, void (*)(uiControl *, void *), void *);
int uiCheckboxChecked(uiControl *);
// TODO should this trigger an event?
void uiChekboxSetChecked(uiControl *, int);
void uiCheckboxSetChecked(uiControl *, int);
#endif