diff --git a/layout/context.go b/layout/context.go index dc35e2ff..009bd1f5 100644 --- a/layout/context.go +++ b/layout/context.go @@ -22,7 +22,9 @@ type Context struct { Constraints Constraints Config system.Config - Queue event.Queue + // By convention, a nil Queue is a signal to widgets to draw themselves + // in a disabled state. + Queue event.Queue *op.Ops } @@ -71,3 +73,13 @@ func (c Context) Events(k event.Tag) []event.Event { } return c.Queue.Events(k) } + +// Disabled returns a copy of this context with a nil Queue, +// blocking events to widgets using it. +// +// By convention, a nil Queue is a signal to widgets to draw themselves +// in a disabled state. +func (c Context) Disabled() Context { + c.Queue = nil + return c +}