From d8eeab30eba6dca60d9ac165efdf636e25a01b4b Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Thu, 27 Aug 2015 12:22:58 -0400 Subject: [PATCH] Decided to nuke the stubs. --- stubs/button.c | 66 ------------------------ stubs/checkbox.c | 82 ------------------------------ stubs/combobox.c | 48 ------------------ stubs/datetimepicker.c | 44 ---------------- stubs/entry.c | 81 ----------------------------- stubs/group.c | 90 --------------------------------- stubs/label.c | 48 ------------------ stubs/progressbar.c | 40 --------------- stubs/radiobuttons.c | 36 ------------- stubs/separator.c | 29 ----------- stubs/slider.c | 64 ----------------------- stubs/spinbox.c | 67 ------------------------ stubs/tab.c | 78 ---------------------------- stubs/window.c | 112 ----------------------------------------- 14 files changed, 885 deletions(-) delete mode 100644 stubs/button.c delete mode 100644 stubs/checkbox.c delete mode 100644 stubs/combobox.c delete mode 100644 stubs/datetimepicker.c delete mode 100644 stubs/entry.c delete mode 100644 stubs/group.c delete mode 100644 stubs/label.c delete mode 100644 stubs/progressbar.c delete mode 100644 stubs/radiobuttons.c delete mode 100644 stubs/separator.c delete mode 100644 stubs/slider.c delete mode 100644 stubs/spinbox.c delete mode 100644 stubs/tab.c delete mode 100644 stubs/window.c diff --git a/stubs/button.c b/stubs/button.c deleted file mode 100644 index f6738e7a..00000000 --- a/stubs/button.c +++ /dev/null @@ -1,66 +0,0 @@ -// 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/stubs/checkbox.c b/stubs/checkbox.c deleted file mode 100644 index 6e912a19..00000000 --- a/stubs/checkbox.c +++ /dev/null @@ -1,82 +0,0 @@ -// 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; - - 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); -} diff --git a/stubs/combobox.c b/stubs/combobox.c deleted file mode 100644 index d90a2032..00000000 --- a/stubs/combobox.c +++ /dev/null @@ -1,48 +0,0 @@ -// 11 june 2015 -#include "uipriv_OSHERE.h" - -struct combobox { - uiCombobox c; - OSTYPE OSHANDLE; -}; - -uiDefineControlType(uiCombobox, uiTypeCombobox, struct combobox) - -static uintptr_t comboboxHandle(uiControl *cc) -{ - struct combobox *c = (struct combobox *) cc; - - return (uintptr_t) (c->OSHANDLE); -} - -static void comboboxAppend(uiCombobox *cc, const char *text) -{ - struct combobox *c = (struct combobox *) cc; - - PUT_CODE_HERE; -} - -static uiCombobox *finishNewCombobox(OSTHING OSARG) -{ - struct combobox *c; - - c = (struct combobox *) MAKE_CONTROL_INSTANCE(uiTypeCombobox()); - - PUT_CODE_HERE; - - uiControl(c)->Handle = comboboxHandle; - - uiCombobox(c)->Append = comboboxAppend; - - return uiCombobox(c); -} - -uiCombobox *uiNewCombobox(void) -{ - return finishNewCombobox(OSARGNONEDITABLE); -} - -uiCombobox *uiNewEditableCombobox(void) -{ - return finishNewCombobox(OSARGEDITABLE); -} diff --git a/stubs/datetimepicker.c b/stubs/datetimepicker.c deleted file mode 100644 index 829e0e5d..00000000 --- a/stubs/datetimepicker.c +++ /dev/null @@ -1,44 +0,0 @@ -// 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); -} diff --git a/stubs/entry.c b/stubs/entry.c deleted file mode 100644 index c4c3cb85..00000000 --- a/stubs/entry.c +++ /dev/null @@ -1,81 +0,0 @@ -// 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; - - 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); -} diff --git a/stubs/group.c b/stubs/group.c deleted file mode 100644 index 75a86d18..00000000 --- a/stubs/group.c +++ /dev/null @@ -1,90 +0,0 @@ -// 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); -} diff --git a/stubs/label.c b/stubs/label.c deleted file mode 100644 index 04cb0111..00000000 --- a/stubs/label.c +++ /dev/null @@ -1,48 +0,0 @@ -// 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); -} diff --git a/stubs/progressbar.c b/stubs/progressbar.c deleted file mode 100644 index 3f6592aa..00000000 --- a/stubs/progressbar.c +++ /dev/null @@ -1,40 +0,0 @@ -// 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); -} diff --git a/stubs/radiobuttons.c b/stubs/radiobuttons.c deleted file mode 100644 index 57c88337..00000000 --- a/stubs/radiobuttons.c +++ /dev/null @@ -1,36 +0,0 @@ -// 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); -} diff --git a/stubs/separator.c b/stubs/separator.c deleted file mode 100644 index 041edecb..00000000 --- a/stubs/separator.c +++ /dev/null @@ -1,29 +0,0 @@ -// 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); -} diff --git a/stubs/slider.c b/stubs/slider.c deleted file mode 100644 index e07c9a3e..00000000 --- a/stubs/slider.c +++ /dev/null @@ -1,64 +0,0 @@ -// 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); -} diff --git a/stubs/spinbox.c b/stubs/spinbox.c deleted file mode 100644 index cb931243..00000000 --- a/stubs/spinbox.c +++ /dev/null @@ -1,67 +0,0 @@ -// 11 june 2015 -#include "uipriv_OSHERE.h" - -struct spinbox { - uiSpinbox s; - OSTYPE OSHANDLE; - 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); -} diff --git a/stubs/tab.c b/stubs/tab.c deleted file mode 100644 index d82cdf25..00000000 --- a/stubs/tab.c +++ /dev/null @@ -1,78 +0,0 @@ -// 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); -} diff --git a/stubs/window.c b/stubs/window.c deleted file mode 100644 index 082dba2e..00000000 --- a/stubs/window.c +++ /dev/null @@ -1,112 +0,0 @@ -// 11 june 2015 -#include "uipriv_OSHERE.h" - -struct window { - uiWindow w; - OSTYPE OSHANDLE; - uiControl *child; - int (*onClosing)(uiWindow *, void *); - void *onClosingData; - int margined; -}; - -uiDefineControlType(uiWindow, uiTypeWindow, struct window) - -static uintptr_t windowHandle(uiControl *c) -{ - struct window *w = (struct window *) c; - - return (uintptr_t) (w->OSHANDLE); -} - -static void windowContainerUpdateState(uiControl *c) -{ - struct window *w = (struct window *) c; - - if (w->child != NULL) - uiControlUpdateState(w->child); -} - -static char *windowTitle(uiWindow *ww) -{ - struct window *w = (struct window *) ww; - - return PUT_CODE_HERE; -} - -static void windowSetTitle(uiWindow *ww, const char *title) -{ - struct window *w = (struct window *) ww; - - PUT_CODE_HERE; - // don't queue resize; the caption isn't part of what affects layout and sizing of the client area (it'll be ellipsized if too long) -} - -static void windowOnClosing(uiWindow *ww, int (*f)(uiWindow *, void *), void *data) -{ - struct window *w = (struct window *) ww; - - w->onClosing = f; - w->onClosingData = data; -} - -static void windowSetChild(uiWindow *ww, uiControl *child) -{ - struct window *w = (struct window *) ww; - - if (w->child != NULL) - uiControlSetParent(w->child, NULL); - w->child = child; - if (w->child != NULL) { - uiControlSetParent(w->child, uiControl(w)); - uiControlQueueResize(w->child); - } -} - -static int windowMargined(uiWindow *ww) -{ - struct window *w = (struct window *) ww; - - return w->margined; -} - -static void windowSetMargined(uiWindow *ww, int margined) -{ - struct window *w = (struct window *) ww; - - w->margined = margined; - uiControlQueueResize(uiControl(w)); -} - -static void windowResizeChild(uiWindow *ww) -{ - struct window *w = (struct window *) ww; - - if (w->child == NULL) - return; - PUT_CODE_HERE; -} - -uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar) -{ - struct window *w; - - w = (struct window *) MAKE_CONTROL_INSTANCE(uiTypeWindow()); - - PUT_CODE_HERE; - - w->onClosing = defaultOnClosing; - - uiControl(w)->Handle = windowHandle; - uiControl(w)->ContainerUpdateState = windowContainerUpdateState; - - uiWindow(w)->Title = windowTitle; - uiWindow(w)->SetTitle = windowSetTitle; - uiWindow(w)->OnClosing = windowOnClosing; - uiWindow(w)->SetChild = windowSetChild; - uiWindow(w)->Margined = windowMargined; - uiWindow(w)->SetMargined = windowSetMargined; - uiWindow(w)->ResizeChild = windowResizeChild; - - return uiWindow(w); -}