gui

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2025 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const PncRegisterEnv = "view: backends: bui: env: register: expect settings.Context"

Variables

View Source
var DefaultFont = func() *giorune.Font {
	fc, err := giorune.Embedded.SelectFace(
		"Go Mono", font.WeightSemibold, font.StyleNormal)
	stdlib.PanicOn(err, "gini: vw: gui: cannot select font face")
	return &giorune.Font{
		Face:    fc,
		Size:    15,
		Leading: 30,
	}
}()
View Source
var DefaultGlyphs = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZäöüÄÖÜ"

Functions

func Skip

func Skip(r rune) bool

Skip given rune returns true if given rune is either a utf8.RuneError or not printable. MOTE `for _, r := range string(byte(0xFC))` will cause a rune error while byte(0) will be reported as not printable.

Types

type AppMain

type AppMain func()

AppMain is the signature of a function called by an gui.UI instance's Display method.

type EventFilter

type EventFilter func(...event.Filter) (event.Event, bool)

type EventFilterFactory

type EventFilterFactory func(gioapp.FrameEvent) EventFilter

type RectPainter

type RectPainter func(image.Rectangle, backends.Color)

type RunePainter

type RunePainter func(_ rune, column, row int, _ backends.Layout)

type Setting

type Setting = settingspkg.Setting

func SetFilterFactory

func SetFilterFactory(kr EventFilterFactory) Setting

SetFilterFactory sets the function that maps a frame event to its associated key events allowing to inject mocked key events for testing.

func SetFont

func SetFont(fnt *giorune.Font) Setting

func SetMain

func SetMain(mn AppMain) Setting

SetMain allows to mock up the main-function used by an gui.UI-instances Display method to avoid giving up the main go routine during testing. Otherwise it defaults to app.Main

func SetRectPainter

func SetRectPainter(cb func(RectPainter) RectPainter) Setting

func SetRunePainter

func SetRunePainter(cb func(RunePainter) RunePainter) Setting

func SetWindowFactory

func SetWindowFactory(cb func(WindowFactory) WindowFactory) Setting

SetWindowFactory allows to inject the window constructor used by an gui.UI instance in order to mock up used windows. Otherwise the default func() { return new(app.Window) } is used.

func UnblockDisplay

func UnblockDisplay() Setting

UnblockDisplay closes the blocker which takes effect if UI.Display has called a non-blocking main function. This is useful to clean up tests.

type UI

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

func Apply

func Apply(ui *UI, ss ...Setting) (*UI, error)

Apply given settings ss to given ui instance ui and return ui or fail if one of ss fails. Note ui is created if nil and providing no settings results in a noop.

func Register

func Register(ui *UI, scc *settingspkg.Contexts) *UI

Register given ui at given settings context scc. Register panics if scc already contains an ui. Note ui is create if nil.

func (*UI) Apply added in v0.7.0

func (ui *UI) Apply(rc backends.ReConfig)

Apply reconfigures given ui's behavior according to set ReConfig rc.Instructions.

func (*UI) Cleanup

func (ui *UI) Cleanup()

func (*UI) Display

func (ui *UI) Display() error

func (*UI) Poll

func (ui *UI) Poll() (evt backends.Event)

func (*UI) WaitForPolling

func (ui *UI) WaitForPolling()

WaitForPolling implements backends.UIer.WaitForPolling.

type Window

type Window interface {

	// NextEvent provides the next system event to the event loop.
	Event() gioevent.Event

	// Invalidate issues a new frame event.
	Invalidate()

	// Option sets window options.
	Option(oo ...gioapp.Option)
}

type WindowFactory

type WindowFactory func() Window

WindowFactory used by an gui.UI instance to create its windows.

Jump to

Keyboard shortcuts

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