aboutsummaryrefslogtreecommitdiff
path: root/ui/ui.go
diff options
context:
space:
mode:
Diffstat (limited to 'ui/ui.go')
-rw-r--r--ui/ui.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/ui/ui.go b/ui/ui.go
new file mode 100644
index 0000000..6dc843a
--- /dev/null
+++ b/ui/ui.go
@@ -0,0 +1,36 @@
+package ui
+
+import (
+ "github.com/prodhe/poe/editor"
+ uitcell "github.com/prodhe/poe/ui/tcell"
+)
+
+const (
+ SignalQuit int = iota
+)
+
+type Messager interface {
+ // Message prints output from the editor, using the Printf signature.
+ Message(format string, a ...interface{})
+}
+
+type Interface interface {
+ //Messager
+
+ // Init initializes the user interface.
+ Init(ed editor.Editor) error
+
+ // Close will close and clean up any resources held by the UI.
+ Close()
+
+ // Listen loops for events and acts upon the editor as it sees fit. It is up to the implementation to decide what events it will look for and how to handle them. This could for example be keyboard input in a terminal implementation updating the buffers or an HTTP server modifing the buffers remotely, depending on the implementation of the UI.
+ Listen()
+}
+
+func NewTcell() Interface {
+ return &uitcell.Tcell{}
+}
+
+func NewCli() Interface {
+ return &Cli{}
+}