Documentation ¶
Index ¶
- Constants
- func CreateAccordion(ctx *errctx.Context, l *Loader, data map[string]interface{}) fyne.CanvasObject
- func CreateButton(ctx *errctx.Context, l *Loader, data map[string]interface{}) fyne.CanvasObject
- func CreateCard(ctx *errctx.Context, l *Loader, data map[string]interface{}) fyne.CanvasObject
- func CreateCheck(ctx *errctx.Context, l *Loader, data map[string]interface{}) fyne.CanvasObject
- func CreateHBox(ctx *errctx.Context, l *Loader, data map[string]interface{}) fyne.CanvasObject
- func CreateHSpacer(ctx *errctx.Context, l *Loader, data map[string]interface{}) fyne.CanvasObject
- func CreateLabel(ctx *errctx.Context, l *Loader, data map[string]interface{}) fyne.CanvasObject
- func CreateRadioGroup(ctx *errctx.Context, l *Loader, data map[string]interface{}) fyne.CanvasObject
- func CreateSlider(ctx *errctx.Context, l *Loader, data map[string]interface{}) fyne.CanvasObject
- func CreateSpacer(ctx *errctx.Context, l *Loader, data map[string]interface{}) fyne.CanvasObject
- func CreateVBox(ctx *errctx.Context, l *Loader, data map[string]interface{}) fyne.CanvasObject
- func CreateVSpacer(ctx *errctx.Context, l *Loader, data map[string]interface{}) fyne.CanvasObject
- func GetButtonAlign(ctx *errctx.Context, data map[string]interface{}) widget.ButtonAlign
- func GetButtonIconPlacement(ctx *errctx.Context, data map[string]interface{}) widget.ButtonIconPlacement
- func GetButtonImportance(ctx *errctx.Context, data map[string]interface{}) widget.ButtonImportance
- func GetFnBoolToVoid(l *Loader, data map[string]interface{}, key string) (func(bool), error)
- func GetFnFloat64ToVoid(l *Loader, data map[string]interface{}, key string) (func(float64), error)
- func GetFnStringToVoid(l *Loader, data map[string]interface{}, key string) (func(string), error)
- func GetFnVoidToVoid(l *Loader, data map[string]interface{}, key string) (func(), error)
- func GetOrientation(ctx *errctx.Context, data map[string]interface{}, defval widget.Orientation) widget.Orientation
- func GetStringEnumAsInt(data map[string]interface{}, key string, allowed []string, values []int, ...) (int, error)
- func GetStringFromArray(data map[string]interface{}, key string, opts []string) (string, error)
- func GetTextAlign(ctx *errctx.Context, data map[string]interface{}) fyne.TextAlign
- func GetTextStyle(ctx *errctx.Context, data map[string]interface{}, key string) fyne.TextStyle
- func GetTextWrap(ctx *errctx.Context, data map[string]interface{}) fyne.TextWrap
- type ArrayIndexOutOfBoundsError
- type ConflictingKeysError
- type ConstError
- type CreateElementFn
- type FunctionTypeError
- type Loader
- func (l *Loader) GetChild(ctx *errctx.Context, data map[string]interface{}) fyne.CanvasObject
- func (l *Loader) GetFunc(name string) (interface{}, error)
- func (l *Loader) GetImage(ctx *errctx.Context, data map[string]interface{}) *canvas.Image
- func (l *Loader) ReadFile(ctx *errctx.Context, path string) (map[string]fyne.CanvasObject, error)
- func (l *Loader) ReadFileJSON(ctx *errctx.Context, path string) (map[string]fyne.CanvasObject, error)
- func (l *Loader) ReadFileYAML(ctx *errctx.Context, path string) (map[string]fyne.CanvasObject, error)
- func (l *Loader) ReadJSON(ctx *errctx.Context, in io.Reader) (map[string]fyne.CanvasObject, error)
- func (l *Loader) ReadYAML(ctx *errctx.Context, in io.Reader) (map[string]fyne.CanvasObject, error)
- func (l *Loader) RegisterElement(name string, fn CreateElementFn)
- func (l *Loader) RegisterFunc(name string, fn interface{}) error
- func (l *Loader) Unmarshal(ctx *errctx.Context, data map[string]interface{}) (map[string]fyne.CanvasObject, error)
- func (l *Loader) Unpack(ctx *errctx.Context, v interface{}) fyne.CanvasObject
- type UndefinedFunctionError
- type UnknownElementType
Constants ¶
const ( KeyAlign = "align" KeyChild = "child" KeyChildren = "children" KeyDisabled = "disabled" KeyFunc = "func" KeyHidden = "hidden" KeyIconPlace = "icon-placement" KeyImageFill = "image-fill" KeyImagePath = "image-path" KeyImageURI = "image-uri" KeyImportance = "importance" KeyItems = "items" KeyMax = "max" KeyMin = "min" KeyMultiOpen = "multi-open" KeyOpen = "open" KeyOptions = "options" KeyOrientation = "orientation" KeyRequired = "required" KeySelected = "selected" KeyStep = "step" KeyStyle = "style" KeySubTitle = "subtitle" KeyText = "text" KeyTitle = "title" KeyType = "type" KeyWrap = "wrap" )
Key constants define the JSON/YAML syntax that the loader accepts.
const ( ValueBreak = "break" ValueCenter = "center" ValueContain = "contain" ValueDefault = "default" ValueHigh = "high" ValueHorizontal = "horizontal" ValueLeading = "leading" ValueLow = "low" ValueMedium = "medium" ValueOff = "off" ValueOriginal = "original" ValueStretch = "stretch" ValueTrailing = "trailing" ValueTruncate = "truncate" ValueVertical = "vertical" ValueWord = "word" )
Value constants define constant values that the loader accepts.
Variables ¶
This section is empty.
Functions ¶
func CreateAccordion ¶
CreateAccordion creates a new Accordion widget.
func CreateButton ¶
CreateButton creates a new button using the data in v.
func CreateCard ¶
CreateCard creates a new Card widget.
func CreateCheck ¶
CreateCheck creates a new Check widget.
func CreateHBox ¶
CreateHBox creates a new HBox container.
func CreateHSpacer ¶
CreateHSpacer creates a new horizontal spacer.
func CreateLabel ¶
CreateLabel creates a new Label.
func CreateRadioGroup ¶
func CreateRadioGroup(ctx *errctx.Context, l *Loader, data map[string]interface{}) fyne.CanvasObject
CreateRadioGroup creates a new RadioGroup widget.
func CreateSlider ¶
CreateSlider creates a new Slider widget.
func CreateSpacer ¶
CreateSpacer creates a new spacer which expands both vertically and horizontally.
func CreateVBox ¶
CreateVBox creates a new HBox container.
func CreateVSpacer ¶
CreateVSpacer creates a new vertical spacer.
func GetButtonAlign ¶
func GetButtonAlign(ctx *errctx.Context, data map[string]interface{}) widget.ButtonAlign
GetButtonAlign fetches and interprets a string from the map as a button alignment.
func GetButtonIconPlacement ¶
func GetButtonIconPlacement(ctx *errctx.Context, data map[string]interface{}) widget.ButtonIconPlacement
GetButtonIconPlacement fetches and interprets a string from the map as a button icon placement value.
func GetButtonImportance ¶
func GetButtonImportance(ctx *errctx.Context, data map[string]interface{}) widget.ButtonImportance
GetButtonImportance fetches and interprets a string from the map as a button importance value.
func GetFnBoolToVoid ¶
GetFnBoolToVoid fetches a func(bool) from the registered functions in the loader.
func GetFnFloat64ToVoid ¶
GetFnFloat64ToVoid fetches a func(float64) from the registered functions in the loader.
func GetFnStringToVoid ¶
GetFnStringToVoid fetches a func(string) from the registered functions in the loader.
func GetFnVoidToVoid ¶
GetFnVoidToVoid fetches a func() from the registered functions in the loader.
func GetOrientation ¶
func GetOrientation(ctx *errctx.Context, data map[string]interface{}, defval widget.Orientation) widget.Orientation
GetOrientation fetches and interprets a string from the map as an orientation value.
func GetStringEnumAsInt ¶
func GetStringEnumAsInt(data map[string]interface{}, key string, allowed []string, values []int, def int) (int, error)
GetStringEnumAsInt fetches a string value from the map and converts it to an integer.
func GetStringFromArray ¶
GetStringFromArray fetches either a string value or an integer value.
If the value is a string, it must be present in the given array.
func GetTextAlign ¶
GetTextAlign fetches and interprets a string from the map as a text alignment.
func GetTextStyle ¶
GetTextStyle fetches and interprets a string from the map as a text style.
func GetTextWrap ¶
GetTextWrap fetches and interprets a string from the map as a text wrap value.
Types ¶
type ArrayIndexOutOfBoundsError ¶
type ArrayIndexOutOfBoundsError struct {
Index int64
}
ArrayIndexOutOfBoundsError is an error indicating that the given index was out of bounds for the source array.
func (ArrayIndexOutOfBoundsError) Error ¶
func (e ArrayIndexOutOfBoundsError) Error() string
type ConflictingKeysError ¶
type ConflictingKeysError struct {
Keys []string
}
ConflictingKeysError is an error which indicates that some keys in the configuration conflict.
func (ConflictingKeysError) Error ¶
func (e ConflictingKeysError) Error() string
type ConstError ¶
type ConstError string
ConstError is a simple constant error type.
const ( // ErrFetchURIDisabled indicates that an image URI was parsed using a // loader with that disabled. ErrFetchURIDisabled ConstError = "loading images from URIs is disabled" // ErrNoWidgetType indicates that an element map did not have a type field. ErrNoWidgetType ConstError = "no type tag on element definition" // ErrUnknownFileExt indicates that a file path did not have a known // extension. ErrUnknownFileExt ConstError = "unknown file extension" // ErrInvalidOption indicates that an option given was not valid. ErrInvalidOption ConstError = "invalid option" )
func (ConstError) Error ¶
func (e ConstError) Error() string
type CreateElementFn ¶
CreateElementFn is the function type used for the element creation callbacks.
type FunctionTypeError ¶
type FunctionTypeError struct {
Func interface{}
}
FunctionTypeError is an error which indicates that a function type did not match any of the allowed types.
func (FunctionTypeError) Error ¶
func (e FunctionTypeError) Error() string
type Loader ¶
type Loader struct { FetchURIs bool // contains filtered or unexported fields }
Loader allows for loading UI definitions at runtime.
func (*Loader) GetChild ¶
GetChild fetches the value for the 'child' key and attempts to unpack it as an element.
func (*Loader) GetFunc ¶
GetFunc returns the function with the given name.
If a function with the given name was not registered, this function will return nil and an error indicating such.
func (*Loader) ReadFileJSON ¶
func (l *Loader) ReadFileJSON(ctx *errctx.Context, path string) (map[string]fyne.CanvasObject, error)
ReadFileJSON reads a file as a JSON definition file.
func (*Loader) ReadFileYAML ¶
func (l *Loader) ReadFileYAML(ctx *errctx.Context, path string) (map[string]fyne.CanvasObject, error)
ReadFileYAML reads a file as a YAML definition file.
func (*Loader) RegisterElement ¶
func (l *Loader) RegisterElement(name string, fn CreateElementFn)
RegisterElement registers a new element callback.
If the function callback is nil and there already exists a callback for the given name, the callback will be removed. This function will replace a callback with no error if a name is repeated.
func (*Loader) RegisterFunc ¶
RegisterFunc registers a new function available for use within generated UI elements.
The type of fn must be a function type; if it is not then the function will return an error. If a name is repeated, the function will be replaced in the set of available functions.
type UndefinedFunctionError ¶
type UndefinedFunctionError struct {
Name string
}
UndefinedFunctionError is an error which indicates that the function with the given name was not registered.
func (UndefinedFunctionError) Error ¶
func (e UndefinedFunctionError) Error() string
type UnknownElementType ¶
type UnknownElementType struct {
TypeName string
}
UnknownElementType is an error which indicates that the element with the given name is unknown.
func (UnknownElementType) Error ¶
func (e UnknownElementType) Error() string