本文整理匯總了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
}