aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ui
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ui')
-rw-r--r--lib/ui/interfaces.go4
-rw-r--r--lib/ui/ui.go4
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/ui/interfaces.go b/lib/ui/interfaces.go
index 9e795712..c12bdb76 100644
--- a/lib/ui/interfaces.go
+++ b/lib/ui/interfaces.go
@@ -16,6 +16,10 @@ type Drawable interface {
Invalidate()
}
+type RootDrawable interface {
+ Initialize(ui *UI)
+}
+
type Interactive interface {
// Returns true if the event was handled by this component
Event(event tcell.Event) bool
diff --git a/lib/ui/ui.go b/lib/ui/ui.go
index 16b176d5..9a9ed14f 100644
--- a/lib/ui/ui.go
+++ b/lib/ui/ui.go
@@ -55,6 +55,10 @@ func Initialize(content DrawableInteractiveBeeper) (*UI, error) {
content.OnBeep(screen.Beep)
content.Focus(true)
+ if root, ok := content.(RootDrawable); ok {
+ root.Initialize(&state)
+ }
+
return &state, nil
}