2015-07-11 15:56:37 -05:00
|
|
|
// 11 june 2015
|
2015-07-11 16:02:01 -05:00
|
|
|
#include "uipriv_darwin.h"
|
2015-07-11 15:56:37 -05:00
|
|
|
|
|
|
|
struct spinbox {
|
|
|
|
uiSpinbox s;
|
2015-07-11 16:02:01 -05:00
|
|
|
OSTYPE *OSHANDLE;
|
2015-07-11 15:56:37 -05:00
|
|
|
void (*onChanged)(uiSpinbox *, void *);
|
|
|
|
void *onChangedData;
|
|
|
|
};
|
|
|
|
|
|
|
|
uiDefineControlType(uiSpinbox, uiTypeSpinbox, struct spinbox)
|
|
|
|
|
|
|
|
static uintptr_t spinboxHandle(uiControl *c)
|
|
|
|
{
|
|
|
|
struct spinbox *s = (struct spinbox *) c;
|
|
|
|
|
|
|
|
return PUT_CODE_HERE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void defaultOnChanged(uiSpinbox *s, void *data)
|
|
|
|
{
|
|
|
|
// do nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
static intmax_t spinboxValue(uiSpinbox *ss)
|
|
|
|
{
|
|
|
|
struct spinbox *s = (struct spinbox *) ss;
|
|
|
|
|
|
|
|
return PUT_CODE_HERE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void spinboxSetValue(uiSpinbox *ss, intmax_t value)
|
|
|
|
{
|
|
|
|
struct spinbox *s = (struct spinbox *) ss;
|
|
|
|
|
|
|
|
PUT_CODE_HERE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void spinboxOnChanged(uiSpinbox *ss, void (*f)(uiSpinbox *, void *), void *data)
|
|
|
|
{
|
|
|
|
struct spinbox *s = (struct spinbox *) ss;
|
|
|
|
|
|
|
|
s->onChanged = f;
|
|
|
|
s->onChangedData = data;
|
|
|
|
}
|
|
|
|
|
|
|
|
uiSpinbox *uiNewSpinbox(intmax_t min, intmax_t max)
|
|
|
|
{
|
|
|
|
struct spinbox *s;
|
|
|
|
|
|
|
|
if (min >= max)
|
|
|
|
complain("error: min >= max in uiNewSpinbox()");
|
|
|
|
|
|
|
|
s = (struct spinbox *) MAKE_CONTROL_INSTANCE(uiTypeSpinbox());
|
|
|
|
|
|
|
|
PUT_CODE_HERE;
|
|
|
|
|
|
|
|
s->onChanged = defaultOnChanged;
|
|
|
|
|
|
|
|
uiControl(s)->Handle = spinboxHandle;
|
|
|
|
|
|
|
|
uiSpinbox(s)->Value = spinboxValue;
|
|
|
|
uiSpinbox(s)->SetValue = spinboxSetValue;
|
|
|
|
uiSpinbox(s)->OnChanged = spinboxOnChanged;
|
|
|
|
|
|
|
|
return uiSpinbox(s);
|
|
|
|
}
|