Type Attachment

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

Attachment is one optional full-surface trigger around attachment content.

Constructors

BeginAttachment#

func BeginAttachment(canvas *ui.Canvas, theme ui.Theme, id ui.ID, bounds ui.Rect, data AttachmentData) Attachment

BeginAttachment starts an attachment declaration. ID 0 paints static content. A bounds width or height of zero means the attachment's natural size (see Size), at the bounds origin.

Methods

Action#

func (attachment Attachment) Action(action AttachmentAction) Attachment

Action adds an icon button, up to three, in the order given: at the end of a horizontal attachment, in the top right corner of a vertical one. The action has its own hit above the attachment's, so declare the attachment with an ID if the whole card should also be pressable.

Disabled#

func (attachment Attachment) Disabled() Attachment

Disabled makes the trigger inert without changing the attachment state.

Paint#

func (attachment Attachment) Paint()

Paint emits state, size, orientation, media, content, and trigger commands. Uploading and processing show a dimmed title, and an uploading attachment its progress bar; neither runs a hidden animation worker.

PaintIn#

func (attachment Attachment) PaintIn(group *AttachmentGroup)

PaintIn paints the attachment at its natural size in the next free slot of a group.

Size#

func (attachment Attachment) Size() ui.Size

Size is the attachment's natural size: as wide as its text, media and actions need but at least the official minimum width (a vertical attachment is a fixed width), and as tall as its media or text.