Interfaces
The core infrastructure that is common and mandatory across nodes is all defined in the Node
and Node2D
interfaces in node.go
and node2d.go
files. These extend the ki.Node
interface and represent somewhat of a departure from the Go philosophy of having many separate mix-n-match interfaces. However, in this case, there is a coherent set of mutually-interdependent methods that must be defined for a node to support the core functions of the GoGi GUI, so it does not make sense to separate these out.
In addition, there several more optional interfaces that are defined, which apply to a specific more narrow domain of functionality, which do make sense to break out. These are as follows:
Label()
method is used to get a GUI-friendly label for any type (e.g., by returning a Name field etc).
for SliceLabeler
it has an idx arg, for given slice index to return label for.
Clipper defines the basic Copy
Cut
and Paste
method interface
DragNDropper defines Drop
and Dragged
methods
Update()
method is called after any type value is changed (e.g., a struct field) from GUI action (e.g., when that type is being viewed by a giv
*View widget).
SetCompleter
method called to set the completion function for a type -- used for complete
tag -- see Tags.
Style() *Style
method returns Style for gui element
Paint() *Paint
method returns Paint for gui element