From 2395485d075f80117fe3ce25ef339bb1ffecf160 Mon Sep 17 00:00:00 2001 From: Petter Rodhelind Date: Mon, 26 Feb 2018 23:51:03 +0100 Subject: Total redesign. Separating editor parts from UI. --- ui/ui.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 ui/ui.go (limited to 'ui/ui.go') 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{} +} -- cgit v1.2.3