aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ui/grid.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ui/grid.go')
-rw-r--r--lib/ui/grid.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/ui/grid.go b/lib/ui/grid.go
index 76eba000..28640d03 100644
--- a/lib/ui/grid.go
+++ b/lib/ui/grid.go
@@ -234,6 +234,24 @@ func (grid *Grid) RemoveChild(content Drawable) {
grid.Invalidate()
}
+func (grid *Grid) ReplaceChild(old Drawable, new Drawable) {
+ grid.mutex.Lock()
+ for i, cell := range grid.cells {
+ if cell.Content == old {
+ grid.cells[i] = &GridCell{
+ RowSpan: cell.RowSpan,
+ ColSpan: cell.ColSpan,
+ Row: cell.Row,
+ Column: cell.Column,
+ Content: new,
+ }
+ break
+ }
+ }
+ grid.mutex.Unlock()
+ grid.Invalidate()
+}
+
func Const(i int) func() int {
return func() int { return i }
}