diff --git a/redo/stubs/button.c b/redo/stubs/button.c new file mode 100644 index 00000000..f6738e7a --- /dev/null +++ b/redo/stubs/button.c @@ -0,0 +1,66 @@ +// 10 june 2015 +#include "uipriv_OSHERE.h" + +struct button { + uiButton b; + OSTYPE OSHANDLE; + void (*onClicked)(uiButton *, void *); + void *onClickedData; +}; + +uiDefineControlType(uiButton, uiTypeButton, struct button) + +static uintptr_t buttonHandle(uiControl *c) +{ + struct button *b = (struct button *) c; + + return (uintptr_t) (b->OSHANDLE); +} + +static void defaultOnClicked(uiButton *b, void *data) +{ + // do nothing +} + +static char *buttonText(uiButton *bb) +{ + struct button *b = (struct button *) bb; + + return PUT_CODE_HERE; +} + +static void buttonSetText(uiButton *bb, const char *text) +{ + struct button *b = (struct button *) bb; + + PUT_CODE_HERE; + // changing the text might necessitate a change in the button's size + uiControlQueueResize(uiControl(b)); +} + +static void buttonOnClicked(uiButton *bb, void (*f)(uiButton *, void *), void *data) +{ + struct button *b = (struct button *) bb; + + b->onClicked = f; + b->onClickedData = data; +} + +uiButton *uiNewButton(const char *text) +{ + struct button *b; + + b = (struct button *) MAKE_CONTROL_INSTANCE(uiTypeButton()); + + PUT_CODE_HERE; + + b->onClicked = defaultOnClicked; + + uiControl(b)->Handle = buttonHandle; + + uiButton(b)->Text = buttonText; + uiButton(b)->SetText = buttonSetText; + uiButton(b)->OnClicked = buttonOnClicked; + + return uiButton(b); +} diff --git a/redo/stubs/checkbox.c b/redo/stubs/checkbox.c new file mode 100644 index 00000000..ee02ccf6 --- /dev/null +++ b/redo/stubs/checkbox.c @@ -0,0 +1,83 @@ +// 10 june 2015 +#include "uipriv_OSHERE.h" + +struct checkbox { + uiCheckbox c; + OSTYPE OSHANDLE; + void (*onToggled)(uiCheckbox *, void *); + void *onToggledData; +}; + +uiDefineControlType(uiCheckbox, uiTypeCheckbox, struct checkbox) + +static uintptr_t checkboxHandle(uiControl *cc) +{ + struct checkbox *c = (struct checkbox *) cc; + + return (uintptr_t) (c->OSHANDLE); +} + +static void defaultOnToggled(uiCheckbox *c, void *data) +{ + // do nothing +} + +static char *checkboxText(uiCheckbox *cc) +{ + struct checkbox *c = (struct checkbox *) cc; + + return PUT_CODE_HERE; +} + +static void checkboxSetText(uiCheckbox *cc, const char *text) +{ + struct checkbox *c = (struct checkbox *) cc; + + PUT_CODE_HERE; + // changing the text might necessitate a change in the checkbox's size + uiControlQueueResize(uiControl(c)); +} + +static void checkboxOnToggled(uiCheckbox *cc, void (*f)(uiCheckbox *, void *), void *data) +{ + struct checkbox *c = (struct checkbox *) cc; + + c->onToggled = f; + c->onToggledData = data; +} + +static int checkboxChecked(uiCheckbox *cc) +{ + struct checkbox *c = (struct checkbox *) cc; + + return PUT_CODE_HERE; +} + +static void checkboxSetChecked(uiCheckbox *cc, int checked) +{ + struct checkbox *c = (struct checkbox *) cc; + + PUT_CODE_HERE; +} + +uiCheckbox *uiNewCheckbox(const char *text) +{ + struct checkbox *c; + WCHAR *wtext; + + c = (struct checkbox *) MAKE_CONTROL_INSTANCE(uiTypeCheckbox()); + + PUT_CODE_HERE; + + c->onToggled = defaultOnToggled; + + uiControl(c)->Handle = checkboxHandle; + + uiCheckbox(c)->Text = checkboxText; + uiCheckbox(c)->SetText = checkboxSetText; + uiCheckbox(c)->OnToggled = checkboxOnToggled; + uiCheckbox(c)->Checked = checkboxChecked; + uiCheckbox(c)->SetChecked = checkboxSetChecked; + + return uiCheckbox(c); +}