cui

package
v1.2.6-sp1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2023 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NoInputEditor gocui.EditorFunc = func(v *gocui.View, key gocui.Key, ch rune, mod gocui.Modifier) {
		return
	}
)

Functions

func ScrollView

func ScrollView(v *gocui.View, dy int) error

Types

type App

type App struct {
	UI *gocui.Gui
	// contains filtered or unexported fields
}

func NewApp

func NewApp() (*App, error)

func (*App) AddToLayout

func (a *App) AddToLayout(frame *AppFrame)

func (*App) AddToLayoutWithTabSwitcher

func (a *App) AddToLayoutWithTabSwitcher(frame *AppFrame, tabToSwitch bool)

func (*App) BeforeStart

func (a *App) BeforeStart(cbs ...func(app *App) error)

func (*App) Close

func (a *App) Close()

func (*App) DeleteAppFrameByName

func (a *App) DeleteAppFrameByName(name string)

func (*App) GetFrameByName

func (a *App) GetFrameByName(name string) (*AppFrame, bool)

func (*App) ModalMessage

func (a *App) ModalMessage(title string, in io.Reader) error

func (*App) ModalMessageWithEvent

func (a *App) ModalMessageWithEvent(title string, in io.Reader, ok, cancel func(g *gocui.Gui)) error

func (*App) ModalMessageWithPostionSetterOnEvent

func (a *App) ModalMessageWithPostionSetterOnEvent(title string, in io.Reader,
	pos PositionSetter,

	ok func(g *gocui.Gui),
	cancel func(g *gocui.Gui),
) error

func (*App) Run

func (a *App) Run(ctx context.Context, cbs ...func()) error

type AppFrame

type AppFrame struct {
	Position PositionSetter
	// contains filtered or unexported fields
}

func NewAppFrame

func NewAppFrame(app *App, name string, position PositionSetter) *AppFrame

func NewAppFrameWithViewWriter

func NewAppFrameWithViewWriter(app *App, name string, position PositionSetter, initCb ...ViewHandler) (*AppFrame, io.Writer)

func NewStatusAppFrame

func NewStatusAppFrame(app *App, name string, position PositionSetter, showValue *[]byte, cb ...ViewHandler) *AppFrame

专门用来显示状态的 Framework

func (*AppFrame) Init

func (a *AppFrame) Init(cb ...ViewHandler)

func (*AppFrame) OnLineSelected

func (a *AppFrame) OnLineSelected(cb ...LineSelectedHandler)

func (*AppFrame) OnUpdated

func (a *AppFrame) OnUpdated(cb ...ViewHandler)

func (*AppFrame) Update

func (a *AppFrame) Update()

type LineSelectedHandler

type LineSelectedHandler func(line string, app *App, g *gocui.Gui, v *gocui.View)

type PositionSetter

type PositionSetter func(x, y int) (int, int, int, int)

type StatusText

type StatusText struct {
	io.Reader
	// contains filtered or unexported fields
}

专门用来更新状态的 Frame

func NewStatusText

func NewStatusText(interval time.Duration, initData []byte) *StatusText

func NewStatusTextWithContext

func NewStatusTextWithContext(interval time.Duration, initData []byte, baseCtx context.Context) *StatusText

func (*StatusText) Close

func (s *StatusText) Close()

func (*StatusText) Read

func (s *StatusText) Read(p []byte) (n int, err error)

func (*StatusText) Update

func (s *StatusText) Update(data []byte)

type ViewHandler

type ViewHandler func(app *App, g *gocui.Gui, v *gocui.View) error

func EnableNoInputEditor

func EnableNoInputEditor(name string) ViewHandler

func EnableScroller

func EnableScroller(name string) ViewHandler

启动手动滚动 View 的模式,应该在 Init 中设置

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL