Documentation ¶
Index ¶
- Variables
- func ExportRegistered()
- func Load(path string) (a NFObjects.AssetProperties, err error)
- func NewChildren(children ...*NFWidget.Widget) []*NFWidget.Widget
- func NewLayoutRegister(layoutType string, requiredArgs, optionalArgs *NFData.NFInterfaceMap, ...)
- type Layout
- func (l *Layout) AddChild(new NFObjects.NFRendered)
- func (l *Layout) AddFunction(new NFObjects.NFObject)
- func (l *Layout) CheckArgs() error
- func (l *Layout) DeleteByID(ID uuid.UUID, search bool) error
- func (l *Layout) DeleteChild(childID uuid.UUID, search bool) error
- func (l *Layout) DeleteFunction(functionID uuid.UUID, search bool) error
- func (l *Layout) Export() error
- func (l *Layout) FetchChildren(children map[uuid.UUID][]NFObjects.NFObject) int
- func (l *Layout) FetchChildrenAndFunctions(childrenAndFunctions map[uuid.UUID][]NFObjects.NFObject) int
- func (l *Layout) FetchFunctions(functions map[uuid.UUID][]NFObjects.NFObject) int
- func (l *Layout) FetchIDs() []uuid.UUID
- func (l *Layout) GetArgs() *NFData.NFInterfaceMap
- func (l *Layout) GetByID(ID uuid.UUID) NFObjects.NFObject
- func (l *Layout) GetChildByID(childID uuid.UUID) NFObjects.NFObject
- func (l *Layout) GetFunctionByID(functionID uuid.UUID) NFObjects.NFObject
- func (l *Layout) GetFunctions() []NFObjects.NFObject
- func (l *Layout) GetID() uuid.UUID
- func (l *Layout) GetName() string
- func (l *Layout) GetType() string
- func (l *Layout) MakeId()
- func (l *Layout) Parse(window fyne.Window) (fyne.CanvasObject, error)
- func (l *Layout) Register(handler layoutHandler)
- func (l *Layout) RunAction(action string, window fyne.Window, newValues *NFData.NFInterfaceMap) (*NFData.NFInterfaceMap, error)
- func (l *Layout) RunAllActions(action string, window fyne.Window, newValues *NFData.NFInterfaceMap) (int, []*NFData.NFInterfaceMap, error)
- func (l *Layout) SetArgs(args *NFData.NFInterfaceMap)
- func (l *Layout) SetName(newName string)
- func (l *Layout) SetType(t string)
- func (l *Layout) Validate() error
Constants ¶
This section is empty.
Variables ¶
var ExportPath = "exports/layouts"
ExportPath is the path where the layout will be exported.
Functions ¶
func ExportRegistered ¶
func ExportRegistered()
ExportRegistered exports all registered layouts to json files.
func NewChildren ¶
NewChildren creates a new list of children widgets.
func NewLayoutRegister ¶
func NewLayoutRegister(layoutType string, requiredArgs, optionalArgs *NFData.NFInterfaceMap, handler layoutHandler)
NewLayoutRegister creates a new layout with the given type and registers it.
Types ¶
type Layout ¶
type Layout struct { Name string `json:"Name"` // Name of the layout Type string `json:"Type"` // Type of the layout UUID uuid.UUID `json:"UUID"` // uuid.UUID of the layout Children []*NFWidget.Widget `json:"Widgets"` // List of widgets that are children of the layout Functions []*NFFunction.Function `json:"Functions"` // List of functions that are children of the layout for action based execution SupportedActions []string `json:"-"` RequiredArgs *NFData.NFInterfaceMap `json:"-"` // List of arguments that are required for the layout to run OptionalArgs *NFData.NFInterfaceMap `json:"-"` // List of arguments that are optional for the layout to run Args *NFData.NFInterfaceMap `json:"Args"` // List of arguments that are passed to the layout }
Layout struct holds all the information about a layout.
Layouts are used to define how widgets are placed in a scene.
They contain a list of widgets that are children of the layout.
They also contain a list of arguments that are required for the layout to run.
func GetLayoutInfo ¶
GetLayoutInfo returns the layout info for the given layout type
func (*Layout) AddChild ¶
func (l *Layout) AddChild(new NFObjects.NFRendered)
func (*Layout) AddFunction ¶
func (*Layout) CheckArgs ¶
CheckArgs checks if all required arguments are present in Args. Returns an error if a required argument is missing.
func (*Layout) DeleteFunction ¶
func (*Layout) Export ¶
Export exports the layout to a json file. These files are used in the main editor to determine inputs needed to create the layout in a scene.
func (*Layout) FetchChildren ¶
func (*Layout) FetchChildrenAndFunctions ¶
func (*Layout) FetchFunctions ¶
func (*Layout) GetArgs ¶
func (l *Layout) GetArgs() *NFData.NFInterfaceMap
func (*Layout) GetFunctionByID ¶
func (*Layout) GetFunctions ¶
func (*Layout) Parse ¶
Parse checks if the layout type exists in the registered layouts. If it does, it uses the assigned handler to parse the layout. If it doesn't, it returns an error.
func (*Layout) Register ¶
func (l *Layout) Register(handler layoutHandler)
Register registers a custom layout handler. If the name is already registered, it will not be registered again.
func (*Layout) RunAction ¶
func (l *Layout) RunAction(action string, window fyne.Window, newValues *NFData.NFInterfaceMap) (*NFData.NFInterfaceMap, error)
func (*Layout) RunAllActions ¶
func (l *Layout) RunAllActions(action string, window fyne.Window, newValues *NFData.NFInterfaceMap) (int, []*NFData.NFInterfaceMap, error)
func (*Layout) SetArgs ¶
func (l *Layout) SetArgs(args *NFData.NFInterfaceMap)