NFWidget

package
v0.0.0-...-ebec9a8 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExportPath = "exports/widgets"

ExportPath is the path where the widget will be exported

View Source
var Widgets = map[string]widgetWithHandler{}

Widgets is a map of all the widgets that are registered and can be used by the engine

Functions

func ExportRegistered

func ExportRegistered()

ExportRegistered exports all registered widgets to json files

func Load

func Load(path string) (a NFObjects.AssetProperties, err error)

func NewAndRegister

func NewAndRegister(widgetType string, requiredArgs, optionalArgs *NFData.NFInterfaceMap, handler widgetHandler)

NewAndRegister creates a new widget with the given type and registers it

Types

type Widget

type Widget struct {
	// Name is the name of the widget for display in the editor
	Name string `json:"Name"`
	// ID is the unique ID of the widget for later reference in editing
	UUID uuid.UUID `json:"UUID"`
	// Type is the type of widget that is used to parse the widget this should be Globally Unique, so when making
	//custom ones prefix it with your package name like "MyPackage.MyWidget"
	Type string `json:"Type"`
	// Children is a list of widgets that are children of this widget
	Children []*Widget `json:"Children"`
	// Functions is a list of functions that are children of this widget for action based execution
	Functions []*NFFunction.Function `json:"Functions"`
	// SupportedActions is a list of actions that the widget supports for action based execution
	SupportedActions []string `json:"-"`
	// RequiredArgs is a list of arguments that are required for the widget to run
	RequiredArgs *NFData.NFInterfaceMap `json:"-"`
	// OptionalArgs is a list of arguments that are optional for the widget to run
	OptionalArgs *NFData.NFInterfaceMap `json:"-"`
	// Args is a list of arguments that are passed to the widget through the scene
	Args *NFData.NFInterfaceMap `json:"Args"`
}

Widget is the struct that holds all the information about a widget

func GetWidgetInfo

func GetWidgetInfo(widget string) (Widget, error)

GetWidgetInfo gets the info of a widget

func New

func New(widgetType string, children []*Widget, args *NFData.NFInterfaceMap) *Widget

New creates a new widget with the given type

func NewChildren

func NewChildren(children ...*Widget) []*Widget

func (*Widget) AddChild

func (w *Widget) AddChild(new NFObjects.NFRendered)

func (*Widget) AddFunction

func (w *Widget) AddFunction(new NFObjects.NFObject)

func (*Widget) CheckArgs

func (w *Widget) CheckArgs() error

func (*Widget) DeleteByID

func (w *Widget) DeleteByID(ID uuid.UUID, search bool) error

func (*Widget) DeleteChild

func (w *Widget) DeleteChild(childID uuid.UUID, search bool) error

func (*Widget) DeleteFunction

func (w *Widget) DeleteFunction(functionID uuid.UUID, search bool) error

func (*Widget) Export

func (w *Widget) Export() error

Export is a function that is used to export the widget to a json file These files are used in the main editor to determine inputs needed to call a widget in a scene

func (*Widget) FetchChildren

func (w *Widget) FetchChildren(children map[uuid.UUID][]NFObjects.NFObject) int

func (*Widget) FetchChildrenAndFunctions

func (w *Widget) FetchChildrenAndFunctions(childrenAndFunctions map[uuid.UUID][]NFObjects.NFObject) int

func (*Widget) FetchFunctions

func (w *Widget) FetchFunctions(functions map[uuid.UUID][]NFObjects.NFObject) int

func (*Widget) FetchIDs

func (w *Widget) FetchIDs() []uuid.UUID

func (*Widget) GetArgs

func (w *Widget) GetArgs() *NFData.NFInterfaceMap

func (*Widget) GetByID

func (w *Widget) GetByID(ID uuid.UUID) NFObjects.NFObject

func (*Widget) GetChildByID

func (w *Widget) GetChildByID(childID uuid.UUID) NFObjects.NFObject

func (*Widget) GetFunctionByID

func (w *Widget) GetFunctionByID(functionID uuid.UUID) NFObjects.NFObject

func (*Widget) GetFunctions

func (w *Widget) GetFunctions() []NFObjects.NFObject

func (*Widget) GetID

func (w *Widget) GetID() uuid.UUID

func (*Widget) GetName

func (w *Widget) GetName() string

func (*Widget) GetType

func (w *Widget) GetType() string

func (*Widget) MakeId

func (w *Widget) MakeId()

func (*Widget) Parse

func (w *Widget) Parse(window fyne.Window) (fyne.CanvasObject, error)

func (*Widget) Register

func (w *Widget) Register(handler widgetHandler)

Register adds a custom widget to the customWidgets map

func (*Widget) RunAction

func (w *Widget) RunAction(action string, window fyne.Window, newValues *NFData.NFInterfaceMap) (*NFData.NFInterfaceMap, error)

func (*Widget) RunAllActions

func (w *Widget) RunAllActions(action string, window fyne.Window, newValues *NFData.NFInterfaceMap) (int, []*NFData.NFInterfaceMap, error)

func (*Widget) SetArgs

func (w *Widget) SetArgs(args *NFData.NFInterfaceMap)

func (*Widget) SetName

func (w *Widget) SetName(newName string)

func (*Widget) SetType

func (w *Widget) SetType(t string)

func (*Widget) Validate

func (w *Widget) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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