Documentation
¶
Index ¶
- func AssertPosition(registry *BoundWidgetRegistry, id string, ...) string
- func Convert(qml string) (meui.Widget, error)
- func ConvertFile(path string) (meui.Widget, error)
- func CreateWidget(name string) (meui.Widget, error)
- func DumpWidgetTree(widget meui.Widget) string
- func GetRegisteredWidgets() []string
- func GetWidgetPosition(registry *BoundWidgetRegistry, id string) (x, y, w, h float32, found bool)
- func GetWidgetProperties(name string) []string
- func HandleProperty(w meui.Widget, propName string, value interface{}) bool
- func IsValidProperty(widgetType, propName string) bool
- func LoadAndConvert(path string) (meui.Widget, error)
- func Parse(qml string) (meui.Widget, error)
- func RegisterFlowWidget(name string, factory WidgetFactory, flowWrapper func() interface{}, ...)
- func RegisterWidget(name string, factory WidgetFactory, properties []string)
- func SetFlowWrapper(name string, fw func() interface{})
- func ValidateQML(obj *Object) error
- type AnchorJSON
- type BindingContext
- type BoundWidget
- type BoundWidgetRegistry
- func (r *BoundWidgetRegistry) ApplyBindings(ctx *BindingContext)
- func (r *BoundWidgetRegistry) Err() error
- func (r *BoundWidgetRegistry) Get(id string) meui.Widget
- func (r *BoundWidgetRegistry) Inject(model interface{}) error
- func (r *BoundWidgetRegistry) Register(id string, widget interface{})
- func (r *BoundWidgetRegistry) RegisterFlow(id string, fw interface{})
- type Object
- type PropHandler
- type Property
- type QMLResult
- type WidgetEntry
- type WidgetFactory
- type WidgetJSON
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertPosition ¶
func AssertPosition(registry *BoundWidgetRegistry, id string, expectedX, expectedY, expectedW, expectedH float32, tolerance float32) string
AssertPosition checks if a widget is at the expected position (for tests)
func DumpWidgetTree ¶
DumpWidgetTree returns JSON representation of the widget tree with coordinates
func GetRegisteredWidgets ¶
func GetRegisteredWidgets() []string
func GetWidgetPosition ¶
func GetWidgetPosition(registry *BoundWidgetRegistry, id string) (x, y, w, h float32, found bool)
GetWidgetPosition returns the frame rect of a widget by ID from the registry
func GetWidgetProperties ¶
func HandleProperty ¶
HandleProperty dispatches a property to its registered handler. Returns true if the property was handled.
func IsValidProperty ¶
func RegisterFlowWidget ¶
func RegisterFlowWidget(name string, factory WidgetFactory, flowWrapper func() interface{}, properties []string)
RegisterFlowWidget registers a widget with a flow wrapper for reflection-based property setting.
func RegisterWidget ¶
func RegisterWidget(name string, factory WidgetFactory, properties []string)
func SetFlowWrapper ¶
func SetFlowWrapper(name string, fw func() interface{})
SetFlowWrapper attaches a flow wrapper factory to an already-registered widget.
func ValidateQML ¶
Types ¶
type AnchorJSON ¶
type AnchorJSON struct {
Fill string `json:"fill,omitempty"` // parent, or ""
CenterIn string `json:"centerIn,omitempty"` // parent, or ""
Left string `json:"left,omitempty"`
Right string `json:"right,omitempty"`
Top string `json:"top,omitempty"`
Bottom string `json:"bottom,omitempty"`
Margins float32 `json:"margins,omitempty"`
}
AnchorJSON represents anchor settings on a widget
type BindingContext ¶
type BindingContext struct {
// contains filtered or unexported fields
}
func NewBindingContext ¶
func NewBindingContext() *BindingContext
func (*BindingContext) ApplyBindings ¶
func (ctx *BindingContext) ApplyBindings()
func (*BindingContext) RegisterObject ¶
func (ctx *BindingContext) RegisterObject(obj *Object)
func (*BindingContext) ResolveProperty ¶
func (ctx *BindingContext) ResolveProperty(obj *Object, propName string, value interface{}) (interface{}, bool)
type BoundWidget ¶
type BoundWidget interface {
SetBoundProperty(name string, value interface{})
}
BoundWidget interface for widgets that support property bindings
type BoundWidgetRegistry ¶
type BoundWidgetRegistry struct {
// contains filtered or unexported fields
}
func LoadFileResult ¶
func LoadFileResult(path string) (*meui.Panel, *BoundWidgetRegistry, error)
func NewBoundWidgetRegistry ¶
func NewBoundWidgetRegistry() *BoundWidgetRegistry
func (*BoundWidgetRegistry) ApplyBindings ¶
func (r *BoundWidgetRegistry) ApplyBindings(ctx *BindingContext)
func (*BoundWidgetRegistry) Err ¶
func (r *BoundWidgetRegistry) Err() error
Err returns the first duplicate-ID error encountered during Register.
func (*BoundWidgetRegistry) Get ¶
func (r *BoundWidgetRegistry) Get(id string) meui.Widget
Get retrieves a widget by ID from the registry
func (*BoundWidgetRegistry) Inject ¶
func (r *BoundWidgetRegistry) Inject(model interface{}) error
Inject reads qml:"id" struct tags from model and populates fields from the registry. Returns an error if any referenced ID is missing or if a type mismatch occurs.
func (*BoundWidgetRegistry) Register ¶
func (r *BoundWidgetRegistry) Register(id string, widget interface{})
Register stores a widget by QML id. Returns silently on duplicate id but records the error — call Err() after loading to check.
func (*BoundWidgetRegistry) RegisterFlow ¶
func (r *BoundWidgetRegistry) RegisterFlow(id string, fw interface{})
RegisterFlow stores a flow wrapper alongside its widget by the same QML id.
type Object ¶
type PropHandler ¶
PropHandler is a function that applies a QML property to a widget.
type QMLResult ¶
type QMLResult struct {
Widget meui.Widget
Context *BindingContext
Widgets *BoundWidgetRegistry
}
func LoadBundle ¶ added in v0.1.3
LoadBundle reads a scene from a resources bundle, e.g. res://scenes/main.qml. Asset and file references inside the scene stay resource URIs (res://, meui://) and are resolved by the widgets when they load them.
func LoadFS ¶ added in v0.1.3
LoadFS reads a scene from any fs.FS. It does not rewrite references, so a caller that also wants resource-scheme assets should use LoadBundle.
func ParseWithBindings ¶
func ParseWithBindingsFile ¶
ParseWithBindingsFile reads a QML file and returns the full result with registry.
type WidgetEntry ¶
type WidgetEntry struct {
Name string
Factory WidgetFactory
FlowWrapper func() interface{} // returns a flow wrapper struct pointer
Properties []string
}
func GetEntry ¶
func GetEntry(name string) *WidgetEntry
GetEntry returns the WidgetEntry for a given type name.
type WidgetFactory ¶
type WidgetJSON ¶
type WidgetJSON struct {
ID string `json:"id,omitempty"`
Type string `json:"type"`
X float32 `json:"x"`
Y float32 `json:"y"`
Width float32 `json:"width"`
Height float32 `json:"height"`
Debug string `json:"debug,omitempty"`
Anchors *AnchorJSON `json:"anchors,omitempty"`
Children []WidgetJSON `json:"children,omitempty"`
}
WidgetJSON represents a widget in the JSON tree dump
func FindWidgetByID ¶
func FindWidgetByID(tree WidgetJSON, id string) *WidgetJSON
FindWidgetByID searches the JSON tree for a widget by ID