aerc/ui/types.go

72 lines
1.1 KiB
Go
Raw Normal View History

2018-01-11 03:03:56 +00:00
package ui
2018-01-11 03:41:15 +00:00
import (
tb "github.com/nsf/termbox-go"
"git.sr.ht/~sircmpwn/aerc2/config"
2018-01-11 14:04:18 +00:00
"git.sr.ht/~sircmpwn/aerc2/worker/types"
2018-01-11 03:41:15 +00:00
)
2018-01-11 03:03:56 +00:00
const (
2018-01-11 03:54:55 +00:00
Valid = 0
InvalidateTabList = 1 << iota
InvalidateTabView
2018-01-11 03:03:56 +00:00
InvalidateStatusBar
)
const (
2018-01-11 03:54:55 +00:00
InvalidateAll = InvalidateTabList |
InvalidateTabView |
InvalidateStatusBar
2018-01-11 03:03:56 +00:00
)
type Geometry struct {
2018-01-11 03:41:15 +00:00
Row int
Col int
Width int
Height int
2018-01-11 03:03:56 +00:00
}
type AercTab interface {
Name() string
Render(at Geometry)
2018-01-11 03:41:15 +00:00
SetParent(parent *UIState)
2018-01-11 03:03:56 +00:00
}
2018-01-11 14:04:18 +00:00
type WorkerListener interface {
GetChannel() chan types.WorkerMessage
HandleMessage(msg types.WorkerMessage)
}
type wrappedMessage struct {
msg types.WorkerMessage
listener WorkerListener
}
2018-01-11 03:03:56 +00:00
type UIState struct {
2018-01-11 03:41:15 +00:00
Config *config.AercConfig
2018-01-11 03:03:56 +00:00
Exit bool
InvalidPanes uint
Panes struct {
TabList Geometry
TabView Geometry
Sidebar Geometry
StatusBar Geometry
}
Tabs []AercTab
SelectedTab int
Prompt struct {
Prompt *string
Text *string
Index int
Scroll int
}
2018-01-11 03:41:15 +00:00
tbEvents chan tb.Event
2018-01-11 14:04:18 +00:00
// Aggregate channel for all worker messages
workerEvents chan wrappedMessage
2018-01-11 03:03:56 +00:00
}