Implemented the Move Page 1 Out part of the test. Move Page 1 Back will come with uiTabInsertPageBefore().

This commit is contained in:
Pietro Gagliardi 2015-04-29 21:09:16 -04:00
parent 8f6b34feb0
commit 6591d5e4cb
3 changed files with 28 additions and 6 deletions

View File

@ -15,6 +15,7 @@ int onClosing(uiWindow *w, void *data)
}
uiBox *mainBox;
uiTab *mainTab;
int main(int argc, char *argv[])
{
@ -22,7 +23,6 @@ int main(int argc, char *argv[])
int i;
const char *err;
uiWindow *w;
uiTab *tab;
uiBox *page2;
memset(&o, 0, sizeof (uiInitOptions));
@ -49,14 +49,14 @@ int main(int argc, char *argv[])
mainBox = newHorizontalBox();
uiWindowSetChild(w, uiControl(mainBox));
tab = newTab();
uiBoxAppend(mainBox, uiControl(tab), 1);
mainTab = newTab();
uiBoxAppend(mainBox, uiControl(mainTab), 1);
makePage1(w);
uiTabAppendPage(tab, "Page 1", uiControl(page1));
uiTabAppendPage(mainTab, "Page 1", uiControl(page1));
page2 = makePage2();
uiTabAppendPage(tab, "Page 2", uiControl(page2));
uiTabAppendPage(mainTab, "Page 2", uiControl(page2));
uiControlShow(uiControl(w));
uiMain();

View File

@ -18,7 +18,21 @@ static void moveLabel(uiButton *b, void *data)
movingCurrent = to;
}
// TODO tab manipulation
static int moveBack;
#define moveOutText "Move Page 1 Out"
#define moveBackText "Move Page 1 Back"
static void movePage1(uiButton *b, void *data)
{
if (moveBack) {
// TODO
return;
}
uiTabDeletePage(mainTab, 0);
uiBoxAppend(mainBox, uiControl(page1), 1);
uiButtonSetText(b, moveBackText);
moveBack = 1;
}
uiBox *makePage2(void)
{
@ -47,5 +61,12 @@ uiBox *makePage2(void)
movingLabel = uiNewLabel("This label moves!");
uiBoxAppend(movingBoxes[movingCurrent], uiControl(movingLabel), 0);
hbox = newHorizontalBox();
button = uiNewButton(moveOutText);
uiButtonOnClicked(button, movePage1, NULL);
uiBoxAppend(hbox, uiControl(button), 0);
uiBoxAppend(page2, uiControl(hbox), 0);
moveBack = 0;
return page2;
}

View File

@ -9,6 +9,7 @@
// main.c
extern void die(const char *, ...);
extern uiBox *mainBox;
extern uiTab *mainTab;
// spaced.c
extern void setSpaced(int);