screen

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// LightModeStyle is a default style for light mode.
	LightModeStyle tcell.Style

	// DarkModeStyle is a default style for dark mode.
	DarkModeStyle tcell.Style

	// GreenStyle is a default style for green text.
	GreenStyle tcell.Style
)

Functions

This section is empty.

Types

type Drawable added in v0.1.6

type Drawable interface {
	// DrawCell draws a cell.
	//
	// Parameters:
	//   - x: The x position of the cell.
	//   - y: The y position of the cell.
	//   - char: The character of the cell.
	//   - style: The style of the cell.
	DrawCell(x, y int, char rune, style tcell.Style)

	// BgStyle returns the background style.
	//
	// Returns:
	//   - tcell.Style: The background style.
	BgStyle() tcell.Style
}

Drawable is an interface that can be drawn.

type Drawer

type Drawer interface {
	// DrawTable draws the table.
	//
	// Parameters:
	//   - bg_style: The background style of the table.
	//
	// Returns:
	//   - *DtTable: The table that was drawn.
	//   - error: An error if the table could not be drawn.
	DrawTable(bg_style tcell.Style) (*dtb.Table, error)
}

Drawer is a table drawer.

type Screen

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

Screen is a screen.

func NewScreen

func NewScreen(bg_style tcell.Style) (*Screen, error)

NewScreen creates a new screen.

Parameters:

  • bg_style: The background style of the screen.

Returns:

  • *Screen: The new screen.
  • error: The error if any.

func (*Screen) Close

func (s *Screen) Close()

Close closes the screen.

func (*Screen) Height added in v0.1.6

func (s *Screen) Height() int

Height returns the height of the screen.

Returns:

  • int: The height of the screen.

func (*Screen) ListenForKey added in v0.1.6

func (s *Screen) ListenForKey() (*tcell.EventKey, bool)

ListenForKey listens for a key press event on the screen.

Parameters:

  • None.

Returns:

  • *tcell.EventKey: The key press event.
  • bool: Whether the channel is still open.

func (*Screen) SetCell added in v0.1.6

func (s *Screen) SetCell(x, y int, c rune, style tcell.Style)

SetCell is a helper function that sets a cell.

Parameters:

  • x: The x position of the cell.
  • y: The y position of the cell.
  • c: The character of the cell.
  • style: The style of the cell.

func (*Screen) Start

func (s *Screen) Start() error

Start starts the screen.

Returns:

  • error: The error if any.

func (*Screen) Width added in v0.1.6

func (s *Screen) Width() int

Width returns the width of the screen.

Returns:

  • int: The width of the screen.

type TextBox added in v0.1.6

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

func NewTextBox added in v0.1.6

func NewTextBox() *TextBox

func (*TextBox) ChangeStyle added in v0.1.6

func (tb *TextBox) ChangeStyle(style tcell.Style) error

func (*TextBox) ChangeText added in v0.1.6

func (tb *TextBox) ChangeText(text string) error

func (TextBox) Draw added in v0.1.6

func (tb TextBox) Draw(screen Drawable, x_coord, y_coord *int) error

Jump to

Keyboard shortcuts

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