editor

package
v0.0.0-...-54b116d Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeEvent

type ChangeEvent struct{}

A ChangeEvent is generated for every user change to the text.

type CommandEvent

type CommandEvent struct {
	Event key.Event
}

A CommandEvent is generated for when moving the cursor and when command keys like enter and arrows-keys is pressed

type DownEvent

type DownEvent struct{}

type Editor

type Editor struct {
	Alignment text.Alignment
	// SingleLine force the text to stay on a single line.
	// SingleLine also sets the scrolling direction to
	// horizontal.
	SingleLine bool
	// Submit enabled translation of carriage return keys to SubmitEvents.
	// If not enabled, carriage returns are inserted as newlines in the text.
	Submit bool
	// contains filtered or unexported fields
}

Editor implements an editable and scrollable text area.

func (*Editor) CaretLine

func (e *Editor) CaretLine()

func (*Editor) Events

func (e *Editor) Events(gtx *layout.Context) []EditorEvent

Events returns available editor events.

func (*Editor) Focus

func (e *Editor) Focus()

Focus requests the input focus for the Editor.

func (*Editor) Layout

func (e *Editor) Layout(gtx *layout.Context, sh *text.Shaper, font text.Font)

Layout lays out the editor.

func (*Editor) LayoutCaret

func (e *Editor) LayoutCaret() (carLine, carCol int, x fixed.Int26_6, y int)

func (*Editor) Len

func (e *Editor) Len() int

Len is the length of the editor contents.

func (*Editor) PaintCaret

func (e *Editor) PaintCaret(gtx *layout.Context)

func (*Editor) PaintText

func (e *Editor) PaintText(gtx *layout.Context)

func (*Editor) SetText

func (e *Editor) SetText(s string)

SetText replaces the contents of the editor.

func (*Editor) Text

func (e *Editor) Text() string

Text returns the contents of the editor.

type EditorEvent

type EditorEvent interface {
	// contains filtered or unexported methods
}

type EditorStyle

type EditorStyle struct {
	Font text.Font
	// Color is the text color.
	Color color.RGBA
	// Hint contains the text displayed when the editor is empty.
	Hint string
	// HintColor is the color of hint text.
	HintColor  color.RGBA
	CaretColor color.RGBA

	Shaper *text.Shaper
}

func (EditorStyle) Layout

func (e EditorStyle) Layout(gtx *layout.Context, editor *Editor)

type Label

type Label struct {
	// Alignment specify the text alignment.
	Alignment text.Alignment
	// MaxLines limits the number of lines. Zero means no limit.
	MaxLines int
}

Label is a widget for laying out and drawing text.

func (Label) Layout

func (l Label) Layout(gtx *layout.Context, s *text.Shaper, font text.Font, txt string)

type Piece

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

type PieceTable

type PieceTable struct {
}

func (PieceTable) Delete

func (pt PieceTable) Delete()

func (PieceTable) Empty

func (pt PieceTable) Empty()

func (PieceTable) Insert

func (pt PieceTable) Insert()

func (PieceTable) ItemAt

func (pt PieceTable) ItemAt()

type SubmitEvent

type SubmitEvent struct{}

type UpEvent

type UpEvent struct{}

Jump to

Keyboard shortcuts

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