Implemented window margins for Grids and Stacks.
This commit is contained in:
parent
131809fc62
commit
214467bb93
7
grid.go
7
grid.go
|
@ -139,8 +139,11 @@ func (g *Grid) allocate(x int, y int, width int, height int, d *sysSizeData) (al
|
||||||
ymargin := d.ymargin
|
ymargin := d.ymargin
|
||||||
d.xmargin = 0
|
d.xmargin = 0
|
||||||
d.ymargin = 0
|
d.ymargin = 0
|
||||||
_=xmargin
|
// 0) inset the available rect by the margins
|
||||||
_=ymargin
|
x += xmargin
|
||||||
|
y += ymargin
|
||||||
|
width -= xmargin * 2
|
||||||
|
height -= ymargin * 2
|
||||||
// 1) clear data structures
|
// 1) clear data structures
|
||||||
for i := range g.rowheights {
|
for i := range g.rowheights {
|
||||||
g.rowheights[i] = 0
|
g.rowheights[i] = 0
|
||||||
|
|
7
stack.go
7
stack.go
|
@ -89,8 +89,11 @@ func (s *Stack) allocate(x int, y int, width int, height int, d *sysSizeData) (a
|
||||||
ymargin := d.ymargin
|
ymargin := d.ymargin
|
||||||
d.xmargin = 0
|
d.xmargin = 0
|
||||||
d.ymargin = 0
|
d.ymargin = 0
|
||||||
_=xmargin
|
// 0) inset the available rect by the margins
|
||||||
_=ymargin
|
x += xmargin
|
||||||
|
y += ymargin
|
||||||
|
width -= xmargin * 2
|
||||||
|
height -= ymargin * 2
|
||||||
// 1) get height and width of non-stretchy controls; figure out how much space is alloted to stretchy controls
|
// 1) get height and width of non-stretchy controls; figure out how much space is alloted to stretchy controls
|
||||||
stretchywid = width
|
stretchywid = width
|
||||||
stretchyht = height
|
stretchyht = height
|
||||||
|
|
|
@ -41,6 +41,7 @@ func gridWindow() *Window {
|
||||||
l20, c21, l22)
|
l20, c21, l22)
|
||||||
g.SetFilling(1, 2)
|
g.SetFilling(1, 2)
|
||||||
g.SetStretchy(1, 1)
|
g.SetStretchy(1, 1)
|
||||||
|
w.SetSpaced(*spacingTest)
|
||||||
w.Open(g)
|
w.Open(g)
|
||||||
return w
|
return w
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue