gxui

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Package gxui contains wrappers to make the gxui library act like a (git.sr.ht/~nelsam/vidar-lib/ui).Creator. This is provided as the default user interface in vidar, but *should* be overrideable.

Index

Constants

View Source
const (
	ErrNoKeyHandler = constant.Error("gxui: no KeyHandler was provided to Creator.Window()")
	ErrNotControl   = constant.Error("gxui: element is not a gxui.Control")
)
View Source
const TextMetaKey = "vidar|edit-applier"

Variables

This section is empty.

Functions

func New

Types

type Clipboard

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

func (*Clipboard) Primary

func (c *Clipboard) Primary(context.Context) ([]rune, error)

func (*Clipboard) SetPrimary

func (c *Clipboard) SetPrimary(_ context.Context, clip []rune) error

type Creator

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

func (*Creator) Clipboard

func (c *Creator) Clipboard(context.Context) (ui.Clipboard, error)

func (*Creator) Image

func (c *Creator) Image(_ context.Context, i image.Image) (any, error)

func (*Creator) KeyName

func (c *Creator) KeyName(_ context.Context, k input.Key) string

func (*Creator) Label

func (c *Creator) Label(context.Context) (ui.Label, error)

func (*Creator) Layout

func (c *Creator) Layout(_ context.Context, opts ...ui.LayoutOpt) (ui.Layout, error)

func (*Creator) Quit

func (c *Creator) Quit(context.Context) error

func (*Creator) Run

func (c *Creator) Run(ctx context.Context, f func(context.Context))

func (*Creator) Start

func (c *Creator) Start(ctx context.Context, f func(context.Context))

func (*Creator) State

func (c *Creator) State(context.Context) (ui.State, error)

func (*Creator) TextBox

func (c *Creator) TextBox(_ context.Context, opts ...ui.TextBoxOpt) (ui.TextBox, error)

TODO: split up a simple text input and a full blown editor.

func (*Creator) Window

func (c *Creator) Window(ctx context.Context, title string, opts ...ui.WindowOpt) (ui.Window, error)

type Editor

type Editor struct {
	mixins.CodeEditor
	// contains filtered or unexported fields
}

func (*Editor) CreateSuggestionList

func (e *Editor) CreateSuggestionList() gxui.List

func (*Editor) DesiredSize

func (e *Editor) DesiredSize(min, max math.Size) math.Size

func (*Editor) KeyPress

func (e *Editor) KeyPress(gxui.KeyboardEvent) bool

func (*Editor) KeyStroke

func (e *Editor) KeyStroke(gxui.KeyStrokeEvent) bool

func (*Editor) Name

func (e *Editor) Name() string

func (*Editor) Paint

func (e *Editor) Paint(c gxui.Canvas)

func (*Editor) Scroll

func (e *Editor) Scroll(ctx context.Context, typ ui.ScrollType, pos int) error

func (*Editor) SetSelections

func (e *Editor) SetSelections(_ context.Context, primary caret.Selection, secondary ...caret.Selection) error

func (*Editor) SetText

func (e *Editor) SetText(ctx context.Context, spans ...ui.Span) error

func (*Editor) Visible

func (e *Editor) Visible(ctx context.Context) ui.Box

type InputBox

type InputBox struct {
	mixins.TextBox
	// contains filtered or unexported fields
}

func (*InputBox) DesiredSize

func (b *InputBox) DesiredSize(min, max math.Size) math.Size

func (*InputBox) KeyPress

func (b *InputBox) KeyPress(gxui.KeyboardEvent) bool

func (*InputBox) KeyStroke

func (b *InputBox) KeyStroke(gxui.KeyStrokeEvent) bool

func (*InputBox) Paint

func (b *InputBox) Paint(c gxui.Canvas)

func (*InputBox) Scroll

func (b *InputBox) Scroll(ctx context.Context, typ ui.ScrollType, pos int) error

func (*InputBox) SetSelections

func (b *InputBox) SetSelections(_ context.Context, primary caret.Selection, secondary ...caret.Selection) error

func (*InputBox) SetText

func (b *InputBox) SetText(_ context.Context, spans ...ui.Span) error

func (*InputBox) Visible

func (b *InputBox) Visible(ctx context.Context) ui.Box

type Label

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

func (*Label) SetText

func (l *Label) SetText(ctx context.Context, spans ...ui.Span) error

type PanelHolder

type PanelHolder interface {
	gxui.PanelHolder
	SelectedPanel() gxui.Control
}

type State

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

func NewState

func NewState() *State

func (*State) Focused

func (s *State) Focused(context.Context) (ui.Window, error)

func (*State) Wait

func (s *State) Wait(context.Context) error

type TextMeta added in v0.6.3

type TextMeta interface {
	Lines(context.Context) int
	LineTabs(context.Context, int) int
	LineChars(context.Context, int) int
}

Jump to

Keyboard shortcuts

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