ui

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DarkMode  = "DarkMode"
	LightMode = "LightMode"
)
View Source
const (
	MaxImageSize = 800
)

Variables

This section is empty.

Functions

This section is empty.

Types

type C

type C = layout.Context

Define some convenient type aliases to make some things more concise.

type ColumnType

type ColumnType int
const (
	HomeColumn ColumnType = iota
	NotificationsColumn
	HashTagColumn
	ListColumn
	UserColumn
	ThreadColumn
	SearchColumn

	RefreshTimeDelta = 10 * time.Second
)

type ComponentState

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

ComponentState wraps the two things any UI component needs to use reactive UI state.

func NewComponentState

func NewComponentState(controller *stream.Controller, backend *mastodon2.MastodonBackend) ComponentState

type ComposeColumn

type ComposeColumn struct {
	ComponentState
	// contains filtered or unexported fields
}

ComposeColumn defines the top-level presentation of your UI.

func NewComposeColumn

func NewComposeColumn(componentState ComponentState, th *ShipdonTheme) *ComposeColumn

NewComposeColumn builds a messageColumns using a controller and backend.

func (*ComposeColumn) Layout

func (p *ComposeColumn) Layout(gtx C) D

Layout builds your UI within the operation list in gtx.

type D

type D = layout.Dimensions

Define some convenient type aliases to make some things more concise.

type DownloadStatus

type DownloadStatus int
const (
	NotProcessed DownloadStatus = iota
	Processing
	Processed
)

type ImageCache

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

Image cache, can be used for avatars of embedded media

func NewImageCache

func NewImageCache() *ImageCache

func (*ImageCache) FlushOldEntries

func (c *ImageCache) FlushOldEntries()

func (*ImageCache) Get

func (c *ImageCache) Get(key string) ImageCacheEntry

Use Lock/UnLock due to updating last used time.

func (*ImageCache) PrintStats added in v0.1.2

func (c *ImageCache) PrintStats()

func (*ImageCache) Set

func (c *ImageCache) Set(key string, entry ImageCacheEntry)

type ImageCacheEntry

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

Modify to be an Widget image cache. See if memory improves. FIXME(kpfaulkner) INVESTIGATE!

type ImageDetails

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

type ImageDownloadDetails

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

type MessageColumn

type MessageColumn struct {
	ComponentState
	// contains filtered or unexported fields
}

MessageColumn defines the top-level presentation of your UI.

func NewMessageColumn

func NewMessageColumn(componentState ComponentState, timelineName string, timelineID string, columnType ColumnType, th *ShipdonTheme) *MessageColumn

NewMessageColumn builds a messageColumns using a controller and backend.

func (*MessageColumn) Layout

func (p *MessageColumn) Layout(gtx C) D

Layout builds your UI within the operation list in gtx.

func (*MessageColumn) PrintStats added in v0.1.2

func (p *MessageColumn) PrintStats()

type ShipdonTheme

type ShipdonTheme struct {
	material.Theme

	LinkColour             color.NRGBA
	IconBackgroundColour   color.NRGBA
	TitleBackgroundColour  color.NRGBA
	StatusBackgroundColour color.NRGBA

	// Actual icon such as reply, star, boost etc when action has been performed (ie the status has been boosted, fav etc)
	IconActiveColour color.NRGBA

	BoostedColour color.NRGBA

	// Similarly icon colour if nothing has been done.
	IconInactiveColour color.NRGBA
}

func GenerateDarkTheme

func GenerateDarkTheme() *ShipdonTheme

func GenerateLightTheme

func GenerateLightTheme() *ShipdonTheme

type StatusState

type StatusState struct {
	ComponentState

	// These fields hold interactive state for the user-manipulable fields of
	// a task.
	Name      richtext.InteractiveText
	NameStyle richtext.TextStyle

	// Description used to indicate boosts or favourites.
	Description      richtext.InteractiveText
	DescriptionStyle richtext.TextStyle

	Details          richtext.InteractiveText
	DetailStyle      richtext.TextStyle
	StatusToggle     widget.Clickable
	ReplyButton      widget.Clickable
	BoostButton      widget.Clickable
	FavouriteButton  widget.Clickable
	ViewThreadButton widget.Clickable

	Avatar widget.Image
	// contains filtered or unexported fields
}

func NewStatusState

func NewStatusState(componentState ComponentState, th *ShipdonTheme) *StatusState

NewStatusState builds an empty state.

type StatusStateCache

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

Image cache, can be used for avatars of embedded media

func NewStatusStateCache

func NewStatusStateCache() *StatusStateCache

func (*StatusStateCache) FlushOldEntries

func (sc *StatusStateCache) FlushOldEntries()

func (*StatusStateCache) Get

Use Lock/UnLock due to updating last used time.

func (*StatusStateCache) Set

func (sc *StatusStateCache) Set(key int64, entry StatusStateCacheEntry)

type StatusStateCacheEntry

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

type StatusStyle

type StatusStyle struct {
	Name    richtext.SpanStyle
	Details richtext.SpanStyle

	Loader material.LoaderStyle
	Error  material.LabelStyle
	// contains filtered or unexported fields
}

StatusStyle defines the presentation of a task.

func NewStatusStyle

func NewStatusStyle(th *material.Theme, state *StatusState) StatusStyle

NewStatusStyle builds the widget style information to display the task with the given state. The style is ephemeral, created and discarded each frame. TODO(kpfaulkner) check if we really need this.

func (StatusStyle) Layout

func (i StatusStyle) Layout(gtx C) D

Layout inserts operations describing this task's UI into the operation list within gtx.

type UI

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

UI defines the state of a single application window's UI.

func NewUI

func NewUI(
	controller *stream.Controller,
	w *app.Window,
	composeColumn *ComposeColumn,
	messageColumns []*MessageColumn,
	backend *mastodon2.MastodonBackend,
	eventListener *events.EventListener,
	cfg *config.Config) *UI

func (*UI) Run

func (u *UI) Run() error

Run executes the window event loop.

Jump to

Keyboard shortcuts

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