label

package
v0.0.0-...-8e5a076 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const CursorBlinkInterval = float32(0.5)

Variables

View Source
var DefaultColor = color.White
View Source
var DefaultFont = Font{
	Name: "fonts/SourceSansPro-Regular.ttf",
	Size: 16,
}
View Source
var DefaultLineHeight = Pct(100)
View Source
var DefaultStyle = &Style{
	Font:       DefaultFont,
	LineHeight: DefaultLineHeight,
	Color:      DefaultColor,
}

Functions

func New

func New(key string, props Props) node.T

Types

type ChangeCallback

type ChangeCallback func(string)

type Hover

type Hover struct {
	Color ColorProp
}

func (*Hover) Apply

func (style *Hover) Apply(w T)

type Props

type Props struct {
	Style    Style
	Text     string
	OnChange ChangeCallback
	OnBlur   func()

	OnMouseUp   mouse.Callback
	OnMouseDown mouse.Callback
	OnKeyUp     keys.Callback
	OnKeyDown   keys.Callback
	OnKeyChar   keys.Callback
}

type Style

type Style struct {
	Extends *Style
	Hover   Hover

	Hidden     bool
	Font       FontProp
	Color      ColorProp
	LineHeight LineHeightProp

	Width     WidthProp
	MaxWidth  MaxWidthProp
	Height    HeightProp
	MaxHeight MaxHeightProp

	Basis  BasisProp
	Grow   FlexGrowProp
	Shrink FlexShrinkProp
}

func (*Style) Apply

func (style *Style) Apply(w T, state State)

func (*Style) Extend

func (s *Style) Extend(e Style) Style

type T

type T interface {
	widget.T
	style.FontWidget
	keys.Handler

	Text() string
	Cursor() int
}

type Text

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

func NewText

func NewText(text string) *Text
func (t *Text) Blink() bool

func (*Text) Clear

func (t *Text) Clear() bool

func (*Text) CursorLeft

func (t *Text) CursorLeft()

func (*Text) CursorRight

func (t *Text) CursorRight()

func (*Text) DeleteBackward

func (t *Text) DeleteBackward() bool

func (*Text) DeleteForward

func (t *Text) DeleteForward() bool

func (*Text) DeleteSelection

func (t *Text) DeleteSelection() bool

func (*Text) Deselect

func (t *Text) Deselect()

func (*Text) HasSelection

func (t *Text) HasSelection() bool

func (*Text) Insert

func (t *Text) Insert(text string)
func (t *Text) ResetBlink()

func (*Text) SelectLeft

func (t *Text) SelectLeft()

func (*Text) SelectRight

func (t *Text) SelectRight()

func (*Text) SelectedRange

func (t *Text) SelectedRange() (start, end int)

func (*Text) Selection

func (t *Text) Selection() string

func (*Text) SetCursor

func (t *Text) SetCursor(cursor int)

func (*Text) SetText

func (t *Text) SetText(text string)

func (*Text) Slice

func (t *Text) Slice(i, j int) string

func (*Text) String

func (t *Text) String() string
func (t *Text) UpdateBlink(delta float32)

Jump to

Keyboard shortcuts

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