本文整理汇总了Golang中github.com/jroimartin/gocui.Gui.SetViewOnTop方法的典型用法代码示例。如果您正苦于以下问题:Golang Gui.SetViewOnTop方法的具体用法?Golang Gui.SetViewOnTop怎么用?Golang Gui.SetViewOnTop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/jroimartin/gocui.Gui
的用法示例。
在下文中一共展示了Gui.SetViewOnTop方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: prevView
func prevView(g *gocui.Gui, v *gocui.View) error {
curView = getCurrentChannelIndex()
next := curView - 1
if next < 0 {
next = len(Server.Channels) - 1
}
logger.Logger.Printf("PREV INDEX %d\n", next)
if newView, err := g.View(Server.Channels[next].Name); err != nil {
return err
} else {
newView.Autoscroll = true
g.SetViewOnTop(newView.Name())
g.SetViewOnTop("header")
}
if _, err := g.SetCurrentView(Server.Channels[next].Name); err != nil {
return err
}
// logger.Logger.Printf("Set Current View %d\n", Server.Channels[next].Name)
Server.CurrentChannel = Server.Channels[next].Name
Server.Channels[next].Unread = false
ui.UpdateMenuView(g)
FocusInputView(g, v)
curView = next
return nil
}
示例2: reloadMenu
func reloadMenu(g *gocui.Gui) error {
v, err := g.View("menu")
if err != nil {
return err
}
v.Clear()
PrintMenu(v)
if cmdMode {
prefix := fmt.Sprintf(cmdPrefix, cTubes.Selected)
if err = v.SetCursor(len(prefix), 0); err != nil {
return err
}
}
_, err = g.SetViewOnTop("menu")
return err
}
示例3: keybindings
func keybindings(g *gocui.Gui) error {
err := g.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, func(g *gocui.Gui, v *gocui.View) error {
return gocui.ErrQuit
})
if err != nil {
return err
}
err = g.SetKeybinding("", '1', gocui.ModNone, func(g *gocui.Gui, v *gocui.View) error {
_, err := g.SetViewOnTop("v1")
return err
})
if err != nil {
return err
}
err = g.SetKeybinding("", '2', gocui.ModNone, func(g *gocui.Gui, v *gocui.View) error {
_, err := g.SetViewOnTop("v2")
return err
})
if err != nil {
return err
}
err = g.SetKeybinding("", '3', gocui.ModNone, func(g *gocui.Gui, v *gocui.View) error {
_, err := g.SetViewOnTop("v3")
return err
})
if err != nil {
return err
}
return nil
}
示例4: UpdateHeaderView
func UpdateHeaderView(g *gocui.Gui) {
Server.Exec("header", func(g *gocui.Gui, v *gocui.View, s *client.Server) error {
v.Clear()
v.SetCursor(0, 0)
g.SetViewOnTop(v.Name())
channel := Server.GetCurrentChannel()
if channel.Name != client.StatusChannel {
if len(channel.Name) <= 0 {
fmt.Fprintf(v, "⣿ %s", "Loading...")
} else {
fmt.Fprintf(v, "⣿ %s", channel.Topic)
}
} else if channel.Name == client.StatusChannel {
fmt.Fprintf(v, "⣿ %s", client.StatusChannel)
} else {
fmt.Fprintf(v, "⣿ %s", "Loading...")
}
return nil
})
}
示例5: setCurrentViewOnTop
func setCurrentViewOnTop(g *gocui.Gui, name string) (*gocui.View, error) {
if _, err := g.SetCurrentView(name); err != nil {
return nil, err
}
return g.SetViewOnTop(name)
}
示例6: ontop
func ontop(g *gocui.Gui, v *gocui.View) error {
_, err := g.SetViewOnTop(views[curView])
return err
}