More work on the uiGrid test.
This commit is contained in:
parent
ba8e5b80ea
commit
e46554f481
|
@ -180,32 +180,75 @@ static uiControl *spanningGrid(void)
|
||||||
return uiControl(g);
|
return uiControl(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO make non-global
|
||||||
|
static uiButton *hideOne, *one, *showOne;
|
||||||
|
|
||||||
|
static void onHideOne(uiButton *b, void *data)
|
||||||
|
{
|
||||||
|
uiControlHide(uiControl(one));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void onShowOne(uiButton *b, void *data)
|
||||||
|
{
|
||||||
|
uiControlShow(uiControl(one));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void onHideAll(uiButton *b, void *data)
|
||||||
|
{
|
||||||
|
uiControlHide(uiControl(hideOne));
|
||||||
|
uiControlHide(uiControl(one));
|
||||||
|
uiControlHide(uiControl(showOne));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void onShowAll(uiButton *b, void *data)
|
||||||
|
{
|
||||||
|
uiControlShow(uiControl(hideOne));
|
||||||
|
uiControlShow(uiControl(one));
|
||||||
|
uiControlShow(uiControl(showOne));
|
||||||
|
}
|
||||||
|
|
||||||
|
#define AT(x) static void onInsert ## x(uiButton *b, void *data) \
|
||||||
|
{ \
|
||||||
|
uiGrid *g = uiGrid(data); \
|
||||||
|
uiGridInsertAt(g, uiControl(uiNewButton("Button")), \
|
||||||
|
uiControl(b), uiAt ## x, 1, 1, \
|
||||||
|
0, uiAlignFill, 0, uiAlignFill); \
|
||||||
|
}
|
||||||
|
AT(Leading)
|
||||||
|
AT(Top)
|
||||||
|
AT(Trailing)
|
||||||
|
AT(Bottom)
|
||||||
|
|
||||||
static uiControl *assorted(void)
|
static uiControl *assorted(void)
|
||||||
{
|
{
|
||||||
uiGrid *outergrid;
|
uiGrid *outergrid;
|
||||||
uiGrid *innergrid;
|
uiGrid *innergrid;
|
||||||
uiButton *b, *b2;
|
uiButton *b;
|
||||||
|
|
||||||
outergrid = newGrid();
|
outergrid = newGrid();
|
||||||
|
|
||||||
innergrid = newGrid();
|
innergrid = newGrid();
|
||||||
b2 = uiNewButton("Test");
|
one = uiNewButton("Test");
|
||||||
uiGridAppend(innergrid, uiControl(b2),
|
uiGridAppend(innergrid, uiControl(one),
|
||||||
1, 1, 1, 1,
|
1, 1, 1, 1,
|
||||||
0, uiAlignFill, 0, uiAlignFill);
|
0, uiAlignFill, 0, uiAlignFill);
|
||||||
b = uiNewButton("Hide One");
|
hideOne = uiNewButton("Hide One");
|
||||||
uiGridAppend(innergrid, uiControl(b),
|
uiButtonOnClicked(hideOne, onHideOne, NULL);
|
||||||
|
uiGridAppend(innergrid, uiControl(hideOne),
|
||||||
0, 1, 1, 1,
|
0, 1, 1, 1,
|
||||||
0, uiAlignFill, 0, uiAlignFill);
|
0, uiAlignFill, 0, uiAlignFill);
|
||||||
b = uiNewButton("Show One");
|
showOne = uiNewButton("Show One");
|
||||||
uiGridAppend(innergrid, uiControl(b),
|
uiButtonOnClicked(showOne, onShowOne, NULL);
|
||||||
|
uiGridAppend(innergrid, uiControl(showOne),
|
||||||
2, 1, 1, 1,
|
2, 1, 1, 1,
|
||||||
0, uiAlignFill, 0, uiAlignFill);
|
0, uiAlignFill, 0, uiAlignFill);
|
||||||
b = uiNewButton("Hide All");
|
b = uiNewButton("Hide All");
|
||||||
|
uiButtonOnClicked(b, onHideAll, NULL);
|
||||||
uiGridAppend(innergrid, uiControl(b),
|
uiGridAppend(innergrid, uiControl(b),
|
||||||
1, 0, 1, 1,
|
1, 0, 1, 1,
|
||||||
0, uiAlignFill, 0, uiAlignFill);
|
0, uiAlignFill, 0, uiAlignFill);
|
||||||
b = uiNewButton("Show All");
|
b = uiNewButton("Show All");
|
||||||
|
uiButtonOnClicked(b, onShowAll, NULL);
|
||||||
uiGridAppend(innergrid, uiControl(b),
|
uiGridAppend(innergrid, uiControl(b),
|
||||||
1, 2, 1, 1,
|
1, 2, 1, 1,
|
||||||
0, uiAlignFill, 0, uiAlignFill);
|
0, uiAlignFill, 0, uiAlignFill);
|
||||||
|
@ -215,18 +258,22 @@ static uiControl *assorted(void)
|
||||||
|
|
||||||
innergrid = newGrid();
|
innergrid = newGrid();
|
||||||
b = uiNewButton("Insert Trailing");
|
b = uiNewButton("Insert Trailing");
|
||||||
|
uiButtonOnClicked(b, onInsertTrailing, innergrid);
|
||||||
uiGridAppend(innergrid, uiControl(b),
|
uiGridAppend(innergrid, uiControl(b),
|
||||||
0, 0, 1, 1,
|
0, 0, 1, 1,
|
||||||
1, uiAlignFill, 0, uiAlignFill);
|
1, uiAlignFill, 0, uiAlignFill);
|
||||||
b = uiNewButton("Insert Bottom");
|
b = uiNewButton("Insert Bottom");
|
||||||
|
uiButtonOnClicked(b, onInsertBottom, innergrid);
|
||||||
uiGridAppend(innergrid, uiControl(b),
|
uiGridAppend(innergrid, uiControl(b),
|
||||||
1, 0, 1, 1,
|
1, 0, 1, 1,
|
||||||
1, uiAlignFill, 0, uiAlignFill);
|
1, uiAlignFill, 0, uiAlignFill);
|
||||||
b = uiNewButton("Insert Leading");
|
b = uiNewButton("Insert Leading");
|
||||||
|
uiButtonOnClicked(b, onInsertLeading, innergrid);
|
||||||
uiGridAppend(innergrid, uiControl(b),
|
uiGridAppend(innergrid, uiControl(b),
|
||||||
1, 1, 1, 1,
|
1, 1, 1, 1,
|
||||||
1, uiAlignFill, 0, uiAlignFill);
|
1, uiAlignFill, 0, uiAlignFill);
|
||||||
b = uiNewButton("Insert Top");
|
b = uiNewButton("Insert Top");
|
||||||
|
uiButtonOnClicked(b, onInsertTop, innergrid);
|
||||||
uiGridAppend(innergrid, uiControl(b),
|
uiGridAppend(innergrid, uiControl(b),
|
||||||
0, 1, 1, 1,
|
0, 1, 1, 1,
|
||||||
1, uiAlignFill, 0, uiAlignFill);
|
1, uiAlignFill, 0, uiAlignFill);
|
||||||
|
|
Loading…
Reference in New Issue