summary refs log blame commit diff stats
path: root/ui/account.go
blob: 9c16cc5749fa4b30404543c67350100e3bed6d9e (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13












                                          

                   












                                                                                 








                                                   





                                                            
 
package ui

import (
	tb "github.com/nsf/termbox-go"

	"git.sr.ht/~sircmpwn/aerc2/config"
	"git.sr.ht/~sircmpwn/aerc2/worker"
)

type AccountTab struct {
	Config *config.AccountConfig
	Worker *worker.Worker
	Parent *UIState

	counter int
}

func NewAccountTab(conf *config.AccountConfig, work *worker.Worker) *AccountTab {
	return &AccountTab{
		Config: conf,
		Worker: work,
	}
}

func (acc *AccountTab) Name() string {
	return acc.Config.Name
}

func (acc *AccountTab) SetParent(parent *UIState) {
	acc.Parent = parent
}

func (acc *AccountTab) Render(at Geometry) {
	cell := tb.Cell{
		Fg: tb.ColorDefault,
		Bg: tb.ColorDefault,
	}
	TPrintf(&at, cell, "%s %d", acc.Name(), acc.counter)
	acc.counter++
	if acc.counter%10000 == 0 {
		acc.counter = 0
	}
	acc.Parent.InvalidateFrom(acc)
}