本文整理汇总了Golang中github.com/jroimartin/gocui.View.Name方法的典型用法代码示例。如果您正苦于以下问题:Golang View.Name方法的具体用法?Golang View.Name怎么用?Golang View.Name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/jroimartin/gocui.View
的用法示例。
在下文中一共展示了View.Name方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: CreateViews
func (c *column) CreateViews(g *gocui.Gui, colv *gocui.View) error {
if c.isActive {
colv.FgColor = gocui.ColorCyan | gocui.AttrBold
} else {
colv.FgColor = gocui.ColorDefault
}
x, y, maxX, maxY, err := g.ViewPosition(colv.Name())
y = y + 2
if err != nil {
return err
}
maxIssues := maxY / LinesPerEntry
c.maxIssues = maxIssues
for i := 0; i < maxIssues; i++ {
v, err := g.SetView(fmt.Sprintf("col-%s-%d", c.name, i),
x, y+(i*LinesPerEntry), maxX, y+((i+1)*LinesPerEntry))
if err != nil {
if err != gocui.ErrorUnkView {
return err
}
}
v.SelBgColor = gocui.ColorRed
v.Frame = false
v.Wrap = true
}
return c.redraw(g)
}
示例2: nextView
func nextView(g *gocui.Gui, v *gocui.View) error {
if v == nil {
return g.SetCurrentView(vPlatforms)
}
getLine(g, v)
switch v.Name() {
case vPlatforms:
return g.SetCurrentView(vTranscripts)
case vTranscripts:
return g.SetCurrentView(vDestinations)
case vDestinations:
if x, err := g.View(vTop); err == nil {
x.Clear()
fmt.Fprintf(x, "Hit enter to submit selections")
}
return g.SetCurrentView(vSubmit)
case vSubmit:
return g.SetCurrentView(vText)
case vText:
return g.SetCurrentView(vPlatforms)
}
return g.SetCurrentView(vPlatforms)
}
示例3: removeTrackCommand
func removeTrackCommand(g *gocui.Gui, v *gocui.View) error {
switch v.Name() {
case VIEW_PLAYLISTS:
if playlist := gui.getSelectedPlaylist(); playlist != nil {
playlists.Remove(playlist.Name())
gui.updatePlaylistsView()
gui.updateTracksView()
}
case VIEW_TRACKS:
if playlist, index := gui.getSelectedPlaylistAndTrack(); index > -1 {
for i := 1; i <= getOffsetFromTypedNumbers(); i++ {
playlist.RemoveTrack(index)
}
gui.updateTracksView()
goTo(g, v, index+1)
}
case VIEW_QUEUE:
if index := gui.getQueueSelectedTrackIndex(); index > -1 {
for i := 1; i <= getOffsetFromTypedNumbers(); i++ {
if queue.Remove(index) != nil {
continue
}
}
gui.updateQueueView()
}
}
return nil
}
示例4: confirmStringDetail
func (runner *appRunner) confirmStringDetail(gui *gocui.Gui, view *gocui.View) error {
text := strings.TrimSpace(view.Buffer())
runner.activeStringDetailController.Confirm(text)
runner.restoreMainView()
runner.gui.DeleteView(view.Name())
return nil
}
示例5: toggleButton
func toggleButton(g *gocui.Gui, v *gocui.View) error {
nextview := "butdown"
if v != nil && v.Name() == "butdown" {
nextview = "butup"
}
_, err := g.SetCurrentView(nextview)
return err
}
示例6: nextView
func nextView(g *gocui.Gui, v *gocui.View) error {
if v == nil || v.Name() == "side" {
_, err := g.SetCurrentView("main")
return err
}
_, err := g.SetCurrentView("side")
return err
}
示例7: confirmListDetail
func (runner *appRunner) confirmListDetail(gui *gocui.Gui, view *gocui.View) error {
_, originY := view.Origin()
_, cursorY := view.Cursor()
runner.activeListDetailController.Confirm(originY + cursorY)
runner.restoreMainView()
runner.gui.DeleteView(view.Name())
return nil
}
示例8: moveView
func moveView(g *gocui.Gui, v *gocui.View, dx, dy int) error {
name := v.Name()
x0, y0, x1, y1, err := g.ViewPosition(name)
if err != nil {
return err
}
if _, err := g.SetView(name, x0+dx, y0+dy, x1+dx, y1+dy); err != nil {
return err
}
return nil
}
示例9: pageUpDownJumpCount
func pageUpDownJumpCount(v *gocui.View) int {
var jump int
switch v.Name() {
case "side", "summary":
jump = 8
case "detail":
jump = 30
default:
jump = 8
}
return jump
}
示例10: onMovingCursorRedrawView
// redraw views
func onMovingCursorRedrawView(g *gocui.Gui, v *gocui.View) error {
switch v.Name() {
case "summary":
if err := redrawDetail(g); err != nil {
return err
}
case "side":
if err := changeHost(g, v); err != nil {
return err
}
}
return nil
}
示例11: previousView
func previousView(g *gocui.Gui, v *gocui.View) error {
if v == nil {
return g.SetCurrentView("side")
}
switch v.Name() {
case "side":
return g.SetCurrentView("side")
case "summary":
return g.SetCurrentView("side")
case "detail":
return g.SetCurrentView("summary")
default:
return g.SetCurrentView("side")
}
}
示例12: removeAllTracksCommand
func removeAllTracksCommand(g *gocui.Gui, v *gocui.View) error {
switch v.Name() {
case VIEW_PLAYLISTS:
case VIEW_TRACKS:
if playlist, index := gui.getSelectedPlaylistAndTrack(); index > -1 {
playlist.RemoveAllTracks()
gui.updateTracksView()
return gui.enableSideView()
}
case VIEW_QUEUE:
queue.RemoveAll()
gui.updateQueueView()
return gui.enableTracksView()
}
return nil
}
示例13: 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
}
示例14: keyPressed
func keyPressed(key rune, g *gocui.Gui, v *gocui.View) error {
multipleKeysBuffer.WriteRune(key)
keyCombination := multipleKeysBuffer.String()
if handler := keyboard.SequentialKeys[v.Name()+" "+keyCombination]; handler != nil {
multipleKeysBuffer.Reset()
err := handler(g, v)
multipleKeysNumber = 0
return err
}
if len(keyCombination) >= 2 {
multipleKeysBuffer.Reset()
return keyPressed(rune(keyCombination[1]), g, v)
}
return nil
}
示例15: moveView
func moveView(g *gocui.Gui, v *gocui.View, dx, dy int) error {
name := v.Name()
// x0, y0, x1, y1, err := g.ViewPosition(name)
// if err != nil {
// return err
// }
// logger.Logger.Printf("RESIZE %d %d %d %d\n", x0+dx, y0+dy, x1+dx, y1+dy)
if _, err := g.SetView(name, 0, 0, 0, 0); err != nil {
return err
}
return nil
}