Added a swap horizontal/vertical uiBox mode to the test program.

This commit is contained in:
Pietro Gagliardi 2015-06-04 00:51:41 -04:00
parent 4d48b08ae2
commit 2aa1227238
4 changed files with 17 additions and 6 deletions

View File

@ -33,6 +33,9 @@ int onShouldQuit(void *data)
uiBox *mainBox;
uiTab *mainTab;
uiBox *(*newhbox)(void);
uiBox *(*newvbox)(void);
int main(int argc, char *argv[])
{
uiInitOptions o;
@ -42,11 +45,17 @@ int main(int argc, char *argv[])
uiBox *page2, *page3, *page4, *page5;
int nomenus = 0;
newhbox = uiNewHorizontalBox;
newvbox = uiNewVerticalBox;
memset(&o, 0, sizeof (uiInitOptions));
for (i = 1; i < argc; i++)
if (strcmp(argv[i], "nomenus") == 0)
nomenus = 1;
else {
else if (strcmp(argv[i], "swaphv") == 0) {
newhbox = uiNewVerticalBox;
newvbox = uiNewHorizontalBox;
} else {
fprintf(stderr, "%s: unrecognized option %s\n", argv[0], argv[i]);
return 1;
}

View File

@ -8,7 +8,7 @@ static uiBox *makeSet(int omit, int hidden, int stretch)
// don't use newHorizontalBox()
// the point of this test is to test hidden controls and padded
hbox = uiNewHorizontalBox();
hbox = (*newhbox)();
uiBoxSetPadded(hbox, 1);
if (omit != 0) {
buttons[0] = uiNewButton("First");
@ -44,8 +44,8 @@ uiBox *makePage3(void)
// first the non-stretchy type
for (hidden = 0; hidden < 4; hidden++) {
// these two must stay unpadded as well, otherwise the test isn't meaningful
hbox2 = uiNewHorizontalBox();
vbox = uiNewVerticalBox();
hbox2 = (*newhbox)();
vbox = (*newvbox)();
// reference set
hbox = makeSet(hidden, -1, 0);
uiBoxAppend(vbox, uiControl(hbox), 0);

View File

@ -108,7 +108,7 @@ uiBox *newHorizontalBox(void)
{
uiBox *b;
b = uiNewHorizontalBox();
b = (*newhbox)();
append(b, box);
return b;
}
@ -117,7 +117,7 @@ uiBox *newVerticalBox(void)
{
uiBox *b;
b = uiNewVerticalBox();
b = (*newvbox)();
append(b, box);
return b;
}

View File

@ -10,6 +10,8 @@
extern void die(const char *, ...);
extern uiBox *mainBox;
extern uiTab *mainTab;
extern uiBox *(*newhbox)(void);
extern uiBox *(*newvbox)(void);
// spaced.c
extern void setSpaced(int);