summaryrefslogtreecommitdiff
path: root/new
diff options
context:
space:
mode:
Diffstat (limited to 'new')
-rw-r--r--new/checkbox_darwin.m20
-rw-r--r--new/test.c2
-rw-r--r--new/ui.h2
3 files changed, 22 insertions, 2 deletions
diff --git a/new/checkbox_darwin.m b/new/checkbox_darwin.m
index a1fd61c..a07a4d0 100644
--- a/new/checkbox_darwin.m
+++ b/new/checkbox_darwin.m
@@ -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];
+}
diff --git a/new/test.c b/new/test.c
index a09e459..e4579b7 100644
--- a/new/test.c
+++ b/new/test.c
@@ -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
diff --git a/new/ui.h b/new/ui.h
index ee2c121..d6b9891 100644
--- a/new/ui.h
+++ b/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