Converted unix/tab.c and fixed an oversight in unix/button.c.

This commit is contained in:
Pietro Gagliardi 2015-04-15 22:20:25 -04:00
parent 922360f112
commit 3730400f97
2 changed files with 25 additions and 21 deletions

View File

@ -67,5 +67,5 @@ uiControl *uiNewButton(const char *text)
uiButton(b)->SetText = setText;
uiButton(b)->OnClicked = setOnClicked;
return b;
return uiButton(b);
}

View File

@ -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);
}