Added a bare-bones uiGroup.
This commit is contained in:
parent
5deac6cfd6
commit
9cd8ff7e93
11
test/page2.c
11
test/page2.c
|
@ -64,6 +64,8 @@ uiBox *makePage2(void)
|
||||||
{
|
{
|
||||||
uiBox *page2;
|
uiBox *page2;
|
||||||
uiBox *hbox;
|
uiBox *hbox;
|
||||||
|
uiGroup *group;
|
||||||
|
uiBox *vbox;
|
||||||
uiButton *button;
|
uiButton *button;
|
||||||
uiBox *nestedBox;
|
uiBox *nestedBox;
|
||||||
uiBox *innerhbox;
|
uiBox *innerhbox;
|
||||||
|
@ -76,20 +78,25 @@ uiBox *makePage2(void)
|
||||||
|
|
||||||
page2 = newVerticalBox();
|
page2 = newVerticalBox();
|
||||||
|
|
||||||
|
group = newGroup("Moving Label");
|
||||||
|
uiBoxAppend(page2, uiControl(group), 0);
|
||||||
|
vbox = newVerticalBox();
|
||||||
|
uiGroupSetChild(group, uiControl(vbox));
|
||||||
|
|
||||||
hbox = newHorizontalBox();
|
hbox = newHorizontalBox();
|
||||||
button = uiNewButton("Move the Label!");
|
button = uiNewButton("Move the Label!");
|
||||||
uiButtonOnClicked(button, moveLabel, NULL);
|
uiButtonOnClicked(button, moveLabel, NULL);
|
||||||
uiBoxAppend(hbox, uiControl(button), 1);
|
uiBoxAppend(hbox, uiControl(button), 1);
|
||||||
// have a blank label for space
|
// have a blank label for space
|
||||||
uiBoxAppend(hbox, uiControl(uiNewLabel("")), 1);
|
uiBoxAppend(hbox, uiControl(uiNewLabel("")), 1);
|
||||||
uiBoxAppend(page2, uiControl(hbox), 0);
|
uiBoxAppend(vbox, uiControl(hbox), 0);
|
||||||
|
|
||||||
hbox = newHorizontalBox();
|
hbox = newHorizontalBox();
|
||||||
movingBoxes[0] = newVerticalBox();
|
movingBoxes[0] = newVerticalBox();
|
||||||
uiBoxAppend(hbox, uiControl(movingBoxes[0]), 1);
|
uiBoxAppend(hbox, uiControl(movingBoxes[0]), 1);
|
||||||
movingBoxes[1] = newVerticalBox();
|
movingBoxes[1] = newVerticalBox();
|
||||||
uiBoxAppend(hbox, uiControl(movingBoxes[1]), 1);
|
uiBoxAppend(hbox, uiControl(movingBoxes[1]), 1);
|
||||||
uiBoxAppend(page2, uiControl(hbox), 0);
|
uiBoxAppend(vbox, uiControl(hbox), 0);
|
||||||
|
|
||||||
movingCurrent = 0;
|
movingCurrent = 0;
|
||||||
movingLabel = uiNewLabel("This label moves!");
|
movingLabel = uiNewLabel("This label moves!");
|
||||||
|
|
|
@ -30,6 +30,7 @@ enum types {
|
||||||
window,
|
window,
|
||||||
box,
|
box,
|
||||||
tab,
|
tab,
|
||||||
|
group,
|
||||||
};
|
};
|
||||||
|
|
||||||
void setSpaced(int spaced)
|
void setSpaced(int spaced)
|
||||||
|
@ -129,3 +130,12 @@ uiTab *newTab(void)
|
||||||
append(t, tab);
|
append(t, tab);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uiGroup *newGroup(const char *text)
|
||||||
|
{
|
||||||
|
uiGroup *g;
|
||||||
|
|
||||||
|
g = uiNewGroup(text);
|
||||||
|
append(g, group);
|
||||||
|
return g;
|
||||||
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ extern uiWindow *newWindow(const char *title, int width, int height, int hasMenu
|
||||||
extern uiBox *newHorizontalBox(void);
|
extern uiBox *newHorizontalBox(void);
|
||||||
extern uiBox *newVerticalBox(void);
|
extern uiBox *newVerticalBox(void);
|
||||||
extern uiTab *newTab(void);
|
extern uiTab *newTab(void);
|
||||||
|
extern uiGroup *newGroup(const char *);
|
||||||
|
|
||||||
// menus.c
|
// menus.c
|
||||||
extern uiMenuItem *shouldQuitItem;
|
extern uiMenuItem *shouldQuitItem;
|
||||||
|
|
7
ui.idl
7
ui.idl
|
@ -130,6 +130,13 @@ interface Tab from Control {
|
||||||
};
|
};
|
||||||
func NewTab(void) *Tab;
|
func NewTab(void) *Tab;
|
||||||
|
|
||||||
|
interface Group from Control {
|
||||||
|
// TODO text and settext
|
||||||
|
func SetChild(c *Control);
|
||||||
|
// TODO margined and setmargined
|
||||||
|
};
|
||||||
|
func NewGroup(text *const char) *Group;
|
||||||
|
|
||||||
interface Menu {
|
interface Menu {
|
||||||
func AppendItem(name *const char) *MenuItem;
|
func AppendItem(name *const char) *MenuItem;
|
||||||
func AppendCheckItem(name *const char) *MenuItem;
|
func AppendCheckItem(name *const char) *MenuItem;
|
||||||
|
|
Loading…
Reference in New Issue