widget

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSeparator

func NewSeparator(separator string) termio.Widget

NewSeparator constructs a new separator with a given separator character.

Types

type Separator

type Separator struct {
	// contains filtered or unexported fields
}

Separator is intended to be something like a horizontal rule, where the separator character can be specified.

func (*Separator) GetHeight

func (p *Separator) GetHeight() uint

GetHeight of this widget, where MaxUint indicates widget expands to take as much as it can.

func (*Separator) Render

func (p *Separator) Render(canvas termio.Canvas)

Render this widget on the given canvas.

type Table

type Table struct {
	// contains filtered or unexported fields
}

Table is a grid of cells of varying width.

func NewTable

func NewTable(source TableSource) *Table

NewTable constructs a new table with a given source.

func (*Table) GetHeight

func (p *Table) GetHeight() uint

GetHeight of this widget, where MaxUint indicates widget expands to take as much as it can.

func (*Table) Render

func (p *Table) Render(canvas termio.Canvas)

Render this widget on the given canvas.

func (*Table) SetSource

func (p *Table) SetSource(source TableSource)

SetSource sets the table source.

type TableSource

type TableSource interface {
	// Width returns the width of a given column.
	ColumnWidth(col uint) uint
	// Get content of given cell in table.
	CellAt(col, row uint) termio.FormattedText
}

TableSource is an abstraction used by a table to determine what values to put in each cell.

type Tabs

type Tabs struct {
	// contains filtered or unexported fields
}

Tabs is a simple widget which shows a bunch of titles in a bar, and highlights a selected one.

func NewTabs

func NewTabs(tabs ...string) *Tabs

NewTabs constructs a new tabs widget with the given titles.

func (*Tabs) GetHeight

func (p *Tabs) GetHeight() uint

GetHeight of this widget, where MaxUint indicates widget expands to take as much as it can.

func (*Tabs) Render

func (p *Tabs) Render(canvas termio.Canvas)

Render the tabs widget to a given canvas.

func (*Tabs) Select

func (p *Tabs) Select(tab uint)

Select sets the given selected tab. If the index is greater than the available tabs, then it automatically "wraps around".

func (*Tabs) Selected

func (p *Tabs) Selected() uint

Selected returns the currently selected tab.

type TextLine

type TextLine struct {
	// contains filtered or unexported fields
}

TextLine displays a line of formatted text.

func NewText

func NewText() *TextLine

NewText constructs a new text widget which is initially empty.

func (*TextLine) Add

func (p *TextLine) Add(txt termio.FormattedText)

Add a new chunk of formatted text.

func (*TextLine) Clear

func (p *TextLine) Clear()

Clear contents of this text line.

func (*TextLine) GetHeight

func (p *TextLine) GetHeight() uint

GetHeight of this widget, where MaxUint indicates widget expands to take as much as it can.

func (*TextLine) Render

func (p *TextLine) Render(canvas termio.Canvas)

Render the tabs widget to a given canvas.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳