diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-02-27 19:30:59 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2018-02-27 19:31:09 -0500 |
commit | 46756487fb56acf26122a7b5d46be2ff8ee3c051 (patch) | |
tree | 3be5178f68abd94f4fc1e47904eef24caef78b7a /lib/ui/grid.go | |
parent | 384fe0d82691d55615655fc17a350f710dd4cf1c (diff) | |
download | aerc-46756487fb56acf26122a7b5d46be2ff8ee3c051.tar.gz |
Add stack UI container
Diffstat (limited to 'lib/ui/grid.go')
-rw-r--r-- | lib/ui/grid.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/ui/grid.go b/lib/ui/grid.go index ede7d0ca..3c375ee3 100644 --- a/lib/ui/grid.go +++ b/lib/ui/grid.go @@ -10,7 +10,7 @@ type Grid struct { rowLayout []gridLayout columns []GridSpec columnLayout []gridLayout - Cells []*GridCell + cells []*GridCell onInvalidate func(d Drawable) invalid bool } @@ -76,7 +76,7 @@ func (grid *Grid) Draw(ctx *Context) { if invalid { grid.reflow(ctx) } - for _, cell := range grid.Cells { + for _, cell := range grid.cells { if !cell.invalid && !invalid { continue } @@ -140,7 +140,7 @@ func (grid *Grid) invalidateLayout() { func (grid *Grid) Invalidate() { grid.invalidateLayout() - for _, cell := range grid.Cells { + for _, cell := range grid.cells { cell.Content.Invalidate() } } @@ -156,7 +156,7 @@ func (grid *Grid) AddChild(content Drawable) *GridCell { Content: content, invalid: true, } - grid.Cells = append(grid.Cells, cell) + grid.cells = append(grid.cells, cell) cell.Content.OnInvalidate(grid.cellInvalidated) cell.invalid = true grid.invalidateLayout() @@ -164,9 +164,9 @@ func (grid *Grid) AddChild(content Drawable) *GridCell { } func (grid *Grid) RemoveChild(cell *GridCell) { - for i, _cell := range grid.Cells { + for i, _cell := range grid.cells { if _cell == cell { - grid.Cells = append(grid.Cells[:i], grid.Cells[i+1:]...) + grid.cells = append(grid.cells[:i], grid.cells[i+1:]...) break } } @@ -175,7 +175,7 @@ func (grid *Grid) RemoveChild(cell *GridCell) { func (grid *Grid) cellInvalidated(drawable Drawable) { var cell *GridCell - for _, cell = range grid.Cells { + for _, cell = range grid.cells { if cell.Content == drawable { break } |