app

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package app wires the view tree to a backend Screen and runs the main event loop: read events, dispatch them down the tree, draw, flush. v0.1 hosts an Application with a MenuBar, Desktop, and StatusLine and quits on Alt-X or the CmdQuit broadcast.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	*view.Group
	// contains filtered or unexported fields
}

Application is the root Group of the view tree. It holds the screen, the composition surface, and the channels that feed the main loop.

func New

func New(screen vio.Screen) *Application

New constructs an Application backed by screen. It sizes itself to the screen, attaches the standard MenuBar/Desktop/StatusLine triplet, and installs the BorlandClassic palette.

func (*Application) Desktop

func (a *Application) Desktop() *Desktop

Desktop returns the desktop child for tests and host applications that want to insert windows into it.

func (*Application) Finished

func (a *Application) Finished() <-chan struct{}

Finished returns a channel that is closed when Run exits.

func (*Application) MenuBar

func (a *Application) MenuBar() *menu.Bar

MenuBar returns the menu bar child.

func (*Application) PutEvent

func (a *Application) PutEvent(e event.Event)

PutEvent posts an event into the application from any goroutine. It is the only thread-safe entry point into the UI; everything else expects to run on the main loop goroutine.

func (*Application) Quit

func (a *Application) Quit()

Quit asks the loop to stop after the current iteration.

func (*Application) Run

func (a *Application) Run() error

Run drives the event loop until Quit is called or the screen channel closes. It returns the error returned by Screen.Show, or nil.

func (*Application) StatusLine

func (a *Application) StatusLine() *menu.Line

StatusLine returns the status line child.

func (*Application) Surface

func (a *Application) Surface() *vio.Surface

Surface returns the composition surface, primarily for tests.

type Background

type Background struct {
	*view.View

	Pattern rune
}

Background is the dotted-fill view that shows behind every window. It is the visual layer of the desktop: the recognizable Borland blue speckle.

func NewBackground

func NewBackground(r vio.Rect, pattern rune) *Background

NewBackground returns a Background sized to r, drawing pattern as its fill rune. Pass 0 for the Turbo Vision default (a light shade block).

func (*Background) Draw

func (b *Background) Draw(s *vio.Surface)

Draw fills the bounds with the desktop pattern in the desktop color.

type Desktop

type Desktop struct {
	*view.Group
	// contains filtered or unexported fields
}

Desktop is the Group that hosts windows. It owns a Background child that fills its bounds and stays behind every other child.

func NewDesktop

func NewDesktop(r vio.Rect) *Desktop

NewDesktop returns an empty desktop sized to r, with the standard dotted background already attached.

func (*Desktop) HandleEvent

func (d *Desktop) HandleEvent(e *event.Event)

HandleEvent forwards the event to the standard Group dispatch. The desktop itself does not consume any events in v0.1; it is a pure container.

Jump to

Keyboard shortcuts

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