diff options
| author | Pietro Gagliardi <[email protected]> | 2014-08-04 22:21:58 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-08-04 22:21:58 -0400 |
| commit | 515a605dda3b4054693cb31d9f4dae36a7e29720 (patch) | |
| tree | f96f5d70ca2fc9a8531397fa13e936024a61373e /redo/tab_unix.go | |
| parent | b84cdaf0772700162d1ad8e622a6095e90c5996b (diff) | |
Same as three commits ago, but for the GTK+ backend.
Diffstat (limited to 'redo/tab_unix.go')
| -rw-r--r-- | redo/tab_unix.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/redo/tab_unix.go b/redo/tab_unix.go index e815935..c73796f 100644 --- a/redo/tab_unix.go +++ b/redo/tab_unix.go @@ -13,6 +13,7 @@ import "C" type tab struct { _widget *C.GtkWidget + container *C.GtkContainer notebook *C.GtkNotebook tabs []*container @@ -22,6 +23,7 @@ func newTab() Tab { widget := C.gtk_notebook_new() t := &tab{ _widget: widget, + container: (*C.GtkContainer)(unsafe.Pointer(widget)), notebook: (*C.GtkNotebook)(unsafe.Pointer(widget)), } // there are no scrolling arrows by default; add them in case there are too many tabs @@ -32,15 +34,14 @@ func newTab() Tab { func (t *tab) Append(name string, control Control) { c := newContainer(control) t.tabs = append(t.tabs, c) + // this calls gtk_container_add(), which, according to gregier in irc.gimp.net/#gtk+, acts just like gtk_notebook_append_page() + c.setParent(&controlParent{t.container}) cname := togstr(name) defer freegstr(cname) - tab := C.gtk_notebook_append_page(t.notebook, - // TODO figure out how to keep this private - c.layoutwidget, - C.gtk_label_new(cname)) - if tab == -1 { - panic("gtk_notebook_append_page() failed") - } + C.gtk_notebook_set_tab_label_text(t.notebook, + // unfortunately there does not seem to be a gtk_notebook_set_nth_tab_label_text() + C.gtk_notebook_get_nth_page(t.notebook, C.gint(len(t.tabs) - 1)), + cname) } func (t *tab) widget() *C.GtkWidget { |
