diff --git a/redo/containerctrls_windows.go b/redo/containerctrls_windows.go index 1aa2c57..e9d116b 100644 --- a/redo/containerctrls_windows.go +++ b/redo/containerctrls_windows.go @@ -33,6 +33,7 @@ func newTab() Tab { } t.supersetParent = t.fsetParent t.fsetParent = t.tabsetParent + t.fpreferredSize = t.tabpreferredSize t.superallocate = t.fallocate t.fallocate = t.taballocate C.controlSetControlFont(t.hwnd) @@ -73,6 +74,20 @@ func tabChanged(data unsafe.Pointer, new C.LRESULT) { t.tabs[int(new)].child.containerShow() } +func (t *tab) tabpreferredSize(d *sizing) (width, height int) { + // TODO only consider the size of the current tab? + for _, s := range t.tabs { + w, h := s.child.preferredSize(d) + if width < w { + width = w + } + if height < h { + height = h + } + } + return width, height + int(C.tabGetTabHeight(t.hwnd)) +} + // a tab control contains other controls; size appropriately // TODO change this to commitResize() func (t *tab) taballocate(x int, y int, width int, height int, d *sizing) []*allocation {