widget

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2020 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package widget contains additional tview widgets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddColor

func AddColor(s, color string) string

AddColor adds tview color tags to the given string.

func GetHashColor

func GetHashColor(val interface{}) tcell.Color

GetHashColor gets the tcell Color value for the given string.

GetHashColor calls GetHashColorName() and gets the Color value from the tcell.ColorNames map.

func GetHashColorName

func GetHashColorName(s string) string

GetHashColorName gets a color name for the given string based on its FNV-1 hash.

The array of possible color names are the alphabetically ordered color names specified in tcell.ColorNames.

The algorithm to get the color is as follows:

colorNames[ FNV1(string) % len(colorNames) ]

With the exception of the three special cases:

--> = green
<-- = red
--- = yellow

func WriteLine

func WriteLine(screen mauview.Screen, align int, line string, x, y, maxWidth int, style tcell.Style)

func WriteLineColor

func WriteLineColor(screen mauview.Screen, align int, line string, x, y, maxWidth int, color tcell.Color)

func WriteLinePadded

func WriteLinePadded(screen mauview.Screen, align int, line string, x, y, maxWidth int, style tcell.Style)

func WriteLineSimple

func WriteLineSimple(screen mauview.Screen, line string, x, y int)

func WriteLineSimpleColor

func WriteLineSimpleColor(screen mauview.Screen, line string, x, y int, color tcell.Color)

Types

type Border

type Border struct {
	Style tcell.Style
}

Border is a simple tview widget that renders a horizontal or vertical bar.

If the width of the box is 1, the bar will be vertical. If the height is 1, the bar will be horizontal. If the width nor the height are 1, nothing will be rendered.

func NewBorder

func NewBorder() *Border

NewBorder wraps a new tview Box into a new Border.

func (*Border) Draw

func (border *Border) Draw(screen mauview.Screen)

func (*Border) OnKeyEvent

func (border *Border) OnKeyEvent(event mauview.KeyEvent) bool

func (*Border) OnMouseEvent

func (border *Border) OnMouseEvent(event mauview.MouseEvent) bool

func (*Border) OnPasteEvent

func (border *Border) OnPasteEvent(event mauview.PasteEvent) bool

Jump to

Keyboard shortcuts

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