NFLayout

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: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 Load

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

func NewChildren

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

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

func GetLayoutInfo(layout string) (Layout, error)

GetLayoutInfo returns the layout info for the given layout type

func New

func New(layoutType string, children []*NFWidget.Widget, args *NFData.NFInterfaceMap) *Layout

New creates a new layout with the given type and generates a new UUID.

func NewLayout

func NewLayout(layoutType string, children []*NFWidget.Widget, args *NFData.NFInterfaceMap) *Layout

NewLayout creates a new layout with the given type.

func (*Layout) AddChild

func (l *Layout) AddChild(new NFObjects.NFRendered)

func (*Layout) AddFunction

func (l *Layout) AddFunction(new NFObjects.NFObject)

func (*Layout) CheckArgs

func (l *Layout) CheckArgs() error

CheckArgs checks if all required arguments are present in Args. Returns an error if a required argument is missing.

func (*Layout) DeleteByID

func (l *Layout) DeleteByID(ID uuid.UUID, search bool) error

func (*Layout) DeleteChild

func (l *Layout) DeleteChild(childID uuid.UUID, search bool) error

func (*Layout) DeleteFunction

func (l *Layout) DeleteFunction(functionID uuid.UUID, search bool) error

func (*Layout) Export

func (l *Layout) Export() error

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 (l *Layout) FetchChildren(children map[uuid.UUID][]NFObjects.NFObject) int

func (*Layout) FetchChildrenAndFunctions

func (l *Layout) FetchChildrenAndFunctions(childrenAndFunctions map[uuid.UUID][]NFObjects.NFObject) int

func (*Layout) FetchFunctions

func (l *Layout) FetchFunctions(functions map[uuid.UUID][]NFObjects.NFObject) int

func (*Layout) FetchIDs

func (l *Layout) FetchIDs() []uuid.UUID

func (*Layout) GetArgs

func (l *Layout) GetArgs() *NFData.NFInterfaceMap

func (*Layout) GetByID

func (l *Layout) GetByID(ID uuid.UUID) NFObjects.NFObject

func (*Layout) GetChildByID

func (l *Layout) GetChildByID(childID uuid.UUID) NFObjects.NFObject

func (*Layout) GetFunctionByID

func (l *Layout) GetFunctionByID(functionID uuid.UUID) NFObjects.NFObject

func (*Layout) GetFunctions

func (l *Layout) GetFunctions() []NFObjects.NFObject

func (*Layout) GetID

func (l *Layout) GetID() uuid.UUID

func (*Layout) GetName

func (l *Layout) GetName() string

func (*Layout) GetType

func (l *Layout) GetType() string

func (*Layout) MakeId

func (l *Layout) MakeId()

func (*Layout) Parse

func (l *Layout) Parse(window fyne.Window) (fyne.CanvasObject, error)

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)

func (*Layout) SetName

func (l *Layout) SetName(newName string)

func (*Layout) SetType

func (l *Layout) SetType(t string)

func (*Layout) Validate

func (l *Layout) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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