Started reintegrating the old Page 1 test into the new test. The UI is done.

This commit is contained in:
Pietro Gagliardi 2015-04-29 13:38:38 -04:00
parent 6c6bce3702
commit 515b25c144
4 changed files with 97 additions and 14 deletions

View File

@ -3,6 +3,7 @@
testCFILES = \
test/main.c \
test/menus.c \
test/page1.c \
test/spaced.c
testHFILES = \

View File

@ -21,7 +21,7 @@ int main(int argc, char *argv[])
const char *err;
uiWindow *w;
uiTab *tab;
uiBox *vbox;
uiBox *page1;
memset(&o, 0, sizeof (uiInitOptions));
for (i = 1; i < argc; i++)
@ -45,21 +45,12 @@ int main(int argc, char *argv[])
uiWindowOnClosing(w, onClosing, NULL);
tab = newTab();
vbox = newVerticalBox();
uiTabAppendPage(tab, "Page 1", uiControl(vbox));
uiTabAppendPage(tab, "Page 2", uiControl(newVerticalBox()));
uiTabAppendPage(tab, "Page 3", uiControl(newVerticalBox()));
uiTabDeletePage(tab, 1);
// TODO delete the stack
page1 = makePage1();
uiTabAppendPage(tab, "Page 1", uiControl(page1));
uiWindowSetChild(w, uiControl(tab));
uiBoxAppend(vbox, uiNewButton("Button"), 0);
uiBoxAppend(vbox, uiNewCheckbox("Checkbox"), 0);
uiBoxAppend(vbox, uiNewEntry(), 0);
uiBoxAppend(vbox, uiNewLabel("Label"), 0);
uiControlShow(uiControl(newWindow("Second Window", 320, 240, 1)));
uiControlShow(uiControl(w));
uiMain();
printf("after uiMain()\n");

88
test/page1.c Normal file
View File

@ -0,0 +1,88 @@
// 29 april 2015
#include "test.h"
static uiEntry *entry;
static uiCheckbox *spaced;
uiBox *makePage1(void)
{
uiBox *page1;
uiButton *getButton, *setButton;
uiBox *hbox;
uiBox *testBox;
uiLabel *label;
page1 = newVerticalBox();
entry = uiNewEntry();
uiBoxAppend(page1, uiControl(entry), 0);
spaced = uiNewCheckbox("Spaced");
label = uiNewLabel("Label");
hbox = newHorizontalBox();
getButton = uiNewButton("Get Window Text");
setButton = uiNewButton("Set Window Text");
uiBoxAppend(hbox, uiControl(getButton), 1);
uiBoxAppend(hbox, uiControl(setButton), 1);
uiBoxAppend(page1, uiControl(hbox), 0);
hbox = newHorizontalBox();
getButton = uiNewButton("Get Button Text");
setButton = uiNewButton("Set Button Text");
uiBoxAppend(hbox, uiControl(getButton), 1);
uiBoxAppend(hbox, uiControl(setButton), 1);
uiBoxAppend(page1, uiControl(hbox), 0);
hbox = newHorizontalBox();
getButton = uiNewButton("Get Checkbox Text");
setButton = uiNewButton("Set Checkbox Text");
uiBoxAppend(hbox, uiControl(getButton), 1);
uiBoxAppend(hbox, uiControl(setButton), 1);
uiBoxAppend(page1, uiControl(hbox), 0);
hbox = newHorizontalBox();
getButton = uiNewButton("Get Label Text");
setButton = uiNewButton("Set Label Text");
uiBoxAppend(hbox, uiControl(getButton), 1);
uiBoxAppend(hbox, uiControl(setButton), 1);
uiBoxAppend(page1, uiControl(hbox), 0);
hbox = newHorizontalBox();
uiBoxAppend(hbox, uiControl(spaced), 1);
getButton = uiNewButton("On");
uiBoxAppend(hbox, uiControl(getButton), 0);
getButton = uiNewButton("Off");
uiBoxAppend(hbox, uiControl(getButton), 0);
getButton = uiNewButton("Show");
uiBoxAppend(hbox, uiControl(getButton), 0);
uiBoxAppend(page1, uiControl(hbox), 0);
testBox = newHorizontalBox();
setButton = uiNewButton("Button");
uiBoxAppend(testBox, uiControl(setButton), 1);
getButton = uiNewButton("Show");
uiBoxAppend(testBox, uiControl(getButton), 0);
getButton = uiNewButton("Hide");
uiBoxAppend(testBox, uiControl(getButton), 0);
getButton = uiNewButton("Enable");
uiBoxAppend(testBox, uiControl(getButton), 0);
getButton = uiNewButton("Disable");
uiBoxAppend(testBox, uiControl(getButton), 0);
uiBoxAppend(page1, uiControl(testBox), 0);
hbox = newHorizontalBox();
getButton = uiNewButton("Show Box");
uiBoxAppend(hbox, uiControl(getButton), 1);
getButton = uiNewButton("Hide Box");
uiBoxAppend(hbox, uiControl(getButton), 1);
getButton = uiNewButton("Enable Box");
uiBoxAppend(hbox, uiControl(getButton), 1);
getButton = uiNewButton("Disable Box");
uiBoxAppend(hbox, uiControl(getButton), 1);
uiBoxAppend(page1, uiControl(hbox), 0);
uiBoxAppend(page1, uiControl(label), 0);
return page1;
}

View File

@ -18,3 +18,6 @@ extern uiTab *newTab(void);
// menus.c
extern void initMenus(void);
// page1.c
extern uiBox *makePage1(void);