diff options
Diffstat (limited to 'lib/ui/grid.go')
-rw-r--r-- | lib/ui/grid.go | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/lib/ui/grid.go b/lib/ui/grid.go index 87b94bde..3ac43a42 100644 --- a/lib/ui/grid.go +++ b/lib/ui/grid.go @@ -6,12 +6,12 @@ import ( ) type Grid struct { + Invalidatable rows []GridSpec rowLayout []gridLayout columns []GridSpec columnLayout []gridLayout cells []*GridCell - onInvalidate func(d Drawable) invalid bool } @@ -141,9 +141,7 @@ func (grid *Grid) reflow(ctx *Context) { func (grid *Grid) invalidateLayout() { grid.invalid = true - if grid.onInvalidate != nil { - grid.onInvalidate(grid) - } + grid.DoInvalidate(grid) } func (grid *Grid) Invalidate() { @@ -153,10 +151,6 @@ func (grid *Grid) Invalidate() { } } -func (grid *Grid) OnInvalidate(onInvalidate func(d Drawable)) { - grid.onInvalidate = onInvalidate -} - func (grid *Grid) AddChild(content Drawable) *GridCell { cell := &GridCell{ RowSpan: 1, @@ -193,7 +187,5 @@ func (grid *Grid) cellInvalidated(drawable Drawable) { panic(fmt.Errorf("Attempted to invalidate unknown cell")) } cell.invalid = true - if grid.onInvalidate != nil { - grid.onInvalidate(grid) - } + grid.DoInvalidate(grid) } |