widget

package
Version: v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Animation

type Animation struct {
	anim.Normal

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

Animation maintains animation states per reply.

func (*Animation) Lookup

func (a *Animation) Lookup(r *forest.Reply, s ReplyStatus) *ReplyAnimationState

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

func (a *Animation) Update(gtx layout.Context, r *forest.Reply, s ReplyStatus) *ReplyAnimationState

Update animation state for the given reply.

type Composer

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

	SendButton, CancelButton, PasteButton widget.Clickable
	widget.Editor

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

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

func (Composer) Composing

func (c Composer) Composing() bool

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

func (*Composer) ComposingConversation

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

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

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

func (*Composer) Layout

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

Layout updates the state of the composer

func (*Composer) Reset

func (c *Composer) Reset()

Reset clears the internal state of the composer.

func (*Composer) StartConversation

func (c *Composer) StartConversation()

StartConversation configures the composer to write a new conversation.

func (*Composer) StartReply

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

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

type ComposerEvent

type ComposerEvent uint

ComposerEvent represents a change in the Composer's state

const (
	ComposerSubmitted ComposerEvent = iota
	ComposerCancelled
)

type MessageList

type MessageList struct {
	layout.List
	States
	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
}

type Polyclick

type Polyclick struct {
	Pass 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

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

func (*Polyclick) Layout

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

func (*Polyclick) LongPressed

func (p *Polyclick) LongPressed() bool

type Reply

type Reply struct {
	Hash    *fields.QualifiedHash
	Content string
	Polyclick
}

Reply holds ui state for each reply.

func (*Reply) WithContent

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

func (*Reply) WithHash

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

type ReplyAnimationState

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 ReplyStatus

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
)

type States

type States struct {
	Buffer  []Reply
	Current int
}

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

func (*States) Begin

func (s *States) Begin()

Begin resets the buffer to the start.

func (*States) Next

func (s *States) Next() *Reply

type TextForm

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

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

func (*TextForm) Submitted

func (c *TextForm) Submitted() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to