Added uiStackPadded().

This commit is contained in:
Pietro Gagliardi 2015-04-09 20:04:18 -04:00
parent 85eb453416
commit 5c2ead2fea
3 changed files with 20 additions and 4 deletions

View File

@ -255,7 +255,12 @@ void uiStackAdd(uiControl *st, uiControl *c, int stretchy)
updateParent(s->parent);
}
// TODO get padded
int uiStackPadded(uiControl *c)
{
stack *s = (stack *) (c->data);
return s->padded;
}
void uiStackSetPadded(uiControl *c, int padded)
{

15
test.c
View File

@ -98,6 +98,16 @@ static void forceSpacedOff(uiControl *c, void *data)
uiCheckboxSetChecked(spaced, 0);
}
static void showSpaced(uiControl *c, void *data)
{
char msg[] = { 'm', ' ', '0', ' ', 'p', ' ', '0', '\0' };
// TODO margined
if (uiStackPadded(stacks[0]))
msg[6] = '1';
uiEntrySetText(e, msg);
}
int main(int argc, char *argv[])
{
uiInitError *err;
@ -158,10 +168,11 @@ int main(int argc, char *argv[])
uiButtonOnClicked(setButton, forceSpacedOff, NULL);
uiStackAdd(stacks[4], getButton, 0);
uiStackAdd(stacks[4], setButton, 0);
setButton = uiNewButton("Show");
uiButtonOnClicked(setButton, showSpaced, NULL);
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

@ -64,7 +64,7 @@ void uiButtonOnClicked(uiControl *, void (*)(uiControl *, void *), void *);
uiControl *uiNewHorizontalStack(void);
uiControl *uiNewVerticalStack(void);
void uiStackAdd(uiControl *, uiControl *, int);
// TODO get padded
int uiStackPadded(uiControl *);
void uiStackSetPadded(uiControl *, int);
uiControl *uiNewEntry(void);