Set up tabs in the test program and renamed uiAddTab() to uiAppendTab().
This commit is contained in:
parent
da2ad417a0
commit
ca1103e347
|
@ -20,6 +20,7 @@ int main(int argc, char *argv[])
|
|||
int i;
|
||||
const char *err;
|
||||
uiWindow *w;
|
||||
uiTab *tab;
|
||||
|
||||
memset(&o, 0, sizeof (uiInitOptions));
|
||||
for (i = 1; i < argc; i++)
|
||||
|
@ -42,6 +43,10 @@ int main(int argc, char *argv[])
|
|||
w = newWindow("Main Window", 320, 240, 1);
|
||||
uiWindowOnClosing(w, onClosing, NULL);
|
||||
|
||||
tab = newTab();
|
||||
uiTabAppendPage(tab, "Page 1", newVerticalBox());
|
||||
uiWindowSetChild(w, uiControl(tab));
|
||||
|
||||
uiControlShow(uiControl(newWindow("Second Window", 320, 240, 1)));
|
||||
|
||||
uiControlShow(uiControl(w));
|
||||
|
|
|
@ -29,6 +29,7 @@ static void *append(void *thing, int type)
|
|||
enum types {
|
||||
window,
|
||||
box,
|
||||
tab,
|
||||
};
|
||||
|
||||
void setSpaced(int spaced)
|
||||
|
@ -45,6 +46,9 @@ void setSpaced(int spaced)
|
|||
case box:
|
||||
uiBoxSetPadded(uiBox(p), spaced);
|
||||
break;
|
||||
case tab:
|
||||
// TODO
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -75,3 +79,12 @@ uiBox *newVerticalBox(void)
|
|||
append(b, box);
|
||||
return b;
|
||||
}
|
||||
|
||||
uiTab *newTab(void)
|
||||
{
|
||||
uiTab *t;
|
||||
|
||||
t = uiNewTab();
|
||||
append(t, tab);
|
||||
return t;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ extern void setSpaced(int);
|
|||
extern uiWindow *newWindow(const char *title, int width, int height, int hasMenubar);
|
||||
extern uiBox *newHorizontalBox(void);
|
||||
extern uiBox *newVerticalBox(void);
|
||||
extern uiTab *newTab(void);
|
||||
|
||||
// menus.c
|
||||
extern void initMenus(void);
|
||||
|
|
|
@ -112,8 +112,7 @@ interface Label from Control {
|
|||
func NewLabel(text *const char) *Label;
|
||||
|
||||
interface Tab from Control {
|
||||
// TODO rename to AppendPage()
|
||||
func AddPage(name *const char, c *Control);
|
||||
func AppendPage(name *const char, c *Control);
|
||||
func DeletePage(index uintmax_t);
|
||||
};
|
||||
func NewTab(void) *Tab;
|
||||
|
|
Loading…
Reference in New Issue