2018-01-11 04:03:56 +01:00
|
|
|
package ui
|
|
|
|
|
2018-01-11 04:41:15 +01:00
|
|
|
import (
|
|
|
|
tb "github.com/nsf/termbox-go"
|
|
|
|
|
|
|
|
"git.sr.ht/~sircmpwn/aerc2/config"
|
|
|
|
)
|
|
|
|
|
2018-01-11 04:03:56 +01:00
|
|
|
const (
|
|
|
|
Valid = 0
|
|
|
|
InvalidateTabs = 1 << iota
|
|
|
|
InvalidateSidebar
|
|
|
|
InvalidateStatusBar
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
InvalidateAll = InvalidateTabs | InvalidateSidebar | InvalidateStatusBar
|
|
|
|
)
|
|
|
|
|
|
|
|
type Geometry struct {
|
2018-01-11 04:41:15 +01:00
|
|
|
Row int
|
|
|
|
Col int
|
|
|
|
Width int
|
|
|
|
Height int
|
2018-01-11 04:03:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type AercTab interface {
|
|
|
|
Name() string
|
|
|
|
Invalid() bool
|
|
|
|
Render(at Geometry)
|
2018-01-11 04:41:15 +01:00
|
|
|
SetParent(parent *UIState)
|
2018-01-11 04:03:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type UIState struct {
|
2018-01-11 04:41:15 +01:00
|
|
|
Config *config.AercConfig
|
2018-01-11 04:03:56 +01: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 04:41:15 +01:00
|
|
|
|
|
|
|
tbEvents chan tb.Event
|
2018-01-11 04:03:56 +01:00
|
|
|
}
|