Added uiWindowSetMargined().

This commit is contained in:
Pietro Gagliardi 2015-04-09 13:42:42 -04:00
parent 1a6ceb9ada
commit 4c13ac57d5
2 changed files with 16 additions and 5 deletions

19
test.c
View File

@ -65,13 +65,21 @@ static void setCheckboxText(uiControl *b, void *data)
uiFreeText(text);
}
uiWindow *w;
uiControl *stacks[5];
uiControl *spaced;
static void setSpaced(uiControl *c, void *data)
static void setSpaced(int spaced)
{
// TODO
printf("toggled %d\n", uiCheckboxChecked(spaced));
uiWindowSetMargined(w, spaced);
}
static void toggleSpaced(uiControl *c, void *data)
{
int s = uiCheckboxChecked(spaced);
printf("toggled %d\n", s);
setSpaced(s);
}
// these will also be used to test if setting checks will trigger events
@ -88,7 +96,6 @@ static void forceSpacedOff(uiControl *c, void *data)
int main(int argc, char *argv[])
{
uiInitError *err;
uiWindow *w;
uiControl *getButton, *setButton;
err = uiInit(NULL);
@ -127,7 +134,7 @@ int main(int argc, char *argv[])
// this will also be used to make sure tab stops work properly when inserted out of creation order, especially on Windows
spaced = uiNewCheckbox("Spaced");
uiCheckboxOnToggled(spaced, setSpaced, NULL);
uiCheckboxOnToggled(spaced, toggleSpaced, NULL);
stacks[3] = uiNewHorizontalStack();
getButton = uiNewButton("Get Checkbox Text");
@ -148,6 +155,8 @@ int main(int argc, char *argv[])
uiStackAdd(stacks[4], setButton, 0);
uiStackAdd(stacks[0], stacks[4], 0);
// TODO get spaced values
uiWindowShow(w);
uiMain();
printf("after uiMain()\n");

2
ui.h
View File

@ -31,6 +31,8 @@ void uiWindowShow(uiWindow *);
void uiWindowHide(uiWindow *);
void uiWindowOnClosing(uiWindow *, int (*)(uiWindow *, void *), void *);
void uiWindowSetChild(uiWindow *, uiControl *);
// TODO uiWindowMargined()
void uiWindowSetMargined(uiWindow *, int);
uiControl *uiNewButton(const char *);
char *uiButtonText(uiControl *);