widget

package
v0.0.0-...-638cd45 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearHighlightRange

func ClearHighlightRange(t *TermGrid, blockMode bool, startRow, startCol, endRow, endCol int)

ClearHighlightRange disables the highlight style for the given range

func GetTextRange

func GetTextRange(t *TermGrid, blockMode bool, startRow, startCol, endRow, endCol int) string

GetTextRange retrieves a text range from the TextGrid. It collects the text within the specified grid coordinates, starting from (startRow, startCol) and ending at (endRow, endCol), and returns it as a string. The behavior of the selection depends on the blockMode parameter. If blockMode is true, then startCol and endCol apply to each row in the range, creating a block selection. If blockMode is false, startCol applies only to the first row, and endCol applies only to the last row, resulting in a continuous range.

Parameters:

  • blockMode: A boolean flag indicating whether to use block mode.
  • startRow: The starting row index of the text range.
  • startCol: The starting column index of the text range.
  • endRow: The ending row index of the text range.
  • endCol: The ending column index of the text range.

Returns:

  • string: The text content within the specified range as a string.

func HighlightRange

func HighlightRange(t *TermGrid, blockMode bool, startRow, startCol, endRow, endCol int, bitmask byte)

HighlightRange highlight options to the given range if highlighting has previously been applied it is enabled

func NewTermTextGridStyle

func NewTermTextGridStyle(fg, bg color.Color, bitmask byte, blinkEnabled bool) widget.TextGridStyle

NewTermTextGridStyle creates a new TextGridStyle with the specified foreground (fg) and background (bg) colors, as well as a bitmask to control the inversion of colors. If fg or bg is nil, the function will use default foreground and background colors from the theme. The bitmask is used to determine which color channels should be inverted.

Parameters:

  • fg: The foreground color.
  • bg: The background color.
  • bitmask: The bitmask to control color inversion.
  • blinkEnabled: Should this cell blink when told to.

Returns:

A pointer to a TermTextGridStyle initialized with the provided colors and inversion settings.

Types

type HighlightOption

type HighlightOption func(h *TermTextGridStyle)

HighlightOption defines a function type that can modify a TermTextGridStyle.

type TermGrid

type TermGrid struct {
	widget.TextGrid
}

TermGrid is a monospaced grid of characters. This is designed to be used by our terminal emulator.

func NewTermGrid

func NewTermGrid() *TermGrid

NewTermGrid creates a new empty TextGrid widget.

func (*TermGrid) CreateRenderer

func (t *TermGrid) CreateRenderer() fyne.WidgetRenderer

CreateRenderer is a private method to Fyne which links this widget to it's renderer

type TermTextGridStyle

type TermTextGridStyle struct {
	OriginalTextColor       color.Color
	OriginalBackgroundColor color.Color
	InvertedTextColor       color.Color
	InvertedBackgroundColor color.Color
	Highlighted             bool
	BlinkEnabled            bool
}

TermTextGridStyle defines a style that can be original or highlighted.

func (*TermTextGridStyle) BackgroundColor

func (h *TermTextGridStyle) BackgroundColor() color.Color

BackgroundColor returns the background color, depending on whether it is highlighted.

func (*TermTextGridStyle) TextColor

func (h *TermTextGridStyle) TextColor() color.Color

TextColor returns the color of the text, depending on whether it is highlighted.

Jump to

Keyboard shortcuts

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