Documentation ¶
Overview ¶
Package termui is a library for creating terminal user interfaces (TUIs) using widgets.
Index ¶
- Constants
- Variables
- func AbsInt(x int) int
- func CellsToString(cells []Cell) string
- func Clear()
- func Close()
- func ConvWidthRelativeToAbs(minX, maxX int, size []int, row []string) []int
- func ConvertSymToMarkers(in string) string
- func ConvertSymToSquaredMarker(in string) string
- func ConvertToBoldNumbers(in int32) string
- func ConvertToFullNumbers(in int32) string
- func ConvertToMonoNumbers(in int32) string
- func ConvertToRomeNumbers(in int32) string
- func FloorFloat64(x float64) float64
- func FormatAmount(amount, decimal int32, isMono bool, addCurSym bool) string
- func FormatAmountToMonoNumbers(amount int64, decimal int32, addCurSym bool) string
- func FormatStrAsMarkers(in string, asSquared bool) string
- func FormatStrWithStyle(in string, style Style) string
- func GetAddressElements(address ...uint32) (p, r, c uint32)
- func GetMaxFloat64From2dSlice(slices [][]float64) (float64, error)
- func GetMaxFloat64FromSlice(slice []float64) (float64, error)
- func GetMaxIntFromSlice(slice []int) (int, error)
- func Init() error
- func InterfaceSlice(slice interface{}) []interface{}
- func MakeCenterPositionWidget(parent image.Rectangle, wData, hData int) image.Rectangle
- func MakeDataProviderAddress(param, row, col uint32) uint32
- func MakeEventUuid(eventId string, t EventType, adv ...interface{}) string
- func MakeStr(countParams uint8, data []interface{}, useSplit32 bool) string
- func MakeStrStaticW(data []interface{}, rw []uint8, useSplit32 bool) string
- func MaxFloat64(x, y float64) float64
- func MaxInt(x, y int) int
- func MinFloat64(x, y float64) float64
- func MinInt(x, y int) int
- func ParseDataProviderAddress(address uint32) (uint32, uint32, uint32)
- func PollEvents() <-chan Event
- func Render(items ...Drawable)
- func RoundFloat64(x float64) float64
- func SplitCells(cells []Cell, r rune) [][]Cell
- func StyleSerializeToCode(st Style) uint32
- func StyleToString(style Style) string
- func SumFloat64Slice(data []float64) float64
- func SumIntSlice(slice []int) int
- func TerminalDimensions() (int, int)
- func TrimString(s string, w int) string
- type AdaptiveSize
- func CalcRelativeHeight(rows uint8, sizes ...AdaptiveSize) []AdaptiveSize
- func NewAdaptiveSize(in int) AdaptiveSize
- func NewAdaptiveSizeFirstPercentile() AdaptiveSize
- func NewAdaptiveSizeMax() AdaptiveSize
- func NewAdaptiveSizeMin() AdaptiveSize
- func NewAdaptiveSizeThird() AdaptiveSize
- func NewAdaptiveSizeThreePercentile() AdaptiveSize
- func NewAdaptiveSizeTwenty() AdaptiveSize
- func NewAdaptiveSizeTwoPercentile() AdaptiveSize
- func NewAdaptiveSizeZero() AdaptiveSize
- type Alignment
- type BarChartTheme
- type Block
- func (self *Block) Draw(buf *Buffer)
- func (self *Block) GetName() string
- func (self *Block) GetRect() image.Rectangle
- func (self *Block) MakeGlamourTitle(title string)
- func (self *Block) SetEmptyHeader()
- func (self *Block) SetHeaderWithMarker(marker, suffix string)
- func (self *Block) SetName(name string)
- func (self *Block) SetRect(x1, y1, x2, y2 int)
- func (self *Block) SetUUIDName()
- type BlockTheme
- type Buffer
- type Canvas
- type Cell
- type CellWithX
- type Color
- type DashboardLib
- func (dl *DashboardLib) AddBoldNumber(r, c uint32, numb int32, name string, styles ...Style) *DashboardLib
- func (dl *DashboardLib) AddCircleLineItem(r, c uint32, name, line string, styles ...Style) *DashboardLib
- func (dl *DashboardLib) AddFullNumber(r, c uint32, numb int32, name string, styles ...Style) *DashboardLib
- func (dl *DashboardLib) AddIconFree(r, c uint32, icon int32, name string) *DashboardLib
- func (dl *DashboardLib) AddMonoNumber(r, c uint32, numb int32, name string, styles ...Style) *DashboardLib
- func (dl *DashboardLib) AddRomeNumber(r, c uint32, numb int32, name string, styles ...Style) *DashboardLib
- func (dl *DashboardLib) AddSquaredLineItem(r, c uint32, name, line string, styles ...Style) *DashboardLib
- func (dl *DashboardLib) AddString(r, c uint32, name, data string, styles ...Style) *DashboardLib
- func (dl *DashboardLib) Cols() int
- func (dl *DashboardLib) GetItem(name string) (*DashboardLibItem, bool)
- func (dl *DashboardLib) Idx() map[uint32]*DashboardLibItem
- func (dl *DashboardLib) Names() []string
- func (dl *DashboardLib) Rows() int
- func (dl *DashboardLib) Size() int
- type DashboardLibItem
- type DataProviderDashboard
- type DataProviderList
- func (dpl *DataProviderList) AddData(data string, param uint32, row uint32)
- func (dpl *DataProviderList) Caching()
- func (dpl *DataProviderList) GetList() []string
- func (dpl *DataProviderList) GetListPtr() *[]string
- func (dpl *DataProviderList) SetExtTarget(t *[]string)
- func (dpl *DataProviderList) SetWidthParams(width []uint8)
- func (dpl *DataProviderList) UpdateData(data string, address ...uint32)
- func (dpl *DataProviderList) UpdateDataFromMap(data map[uint32]string)
- func (dpl *DataProviderList) UseSplit32() *DataProviderList
- type DataProviderTable
- func (dpt *DataProviderTable) AddData(data string, row, col, param uint32) *DataProviderTable
- func (dpt *DataProviderTable) AddStyledData(data string, row, col, param uint32) *DataProviderTable
- func (dpt *DataProviderTable) Caching()
- func (dpt *DataProviderTable) GetMaxColsCount() uint8
- func (dpt *DataProviderTable) GetRow(row int) []string
- func (dpt *DataProviderTable) GetTable() [][]string
- func (dpt *DataProviderTable) Off(r, c uint32)
- func (dpt *DataProviderTable) On(r, c uint32)
- func (dpt *DataProviderTable) SetMaxColsCount(count uint8)
- func (dpt *DataProviderTable) UpdateData(data string, address ...uint32)
- func (dpt *DataProviderTable) UpdateDataFromMap(data map[uint32]string) error
- func (dpt *DataProviderTable) UseSplit32() *DataProviderTable
- type DataProviderText
- type Drawable
- type Event
- type EventType
- type FDataProviderConverter
- type GaugeTheme
- type Grid
- type GridItem
- type InputPld
- type ListTheme
- type Modifier
- type Mouse
- type ParagraphTheme
- type PieChartTheme
- type PlotTheme
- type Resize
- type RootTheme
- type ServicePld
- type SparklineTheme
- type StackedBarChartTheme
- type Style
- type SystemPld
- type TabTheme
- type TableTheme
- type TickerPld
- type TreeTheme
- type UpdatingDataProvider
- type WidgetTheme
Constants ¶
const ( KeyboardEvent EventType = iota MouseEvent ResizeEvent TickerEvent // событие тикера должен иметь набор константных типов ServiceEvent // событие от внеш сервиса id сервиса SystemEvent // события внутри приложения InputEvent // события полей редактирования SystemEventActionSomeOp = 0x100 // передаем id виджета SystemEventActionUpdateDataOp = 0x101 // передаем id виджета SystemEventDashboardIconSwitch = 0x102 // передаем имя параметра дащборда если он есть SysEventOpCustom = 0x00 // free style SysEventOpUpdateDP = 0x01 // update data provider SysEventOpUpdateData = 0x02 // update storage data // SysEventOpModifyWidget - тип операции, который указывает, что мы меняем данные // в самом виджете. Например заголовок. Требуется что бы группа виджет - провайдер данных // имела один идентификатор. При данном типе операции первым значением в Payload Data идет // индекс, начиная с которого идут данные для виджета. SysEventOpModifyWidget = 0x04 SysEventOpDashIconSwitch = 0x08 SysEventOpUpdateGrData = 0x10 SysEventOpUpdateGrDP = 0x20 )
const ( TokenBeginStyledText = '[' TokenEndStyledText = ']' )
const ( DOT = '•' ELLIPSES = '…' UP_ARROW = '▲' DOWN_ARROW = '▼' LEFT_ARROW = '◀' RIGHT_ARROW = '▶' COLLAPSED = '+' EXPANDED = '−' EMPTY int32 = ' ' RUR int32 = '₽' SHEKEL int32 = '₪' LAOS_KIP int32 = '₭' LIGHT_COIN int32 = 'Ł' SYMBOL_YAT int32 = 'Ѣ' SYMBOL_MATH_MINUS int32 = '−' SYMBOL_MATH_PLUS int32 = '+' CHECK_DEFAULT int32 = '✓' DISABLE_DEFAULT int32 = '✖' GR_TETA int32 = 'Θ' GR_DELTA int32 = 'Δ' GR_KSI int32 = 'Ξ' GR_PSI int32 = 'Ψ' GR_OMEGA int32 = 'Ω' GR_SIGMA int32 = 'Σ' ROME_1 int32 = 'Ⅰ' ROME_2 int32 = 'Ⅱ' ROME_3 int32 = 'Ⅲ' ROME_4 int32 = 'Ⅳ' ROME_5 int32 = 'Ⅴ' ROME_6 int32 = 'Ⅵ' ROME_7 int32 = 'Ⅶ' ROME_8 int32 = 'Ⅷ' ROME_9 int32 = 'Ⅸ' ROME_10 int32 = 'Ⅹ' ROME_11 int32 = 'Ⅺ' ROME_12 int32 = 'Ⅻ' ROME_50 int32 = 'Ⅼ' ROME_100 int32 = 'Ⅽ' ROME_500 int32 = 'Ⅾ' ROME_1000 int32 = 'Ⅿ' NUMBER_BOLD_0 int32 = '𝟬' NUMBER_BOLD_1 int32 = '𝟭' NUMBER_BOLD_2 int32 = '𝟮' NUMBER_BOLD_3 int32 = '𝟯' NUMBER_BOLD_4 int32 = '𝟰' NUMBER_BOLD_5 int32 = '𝟱' NUMBER_BOLD_6 int32 = '𝟲' NUMBER_BOLD_7 int32 = '𝟳' NUMBER_BOLD_8 int32 = '𝟴' NUMBER_BOLD_9 int32 = '𝟵' CS_FOOTPRINT int32 = '👣' CS_FOOTPRINT_ANIMAL int32 = '🐾' CS_CLOVER_4_LIST int32 = '🍀' CS_ANGER int32 = '💢' CS_EYES int32 = '👀' CS_HOURGLASS int32 = '⌛' CS_COFFEE int32 = '☕' CS_SHOWING int32 = '🌨' CS_FIRE int32 = '🔥' CS_FIRE_ENGINE int32 = '🚒' CS_ROCKET int32 = '🚀' CS_DIZZINESS int32 = '💫' CS_BUMP int32 = '💥' CS_NOTES int32 = '🎶' CS_BEEPER int32 = '📯' /* triangles */ TRIA_TOP_L int32 = '◸' TRIA_TOP_R int32 = '◹' TRIA_BOTTOM_L int32 = '◺' TRIA_BOTTOM_R int32 = '◿' /* i-chin */ I_CHIN_1 int32 = '☰' I_CHIN_2 int32 = '☱' I_CHIN_3 int32 = '☲' I_CHIN_4 int32 = '☳' I_CHIN_5 int32 = '☴' I_CHIN_6 int32 = '☵' I_CHIN_7 int32 = '☶' I_CHIN_8 int32 = '☷' )
const ( TOP_LEFT int32 = '┌' TOP_RIGHT int32 = '┐' BOTTOM_LEFT int32 = '└' BOTTOM_RIGHT int32 = '┘' VERTICAL_LINE int32 = '│' HORIZONTAL_LINE int32 = '─' VERTICAL_LEFT int32 = '┤' VERTICAL_RIGHT int32 = '├' HORIZONTAL_UP int32 = '┴' HORIZONTAL_DOWN int32 = '┬' QUOTA_LEFT int32 = '«' QUOTA_RIGHT int32 = '»' VERTICAL_DASH int32 = '┊' HORIZONTAL_DASH int32 = '┈' )
const (
AdaptiveSizeMaxInt int = 100
)
Variables ¶
var ( BARS = [...]rune{' ', '▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'} SHADED_BLOCKS = [...]rune{' ', '░', '▒', '▓', '█'} IRREGULAR_BLOCKS = [...]rune{ ' ', '▘', '▝', '▀', '▖', '▌', '▞', '▛', '▗', '▚', '▐', '▜', '▄', '▙', '▟', '█', } BRAILLE_OFFSET = '\u2800' BRAILLE = [4][2]rune{ {'\u0001', '\u0008'}, {'\u0002', '\u0010'}, {'\u0004', '\u0020'}, {'\u0040', '\u0080'}, } DOUBLE_BRAILLE = map[[2]int]rune{ [2]int{0, 0}: '⣀', [2]int{0, 1}: '⡠', [2]int{0, 2}: '⡐', [2]int{0, 3}: '⡈', [2]int{1, 0}: '⢄', [2]int{1, 1}: '⠤', [2]int{1, 2}: '⠔', [2]int{1, 3}: '⠌', [2]int{2, 0}: '⢂', [2]int{2, 1}: '⠢', [2]int{2, 2}: '⠒', [2]int{2, 3}: '⠊', [2]int{3, 0}: '⢁', [2]int{3, 1}: '⠡', [2]int{3, 2}: '⠑', [2]int{3, 3}: '⠉', } SINGLE_BRAILLE_LEFT = [4]rune{'\u2840', '⠄', '⠂', '⠁'} SINGLE_BRAILLE_RIGHT = [4]rune{'\u2880', '⠠', '⠐', '⠈'} )
var CellClear = Cell{ Rune: ' ', Style: StyleClear, }
var StandardColors = []Color{ ColorRed, ColorGreen, ColorYellow, ColorBlue, ColorMagenta, ColorCyan, ColorWhite, }
var StandardStyles = []Style{ NewStyle(ColorRed), NewStyle(ColorGreen), NewStyle(ColorYellow), NewStyle(ColorBlue), NewStyle(ColorMagenta), NewStyle(ColorCyan), NewStyle(ColorWhite), }
var StyleClear = Style{ Fg: ColorClear, Bg: ColorClear, Modifier: ModifierClear, }
StyleClear represents a default Style, with no colors or modifiers
var StyleParserColorMap = map[string]Color{ "red": ColorRed, "blue": ColorBlue, "black": ColorBlack, "cyan": ColorCyan, "yellow": ColorYellow, "white": ColorWhite, "clear": ColorClear, "green": ColorGreen, "magenta": ColorMagenta, "22": ColorGreenBgDunkel, "23": ColorGreenBlue, "30": ColorBlueLightFg, "31": ColorBlueLightFg2, }
StyleParserColorMap can be modified to add custom color parsing to text
var Theme = RootTheme{ Default: NewStyle(ColorWhite), Block: BlockTheme{ Title: NewStyle(ColorWhite), Border: NewStyle(ColorWhite), }, BarChart: BarChartTheme{ Bars: StandardColors, Nums: StandardStyles, Labels: StandardStyles, }, Paragraph: ParagraphTheme{ Text: NewStyle(ColorWhite), }, PieChart: PieChartTheme{ Slices: StandardColors, }, List: ListTheme{ Text: NewStyle(ColorWhite), }, Tree: TreeTheme{ Text: NewStyle(ColorWhite), Collapsed: COLLAPSED, Expanded: EXPANDED, }, StackedBarChart: StackedBarChartTheme{ Bars: StandardColors, Nums: StandardStyles, Labels: StandardStyles, }, Gauge: GaugeTheme{ Bar: ColorWhite, Label: NewStyle(ColorWhite), }, Sparkline: SparklineTheme{ Title: NewStyle(ColorWhite), Line: ColorWhite, }, Plot: PlotTheme{ Lines: StandardColors, Axes: ColorWhite, }, Table: TableTheme{ Text: NewStyle(ColorWhite), }, Tab: TabTheme{ Active: NewStyle(ColorRed), Inactive: NewStyle(ColorWhite), }, }
Theme holds the default Styles and Colors for all widgets. You can set default widget Styles by modifying the Theme before creating the widgets.
Functions ¶
func CellsToString ¶
func ConvWidthRelativeToAbs ¶
ConvWidthRelativeToAbs - цели: значения размеров указанных как -1 или 0. Такие размеры являются относительными -1 - такая ячейка займет все не размеченное пространство, если их несколько то будет их делить
поровну с остальными такими же 0 - размер такой колонки определиться по длине текста в первой строке
Размер size и data должны совпадать Если возникают какие-то ошибки возвращается массив с "резиновыми" значениями
func ConvertSymToMarkers ¶
func ConvertToBoldNumbers ¶
func ConvertToFullNumbers ¶
func ConvertToMonoNumbers ¶
func ConvertToRomeNumbers ¶
ConvertToRomeNumbers Актуальны числа от 1 до 12, 50, 100, 500, 1000
func FloorFloat64 ¶
func FormatAmount ¶
FormatAmount - вывод форматированной суммы. @decimal - если меньше 0, значит вывод десятичных отключаем
func FormatStrAsMarkers ¶
func FormatStrWithStyle ¶
func GetAddressElements ¶
GetAddressElements - элементы адреса: - один элемент - номер параметра для текста, номер параметра для 0 строки списка, 0 строки и 0 колонки таблицы - два элемента - номер строки, номер параметра, 0 - номер колонки для таблицы - три элемента - номер строки, номер колонки, номер параметра
func GetMaxFloat64FromSlice ¶
func GetMaxIntFromSlice ¶
func Init ¶
func Init() error
Init initializes termbox-go and is required to render anything. After initialization, the library must be finalized with `Close`.
func InterfaceSlice ¶
func InterfaceSlice(slice interface{}) []interface{}
InterfaceSlice takes an []interface{} represented as an interface{} and converts it https://stackoverflow.com/questions/12753805/type-converting-slices-of-interfaces-in-go
func MakeCenterPositionWidget ¶
MakeCenterPositionWidget - расчет позиционирования виджета по середине родительского фрейма maxX, maxY - размеры
func MakeDataProviderAddress ¶
func MakeEventUuid ¶
func MakeStrStaticW ¶
func MaxFloat64 ¶
func MinFloat64 ¶
func ParseDataProviderAddress ¶
ParseDataProviderAddress - порядок элементов возврата как в в параметрах функции MakeDataProviderAddress: param, row, col
func PollEvents ¶
func PollEvents() <-chan Event
PollEvents gets events from termbox, converts them, then sends them to each of its channels.
func RoundFloat64 ¶
func SplitCells ¶
func StyleSerializeToCode ¶
func StyleToString ¶
func SumFloat64Slice ¶
func SumIntSlice ¶
func TerminalDimensions ¶
func TrimString ¶
TrimString trims a string to a max length and adds '…' to the end if it was trimmed.
Types ¶
type AdaptiveSize ¶
type AdaptiveSize int
AdaptiveSize тип для указания адаптивных размеров под виджеты. числа от 10 до 100. Остальные числа ограничиваются в этом диапазоне Далее при построении сетки виджета эти размеры будут разделены на 100 что бы определить относительный размер каждой клетки в сетке
func CalcRelativeHeight ¶
func CalcRelativeHeight(rows uint8, sizes ...AdaptiveSize) []AdaptiveSize
CalcRelativeHeight - расcчитываем относительные высоты строк. Общая сумма не должна превышать tmpl.AdaptiveSize.Max()
func NewAdaptiveSize ¶
func NewAdaptiveSize(in int) AdaptiveSize
func NewAdaptiveSizeFirstPercentile ¶
func NewAdaptiveSizeFirstPercentile() AdaptiveSize
func NewAdaptiveSizeMax ¶
func NewAdaptiveSizeMax() AdaptiveSize
func NewAdaptiveSizeMin ¶
func NewAdaptiveSizeMin() AdaptiveSize
func NewAdaptiveSizeThird ¶
func NewAdaptiveSizeThird() AdaptiveSize
func NewAdaptiveSizeThreePercentile ¶
func NewAdaptiveSizeThreePercentile() AdaptiveSize
func NewAdaptiveSizeTwenty ¶
func NewAdaptiveSizeTwenty() AdaptiveSize
func NewAdaptiveSizeTwoPercentile ¶
func NewAdaptiveSizeTwoPercentile() AdaptiveSize
func NewAdaptiveSizeZero ¶
func NewAdaptiveSizeZero() AdaptiveSize
func (AdaptiveSize) FloatSize ¶
func (as AdaptiveSize) FloatSize() float64
func (AdaptiveSize) IsMax ¶
func (as AdaptiveSize) IsMax() bool
func (AdaptiveSize) Sum ¶
func (as AdaptiveSize) Sum(num AdaptiveSize) AdaptiveSize
func (AdaptiveSize) ToInt ¶
func (as AdaptiveSize) ToInt() int
func (AdaptiveSize) ToUint8 ¶
func (as AdaptiveSize) ToUint8() uint8
type BarChartTheme ¶
type Block ¶
type Block struct { Border bool BorderStyle Style BorderLeft, BorderRight, BorderTop, BorderBottom bool PaddingLeft, PaddingRight, PaddingTop, PaddingBottom int image.Rectangle Inner image.Rectangle Title string TitleStyle Style sync.Mutex // contains filtered or unexported fields }
Block is the base struct inherited by most widgets. Block manages size, position, border, and title. It implements all 3 of the methods needed for the `Drawable` interface. Custom widgets will override the Draw method.
func (*Block) MakeGlamourTitle ¶
func (*Block) SetEmptyHeader ¶
func (self *Block) SetEmptyHeader()
func (*Block) SetHeaderWithMarker ¶
func (*Block) SetUUIDName ¶
func (self *Block) SetUUIDName()
type BlockTheme ¶
type Cell ¶
Cell represents a viewable terminal cell
func ParseStyles ¶
ParseStyles parses a string for embedded Styles and returns []Cell with the correct styling. Uses defaultStyle for any text without an embedded style. Syntax is of the form [text](fg:<color>,mod:<attribute>,bg:<color>). Ordering does not matter. All fields are optional.
func RunesToStyledCells ¶
type CellWithX ¶
func BuildCellWithXArray ¶
type Color ¶
type Color int
Color is an integer from -1 to 255 -1 = ColorClear 0-255 = Xterm colors
const ( ColorBlack Color = 0 ColorRed Color = 1 ColorGreen Color = 2 ColorYellow Color = 3 ColorBlue Color = 4 ColorMagenta Color = 5 ColorCyan Color = 6 ColorWhite Color = 7 ColorGreenBgDunkel Color = 22 ColorGreenBlue Color = 23 ColorBlueLightFg Color = 30 ColorBlueLightFg2 Color = 31 )
Basic terminal colors
const ColorClear Color = -1
ColorClear clears the Fg or Bg color of a Style
func SelectColor ¶
type DashboardLib ¶
type DashboardLib struct {
// contains filtered or unexported fields
}
func NewDashboardLib ¶
func NewDashboardLib() *DashboardLib
func (*DashboardLib) AddBoldNumber ¶
func (dl *DashboardLib) AddBoldNumber(r, c uint32, numb int32, name string, styles ...Style) *DashboardLib
func (*DashboardLib) AddCircleLineItem ¶
func (dl *DashboardLib) AddCircleLineItem(r, c uint32, name, line string, styles ...Style) *DashboardLib
func (*DashboardLib) AddFullNumber ¶
func (dl *DashboardLib) AddFullNumber(r, c uint32, numb int32, name string, styles ...Style) *DashboardLib
func (*DashboardLib) AddIconFree ¶
func (dl *DashboardLib) AddIconFree(r, c uint32, icon int32, name string) *DashboardLib
func (*DashboardLib) AddMonoNumber ¶
func (dl *DashboardLib) AddMonoNumber(r, c uint32, numb int32, name string, styles ...Style) *DashboardLib
func (*DashboardLib) AddRomeNumber ¶
func (dl *DashboardLib) AddRomeNumber(r, c uint32, numb int32, name string, styles ...Style) *DashboardLib
func (*DashboardLib) AddSquaredLineItem ¶
func (dl *DashboardLib) AddSquaredLineItem(r, c uint32, name, line string, styles ...Style) *DashboardLib
func (*DashboardLib) AddString ¶
func (dl *DashboardLib) AddString(r, c uint32, name, data string, styles ...Style) *DashboardLib
func (*DashboardLib) Cols ¶
func (dl *DashboardLib) Cols() int
func (*DashboardLib) GetItem ¶
func (dl *DashboardLib) GetItem(name string) (*DashboardLibItem, bool)
func (*DashboardLib) Idx ¶
func (dl *DashboardLib) Idx() map[uint32]*DashboardLibItem
func (*DashboardLib) Names ¶
func (dl *DashboardLib) Names() []string
func (*DashboardLib) Rows ¶
func (dl *DashboardLib) Rows() int
func (*DashboardLib) Size ¶
func (dl *DashboardLib) Size() int
type DashboardLibItem ¶
type DashboardLibItem struct {
P, R, C uint32 // номер параметра, строки, колонки
// contains filtered or unexported fields
}
func NewDashboardLibsItem ¶
func NewDashboardLibsItem(iconView string, r, c, p uint32, styles ...Style) *DashboardLibItem
func (*DashboardLibItem) Address ¶
func (dli *DashboardLibItem) Address() uint32
func (*DashboardLibItem) String ¶
func (dli *DashboardLibItem) String() string
type DataProviderDashboard ¶
type DataProviderDashboard struct {
// contains filtered or unexported fields
}
func NewDataProviderDashboard ¶
func NewDataProviderDashboard(lib *DashboardLib) *DataProviderDashboard
func (*DataProviderDashboard) GetTable ¶
func (dpd *DataProviderDashboard) GetTable() [][]string
func (*DataProviderDashboard) OFF ¶
func (dpd *DataProviderDashboard) OFF(r, c uint32)
func (*DataProviderDashboard) ON ¶
func (dpd *DataProviderDashboard) ON(r, c uint32)
func (*DataProviderDashboard) Off ¶
func (dpd *DataProviderDashboard) Off(name string)
func (*DataProviderDashboard) On ¶
func (dpd *DataProviderDashboard) On(name string)
type DataProviderList ¶
type DataProviderList struct {
// contains filtered or unexported fields
}
func NewDataProviderList ¶
func NewDataProviderList() *DataProviderList
func (*DataProviderList) AddData ¶
func (dpl *DataProviderList) AddData(data string, param uint32, row uint32)
func (*DataProviderList) Caching ¶
func (dpl *DataProviderList) Caching()
func (*DataProviderList) GetList ¶
func (dpl *DataProviderList) GetList() []string
func (*DataProviderList) GetListPtr ¶
func (dpl *DataProviderList) GetListPtr() *[]string
func (*DataProviderList) SetExtTarget ¶
func (dpl *DataProviderList) SetExtTarget(t *[]string)
func (*DataProviderList) SetWidthParams ¶
func (dpl *DataProviderList) SetWidthParams(width []uint8)
func (*DataProviderList) UpdateData ¶
func (dpl *DataProviderList) UpdateData(data string, address ...uint32)
UpdateData - адрес подается след образом - row, col, param
func (*DataProviderList) UpdateDataFromMap ¶
func (dpl *DataProviderList) UpdateDataFromMap(data map[uint32]string)
func (*DataProviderList) UseSplit32 ¶
func (dpl *DataProviderList) UseSplit32() *DataProviderList
type DataProviderTable ¶
type DataProviderTable struct {
// contains filtered or unexported fields
}
func NewDataProviderTable ¶
func NewDataProviderTable() *DataProviderTable
func (*DataProviderTable) AddData ¶
func (dpt *DataProviderTable) AddData(data string, row, col, param uint32) *DataProviderTable
AddData - добавить данные в провайдер
func (*DataProviderTable) AddStyledData ¶
func (dpt *DataProviderTable) AddStyledData(data string, row, col, param uint32) *DataProviderTable
AddStyledData - если мы хотим вставить стилизованный текст как 2 параметра: его нужно обернуть в спец символы
func (*DataProviderTable) Caching ¶
func (dpt *DataProviderTable) Caching()
func (*DataProviderTable) GetMaxColsCount ¶
func (dpt *DataProviderTable) GetMaxColsCount() uint8
func (*DataProviderTable) GetRow ¶
func (dpt *DataProviderTable) GetRow(row int) []string
func (*DataProviderTable) GetTable ¶
func (dpt *DataProviderTable) GetTable() [][]string
func (*DataProviderTable) Off ¶
func (dpt *DataProviderTable) Off(r, c uint32)
func (*DataProviderTable) On ¶
func (dpt *DataProviderTable) On(r, c uint32)
func (*DataProviderTable) SetMaxColsCount ¶
func (dpt *DataProviderTable) SetMaxColsCount(count uint8)
func (*DataProviderTable) UpdateData ¶
func (dpt *DataProviderTable) UpdateData(data string, address ...uint32)
UpdateData - обновляем данные по указанному адресу @address: - первым всегда идет индекс параметра. Он есть у всех видов провайдеров - вторым - индекс строки, он есть у двух из трех видов провайдеров - третий - индекс колонки, он есть только у табличного провайдера
func (*DataProviderTable) UpdateDataFromMap ¶
func (dpt *DataProviderTable) UpdateDataFromMap(data map[uint32]string) error
func (*DataProviderTable) UseSplit32 ¶
func (dpt *DataProviderTable) UseSplit32() *DataProviderTable
type DataProviderText ¶
type DataProviderText struct {
// contains filtered or unexported fields
}
func NewDataProviderText ¶
func NewDataProviderText() *DataProviderText
func (*DataProviderText) AddData ¶
func (dpt *DataProviderText) AddData(data string, address uint32)
func (*DataProviderText) GetText ¶
func (dpt *DataProviderText) GetText() string
func (*DataProviderText) UpdateData ¶
func (dpt *DataProviderText) UpdateData(data string, address ...uint32)
type FDataProviderConverter ¶
FDataProviderConverter - тип функций сборки и конвертации данных для дата провайдеров
type GaugeTheme ¶
type GridItem ¶
type GridItem struct { Type gridItemType XRatio float64 YRatio float64 WidthRatio float64 HeightRatio float64 Entry interface{} // Entry.type == GridBufferer if IsLeaf else []GridItem IsLeaf bool // contains filtered or unexported fields }
GridItem represents either a Row or Column in a grid. Holds sizing information and either an []GridItems or a widget.
type ParagraphTheme ¶
type ParagraphTheme struct {
Text Style
}
type PieChartTheme ¶
type PieChartTheme struct {
Slices []Color
}
type RootTheme ¶
type RootTheme struct { Default Style Block BlockTheme BarChart BarChartTheme Gauge GaugeTheme Plot PlotTheme List ListTheme Tree TreeTheme Paragraph ParagraphTheme PieChart PieChartTheme Sparkline SparklineTheme StackedBarChart StackedBarChartTheme Tab TabTheme Table TableTheme }
type ServicePld ¶
type ServicePld struct { Op int Id string // id widget or id dp. id widget = id dp Data []interface{} }
ServicePld payload
type SparklineTheme ¶
type StackedBarChartTheme ¶
type Style ¶
Style represents the style of one terminal cell
func NewStyle ¶
NewStyle takes 1 to 3 arguments 1st argument = Fg 2nd argument = optional Bg 3rd argument = optional Modifier
func NewStyleBgFree ¶
func NewStyleFromStyleCode ¶
func SelectStyle ¶
type SystemPld ¶
type SystemPld struct { Op int Id string // id widget or id dp. id widget = id dp Data []interface{} }
SystemPld payload
type TableTheme ¶
type TableTheme struct {
Text Style
}
type UpdatingDataProvider ¶
type WidgetTheme ¶
type WidgetTheme struct {
// contains filtered or unexported fields
}
func NewButtonDefaultTheme ¶
func NewButtonDefaultTheme() *WidgetTheme
func NewDefWidgetTheme ¶
func NewDefWidgetTheme() *WidgetTheme
func NewMyDefaultWidgetTheme ¶
func NewMyDefaultWidgetTheme() *WidgetTheme
func (*WidgetTheme) GetBorderStyle ¶
func (wt *WidgetTheme) GetBorderStyle(isActive bool) Style
GetBorderStyle - получить стиль линии обводки
func (*WidgetTheme) GetTitleStyle ¶
func (wt *WidgetTheme) GetTitleStyle(isActive bool) Style
GetTitleStyle - получить стиль заголовка
Source Files ¶
- adaptive_size_type.go
- alignment.go
- backend.go
- block.go
- buffer.go
- canvas.go
- data_provider_dashboard_lib_item_type.go
- data_provider_dashboard_lib_type.go
- data_provider_dashboard_type.go
- data_provider_hlp.go
- data_provider_inf.go
- data_provider_list.go
- data_provider_table.go
- data_provider_text.go
- doc.go
- events.go
- grid.go
- render.go
- style.go
- style_parser.go
- symbols.go
- symbols_converter.go
- symbols_other.go
- theme.go
- utils.go
- utils_formatter.go