2014-06-25 21:07:37 -05:00
// 25 june 2014
package ui
type allocation struct {
x int
y int
width int
height int
this Control
neighbor Control
}
2014-06-25 22:05:29 -05:00
type cSysSizeData struct {
xmargin int
ymargin int
xpadding int
ypadding int
}
2014-06-25 21:07:37 -05:00
// for verification; see sysdata.go
2014-06-25 22:21:57 -05:00
type sysDataSizingFunctions interface {
2014-06-25 21:07:37 -05:00
beginResize ( ) * sysSizeData
endResize ( * sysSizeData )
translateAllocationCoords ( [ ] * allocation , int , int )
preferredSize ( * sysSizeData ) ( int , int )
commitResize ( * allocation , * sysSizeData )
getAuxResizeInfo ( * sysSizeData )
}
func ( s * sysData ) resizeWindow ( width , height int ) {
d := s . beginResize ( )
allocations := s . allocate ( 0 , 0 , width , height , d )
s . translateAllocationCoords ( allocations , width , height )
2014-06-25 22:21:57 -05:00
for _ , c := range allocations {
2014-06-25 21:07:37 -05:00
c . this . commitResize ( c , d )
}
s . endResize ( d )
}
// non-layout controls: allocate() should just return a one-element slice; preferredSize(), commitResize(), and getAuxResizeInfo() should defer to their sysData equivalents
type controlSizing interface {
allocate ( x int , y int , width int , height int , d * sysSizeData ) [ ] * allocation
preferredSize ( d * sysSizeData ) ( width , height int )
commitResize ( c * allocation , d * sysSizeData )
getAuxResizeInfo ( d * sysSizeData )
}