Implemented Tab.preferredSize() on Windows.
This commit is contained in:
parent
668cf5e46e
commit
cafc9daa72
|
@ -33,6 +33,7 @@ func newTab() Tab {
|
||||||
}
|
}
|
||||||
t.supersetParent = t.fsetParent
|
t.supersetParent = t.fsetParent
|
||||||
t.fsetParent = t.tabsetParent
|
t.fsetParent = t.tabsetParent
|
||||||
|
t.fpreferredSize = t.tabpreferredSize
|
||||||
t.superallocate = t.fallocate
|
t.superallocate = t.fallocate
|
||||||
t.fallocate = t.taballocate
|
t.fallocate = t.taballocate
|
||||||
C.controlSetControlFont(t.hwnd)
|
C.controlSetControlFont(t.hwnd)
|
||||||
|
@ -73,6 +74,20 @@ func tabChanged(data unsafe.Pointer, new C.LRESULT) {
|
||||||
t.tabs[int(new)].child.containerShow()
|
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
|
// a tab control contains other controls; size appropriately
|
||||||
// TODO change this to commitResize()
|
// TODO change this to commitResize()
|
||||||
func (t *tab) taballocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
func (t *tab) taballocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
||||||
|
|
Loading…
Reference in New Issue