input

package
v0.0.0-...-6513b37 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2021 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClampMaxSize   = 1000
	ClampThreshold = ClampMaxSize
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller interface {
	LatestMessageFrom(userID cchat.ID) container.MessageRow
	MessageAuthor(msgID cchat.ID) *message.Author
	Author(authorID cchat.ID) (name rich.LabelStateStorer)

	// SendMessage asynchronously sends the given message.
	SendMessage(msg message.PresendMessage)
}

Controller is an interface to control message containers.

type Field

type Field struct {
	*gtk.Box
	Clamp *handy.Clamp

	// MainBox contains the field box and the attachment container.
	MainBox     *gtk.Box
	Attachments *attachment.Container

	// FieldMainBox contains the username container and the input field. It spans
	// horizontally.
	FieldBox *gtk.Box
	Username *username.Container

	TextScroll *gtk.ScrolledWindow
	// contains filtered or unexported fields
}

func NewField

func NewField(text *gtk.TextView, ctrl Controller, labeler LabelBorrower) *Field

func (*Field) Editable

func (f *Field) Editable(msgID cchat.ID) bool

Editable returns whether or not the input field can be edited.

func (*Field) Reset

func (f *Field) Reset()

Reset prepares the field before SetSender() is called.

func (*Field) SetAllowUpload

func (f *Field) SetAllowUpload(allow bool)

func (*Field) SetMessenger

func (f *Field) SetMessenger(session cchat.Session, messenger cchat.Messenger)

SetMessenger changes the messenger of the input field. If nil, the input will be disabled. Reset() should be called first.

func (*Field) StartEditing

func (f *Field) StartEditing(msgID cchat.ID) bool

func (*Field) StartReplyingTo

func (f *Field) StartReplyingTo(msgID cchat.ID)

func (*Field) StopEditing

func (f *Field) StopEditing() bool

StopEditing cancels the current editing message. It returns a false and does nothing if the editor is not editing anything.

type Files

type Files []attachment.File

Files is a list of attachments.

func (Files) Attachments

func (files Files) Attachments() []cchat.MessageAttachment

Attachments returns the list of files as a list of cchat attachments.

type InputView

type InputView struct {
	*Field
	Completer *completion.Completer
}

func NewView

func NewView(ctrl Controller, labeler LabelBorrower) *InputView

func (*InputView) SetMessenger

func (v *InputView) SetMessenger(session cchat.Session, messenger cchat.Messenger)

type LabelBorrower

type LabelBorrower interface {
	BorrowLabel(markup string)
	Unborrow()
}

LabelBorrower is an interface that allows the caller to borrow a label.

type SendMessageData

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

SendMessageData contains what is to be sent in a message. It behaves similarly to a regular CreateMessage.

func (SendMessageData) AsAttacher

func (s SendMessageData) AsAttacher() cchat.Attacher

func (SendMessageData) AsNoncer

func (s SendMessageData) AsNoncer() cchat.Noncer

func (SendMessageData) AsReplier

func (s SendMessageData) AsReplier() cchat.Replier

func (SendMessageData) Content

func (s SendMessageData) Content() string

func (SendMessageData) Files

func (s SendMessageData) Files() []attachment.File

func (SendMessageData) ID

func (s SendMessageData) ID() string

ID returns a pseudo ID for internal use.

func (SendMessageData) Nonce

func (s SendMessageData) Nonce() string

func (SendMessageData) ReplyingTo

func (s SendMessageData) ReplyingTo() cchat.ID

func (SendMessageData) Time

func (s SendMessageData) Time() time.Time

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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