本文整理汇总了Golang中github.com/deweerdt/gocui.Gui.SetViewOnTop方法的典型用法代码示例。如果您正苦于以下问题:Golang Gui.SetViewOnTop方法的具体用法?Golang Gui.SetViewOnTop怎么用?Golang Gui.SetViewOnTop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/deweerdt/gocui.Gui
的用法示例。
在下文中一共展示了Gui.SetViewOnTop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: switchToMode
func switchToMode(amua *Amua, g *gocui.Gui, mode Mode) error {
/* highlight off */
if amua.mode.IsHighlighted() {
v := modeToView(g, amua.mode)
v.Highlight = false
}
amua.prevMode = amua.mode
amua.mode = mode
curview := modeToViewStr(amua.mode)
var err error
switch amua.mode {
case MessageMode:
m := amua.curMessage()
m.Flags |= Seen
err = m.Draw(amua, g)
case MessageMimeMode:
m := amua.curMessage()
err = (*MessageAsMimeTree)(m).Draw(amua, g)
case MaildirMode:
v, _ := g.View(curview)
err = amua.curMaildirView.Draw(v)
case SendMailMode:
v, _ := g.View(curview)
err = amua.sendMailDraw(v)
case CommandNewMailMode:
tos := util.ConcatAddresses(amua.newMail.to)
amua.newMail.to = []*mail.Address{}
displayPromptWithPrefill(TO_PROMPT, tos)
case CommandMailModeTo:
displayPromptWithPrefill(TO_PROMPT, util.ConcatAddresses(amua.newMail.to))
case CommandMailModeCc:
displayPromptWithPrefill(CC_PROMPT, util.ConcatAddresses(amua.newMail.cc))
case CommandMailModeBcc:
displayPromptWithPrefill(BCC_PROMPT, util.ConcatAddresses(amua.newMail.bcc))
case CommandSearchMode:
displayPrompt(SEARCH_PROMPT)
}
if err != nil {
v, _ := g.View(curview)
if v != nil {
fmt.Fprintf(v, err.Error())
}
/* we printed the error, fallback */
}
_, err = g.SetViewOnTop(curview)
if err != nil {
return err
}
err = g.SetCurrentView(curview)
if err != nil {
return err
}
/* highlight back */
if amua.mode.IsHighlighted() {
v := modeToView(g, amua.mode)
v.Highlight = true
}
return nil
}