diff options
Diffstat (limited to 'layout/interface.go')
| -rw-r--r-- | layout/interface.go | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/layout/interface.go b/layout/interface.go index d203c3f..28b6a01 100644 --- a/layout/interface.go +++ b/layout/interface.go @@ -7,24 +7,17 @@ import ( ) type EventDrawer interface { - Event() <-chan EventConsume - Draw(func(draw.Image) image.Rectangle) -} - -type EventConsume struct { - Event - Consume chan<- bool + Event() <-chan Event + Draw() chan<- func(draw.Image) image.Rectangle } type Event string +func Eventf(format string, a ...interface{}) Event { + return Event(fmt.Sprintf(format, a...)) +} + func (e Event) Matches(format string, a ...interface{}) bool { _, err := fmt.Sscanf(string(e), format, a...) return err == nil } - -func SendEvent(ch chan<- EventConsume, format string, a ...interface{}) (consume <-chan bool) { - cons := make(chan bool) - ch <- EventConsume{Event(fmt.Sprintf(format, a...)), cons} - return cons -} |