summary refs log tree commit diff stats
path: root/lib/ui/ui.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ui/ui.go')
-rw-r--r--lib/ui/ui.go19
1 files changed, 6 insertions, 13 deletions
diff --git a/lib/ui/ui.go b/lib/ui/ui.go
index 9ea037c..e9b4e9b 100644
--- a/lib/ui/ui.go
+++ b/lib/ui/ui.go
@@ -8,16 +8,16 @@ import (
 
 type UI struct {
 	Exit    bool
-	Content Drawable
+	Content DrawableInteractive
 	ctx     *Context
 
-	interactive []Interactive
-
 	tbEvents      chan tb.Event
 	invalidations chan interface{}
 }
 
-func Initialize(conf *config.AercConfig, content Drawable) (*UI, error) {
+func Initialize(conf *config.AercConfig,
+	content DrawableInteractive) (*UI, error) {
+
 	if err := tb.Init(); err != nil {
 		return nil, err
 	}
@@ -52,6 +52,7 @@ func (state *UI) Tick() bool {
 	case event := <-state.tbEvents:
 		switch event.Type {
 		case tb.EventKey:
+			// TODO: temporary
 			if event.Key == tb.KeyEsc {
 				state.Exit = true
 			}
@@ -60,11 +61,7 @@ func (state *UI) Tick() bool {
 			state.ctx = NewContext(event.Width, event.Height)
 			state.Content.Invalidate()
 		}
-		if state.interactive != nil {
-			for _, i := range state.interactive {
-				i.Event(event)
-			}
-		}
+		state.Content.Event(event)
 	case <-state.invalidations:
 		state.Content.Draw(state.ctx)
 		tb.Flush()
@@ -73,7 +70,3 @@ func (state *UI) Tick() bool {
 	}
 	return true
 }
-
-func (state *UI) AddInteractive(i Interactive) {
-	state.interactive = append(state.interactive, i)
-}