internal

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: MIT, Unlicense, MIT, + 1 more Imports: 3 Imported by: 0

Documentation

Overview

Package internal provides functions/types that should be accessible for the testing backend and for the view but not for any one else. For example the definition of library wrapper wrapping the used aspects of gio or the standard library which need to be mocked.

Index

Constants

View Source
const LibPnc = "view: internal: lib-adaption: unknown signature"

Variables

This section is empty.

Functions

This section is empty.

Types

type GioLiber

type GioLiber interface {

	// Main calls by default app.Main to breath some actual appearance
	// into a NewWindow.
	Main()

	// NewWindow provides the application window defined by the
	// Window-interface.
	NewWindow() Window

	// Adapt replaces the method from the default implementation with
	// given method.
	Adapt(method any)
}

GioLiber abstracts from the implementation of gio's functionality to make it mockable.

func MkGioLib

func MkGioLib() GioLiber

MkGioLib returns a new, adaptable default implementation of Lib.

type Guier

type Guier interface {
	AppendAppOption(app.Option)
	SetSendTimeout(time.Duration)
	Lib() GioLiber
	SetEventHandlerWrapper(func(func()))
	Msg(id int, txt string, aa ...any) Message
	SetIDSeed(int)
}

GUIer abstracts from the view.GUI type in order to setup GUI options also from internal options for testing without making their setting part of the public API: the GUIer interface is internally defined, i.e. by spec not accessible outside of the view package. The public methods are implemented by a private view.GUI wrapper hence also not accessible from the public API.

type Message

type Message interface{}

Message abstracts from view.Message in order to be able to issue messages also from internal options.

type Option

type Option func(Guier) (_ Message, mtx any)

An Option can be pass into GUI.Main to set a GUI's options.

func EventHandlerWrapper

func EventHandlerWrapper(cb func(func())) Option

EventHandlerWrapper provides given callback cb with an function that starts event handling to allow the testing backend more fine grained control when things are happening.

func GioLib

func GioLib(cb func(GioLiber)) Option

GioLib allows to adapt the methods used to access gio's api; provided for test-mocks.

func IDSeed

func IDSeed(value int) Option

IDSeed is an option for internal use by the test-code only. It allows to test for an ID-overflow.

type Window

type Window interface {

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

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

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

Window defines what the view needs from a gio app.Window

Jump to

Keyboard shortcuts

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