Implemented Tab.preferredSize() on Windows.

This commit is contained in:
Pietro Gagliardi 2014-08-02 12:35:36 -04:00
parent 668cf5e46e
commit cafc9daa72
1 changed files with 15 additions and 0 deletions

View File

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