Documentation ¶
Index ¶
- Variables
- func DrawLine(s tcell.Screen, StartX, StartY int, style tcell.Style, text string)
- func DrawText(s tcell.Screen, StartX, StartY, EndX, EndY int, style tcell.Style, text string) error
- func FillString(text string, width int) string
- func OmitString(text string, maxWidth int) string
- func OmitStringMid(text string, maxWidth int) string
- func OmitStringRight(text string, maxWidth int) string
- type Box
- func (b *Box) Clean() *Box
- func (b *Box) Draw()
- func (b *Box) DrawLineText(StartY int, style tcell.Style, text string)
- func (b *Box) DrawMultiLineText(style tcell.Style, text []string)
- func (b *Box) DrawOneLineText(StartY int, style tcell.Style, text string)
- func (b *Box) DrawText(StartX, StartY int, style tcell.Style, text string)
- func (b *Box) FillOneLineText(text string) string
- func (b Box) GetDrawRange() (StartX, StartY, EndX, EndY int)
- func (b Box) Height() int
- func (b *Box) OmitOneLineText(text string) string
- func (b *Box) SetPaddingLeft(p int) *Box
- func (b Box) Width() int
- type Confirm
- type ConfirmSelect
- type Help
- type HelpItem
- type List
- type Select
- func (s *Select) Draw()
- func (s *Select) DrawLoading()
- func (s *Select) Filter(filter string) *Select
- func (s *Select) GetDrawItems(offset int) []*SelectItem
- func (s Select) GetSeleteItem() *SelectItem
- func (s *Select) IsMoveEnd() bool
- func (s Select) Length() int
- func (s *Select) MoveDownSelect(step int) (isChange bool)
- func (s *Select) MoveUpSelect(step int) (isChange bool)
- func (s *Select) SetAnchorIndex(i int) *Select
- func (s *Select) SetEmptyFillText(t string) *Select
- func (s *Select) SetItems(items []*SelectItem) *Select
- func (s *Select) SetLoadingText(t string) *Select
- func (s *Select) SetSelectFn(fn func(*SelectItem)) *Select
- func (s *Select) SetSelectIndex(i int) *Select
- type SelectItem
- type SelectItemInfo
- type Terminal
- func (t *Terminal) DrawBox(b Box) error
- func (t *Terminal) DrawLineText(StartX, StartY, MaxLineW int, style tcell.Style, text string) error
- func (t *Terminal) DrawOneLineText(StartY int, style tcell.Style, text string) error
- func (t *Terminal) DrawText(StartX, StartY, EndX, EndY int, style tcell.Style, text string) error
- func (t *Terminal) Exec() error
- func (t *Terminal) NewBox(StartX, StartY, EndX, EndY int, Style tcell.Style) *Box
- func (t *Terminal) Quit()
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Log = bdpan.GetLogger() StyleDefault = tcell.StyleDefault.Background(tcell.ColorReset).Foreground(tcell.ColorReset) StyleSelect = tcell.StyleDefault.Background(tcell.ColorDarkCyan).Foreground(tcell.ColorWhite) )
Functions ¶
Types ¶
type Box ¶
type Box struct { S tcell.Screen StartX int StartY int EndX int EndY int Style tcell.Style PaddingLeft int PaddingRight int }
func (*Box) DrawLineText ¶
绘制当行数据
func (*Box) DrawMultiLineText ¶
绘制多行数据
func (*Box) DrawOneLineText ¶
绘制当行数据
func (*Box) SetPaddingLeft ¶
type Confirm ¶
type Confirm struct { Box *Box Text string Ensure *ConfirmSelect Cancel *ConfirmSelect // contains filtered or unexported fields }
func NewConfirm ¶
func (*Confirm) EnableCancel ¶
func (*Confirm) EnableEnsure ¶
type ConfirmSelect ¶
func (ConfirmSelect) Style ¶
func (s ConfirmSelect) Style() tcell.Style
type Select ¶
type Select struct { Box *Box StartX int StartY int // MaxWidth int // MaxHeight int Items []*SelectItem // 选中行的样式 StyleSelect tcell.Style // 选中行索引 SelectIndex int // 选中后的执行方法 SelectFn func(*SelectItem) // 上下移动时光标固定的锚点 AnchorIndex int // Items 为空时需要填充的数据 EmptyFillText string LoadingText string // contains filtered or unexported fields }
func NewEmptySelect ¶
func (*Select) DrawLoading ¶
func (s *Select) DrawLoading()
func (*Select) GetDrawItems ¶
func (s *Select) GetDrawItems(offset int) []*SelectItem
func (Select) GetSeleteItem ¶
func (s Select) GetSeleteItem() *SelectItem
func (*Select) MoveDownSelect ¶
func (*Select) MoveUpSelect ¶
func (*Select) SetAnchorIndex ¶
func (*Select) SetEmptyFillText ¶
func (*Select) SetItems ¶
func (s *Select) SetItems(items []*SelectItem) *Select
func (*Select) SetLoadingText ¶
func (*Select) SetSelectFn ¶
func (s *Select) SetSelectFn(fn func(*SelectItem)) *Select
func (*Select) SetSelectIndex ¶
type SelectItem ¶
type SelectItem struct { IsSelect bool Info SelectItemInfo }
type SelectItemInfo ¶
type Terminal ¶
type Terminal struct { S tcell.Screen StyleDefault tcell.Style }
func NewTerminal ¶
func (*Terminal) DrawLineText ¶
func (*Terminal) DrawOneLineText ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.