Added a bare-bones uiGroup.

This commit is contained in:
Pietro Gagliardi 2015-05-11 22:35:16 -04:00
parent 5deac6cfd6
commit 9cd8ff7e93
4 changed files with 27 additions and 2 deletions

View File

@ -64,6 +64,8 @@ uiBox *makePage2(void)
{
uiBox *page2;
uiBox *hbox;
uiGroup *group;
uiBox *vbox;
uiButton *button;
uiBox *nestedBox;
uiBox *innerhbox;
@ -76,20 +78,25 @@ uiBox *makePage2(void)
page2 = newVerticalBox();
group = newGroup("Moving Label");
uiBoxAppend(page2, uiControl(group), 0);
vbox = newVerticalBox();
uiGroupSetChild(group, uiControl(vbox));
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);
uiBoxAppend(vbox, 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);
uiBoxAppend(vbox, uiControl(hbox), 0);
movingCurrent = 0;
movingLabel = uiNewLabel("This label moves!");

View File

@ -30,6 +30,7 @@ enum types {
window,
box,
tab,
group,
};
void setSpaced(int spaced)
@ -129,3 +130,12 @@ uiTab *newTab(void)
append(t, tab);
return t;
}
uiGroup *newGroup(const char *text)
{
uiGroup *g;
g = uiNewGroup(text);
append(g, group);
return g;
}

View File

@ -18,6 +18,7 @@ extern uiWindow *newWindow(const char *title, int width, int height, int hasMenu
extern uiBox *newHorizontalBox(void);
extern uiBox *newVerticalBox(void);
extern uiTab *newTab(void);
extern uiGroup *newGroup(const char *);
// menus.c
extern uiMenuItem *shouldQuitItem;

7
ui.idl
View File

@ -130,6 +130,13 @@ interface Tab from Control {
};
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 {
func AppendItem(name *const char) *MenuItem;
func AppendCheckItem(name *const char) *MenuItem;