diff options
| author | Pietro Gagliardi <[email protected]> | 2015-04-15 22:20:25 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2015-04-15 22:20:25 -0400 |
| commit | 3730400f9755311a5f557bd1b7e5687161b831d5 (patch) | |
| tree | 227389c112ee77fce1bf7f04ac79b2ea5150084b /new/unix/tab.c | |
| parent | 922360f1120daa1581c8db9feb365929bce416eb (diff) | |
Converted unix/tab.c and fixed an oversight in unix/button.c.
Diffstat (limited to 'new/unix/tab.c')
| -rw-r--r-- | new/unix/tab.c | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/new/unix/tab.c b/new/unix/tab.c index dd69e4c..eca7997 100644 --- a/new/unix/tab.c +++ b/new/unix/tab.c @@ -2,6 +2,7 @@ #include "uipriv_unix.h" struct tab { + uiTab t; uiParent **pages; uintmax_t len; uintmax_t cap; @@ -15,30 +16,13 @@ static void onDestroy(GtkWidget *widget, gpointer data) uiFree(t); } -uiControl *uiNewTab(void) -{ - uiControl *c; - struct tab *t; - GtkWidget *widget; - - c = uiUnixNewControl(GTK_TYPE_NOTEBOOK, - FALSE, FALSE, - NULL); - - widget = GTK_WIDGET(uiControlHandle(c)); - - t = uiNew(struct tab); - g_signal_connect(widget, "destroy", G_CALLBACK(onDestroy), t); - c->data = t; - - return c; -} +#define TAB(t) GTK_NOTEBOOK(uiControlHandle(uiControl(t))) #define tabCapGrow 32 -void uiTabAddPage(uiControl *c, const char *name, uiControl *child) +static void addPage(uiTab *tt, const char *name, uiControl *child) { - struct tab *t = (struct tab *) (c->data); + struct tab *t = (struct tab *) tt; GtkWidget *notebook; uiParent *content; @@ -56,3 +40,23 @@ void uiTabAddPage(uiControl *c, const char *name, uiControl *child) t->pages[t->len] = content; t->len++; } + +uiControl *uiNewTab(void) +{ + uiControl *c; + struct tab *t; + GtkWidget *widget; + + t = uiNew(struct tab); + + uiUnixNewControl(uiControl(t), GTK_TYPE_NOTEBOOK, + FALSE, FALSE, + NULL); + + widget = GTK_WIDGET(TAB(t)); + g_signal_connect(widget, "destroy", G_CALLBACK(onDestroy), t); + + uiTab(t)->AddPage = addPage; + + return uiTab(t); +} |
