From bd44815a5480061b48106d209767e3ad6d724a13 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Mon, 27 Oct 2014 15:21:47 -0400 Subject: Migrated the GTK+ backend to the new new container system in which containers are no longer full controls but are still used to hold more than one control and handle the resizing entirely on their own. --- tab_unix.go | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'tab_unix.go') diff --git a/tab_unix.go b/tab_unix.go index 064f17f..5e77b17 100644 --- a/tab_unix.go +++ b/tab_unix.go @@ -18,8 +18,6 @@ type tab struct { tabs []*container children []Control - - chainresize func(x int, y int, width int, height int, d *sizing) } func newTab() Tab { @@ -29,8 +27,6 @@ func newTab() Tab { container: (*C.GtkContainer)(unsafe.Pointer(widget)), notebook: (*C.GtkNotebook)(unsafe.Pointer(widget)), } - t.chainresize = t.fresize - t.fresize = t.xresize // there are no scrolling arrows by default; add them in case there are too many tabs C.gtk_notebook_set_scrollable(t.notebook, C.TRUE) return t @@ -40,8 +36,9 @@ func (t *tab) Append(name string, control Control) { c := newContainer() 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}) + C.gtk_container_add(t.container, c.widget) control.setParent(c.parent()) + c.resize = control.resize t.children = append(t.children, control) cname := togstr(name) defer freegstr(cname) @@ -51,13 +48,4 @@ func (t *tab) Append(name string, control Control) { cname) } -func (t *tab) xresize(x int, y int, width int, height int, d *sizing) { - // first, chain up to change the GtkFrame and its child container - t.chainresize(x, y, width, height, d) - - // now that the containers have the correct size, we can resize the children - for i, _ := range t.tabs { - a := t.tabs[i].allocation(false/*TODO*/) - t.children[i].resize(int(a.x), int(a.y), int(a.width), int(a.height), d) - } -} +// no need to handle resize; the children containers handle that for us -- cgit v1.2.3