Skip to content
Snippets Groups Projects
app.go 452 B
Newer Older
  • Learn to ignore specific revisions
  • Malte Bauch's avatar
    Malte Bauch committed
    package app
    
    
    import "github.com/rivo/tview"
    
    type view interface {
    	GetContent() tview.Primitive
    }
    type App struct {
    	app *tview.Application
    }
    
    func NewApp() *App {
    	a := &App{
    		app: tview.NewApplication(),
    	}
    	return a
    }
    
    
    Malte Bauch's avatar
    Malte Bauch committed
    func (a *App) SetView(v view) {
    
    	a.app.SetRoot(v.GetContent(), true)
    }
    
    func (a *App) Run() error {
    	return a.app.Run()
    }
    
    Malte Bauch's avatar
    Malte Bauch committed
    
    func (a *App) Stop() {
    	a.app.Stop()
    }
    
    
    func (a *App) SetFocus(v tview.Primitive) {
    	a.app.SetFocus(v)
    }