eventlink

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2025 License: MIT Imports: 9 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

type Actor interface {
	// Action performs the main action for the child controller using the provided context and app.
	Action(ctx context.Context, app App)
	// Wait waits for the child controller's action to complete.
	Wait()
}

Actor is an interface for linking and managing a child controller.

type App

type App interface {
	Linker
	AppFramer
}

App is an interface that combines Linker and AppFramer interfaces, providing methods for accessing application methods, a parent event channel, and a parent frame.

func AppWithLink(app AppFramer, linker Linker) App

AppWithLink combines an AppFrame with the specified Linker

type AppFramer

type AppFramer interface {
	Control
	Framer
}

AppFramer is an interface that combines Control and Framer interfaces, providing methods for accessing application methods and the parent frame.

func AppWithFrame

func AppWithFrame(app Control, framer Framer) AppFramer

AppWithFrame combines an AppFrame with a specified Framer

type Control

type Control interface {
	// Application returns the current application instance.
	Application() *impress.Application
	// Cancel cancels a child controller context.
	Cancel()
}

Control is an interface that provides methods for accessing application-level methods.

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

EventLink represents a channel for managing events between the parent and child controllers.

func New

func New() *EventLink

New creates and returns a new EventLink.

func (*EventLink) Actor

func (c *EventLink) Actor() (Actor, bool)

Actor returns the current child controller and a boolean indicating if the child context is still active.

func (*EventLink) Cancel

func (c *EventLink) Cancel()

Cancel cancels the current child context, if one exists.

func (*EventLink) Chan

func (c *EventLink) Chan() <-chan event.Eventer

Chan returns a channel for receiving events intended for the child window controller.

func (*EventLink) Close

func (c *EventLink) Close()

Close cancels the child context and waits for all child goroutines to complete.

func (c *EventLink) Link(parentCtx context.Context, appFramer AppFramer, child Actor)

Link launches the child window controller. Previous child controller context will be cancelled, if one exists.

func (*EventLink) Put

func (c *EventLink) Put(ctx context.Context, ev event.Eventer)

Put sends an event to the child channel if the context has not been canceled.

func (*EventLink) PutInnerPt

func (c *EventLink) PutInnerPt(ctx context.Context, e event.Eventer)

PutInnerPt puts an event into a child event channel. Mouse event coordinates are shifted to match the child frame rectangle

type Framer

type Framer interface {
	// NewWindow creates a new window with the specified rectangle and background color.
	NewWindow(rect image.Rectangle, background color.Color) *impress.Window
	// NewRectFrame creates a new rectangular frame with the specified rectangle.
	NewRectFrame(rect image.Rectangle) *rectframe.RectFrame
	// Rect returns the rectangle representing the frame boundaries.
	Rect() image.Rectangle
	// InnerRect returns the inner rectangle of the frame.
	InnerRect() image.Rectangle
}

Framer is an interface that provides methods for accessing and manipulating the parent frame.

type Linker

type Linker interface {
	// Chan returns a channel for receiving events from the parent event link.
	Chan() <-chan event.Eventer
	// Put sends an event to the child event link if the context is not canceled.
	Put(ctx context.Context, ev event.Eventer)
	// Link links the parent event link with a new child controller.
	Link(ctx context.Context, appFramer AppFramer, actor Actor)
}

Linker is an interface that provides methods for interacting with parent EventLink methods.

type RootApp added in v0.1.10

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

RootApp is wrapper to impress.Application to implement AppFramer interface

func MainApp

func MainApp(a *impress.Application) *RootApp

MainApp creates RootApp from impress.Application

func (*RootApp) Application added in v0.1.10

func (app *RootApp) Application() *impress.Application

Application returns impress.Application

func (*RootApp) Cancel added in v0.1.10

func (app *RootApp) Cancel()

Cancel cancels child context.Context

func (*RootApp) Close added in v0.1.10

func (app *RootApp) Close()

Close closes MainApp resources include impress.Application

func (*RootApp) InnerRect added in v0.1.10

func (app *RootApp) InnerRect() image.Rectangle

Rects returns inner size of main frame

func (*RootApp) NewRectFrame added in v0.1.10

func (app *RootApp) NewRectFrame(rect image.Rectangle) *rectframe.RectFrame

NewRectFrame creates child frame

func (*RootApp) NewWindow added in v0.1.10

func (app *RootApp) NewWindow(rect image.Rectangle, background color.Color) *impress.Window

NewWindow creates child window

func (*RootApp) Rect added in v0.1.10

func (app *RootApp) Rect() image.Rectangle

Rects returns outer size of main frame

func (*RootApp) Run added in v0.1.10

func (app *RootApp) Run(parentCtx context.Context, child Actor)

Run runs child actor

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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