Added nested and empty tabs to the test program, and fixed up relevant documentation.

This commit is contained in:
Pietro Gagliardi 2014-08-08 22:28:58 -04:00
parent 8ee7b2b809
commit 0cf86eeb03
4 changed files with 15 additions and 8 deletions

View File

@ -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.

View File

@ -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

View File

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

View File

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