本文整理汇总了Golang中github.com/jroimartin/gocui.Gui.CurrentView方法的典型用法代码示例。如果您正苦于以下问题:Golang Gui.CurrentView方法的具体用法?Golang Gui.CurrentView怎么用?Golang Gui.CurrentView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/jroimartin/gocui.Gui
的用法示例。
在下文中一共展示了Gui.CurrentView方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: layout
func (runner *appRunner) layout(g *gocui.Gui) error {
maxX, maxY := g.Size()
view, _ := g.SetView("mainControls", -1, -1, maxX/2, maxY)
_, originY := view.Origin()
_, cursorY := view.Cursor()
view.Clear()
runner.mainControlLines = 0
runner.highlightedTexter = nil
if g.CurrentView() == nil {
g.SetCurrentView("mainControls")
}
view.Highlight = g.CurrentView() == view
runner.rootTexter.TextMain(func(label, line string, texter ViewModelNodeTexter) {
paddedLabel := fmt.Sprintf("%20s", label)
fmt.Fprintf(view, "%s %v\n", paddedLabel[len(paddedLabel)-20:len(paddedLabel)], line)
if (originY + cursorY) == runner.mainControlLines {
runner.highlightedTexter = texter
}
runner.mainControlLines++
})
return nil
}
示例2: nextView
func nextView(g *gocui.Gui, v *gocui.View) error {
currentView := g.CurrentView()
if currentView == nil || currentView.Name() == "side" {
return g.SetCurrentView("main")
}
return g.SetCurrentView("side")
}
示例3: nextView
func nextView(g *gocui.Gui, v *gocui.View) error {
g.Cursor = false
v.Highlight = false
log.Println("nextView: " + v.Name())
var err error
switch v.Name() {
case "channels":
err = g.SetCurrentView("input")
g.Cursor = true
case "input":
err = g.SetCurrentView("channels")
g.CurrentView().Highlight = true
}
// g.Flush()
return err
}
示例4: nextSummary
func nextSummary(g *gocui.Gui, v *gocui.View) error {
if v != nil {
// cursor to summary
if err := g.SetCurrentView("summary"); err != nil {
return err
}
// move next line
if err := cursorDown(g, g.CurrentView()); err != nil {
return err
}
// cursor to detail
if err := g.SetCurrentView("detail"); err != nil {
return err
}
}
return nil
}