fieldview

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FieldView

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

FieldView is a text element. FieldView is used to draw the field's value inside any rectangle

func New

func New(fielder FocusFielder, font *impress.Font, foreground fn.Color) *FieldView

New creates a FieldView

func (*FieldView) Draw

func (v *FieldView) Draw(w *impress.Window, rect image.Rectangle)

Draw draws a view element. Width of rect parameter is used to split a text into sublines

func (*FieldView) LineHeight added in v0.1.5

func (v *FieldView) LineHeight(lineHeight int) *FieldView

LineHeight sets a custom line height

func (*FieldView) MaxRows added in v0.1.5

func (v *FieldView) MaxRows(maxRows int) *FieldView

MaxRows sets a maximum row height

func (*FieldView) Size

func (v *FieldView) Size(size image.Point) image.Point

Size returns size of a view element. Width of size parameter is used to split a text into sublines

func (*FieldView) WithCursor added in v0.1.5

func (v *FieldView) WithCursor(cursor view.Viewer) *FieldView

WithCursor adds a cursor Viewer to draw in cursor position

type FieldWithFocused

type FieldWithFocused struct {
	Fielder
	// contains filtered or unexported fields
}

FieldWithFocused contains a field with focused state func

func WithFocused

func WithFocused(field Fielder, isFocused fn.Bool) *FieldWithFocused

WithFocused returns a FieldWithFocused

func (*FieldWithFocused) Focused

func (m *FieldWithFocused) Focused() bool

Focused returns a focused flag

type Fielder

type Fielder interface {
	Strings() []string
	Cursor() int
}

Fielder is an interface of a field model

type FocusFielder

type FocusFielder interface {
	Fielder
	Focused() bool
}

FocusFielder is an interface of a field model with a focused flag

Jump to

Keyboard shortcuts

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