Implemented uiCheckbox(Set)Checked() on Mac OS X.
This commit is contained in:
parent
ca607f8fb7
commit
6d93fce5b5
|
@ -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];
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
2
new/ui.h
2
new/ui.h
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue