screen

package
v0.0.0-...-299fdb3 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DrawBox

func DrawBox(position BufferPosition, size BufferSize, screen tcell.Screen, title BoxTitle)

func DrawBoxWithStyle

func DrawBoxWithStyle(position BufferPosition, size BufferSize, screen tcell.Screen, title BoxTitle, style tcell.Style)

func DrawParagraphInContainer

func DrawParagraphInContainer(screen tcell.Screen, containerX *int, y *int, maxWidth int, text string, style tcell.Style, center bool)

func DrawText

func DrawText(screen tcell.Screen, s string, x *int, y *int, style tcell.Style)

Types

type BoxTitle

type BoxTitle struct {
	Title     string
	Alignment TextAlignment
}

type Buffer

type Buffer interface {
	Draw()
	GetID() int
	SetScreen(tcell.Screen)
	HandleKeyEvent(*tcell.EventKey)
	SetWindow(*Window)
}

type BufferPosition

type BufferPosition struct {
	X int
	Y int
}

type BufferSize

type BufferSize struct {
	Width  int
	Height int
}

type TextAlignment

type TextAlignment string
const (
	TextAlignmentCenter TextAlignment = "center"
	TextAlignmentRight  TextAlignment = "right"
	TextAlignmentLeft   TextAlignment = "left"
)

type Window

type Window struct {
	Screen tcell.Screen
	// contains filtered or unexported fields
}

func NewWindow

func NewWindow() Window

func (*Window) AppendBuffer

func (w *Window) AppendBuffer(b Buffer)

Adds new buffer to the window

Parameters:

  • b: buffer to add

func (Window) Close

func (w Window) Close()

Close the window

func (Window) Draw

func (w Window) Draw() error

func (Window) GetBufferByID

func (w Window) GetBufferByID(id int) Buffer

func (Window) HandleEvents

func (w Window) HandleEvents() bool

Handles tcell screen HandleEvents

Returns:

  • bool: terminate signal received

func (*Window) Init

func (w *Window) Init() error

Initialize the window

Parameters:

  • mainBuffer: The first buffer that window will draw

Returns:

  • error: nil in case of success

func (*Window) RemoveBuffer

func (w *Window) RemoveBuffer(i int)

Removes buffer from window Parameters:

  • b: the buffer to be removed

func (*Window) ReplaceBuffer

func (w *Window) ReplaceBuffer(id int, b Buffer)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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