NFWidget

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

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

Functions

func Register

func Register(name string, handler widgetHandler)

Register adds a custom widget to the customWidgets map

func WidgetExport

func WidgetExport(widget interface{}, widgetType string) error

WidgetExport exports a widget to a json file to allow for use in the editor

Types

type Padding

type Padding struct {
	Top    float32
	Bottom float32
	Left   float32
	Right  float32
}

func NewPadding

func NewPadding(top float32, bottom float32, left float32, right float32) Padding

func (*Padding) Horizontal

func (p *Padding) Horizontal() float32

func (*Padding) Origin

func (p *Padding) Origin(args ...float32) fyne.Position

Origin returns the top left combination of the padding, but it can accept float args to offset the origin

One arg will offset the origin by the arg in the x direction,

Two args will offset the origin by the first arg in the x direction and the second arg in the y direction

Three args will offset the origin by the first arg in the x direction, the second arg in the y direction, and the third added to both

Example: padding.Origin() will return a fyne.Position with the x value of padding.Left and the y value of padding.Top

Example: padding.Origin(10) will return a fyne.Position with the x value of padding.Left+10 and the y value of padding.Top

Example: padding.Origin(10, 20) will return a fyne.Position with the x value of padding.Left+10 and the y value of padding.Top+20

Example: padding.Origin(10, 20, 30) will return a fyne.Position with the x value of padding.Left+10+30 and the y value of padding.Top+20+30

func (*Padding) SetAll

func (p *Padding) SetAll(top, bottom, left, right float32, parent fyne.CanvasObject)

func (*Padding) SetBottom

func (p *Padding) SetBottom(bottom float32, parent fyne.CanvasObject)

func (*Padding) SetHorizontal

func (p *Padding) SetHorizontal(horizontal float32, parent fyne.CanvasObject)

func (*Padding) SetLeft

func (p *Padding) SetLeft(left float32, parent fyne.CanvasObject)

func (*Padding) SetOrigin

func (p *Padding) SetOrigin(x, y float32, parent fyne.CanvasObject)

func (*Padding) SetRight

func (p *Padding) SetRight(right float32, parent fyne.CanvasObject)

func (*Padding) SetTop

func (p *Padding) SetTop(top float32, parent fyne.CanvasObject)

func (*Padding) SetVertical

func (p *Padding) SetVertical(vertical float32, parent fyne.CanvasObject)

func (*Padding) Vertical

func (p *Padding) Vertical() float32

type Sizing

type Sizing struct {
	MinWidth  float32
	MinHeight float32
	MaxWidth  float32
	MaxHeight float32
	FitWidth  bool
	FitHeight bool
}

func NewSizing

func NewSizing(minWidth float32, minHeight float32, maxWidth float32, maxHeight float32, fitWidth bool, fitHeight bool) Sizing

func (*Sizing) SetFitHeight

func (s *Sizing) SetFitHeight(fitHeight bool, parent fyne.CanvasObject)

func (*Sizing) SetFitWidth

func (s *Sizing) SetFitWidth(fitWidth bool, parent fyne.CanvasObject)

func (*Sizing) SetMaxHeight

func (s *Sizing) SetMaxHeight(maxHeight float32, parent fyne.CanvasObject)

func (*Sizing) SetMaxWidth

func (s *Sizing) SetMaxWidth(maxWidth float32, parent fyne.CanvasObject)

func (*Sizing) SetMinHeight

func (s *Sizing) SetMinHeight(minHeight float32, parent fyne.CanvasObject)

func (*Sizing) SetMinWidth

func (s *Sizing) SetMinWidth(minWidth float32, parent fyne.CanvasObject)

type TextStyling

type TextStyling struct {
	fyne.TextStyle
	Wrapping fyne.TextWrap
}

func NewTextStyling

func NewTextStyling() TextStyling

func (*TextStyling) SetBold

func (t *TextStyling) SetBold(bold bool, parent fyne.CanvasObject)

func (*TextStyling) SetItalic

func (t *TextStyling) SetItalic(italic bool, parent fyne.CanvasObject)

func (*TextStyling) SetMonospace

func (t *TextStyling) SetMonospace(monospace bool, parent fyne.CanvasObject)

func (*TextStyling) SetSymbol

func (t *TextStyling) SetSymbol(symbol bool, parent fyne.CanvasObject)

func (*TextStyling) SetTabWidth

func (t *TextStyling) SetTabWidth(tabWidth int, parent fyne.CanvasObject)

type Widget

type Widget struct {
	//ID is the unique ID of the widget for later reference in editing
	ID string `json:"ID"`
	//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"`
	//Properties is a map of properties that are used to parse the widget
	Properties map[string]interface{} `json:"Properties"`
	//JsonSafe is a json safe version of the widget being parsed to allow quick setting of properties; this is not required
	JsonSafe interface{} `json:"JsonSafe"`
}

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

func (Widget) Parse

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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