widget

package
v0.0.0-...-d956aad Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2020 License: Unlicense Imports: 17 Imported by: 0

Documentation

Overview

Package widget implements state tracking and event handling of common user interface controls. To draw widgets, use a theme packages such as package gioui.org/widget/material.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Button

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

func (*Button) Clicked

func (b *Button) Clicked(gtx *layout.Context) bool

func (*Button) History

func (b *Button) History() []Click

func (*Button) Layout

func (b *Button) Layout(gtx *layout.Context)

type ChangeEvent

type ChangeEvent struct{}

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

type CheckBox

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

func (*CheckBox) Checked

func (c *CheckBox) Checked(gtx *layout.Context) bool

func (*CheckBox) Layout

func (c *CheckBox) Layout(gtx *layout.Context)

func (*CheckBox) SetChecked

func (c *CheckBox) SetChecked(value bool)

type Click

type Click struct {
	Position f32.Point
	Time     time.Time
}

Click represents a historic click.

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) Delete

func (e *Editor) Delete(runes int)

Delete runes from the caret position. The sign of runes specifies the direction to delete: positive is forward, negative is backward.

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) Insert

func (e *Editor) Insert(s string)

Insert inserts text at the caret, moving the caret forward.

func (*Editor) Layout

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

Layout lays out the editor.

func (*Editor) Len

func (e *Editor) Len() int

Len is the length of the editor contents.

func (*Editor) Move

func (e *Editor) Move(distance int)

Move the caret: positive distance moves forward, negative distance moves backward.

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 Enum

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

func (*Enum) Layout

func (rg *Enum) Layout(gtx *layout.Context, key string)

Layout adds the event handler for key.

func (*Enum) SetValue

func (rg *Enum) SetValue(value string)

func (*Enum) Value

func (e *Enum) Value(gtx *layout.Context) string

Value processes events and returns the last selected value, or the empty string.

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 SubmitEvent

type SubmitEvent struct {
	Text string
}

A SubmitEvent is generated when Submit is set and a carriage return key is pressed.

Directories

Path Synopsis
Package material implements the Material design.
Package material implements the Material design.

Jump to

Keyboard shortcuts

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