From 0cf86eeb03a53bd7f81c7de977cea1a2b1c3459c Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Fri, 8 Aug 2014 22:28:58 -0400 Subject: [PATCH] Added nested and empty tabs to the test program, and fixed up relevant documentation. --- redo/basicctrls.go | 8 +------- redo/future | 7 +++++++ redo/tab_windows.c | 2 +- redo/zz_test.go | 6 ++++++ 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/redo/basicctrls.go b/redo/basicctrls.go index 3f036ef..81a9b79 100644 --- a/redo/basicctrls.go +++ b/redo/basicctrls.go @@ -64,19 +64,13 @@ func NewPasswordField() TextField { // Tab is a Control that contains multiple pages of tabs, each containing a single Control. // You can add and remove tabs from the Tab at any time. -// -// [TODO if each tab of your Tab is going to have the same content Controls, then use LikeTab instead, to conserve resources] +// The appearance of a Tab with no tabs is implementation-defined. type Tab interface { Control // Append adds a new tab to Tab. // The tab is added to the end of the current list of tabs. Append(name string, control Control) - - // Delete removes the given tab. - // It panics if index is out of range. -// Delete(index int) -//TODO } // NewTab creates a new Tab with no tabs. diff --git a/redo/future b/redo/future index 73c8886..3eb26d0 100644 --- a/redo/future +++ b/redo/future @@ -10,6 +10,13 @@ Table table_darwin.m: constructor table_unix.c: goTableModel_get_column_type(), goTableModel_get_value() multiple selection +Tab + // [TODO if each tab of your Tab is going to have the same content Controls, then use LikeTab instead, to conserve resources] + Delete() + // Delete removes the given tab. + // It panics if index is out of range. + // After Delete(), the effect of accessing the Control of the deleted tab or any of its children is undefned. [TODO reword?] + investigate close buttons (especially for LikeTab) so I don't forget, some TODOs: windows diff --git a/redo/tab_windows.c b/redo/tab_windows.c index 5a998b5..6d5c708 100644 --- a/redo/tab_windows.c +++ b/redo/tab_windows.c @@ -70,7 +70,7 @@ LONG tabGetTabHeight(HWND hwnd) LONG tallest; n = SendMessageW(hwnd, TCM_GETITEMCOUNT, 0, 0); - /* if there are no tabs, then the control just draws a box over the full window rect, reserving no space for tabs (TODO check on windows xp and 7); this is handled here */ + /* if there are no tabs, then the control just draws a box over the full window rect, reserving no space for tabs; this is handled with the next line */ tallest = 0; for (i = 0; i < n; i++) { if (SendMessageW(hwnd, TCM_GETITEMRECT, (WPARAM) i, (LPARAM) (&r)) == FALSE) diff --git a/redo/zz_test.go b/redo/zz_test.go index 22ab0bc..61a7ca2 100644 --- a/redo/zz_test.go +++ b/redo/zz_test.go @@ -31,6 +31,7 @@ var ddata = []dtype{ type testwin struct { t Tab w Window + nt Tab a Area spw *Stack sph *Stack @@ -64,6 +65,11 @@ func (tw *testwin) make(done chan struct{}) { done <- struct{}{} return true }) + tw.t.Append("Blank Tab", NewTab()) + tw.nt = NewTab() + tw.nt.Append("Tab 1", Space()) + tw.nt.Append("Tab 2", Space()) + tw.t.Append("Tab", tw.nt) tw.t.Append("Space", Space()) tw.a = NewArea(200, 200, &areaHandler{}) tw.t.Append("Area", tw.a)