func NewMainPanel(app *App, server string) *MainPanel { m := &MainPanel{ content: topsl.NewCellView(), info: nil, titlebar: topsl.NewTitleBar(), keybar: topsl.NewKeyBar(), statusbar: topsl.NewStatusBar(), panel: topsl.NewPanel(), app: app, } m.panel.SetBottom(m.keybar) m.panel.SetTitle(m.titlebar) m.panel.SetStatus(m.statusbar) m.panel.SetContent(m.content) m.content.SetModel(&mainModel{m}) m.titlebar.SetRight(app.GetAppName()) m.titlebar.SetCenter(server) // We don't change the keybar, so set it once m.keybar.SetKeys([]string{"_Quit"}) return m }
func main() { app := &MyApp{} app.model = &model{endx: 60, endy: 15} if e := topsl.AppInit(); e != nil { fmt.Fprintln(os.Stderr, e.Error()) os.Exit(1) } title := topsl.NewTitleBar() title.SetCenter("CellView Test") title.SetRight("Example v1.0") app.keybar = topsl.NewKeyBar() app.keybar.SetKeys([]string{"[Q] Quit"}) app.status = topsl.NewStatusBar() app.status.SetStatus("My status is here.") app.main = topsl.NewCellView() app.main.SetModel(app.model) app.panel = topsl.NewPanel() app.panel.SetBottom(app.keybar) app.panel.SetTitle(title) app.panel.SetContent(app.main) app.panel.SetStatus(app.status) app.updateKeys() topsl.SetApplication(app) topsl.RunApplication() }