Implemented the Move Page 1 Out part of the test. Move Page 1 Back will come with uiTabInsertPageBefore().
This commit is contained in:
parent
8f6b34feb0
commit
6591d5e4cb
10
test/main.c
10
test/main.c
|
@ -15,6 +15,7 @@ int onClosing(uiWindow *w, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
uiBox *mainBox;
|
uiBox *mainBox;
|
||||||
|
uiTab *mainTab;
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -22,7 +23,6 @@ int main(int argc, char *argv[])
|
||||||
int i;
|
int i;
|
||||||
const char *err;
|
const char *err;
|
||||||
uiWindow *w;
|
uiWindow *w;
|
||||||
uiTab *tab;
|
|
||||||
uiBox *page2;
|
uiBox *page2;
|
||||||
|
|
||||||
memset(&o, 0, sizeof (uiInitOptions));
|
memset(&o, 0, sizeof (uiInitOptions));
|
||||||
|
@ -49,14 +49,14 @@ int main(int argc, char *argv[])
|
||||||
mainBox = newHorizontalBox();
|
mainBox = newHorizontalBox();
|
||||||
uiWindowSetChild(w, uiControl(mainBox));
|
uiWindowSetChild(w, uiControl(mainBox));
|
||||||
|
|
||||||
tab = newTab();
|
mainTab = newTab();
|
||||||
uiBoxAppend(mainBox, uiControl(tab), 1);
|
uiBoxAppend(mainBox, uiControl(mainTab), 1);
|
||||||
|
|
||||||
makePage1(w);
|
makePage1(w);
|
||||||
uiTabAppendPage(tab, "Page 1", uiControl(page1));
|
uiTabAppendPage(mainTab, "Page 1", uiControl(page1));
|
||||||
|
|
||||||
page2 = makePage2();
|
page2 = makePage2();
|
||||||
uiTabAppendPage(tab, "Page 2", uiControl(page2));
|
uiTabAppendPage(mainTab, "Page 2", uiControl(page2));
|
||||||
|
|
||||||
uiControlShow(uiControl(w));
|
uiControlShow(uiControl(w));
|
||||||
uiMain();
|
uiMain();
|
||||||
|
|
23
test/page2.c
23
test/page2.c
|
@ -18,7 +18,21 @@ static void moveLabel(uiButton *b, void *data)
|
||||||
movingCurrent = to;
|
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)
|
uiBox *makePage2(void)
|
||||||
{
|
{
|
||||||
|
@ -47,5 +61,12 @@ uiBox *makePage2(void)
|
||||||
movingLabel = uiNewLabel("This label moves!");
|
movingLabel = uiNewLabel("This label moves!");
|
||||||
uiBoxAppend(movingBoxes[movingCurrent], uiControl(movingLabel), 0);
|
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;
|
return page2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
// main.c
|
// main.c
|
||||||
extern void die(const char *, ...);
|
extern void die(const char *, ...);
|
||||||
extern uiBox *mainBox;
|
extern uiBox *mainBox;
|
||||||
|
extern uiTab *mainTab;
|
||||||
|
|
||||||
// spaced.c
|
// spaced.c
|
||||||
extern void setSpaced(int);
|
extern void setSpaced(int);
|
||||||
|
|
Loading…
Reference in New Issue