widget

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Animation added in v0.0.16

type Animation struct {
	anim.Normal

	Collection map[*fields.QualifiedHash]*ReplyAnimationState
	// contains filtered or unexported fields
}

Animation maintains animation states per reply.

func (*Animation) Lookup added in v0.0.16

Lookup animation state for the given reply. If state doesn't exist, it will be created with using `s` as the beginning status.

func (*Animation) Update added in v0.0.16

Update animation state for the given reply.

type CacheEntry added in v0.0.18

type CacheEntry struct {
	UsedSinceLastFrame bool
	richtext.InteractiveText
}

type Composer added in v0.0.4

type Composer struct {
	CommunityList layout.List
	Community     widget.Enum

	SendButton, CancelButton, PasteButton widget.Clickable
	widget.Editor

	TextState richtext.InteractiveText

	ReplyingTo ds.ReplyData
	// contains filtered or unexported fields
}

Composer holds the state for a widget that creates new arbor nodes.

func (Composer) Composing added in v0.0.15

func (c Composer) Composing() bool

Composing indicates whether the composer is composing a message of any kind.

func (*Composer) ComposingConversation added in v0.0.15

func (c *Composer) ComposingConversation() bool

ComposingConversation returns whether the composer is currently creating a conversation (rather than a new reply within an existing conversation)

func (*Composer) Events added in v0.0.15

func (c *Composer) Events() (out []ComposerEvent)

Events returns state change events for the composer since the last call to events.

func (*Composer) Layout added in v0.0.15

func (c *Composer) Layout(gtx layout.Context) layout.Dimensions

Layout updates the state of the composer

func (Composer) MessageType added in v0.0.22

func (c Composer) MessageType() MessageType

func (Composer) PromptText added in v0.0.22

func (c Composer) PromptText() string

PromptText returns the text prompt for the composer, based off of the message type

func (*Composer) Reset added in v0.0.15

func (c *Composer) Reset()

Reset clears the internal state of the composer.

func (*Composer) StartConversation added in v0.0.15

func (c *Composer) StartConversation()

StartConversation configures the composer to write a new conversation.

func (*Composer) StartReply added in v0.0.15

func (c *Composer) StartReply(to ds.ReplyData)

StartReply configures the composer to write a reply to the provided ReplyData.

type ComposerEvent added in v0.0.15

type ComposerEvent uint

ComposerEvent represents a change in the Composer's state

const (
	ComposerSubmitted ComposerEvent = iota
	ComposerCancelled
)

type MessageList added in v0.0.16

type MessageList struct {
	widget.List

	ReplyStates
	ShouldHide     func(reply ds.ReplyData) bool
	StatusOf       func(reply ds.ReplyData) ReplyStatus
	HiddenChildren func(reply ds.ReplyData) int
	UserIsActive   func(identity *fields.QualifiedHash) bool
	Animation
	// contains filtered or unexported fields
}

func (*MessageList) Events added in v0.0.18

func (m *MessageList) Events() []MessageListEvent

Events returns user interactions with the message list that have occurred since the last call to Events().

func (*MessageList) GetTextState added in v0.0.18

GetTextState returns state storage for a node with the given ID, as well as hint text that should be shown when rendering the given node (if any).

func (*MessageList) Layout added in v0.0.18

func (m *MessageList) Layout(gtx layout.Context) layout.Dimensions

Layout updates the state of the message list each frame.

type MessageListEvent added in v0.0.18

type MessageListEvent struct {
	Type MessageListEventType
	// Data contains event-specific content:
	// - LinkOpened: the hyperlink being opened
	// - LinkLongPressed: the hyperlink that was longpressed
	Data string
}

MessageListEvent describes a user interaction with the message list.

type MessageListEventType added in v0.0.18

type MessageListEventType uint8

MessageListEventType is a kind of message list event.

const (
	LinkOpen MessageListEventType = iota
	LinkLongPress
)

type MessageType added in v0.0.22

type MessageType int32
const (
	MessageTypeNone MessageType = iota
	MessageTypeConversation
	MessageTypeReply
)

type Polyclick added in v0.0.13

type Polyclick struct {
	// The zero value will pass through pointer events by default.
	NoPass bool
	gesture.Click
	// contains filtered or unexported fields
}

Polyclick can detect and report a variety of gesture interactions within a single pointer input area.

func (*Polyclick) Clicks added in v0.0.13

func (p *Polyclick) Clicks() (out []widget.Click)

func (*Polyclick) Layout added in v0.0.13

func (p *Polyclick) Layout(gtx layout.Context) layout.Dimensions

func (*Polyclick) LongPressed added in v0.0.13

func (p *Polyclick) LongPressed() bool

type Reply

type Reply struct {
	Hash    *fields.QualifiedHash
	Content string
	Polyclick
	richtext.InteractiveText
	ReplyStatus
	gesture.Drag
	// contains filtered or unexported fields
}

Reply holds ui state for each reply.

func (*Reply) DragOffset added in v0.0.22

func (r *Reply) DragOffset() float32

DragOffset returns the X-axis offset for this reply as a result of a user dragging it.

func (*Reply) Events added in v0.0.22

func (r *Reply) Events() []ReplyEvent

Events returns reply events that have occurred since the last call to Events.

func (*Reply) Layout added in v0.0.22

func (r *Reply) Layout(gtx layout.Context, replyWidth int) layout.Dimensions

Layout adds the drag operation (using the most recently laid out pointer hit area) and processes drag status.

func (*Reply) WithContent added in v0.0.12

func (r *Reply) WithContent(s string) *Reply

func (*Reply) WithHash added in v0.0.12

func (r *Reply) WithHash(h *fields.QualifiedHash) *Reply

type ReplyAnimationState added in v0.0.16

type ReplyAnimationState struct {
	*anim.Normal
	Begin, End ReplyStatus
}

ReplyAnimationState holds the state of an in-progress animation for a reply. The anim.Normal field defines how far through the animation the node is, and the Begin and End fields define the two states that the node is transitioning between.

type ReplyEvent added in v0.0.22

type ReplyEvent struct {
	Type ReplyEventType
}

ReplyEvent models a change or interaction with a reply.

type ReplyEventType added in v0.0.22

type ReplyEventType uint8

ReplyEventType encodes a kind of event.

const (
	// SwipedRight indicates that a given reply was swiped to the right margin
	// by a user.
	SwipedRight ReplyEventType = iota
)

type ReplyStates added in v0.0.22

type ReplyStates = States[Reply]

type ReplyStatus added in v0.0.16

type ReplyStatus int
const (
	None ReplyStatus = 1 << iota
	Sibling
	Selected
	Ancestor
	Descendant
	ConversationRoot
	// Anchor indicates that this node is visible, but its descendants have been
	// hidden.
	Anchor
	// Hidden indicates that this node is not currently visible.
	Hidden
)

func (ReplyStatus) Contains added in v0.0.22

func (r ReplyStatus) Contains(other ReplyStatus) bool

func (ReplyStatus) String added in v0.0.22

func (r ReplyStatus) String() string

type RichTextCache added in v0.0.18

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

RichTextCache holds rendered richtext state across frames, discarding any state that is not used during a given frame.

func (*RichTextCache) Frame added in v0.0.18

func (r *RichTextCache) Frame()

Frame purges cache entries that haven't been used since the last frame.

func (*RichTextCache) Get added in v0.0.18

Get returns richtext state for the given id if it exists, and allocates a new state in the cache if it doesn't.

type States added in v0.0.16

type States[T any] struct {
	Buffer  []T
	Current int
}

States implements a buffer states such that memory is reused each frame, yet grows as the view expands to hold more values.

func (*States[T]) Begin added in v0.0.16

func (s *States[T]) Begin()

Begin resets the buffer to the start.

func (*States[T]) Next added in v0.0.16

func (s *States[T]) Next() *T

Next returns the next available state to use, growing the underlying buffer if necessary.

type TextForm added in v0.0.9

type TextForm struct {
	TextField    materials.TextField
	SubmitButton widget.Clickable
	PasteButton  widget.Clickable
	// contains filtered or unexported fields
}

TextForm holds the theme-independent state of a simple form that allows a user to provide a single text value and supports pasting. It can be submitted with either the submit button or pressing enter on the keyboard.

func (*TextForm) Layout added in v0.0.9

func (c *TextForm) Layout(gtx layout.Context) layout.Dimensions

func (*TextForm) Submitted added in v0.0.9

func (c *TextForm) Submitted() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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