From ca1103e34789c97d8f7d22182e4a9fb82e3ed669 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Tue, 28 Apr 2015 21:47:18 -0400 Subject: [PATCH] Set up tabs in the test program and renamed uiAddTab() to uiAppendTab(). --- new/test/main.c | 5 +++++ new/test/spaced.c | 13 +++++++++++++ new/test/test.h | 1 + new/ui.idl | 3 +-- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/new/test/main.c b/new/test/main.c index c7ce2d02..0419d4b5 100644 --- a/new/test/main.c +++ b/new/test/main.c @@ -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)); diff --git a/new/test/spaced.c b/new/test/spaced.c index bb64bd00..a5932eed 100644 --- a/new/test/spaced.c +++ b/new/test/spaced.c @@ -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; +} diff --git a/new/test/test.h b/new/test/test.h index 649ceb44..79fd7527 100644 --- a/new/test/test.h +++ b/new/test/test.h @@ -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); diff --git a/new/ui.idl b/new/ui.idl index cde3e1ce..51b41bef 100644 --- a/new/ui.idl +++ b/new/ui.idl @@ -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;