Readded the moving label test, which starts Page 2.
This commit is contained in:
parent
0370f10031
commit
d2c491dbd0
|
@ -4,6 +4,7 @@ testCFILES = \
|
|||
test/main.c \
|
||||
test/menus.c \
|
||||
test/page1.c \
|
||||
test/page2.c \
|
||||
test/spaced.c
|
||||
|
||||
testHFILES = \
|
||||
|
|
|
@ -23,7 +23,7 @@ int main(int argc, char *argv[])
|
|||
const char *err;
|
||||
uiWindow *w;
|
||||
uiTab *tab;
|
||||
uiBox *page1;
|
||||
uiBox *page1, *page2;
|
||||
|
||||
memset(&o, 0, sizeof (uiInitOptions));
|
||||
for (i = 1; i < argc; i++)
|
||||
|
@ -55,6 +55,9 @@ int main(int argc, char *argv[])
|
|||
page1 = makePage1(w);
|
||||
uiTabAppendPage(tab, "Page 1", uiControl(page1));
|
||||
|
||||
page2 = makePage2();
|
||||
uiTabAppendPage(tab, "Page 2", uiControl(page2));
|
||||
|
||||
uiControlShow(uiControl(w));
|
||||
uiMain();
|
||||
printf("after uiMain()\n");
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
// 29 april 2015
|
||||
#include "test.h"
|
||||
|
||||
static uiLabel *movingLabel;
|
||||
static uiBox *movingBoxes[2];
|
||||
static int movingCurrent;
|
||||
|
||||
static void moveLabel(uiButton *b, void *data)
|
||||
{
|
||||
int from, to;
|
||||
|
||||
from = movingCurrent;
|
||||
to = 0;
|
||||
if (from == 0)
|
||||
to = 1;
|
||||
uiBoxDelete(movingBoxes[from], 0);
|
||||
uiBoxAppend(movingBoxes[to], uiControl(movingLabel), 0);
|
||||
movingCurrent = to;
|
||||
}
|
||||
|
||||
// TODO tab manipulation
|
||||
|
||||
uiBox *makePage2(void)
|
||||
{
|
||||
uiBox *page2;
|
||||
uiBox *hbox;
|
||||
uiButton *button;
|
||||
|
||||
page2 = newVerticalBox();
|
||||
|
||||
hbox = newHorizontalBox();
|
||||
button = uiNewButton("Move the Label!");
|
||||
uiButtonOnClicked(button, moveLabel, NULL);
|
||||
uiBoxAppend(hbox, uiControl(button), 1);
|
||||
// have a blank label for space
|
||||
uiBoxAppend(hbox, uiControl(uiNewLabel("")), 1);
|
||||
uiBoxAppend(page2, uiControl(hbox), 0);
|
||||
|
||||
hbox = newHorizontalBox();
|
||||
movingBoxes[0] = newVerticalBox();
|
||||
uiBoxAppend(hbox, uiControl(movingBoxes[0]), 1);
|
||||
movingBoxes[1] = newVerticalBox();
|
||||
uiBoxAppend(hbox, uiControl(movingBoxes[1]), 1);
|
||||
uiBoxAppend(page2, uiControl(hbox), 0);
|
||||
|
||||
movingCurrent = 0;
|
||||
movingLabel = uiNewLabel("This label moves!");
|
||||
uiBoxAppend(movingBoxes[movingCurrent], uiControl(movingLabel), 0);
|
||||
|
||||
return page2;
|
||||
}
|
|
@ -23,3 +23,6 @@ extern void initMenus(void);
|
|||
|
||||
// page1.c
|
||||
extern uiBox *makePage1(uiWindow *);
|
||||
|
||||
// page2.c
|
||||
extern uiBox *makePage2(void);
|
||||
|
|
Loading…
Reference in New Issue