More stub controls. This just leaves stub uiWindow.

This commit is contained in:
Pietro Gagliardi 2015-06-11 16:53:52 -04:00
parent a6d38831cc
commit 45cb2890f2
10 changed files with 575 additions and 0 deletions

View File

@ -0,0 +1,44 @@
// 11 june 2015
#include "uipriv_OSHERE.h"
struct datetimepicker {
uiDateTimePicker d;
OSTYPE OSHANDLE;
};
uiDefineControlType(uiDateTimePicker, uiTypeDateTimePicker, struct datetimepicker)
static uintptr_t datetimepickerHandle(uiControl *c)
{
struct datetimepicker *d = (struct datetimepicker *) c;
return (uintptr_t) (d->OSHANDLE);
}
uiDateTimePicker *finishNewDateTimePicker(OSTHING OSARG)
{
struct datetimepicker *d;
d = (struct datetimepicker *) MAKE_CONTROL_INSTANCE(uiTypeDateTimePicker());
PUT_CODE_HERE;
uiControl(d)->Handle = datetimepickerHandle;
return uiDateTimePicker(d);
}
uiDateTimePicker *uiNewDateTimePicker(void)
{
return finishNewDateTimePicker(OSARGDATETIME);
}
uiDateTimePicker *uiNewDatePicker(void)
{
return finishNewDateTimePicker(OSARGDATEONLY);
}
uiDateTimePicker *uiNewTimePicker(void)
{
return finishNewDateTimePicker(OSARGTIMEONLY);
}

82
redo/stubs/entry.c Normal file
View File

@ -0,0 +1,82 @@
// 11 june 2015
#include "uipriv_OSHERE.h"
struct entry {
uiEntry e;
OSTYPE OSHANDLE;
void (*onChanged)(uiEntry *, void *);
void *onChangedData;
};
uiDefineControlType(uiEntry, uiTypeEntry, struct entry)
static uintptr_t entryHandle(uiControl *c)
{
struct entry *e = (struct entry *) c;
return (uintptr_t) (e->OSHANDLE);
}
static void defaultOnChanged(uiEntry *e, void *data)
{
// do nothing
}
static char *entryText(uiEntry *ee)
{
struct entry *e = (struct entry *) ee;
return PUT_CODE_HERE;
}
static void entrySetText(uiEntry *ee, const char *text)
{
struct entry *e = (struct entry *) ee;
PUT_CODE_HERE;
// don't queue the control for resize; entry sizes are independent of their contents
}
static void entryOnChanged(uiEntry *ee, void (*f)(uiEntry *, void *), void *data)
{
struct entry *e = (struct entry *) ee;
e->onChanged = f;
e->onChangedData = data;
}
static int entryReadOnly(uiEntry *ee)
{
struct entry *e = (struct entry *) ee;
return PUT_CODE_HERE;
}
static void entrySetReadOnly(uiEntry *ee, int readonly)
{
struct entry *e = (struct entry *) ee;
WPARAM ro;
PUT_CODE_HERE;
}
uiEntry *uiNewEntry(void)
{
struct entry *e;
e = (struct entry *) MAKE_CONTROL_INSTANCE(uiTypeEntry());
PUT_CODE_HERE;
e->onChanged = defaultOnChanged;
uiControl(e)->Handle = entryHandle;
uiEntry(e)->Text = entryText;
uiEntry(e)->SetText = entrySetText;
uiEntry(e)->OnChanged = entryOnChanged;
uiEntry(e)->ReadOnly = entryReadOnly;
uiEntry(e)->SetReadOnly = entrySetReadOnly;
return uiEntry(e);
}

90
redo/stubs/group.c Normal file
View File

@ -0,0 +1,90 @@
// 11 june 2015
#include "uipriv_OSHERE.h"
struct group {
uiGroup g;
OSTYPE OSHANDLE;
uiControl *child;
int margined;
};
uiDefineControlType(uiGroup, uiTypeGroup, struct group)
static uintptr_t groupHandle(uiControl *c)
{
struct group *g = (struct group *) c;
return (uintptr_t) (g->OSHANDLE);
}
static void groupContainerUpdateState(uiControl *c)
{
struct group *g = (struct group *) c;
if (g->child != NULL)
uiControlUpdateState(g->child);
}
static char *groupTitle(uiGroup *gg)
{
struct group *g = (struct group *) gg;
return PUT_CODE_HERE;
}
static void groupSetTitle(uiGroup *gg, const char *text)
{
struct group *g = (struct group *) gg;
PUT_CODE_HERE;
// changing the text might necessitate a change in the groupbox's size
uiControlQueueResize(uiControl(g));
}
static void groupSetChild(uiGroup *gg, uiControl *child)
{
struct group *g = (struct group *) gg;
if (g->child != NULL)
uiControlSetParent(g->child, NULL);
g->child = child;
if (g->child != NULL) {
uiControlSetParent(g->child, uiControl(g));
uiControlQueueResize(g->child);
}
}
static int groupMargined(uiGroup *gg)
{
struct group *g = (struct group *) gg;
return g->margined;
}
static void groupSetMargined(uiGroup *gg, int margined)
{
struct group *g = (struct group *) gg;
g->margined = margined;
uiControlQueueResize(uiControl(g));
}
uiGroup *uiNewGroup(const char *text)
{
struct group *g;
g = (struct group *) MAKE_CONTROL_INSTANCE(uiTypeGroup());
PUT_CODE_HERE;
uiControl(g)->Handle = groupHandle;
uiControl(g)->ContainerUpdateState = groupContainerUpdateState;
uiGroup(g)->Title = groupTitle;
uiGroup(g)->SetTitle = groupSetTitle;
uiGroup(g)->SetChild = groupSetChild;
uiGroup(g)->Margined = groupMargined;
uiGroup(g)->SetMargined = groupSetMargined;
return uiGroup(g);
}

48
redo/stubs/label.c Normal file
View File

@ -0,0 +1,48 @@
// 11 june 2015
#include "uipriv_OSHERE.h"
struct label {
uiLabel l;
OSTYPE OSHANDLE;
};
uiDefineControlType(uiLabel, uiTypeLabel, struct label)
static uintptr_t labelHandle(uiControl *c)
{
struct label *l = (struct label *) c;
return (uintptr_t) (l->OSHANDLE);
}
static char *labelText(uiLabel *ll)
{
struct label *l = (struct label *) ll;
return PUT_CODE_HERE;
}
static void labelSetText(uiLabel *ll, const char *text)
{
struct label *l = (struct label *) ll;
PUT_CODE_HERE;
// changing the text might necessitate a change in the label's size
uiControlQueueResize(uiControl(l));
}
uiLabel *uiNewLabel(const char *text)
{
struct label *l;
l = (struct label *) MAKE_CONTROL_INSTANCE(uiTypeLabel());
PUT_CODE_HERE;
uiControl(l)->Handle = labelHandle;
uiLabel(l)->Text = labelText;
uiLabel(l)->SetText = labelSetText;
return uiLabel(l);
}

40
redo/stubs/progressbar.c Normal file
View File

@ -0,0 +1,40 @@
// 11 june 2015
#include "uipriv_OSHERE.h"
struct progressbar {
uiProgressBar p;
OSTYPE OSHANDLE;
};
uiDefineControlType(uiProgressBar, uiTypeProgressBar, struct progressbar)
static uintptr_t progressbarHandle(uiControl *c)
{
struct progressbar *p = (struct progressbar *) c;
return (uintptr_t) (p->OSHANDLE);
}
static void progressbarSetValue(uiProgressBar *pp, int value)
{
struct progressbar *p = (struct progressbar *) pp;
if (value < 0 || value > 100)
complain("value %d out of range in progressbarSetValue()", value);
PUT_CODE_HERE;
}
uiProgressBar *uiNewProgressBar(void)
{
struct progressbar *p;
p = (struct progressbar *) MAKE_CONTROL_INSTANCE(uiTypeProgressBar());
PUT_CODE_HERE;
uiControl(p)->Handle = progressbarHandle;
uiProgressBar(p)->SetValue = progressbarSetValue;
return uiProgressBar(p);
}

36
redo/stubs/radiobuttons.c Normal file
View File

@ -0,0 +1,36 @@
// 11 june 2015
#include "uipriv_OSHERE.h"
struct radiobuttons {
uiRadioButtons r;
};
uiDefineControlType(uiRadioButtons, uiTypeRadioButtons, struct radiobuttons)
static uintptr_t radiobuttonsHandle(uiControl *c)
{
return 0;
}
static void radiobuttonsAppend(uiRadioButtons *rr, const char *text)
{
struct radiobuttons *r = (struct radiobuttons *) rr;
PUT_CODE_HERE;
uiControlQueueResize(uiControl(r));
}
uiRadioButtons *uiNewRadioButtons(void)
{
struct radiobuttons *r;
r = (struct radiobuttons *) MAKE_CONTROL_INSTANCE(uiTypeRadioButtons());
PUT_CODE_HERE;
uiControl(r)->Handle = radiobuttonsHandle;
uiRadioButtons(r)->Append = radiobuttonsAppend;
return uiRadioButtons(r);
}

29
redo/stubs/separator.c Normal file
View File

@ -0,0 +1,29 @@
// 11 june 2015
#include "uipriv_OSHERE.h"
struct separator {
uiSeparator s;
OSTYPE OSHANDLE;
};
uiDefineControlType(uiSeparator, uiTypeSeparator, struct separator)
static uintptr_t separatorHandle(uiControl *c)
{
struct separator *s = (struct separator *) c;
return (uintptr_t) (s->OSHANDLE);
}
uiSeparator *uiNewHorizontalSeparator(void)
{
struct separator *s;
s = (struct separator *) MAKE_CONTROL_INSTANCE(uiTypeSeparator());
PUT_CODE_HERE;
uiControl(s)->Handle = separatorHandle;
return uiSeparator(s);
}

64
redo/stubs/slider.c Normal file
View File

@ -0,0 +1,64 @@
// 11 june 2015
#include "uipriv_OSHERE.h"
struct slider {
uiSlider s;
OSTYPE OSHANDLE;
void (*onChanged)(uiSlider *, void *);
void *onChangedData;
};
uiDefineControlType(uiSlider, uiTypeSlider, struct slider)
static uintptr_t sliderHandle(uiControl *c)
{
struct slider *s = (struct slider *) c;
return (uintptr_t) (s->OSHANDLE);
}
static void defaultOnChanged(uiSlider *s, void *data)
{
// do nothing
}
static intmax_t sliderValue(uiSlider *ss)
{
struct slider *s = (struct slider *) ss;
return PUT_CODE_HERE;
}
static void sliderSetValue(uiSlider *ss, intmax_t value)
{
struct slider *s = (struct slider *) ss;
PUT_CODE_HERE;
}
static void sliderOnChanged(uiSlider *ss, void (*f)(uiSlider *, void *), void *data)
{
struct slider *s = (struct slider *) ss;
s->onChanged = f;
s->onChangedData = data;
}
uiSlider *uiNewSlider(intmax_t min, intmax_t max)
{
struct slider *s;
s = (struct slider *) MAKE_CONTROL_INSTANCE(uiTypeSlider());
PUT_CODE_HERE;
s->onChanged = defaultOnChanged;
uiControl(s)->Handle = sliderHandle;
uiSlider(s)->Value = sliderValue;
uiSlider(s)->SetValue = sliderSetValue;
uiSlider(s)->OnChanged = sliderOnChanged;
return uiSlider(s);
}

64
redo/stubs/spinbox.c Normal file
View File

@ -0,0 +1,64 @@
// 11 june 2015
#include "uipriv_OSHERE.h"
struct spinbox {
uiSpinbox s;
};
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);
}

78
redo/stubs/tab.c Normal file
View File

@ -0,0 +1,78 @@
// 11 june 2015
#include "uipriv_OSHERE.h"
struct tab {
uiTab t;
OSTYPE OSHANDLE;
};
uiDefineControlType(uiTab, uiTypeTab, struct tab)
static uintptr_t tabHandle(uiControl *c)
{
struct tab *t = (struct tab *) c;
return (uintptr_t) (t->OSHANDLE);
}
static void tabAppend(uiTab *tt, const char *name, uiControl *child)
{
struct tab *t = (struct tab *) tt;
uiTabInsertAt(tt, name, PUT_CODE_HERE, child);
}
static void tabInsertAt(uiTab *tt, const char *name, uintmax_t n, uiControl *child)
{
struct tab *t = (struct tab *) tt;
PUT_CODE_HERE;
}
static void tabDelete(uiTab *tt, uintmax_t n)
{
struct tab *t = (struct tab *) tt;
PUT_CODE_HERE;
}
static uintmax_t tabNumPages(uiTab *tt)
{
struct tab *t = (struct tab *) tt;
return PUT_CODE_HERE;
}
static int tabMargined(uiTab *tt, uintmax_t n)
{
struct tab *t = (struct tab *) tt;
return PUT_CODE_HERE;
}
static void tabSetMargined(uiTab *tt, uintmax_t n, int margined)
{
struct tab *t = (struct tab *) tt;
PUT_CODE_HERE;
}
uiTab *uiNewTab(void)
{
struct tab *t;
t = (struct tab *) MAKE_CONTROL_INSTANCE(uiTypeTab());
PUT_CODE_HERE;
uiControl(t)->Handle = tabHandle;
uiTab(t)->Append = tabAppend;
uiTab(t)->InsertAt = tabInsertAt;
uiTab(t)->Delete = tabDelete;
uiTab(t)->NumPages = tabNumPages;
uiTab(t)->Margined = tabMargined;
uiTab(t)->SetMargined = tabSetMargined;
return uiTab(t);
}