summaryrefslogtreecommitdiff
path: root/new/unix/tab.c
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-04-16 20:33:28 -0400
committerPietro Gagliardi <[email protected]>2015-04-16 20:33:28 -0400
commite34c561ed5bedeb180437ec165882b98d70d38c1 (patch)
treed095e5db16d7a23e883526c8c1d3c524639c97cf /new/unix/tab.c
parentde9d72299fb89a8b6cdc8963cd6b6ae708a81e80 (diff)
Split the rewrite into a new repository.
Diffstat (limited to 'new/unix/tab.c')
-rw-r--r--new/unix/tab.c61
1 files changed, 0 insertions, 61 deletions
diff --git a/new/unix/tab.c b/new/unix/tab.c
deleted file mode 100644
index bb168f5..0000000
--- a/new/unix/tab.c
+++ /dev/null
@@ -1,61 +0,0 @@
-// 12 april 2015
-#include "uipriv_unix.h"
-
-struct tab {
- uiTab t;
- uiParent **pages;
- uintmax_t len;
- uintmax_t cap;
-};
-
-static void onDestroy(GtkWidget *widget, gpointer data)
-{
- struct tab *t = (struct tab *) data;
-
- uiFree(t->pages);
- uiFree(t);
-}
-
-#define TAB(t) GTK_NOTEBOOK(uiControlHandle(uiControl(t)))
-
-#define tabCapGrow 32
-
-static void addPage(uiTab *tt, const char *name, uiControl *child)
-{
- struct tab *t = (struct tab *) tt;
- GtkWidget *notebook;
- uiParent *content;
-
- if (t->len >= t->cap) {
- t->cap += tabCapGrow;
- t->pages = (uiParent **) uiRealloc(t->pages, t->cap * sizeof (uiParent *), "uiParent *[]");
- }
-
- notebook = GTK_WIDGET(TAB(t));
- content = uiNewParent((uintptr_t) notebook);
- uiParentSetChild(content, child);
- uiParentUpdate(content);
- gtk_notebook_set_tab_label_text(GTK_NOTEBOOK(notebook), GTK_WIDGET(uiParentHandle(content)), name);
-
- t->pages[t->len] = content;
- t->len++;
-}
-
-uiTab *uiNewTab(void)
-{
- 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);
-}