aboutsummaryrefslogtreecommitdiff
path: root/ui/ui.go
diff options
context:
space:
mode:
authorPetter Rodhelind <petter.rodhelind@gmail.com>2018-02-26 23:51:03 +0100
committerPetter Rodhelind <petter.rodhelind@gmail.com>2018-02-26 23:51:03 +0100
commit2395485d075f80117fe3ce25ef339bb1ffecf160 (patch)
tree87cabebd5ba1c7210adb5dabe253310f17694931 /ui/ui.go
parent0023e0929ac7075cd008e0093de58ddc89efd597 (diff)
downloadpoe-2395485d075f80117fe3ce25ef339bb1ffecf160.tar.gz
poe-2395485d075f80117fe3ce25ef339bb1ffecf160.tar.bz2
poe-2395485d075f80117fe3ce25ef339bb1ffecf160.zip
Total redesign. Separating editor parts from UI.
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{}
+}