ui

package
v0.0.0-...-a6db905 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BackgroundColor = z3.NewSym("background")
View Source
var ButtonColor = z3.NewSym("button")
View Source
var CaretDown = z3.NewSym("down")

zedit caret movement selectors

View Source
var CaretEnd = z3.NewSym("end")
View Source
var CaretHalfPageDown = z3.NewSym("half-page-down")
View Source
var CaretHalfPageUp = z3.NewSym("half-page-up")
View Source
var CaretHome = z3.NewSym("home")
View Source
var CaretLeft = z3.NewSym("left")
View Source
var CaretLineEnd = z3.NewSym("line-end")
View Source
var CaretLineStart = z3.NewSym("line-start")
View Source
var CaretPageDown = z3.NewSym("page-down")
View Source
var CaretPageUp = z3.NewSym("page-up")
View Source
var CaretRight = z3.NewSym("right")
View Source
var CaretUp = z3.NewSym("up")
View Source
var CheckedSym = z3.NewSym("checked")
View Source
var CrosshairCursorSym = z3.NewSym("crosshair")
View Source
var DefaultConfig = Config{
	HyperlinksAllowed:   true,
	CheckHyperlinks:     HyperlinkCheckFunc(func(url *url.URL) *url.URL { return url }),
	WindowsAllowed:      true,
	Prefix:              "",
	ClipboardGetAllowed: true,
	ClipboardSetAllowed: true,
}
View Source
var DefaultCursorSym = z3.NewSym("default")
View Source
var DisabledButtonColor = z3.NewSym("disabled-button")
View Source
var DisabledColor = z3.NewSym("disabled")
View Source
var DisabledSym = z3.NewSym("disabled")
View Source
var DisabledTextColor = z3.NewSym("disabled-text")
View Source
var ErrorColor = z3.NewSym("error")
View Source
var FocusColor = z3.NewSym("focus")
View Source
var ForegroundColor = z3.NewSym("foreground")

theme selectors

View Source
var FyneSym = z3.NewSym("fyne2")
View Source
var GUISym = z3.NewSym("gui")
View Source
var HResizeCursorSym = z3.NewSym("hresize")
View Source
var HoverColor = z3.NewSym("hover")
View Source
var InputBackgroundColor = z3.NewSym("input-background")
View Source
var InputBorderColor = z3.NewSym("input-border")
View Source
var IsQuitSym = z3.NewSym("is-quit")
View Source
var IsSeparatorSym = z3.NewSym("is-separator")
View Source
var Key0 = z3.NewSym("key0")
View Source
var Key1 = z3.NewSym("key1")
View Source
var Key2 = z3.NewSym("key2")
View Source
var Key3 = z3.NewSym("key3")
View Source
var Key4 = z3.NewSym("key4")
View Source
var Key5 = z3.NewSym("key5")
View Source
var Key6 = z3.NewSym("key6")
View Source
var Key7 = z3.NewSym("key7")
View Source
var Key8 = z3.NewSym("key8")
View Source
var Key9 = z3.NewSym("key9")
View Source
var KeyA = z3.NewSym("a")
View Source
var KeyAlt = z3.NewSym("alt")
View Source
var KeyAsterisk = z3.NewSym("asterisk")
View Source
var KeyB = z3.NewSym("b")
View Source
var KeyBackTick = z3.NewSym("back-tick")
View Source
var KeyBackslash = z3.NewSym("backslash")
View Source
var KeyBackspace = z3.NewSym("backspace")
View Source
var KeyC = z3.NewSym("c")
View Source
var KeyComma = z3.NewSym("comma")
View Source
var KeyControl = z3.NewSym("control")
View Source
var KeyD = z3.NewSym("d")
View Source
var KeyDelete = z3.NewSym("delete")
View Source
var KeyDown = z3.NewSym("down")
View Source
var KeyE = z3.NewSym("e")
View Source
var KeyEnd = z3.NewSym("end")
View Source
var KeyEnter = z3.NewSym("enter")
View Source
var KeyEqual = z3.NewSym("equal")
View Source
var KeyEscape = z3.NewSym("escape")

key name symbols, for a more Lispy interface to logical key names

View Source
var KeyF = z3.NewSym("f")
View Source
var KeyF1 = z3.NewSym("f1")
View Source
var KeyF10 = z3.NewSym("f10")
View Source
var KeyF11 = z3.NewSym("f11")
View Source
var KeyF12 = z3.NewSym("f12")
View Source
var KeyF2 = z3.NewSym("f2")
View Source
var KeyF3 = z3.NewSym("f3")
View Source
var KeyF4 = z3.NewSym("f4")
View Source
var KeyF5 = z3.NewSym("f5")
View Source
var KeyF6 = z3.NewSym("f6")
View Source
var KeyF7 = z3.NewSym("f7")
View Source
var KeyF8 = z3.NewSym("f8")
View Source
var KeyF9 = z3.NewSym("f9")
View Source
var KeyG = z3.NewSym("g")
View Source
var KeyH = z3.NewSym("h")
View Source
var KeyHome = z3.NewSym("home")
View Source
var KeyI = z3.NewSym("i")
View Source
var KeyInsert = z3.NewSym("insert")
View Source
var KeyJ = z3.NewSym("j")
View Source
var KeyK = z3.NewSym("k")
View Source
var KeyL = z3.NewSym("l")
View Source
var KeyLeft = z3.NewSym("left")
View Source
var KeyLeftBracket = z3.NewSym("left-bracket")
View Source
var KeyM = z3.NewSym("m")
View Source
var KeyMinus = z3.NewSym("minus")
View Source
var KeyN = z3.NewSym("n")
View Source
var KeyO = z3.NewSym("o")
View Source
var KeyP = z3.NewSym("p")
View Source
var KeyPageDown = z3.NewSym("page-down")
View Source
var KeyPageUp = z3.NewSym("page-up")
View Source
var KeyPeriod = z3.NewSym("dot")
View Source
var KeyPlus = z3.NewSym("plus")
View Source
var KeyQ = z3.NewSym("q")
View Source
var KeyR = z3.NewSym("r")
View Source
var KeyReturn = z3.NewSym("return")
View Source
var KeyRight = z3.NewSym("right")
View Source
var KeyRightBracket = z3.NewSym("right-bracket")
View Source
var KeyS = z3.NewSym("s")
View Source
var KeySemicolon = z3.NewSym("semicolon")
View Source
var KeyShift = z3.NewSym("shift")
View Source
var KeySlash = z3.NewSym("slash")
View Source
var KeySpace = z3.NewSym("space")
View Source
var KeySuper = z3.NewSym("super")
View Source
var KeyT = z3.NewSym("t")
View Source
var KeyTab = z3.NewSym("tab")
View Source
var KeyTick = z3.NewSym("tick")
View Source
var KeyU = z3.NewSym("u")
View Source
var KeyUnknown = z3.NewSym("unknown")
View Source
var KeyUp = z3.NewSym("up")
View Source
var KeyV = z3.NewSym("v")
View Source
var KeyW = z3.NewSym("w")
View Source
var KeyX = z3.NewSym("x")
View Source
var KeyY = z3.NewSym("y")
View Source
var KeyZ = z3.NewSym("z")
View Source
var LoremParagraph = z3.NewSym("paragraph")
View Source
var LoremSentence = z3.NewSym("sentence")
View Source
var LoremWord = z3.NewSym("word")

lorem ipsum selectors for create-lorem-ipsum helper

View Source
var MenuBackgroundColor = z3.NewSym("menu-background")
View Source
var OverlayBackgroundColor = z3.NewSym("overlay-background")
View Source
var PlaceHolderColor = z3.NewSym("place-holder")
View Source
var PointerCursorSym = z3.NewSym("pointer")
View Source
var PressedColor = z3.NewSym("pressed")
View Source
var PrimaryColor = z3.NewSym("primary")
View Source
var RestrictedConfig = Config{
	HyperlinksAllowed:   false,
	CheckHyperlinks:     HyperlinkCheckFunc(func(url *url.URL) *url.URL { panic("hyperlinks are not allowed by security policy!") }),
	WindowsAllowed:      false,
	Prefix:              "",
	ClipboardGetAllowed: false,
	ClipboardSetAllowed: false,
}
View Source
var ScrollBarColor = z3.NewSym("scroll-bar")
View Source
var SelectionColor = z3.NewSym("selection")
View Source
var SeparatorColor = z3.NewSym("separator")
View Source
var ShadowColor = z3.NewSym("shadow")
View Source
var SuccessColor = z3.NewSym("success")
View Source
var TagEvtCaretEnter = z3.NewSym("caret-enter")

zedit tag events

View Source
var TagEvtCaretLeave = z3.NewSym("caret-leave")
View Source
var TagEvtUnknown = z3.NewSym("unknown")
View Source
var TextCursorSym = z3.NewSym("text")
View Source
var TextGridBackgroundColor = z3.NewSym("text-grid-background")
View Source
var TextGridForegroundColor = z3.NewSym("text-grid-foreground")
View Source
var VResizeCursorSym = z3.NewSym("vresize")
View Source
var VersionSym = z3.NewSym("*z3s5-version*")
View Source
var WarningColor = z3.NewSym("warning")
View Source
var WrapBreakSym = z3.NewSym("break")
View Source
var WrapOffSym = z3.NewSym("none")
View Source
var WrapWordSym = z3.NewSym("word")
View Source
var ZeditDrawCaret = z3.NewSym("draw-caret?")
View Source
var ZeditHighlightParenRange = z3.NewSym("highlight-paren-range?")
View Source
var ZeditHighlightParens = z3.NewSym("highlight-parens?")
View Source
var ZeditLineWrap = z3.NewSym("line-wrap?")
View Source
var ZeditShowWhitespace = z3.NewSym("show-whitespace?")
View Source
var ZeditShowlineNumbers = z3.NewSym("show-line-numbers?")

zedit properties

View Source
var ZeditSoftWrap = z3.NewSym("soft-wrap?")

Functions

func CaretMovementSymToCaretMovement

func CaretMovementSymToCaretMovement(caller string, sym *z3.Sym) zedit.CaretMovement

CaretMovementSymToCaretMovement converts a Z3S5 Lisp symbol for the caret movement to a zedit CaretMovement int, panicking if the movement symbol is not supported.

func CharIntervalToList

func CharIntervalToList(interval zedit.CharInterval) *z3.Cell

CharIntervalToList converts a zedit char interval to a Z3S5 list of lists.

func CharPosToList

func CharPosToList(pos zedit.CharPos) *z3.Cell

CharPosToList converts a zedit char position to a Z3S5 list of integers.

func CloseGUI

func CloseGUI()

CloseGUI closes all existing windows and attempts to free existing resources but does not quit the the internal main application, so new windows can be opened again.

func ColorToList

func ColorToList(c color.Color) *z3.Cell

ColorToList converts a Go color.Color to a Z3S5 Lisp list of numbers.

func CursorToSym

func CursorToSym(c desktop.Cursor) *z3.Sym

CursorToSym converts a Fyne desktop.Cursor to a symbol.

func DefGUI

func DefGUI(interp *z3.Interp, config Config)

DefGUI defines the user interface functions. If you want to avoid polluting the namespace, use a config with a custom Prefix. Use DefaultConfig for a maximally permissive default configuration. Various security-sensitive settings such as allowing or disallowing creation of new windows can be adjusted in the Config. If you set these, be sure to also restrict the language using Z3S5 Lisp standard security tools, such as unbinding certain functions and then protecting them and disallowing unprotecting them again.

func DefGUIAdditions

func DefGUIAdditions(interp *z3.Interp) error

DefGUIAdditions defines additional functions from an embedded Lisp source.

func DefGUIHelp

func DefGUIHelp(interp *z3.Interp) error

DefGUIHelp defines the help definitions for the GUI functions.

func FindTextGridParagraphEnd

func FindTextGridParagraphEnd(grid *widget.TextGrid, row int, lf rune) int

FindTextGridParagraphEnd finds the end row of the paragraph in which row is located. If row is the last row, then it is returned. Otherwise, it checks for the next row that ends in lf (which may be the row with which this function was called).

func FindTextGridParagraphStart

func FindTextGridParagraphStart(grid *widget.TextGrid, row int, lf rune) int

FindTextGridParagraphStart finds the start row of the paragraph in which row is located. If the row is 0, 0 is returned, otherwise this checks for the next line ending with lf and returns the row after it.

func GetTextGridParagraph

func GetTextGridParagraph(grid *widget.TextGrid, first, last int) []widget.TextGridCell

GetTextGridParagraph returns the styled text of the paragraph as a list of cells, ignoring any row styles (the caller of this function needs to take care of proper handling of row styles themselves).

func GetZeditConfig

func GetZeditConfig(caller string, z *zedit.Editor, sel any) any

func KeyNameToSymbol

func KeyNameToSymbol(name fyne.KeyName) *z3.Sym

KeyNameToSymbol converts a Fyne key name string to a symbol, as they are used in MustGetShortcut.

func ListToCharInterval

func ListToCharInterval(caller string, li *z3.Cell) zedit.CharInterval

ListToCharInterval converts a Z3S5 Lisp to a zedit char interval, panicking if the list is malformed. The parsing is permissive, if only one char position is given as list, the point interval (pos1...pos1) is returned. (Zedit char intervals are right-end inclusive, so this make sense.)

func ListToCharPos

func ListToCharPos(caller string, li *z3.Cell) zedit.CharPos

ListToCharPos converts a Z3S5 Lisp to a zedit char position, panicking if the list is malformed. The parsing is permissive, a list (n) returns a line number position, (n m) returns a non-line number position, and (n m b) returns a position where b is interpreted as bool.

func ListToColor

func ListToColor(li *z3.Cell) color.Color

ListToColor converts a Z3S5 Lisp color list to a color.

func ListToTextGridCell

func ListToTextGridCell(arg any) widget.TextGridCell

ListToTextGridCell converts a list in the format (rune style-list) to a text grid TextGridCell.

func ListToTextGridStyle

func ListToTextGridStyle(arg any) widget.TextGridStyle

ListToTextGridStyle converts a list in the format returned by TextGridStyleToList back to a Fyne text grid style.

func ListToZeditStyle

func ListToZeditStyle(arg any) zedit.EditorStyle

ListToZeditStyle converts a list of colors to a zedit.EditorStyle used by zedit.Editor.

func MustConvertSymToTextWrap

func MustConvertSymToTextWrap(caller string, sym *z3.Sym) fyne.TextWrap

MustConvertSymToTextWrap converts a symbol to a fyne.TextWrap or panics with an error message.

func MustGetPosition

func MustGetPosition(caller string, argIdx int, a any) (fyne.Position, bool)

MustGetPosition expects a position in argument a at argument index argIdx and returns it, panics if a is not a position list. The argument may be nil, in case of which bool is false.

func MustGetShortcut

func MustGetShortcut(caller string, li *z3.Cell) (fyne.KeyName, fyne.KeyModifier)

MustGetShortcut converts a Z3S5 Lisp list shortcut representations into the key name and modifier of a fyne.KeyShortcut.

func MustGetTextAlign

func MustGetTextAlign(caller string, idx int, a any) (fyne.TextAlign, bool)

MustGetTextAlign returns a text align and true, or nil and false if the alignment specified was Nil.

func MustGetTextStyle

func MustGetTextStyle(caller string, idx int, a any) fyne.TextStyle

MustGetTextStyle turns a list of style symbols into a Fyne text style.

func RunGUI

func RunGUI(id string, onStarted func())

RunGUI initializes the user interface and starts running it. The function blocks until the application is quit, e.g. via ShutDownUI. Since it blocks, the Lisp interpreter must be started in parallel. The onStarted function is called when the application has been started. This can be used for synchronization, for example. The provided ID should be unique if the executable is duplicated.

func SetZeditConfig

func SetZeditConfig(caller string, z *zedit.Editor, sel, prop any)

func ShutDownGUI

func ShutDownGUI()

ShutdownGUI shuts down the user interface. Any attempt to use it afterwards may result in a panic. This should be called before closing the application, e.g. in a defer statement.

func TagEventToTagEventSymbol

func TagEventToTagEventSymbol(evt zedit.TagEvent) *z3.Sym

func TextGridRangeListToRange

func TextGridRangeListToRange(caller string, li *z3.Cell) (int, int, int, int)

TextGridRangeListToRange converts a Z3S5 List containing a range of the form (start-row- start-column end-row end-column) of integers to the integers. end-row and end-column are optional.

func TextGridStyleToList

func TextGridStyleToList(s widget.TextGridStyle) *z3.Cell

TextGridStyleToList converts a text grid style to a Z3S5 Lisp list.

func WordWrapTextGridRows

func WordWrapTextGridRows(rows []widget.TextGridRow, wrapCol int,
	softWrap bool, hardLF, softLF rune, cursorRow, cursorCol int) ([]widget.TextGridRow, int, int)

WordWrapTextGridRows word wraps a number of text grid rows, making sure soft line breaks are adjusted and removed accordingly. The number of rows returned may be larger then the number of rows provided as an argument. The position of the original cursor row and column is returned.

Types

type Config

type Config struct {
	HyperlinksAllowed   bool               // if true, hyperlinks can be created
	CheckHyperlinks     HyperlinkCheckFunc // if set, transform hyperlink URLs during creation
	WindowsAllowed      bool               // is true, windows can be created
	Prefix              string             // a prefix for all identifiers defined (excluding ".")
	ClipboardGetAllowed bool               // allow getting the clipboard content (could be used to monitor for passwords)
	ClipboardSetAllowed bool               // allow setting the clipboard content
}

Config stores the configuration for the GUI, which is global and cannot be changed once set. This is passed to DefUI. Use DefaultConfig for a maximally permissive default configuration.

type HyperlinkCheckFunc

type HyperlinkCheckFunc = func(url *url.URL) *url.URL

used for transforming hyperlink URLs

Jump to

Keyboard shortcuts

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