view

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAutomationIDRequired is returned when an automation action is attempted without an id.
	ErrAutomationIDRequired = errors.New("automation id is required")
	// ErrAutomationNodeNotFound is returned when no registered view has the requested id.
	ErrAutomationNodeNotFound = errors.New("automation node not found")
	// ErrAutomationActionUnsupported is returned when the target view does not expose the requested action.
	ErrAutomationActionUnsupported = errors.New("automation action unsupported")
)

Functions

func AutomationClick

func AutomationClick(id string) error

func AutomationSetText

func AutomationSetText(id, text string) error

func AutomationUnregisterPrefix

func AutomationUnregisterPrefix(prefix string)

Types

type AutomationBounds

type AutomationBounds struct {
	X      int `json:"x"`
	Y      int `json:"y"`
	Width  int `json:"width"`
	Height int `json:"height"`
}

AutomationBounds describes a view's current FLTK bounds.

type AutomationNode

type AutomationNode struct {
	ID         string            `json:"id,omitempty"`
	Role       string            `json:"role,omitempty"`
	Name       string            `json:"name,omitempty"`
	Label      string            `json:"label,omitempty"`
	Text       string            `json:"text,omitempty"`
	Value      string            `json:"value,omitempty"`
	Actions    []string          `json:"actions,omitempty"`
	Enabled    bool              `json:"enabled"`
	Visible    bool              `json:"visible"`
	Bounds     AutomationBounds  `json:"bounds"`
	Properties map[string]string `json:"properties,omitempty"`
	Children   []AutomationNode  `json:"children,omitempty"`
}

AutomationNode is a serializable snapshot of a registered UIView.

func AutomationSnapshot

func AutomationSnapshot() []AutomationNode

type Container

type Container interface {
	Add(w fltk_bridge.Widget)
	Remove(w fltk_bridge.Widget)
}

Container:任何能容纳子控件的对象(Window/Group) 你 fltk_bridge.Window 继承了 Group,天然满足 Add/Remove

type UIView

type UIView struct {
	// contains filtered or unexported fields
}

UIView:UIKit 风格的基础 View raw:底层 FLTK widget(Box/Button/Group/Window 都是 Widget) host:父容器(Window 或 Group)

func AutomationLookup

func AutomationLookup(id string) (*UIView, bool)

func (*UIView) AddAutomationChild

func (v *UIView) AddAutomationChild(child Viewable) *UIView

func (*UIView) AddSubview

func (v *UIView) AddSubview(child Viewable)

AddSubview:iOS 语义。如果当前 view 本身是容器,则将 child 添加到当前 view 中; 否则,退回到将 child 添加到当前 view 的父容器中(虽然不推荐,但兼容旧逻辑)。

func (*UIView) AutomationID

func (v *UIView) AutomationID() string

func (*UIView) AutomationName

func (v *UIView) AutomationName() string

func (*UIView) AutomationRole

func (v *UIView) AutomationRole() string

func (*UIView) AutomationSnapshot

func (v *UIView) AutomationSnapshot() AutomationNode

func (*UIView) BindHost

func (v *UIView) BindHost(host Container)

BindHost:框架内部使用,为 view 绑定父容器

func (*UIView) BindRaw

func (v *UIView) BindRaw(raw fltk_bridge.Widget)

BindRaw:框架内部使用,为 view 绑定底层 widget

func (*UIView) ClearAutomationChildren

func (v *UIView) ClearAutomationChildren() *UIView

func (*UIView) ObserveSuperviewChanges added in v0.0.25

func (v *UIView) ObserveSuperviewChanges(observer func(Container, Container)) func()

ObserveSuperviewChanges observes logical UIKit ownership changes. The returned function unregisters the observer.

func (*UIView) On

func (v *UIView) On(event fltk_bridge.Event, handler func(fltk_bridge.Event) bool)

On 绑定闭包事件流

func (*UIView) OnAutomationClick

func (v *UIView) OnAutomationClick(handler func() error) *UIView

func (*UIView) Raw

func (v *UIView) Raw() fltk_bridge.Widget

func (*UIView) RemoveAutomationChild added in v0.0.25

func (v *UIView) RemoveAutomationChild(child Viewable) *UIView

RemoveAutomationChild removes one child from the semantic automation tree.

func (*UIView) RemoveFromSuperview

func (v *UIView) RemoveFromSuperview()

RemoveFromSuperview removes the view's raw widget from its current host.

func (*UIView) SetAutomationID

func (v *UIView) SetAutomationID(id string) *UIView

SetAutomationID assigns a stable automation id and registers the view for debug automation.

func (*UIView) SetAutomationName

func (v *UIView) SetAutomationName(name string) *UIView

func (*UIView) SetAutomationProperty

func (v *UIView) SetAutomationProperty(key, value string) *UIView

func (*UIView) SetAutomationRole

func (v *UIView) SetAutomationRole(role string) *UIView

func (*UIView) SetAutomationTextHandlers

func (v *UIView) SetAutomationTextHandlers(set func(string) error, get func() (string, bool)) *UIView

func (*UIView) SetAutomationValueHandler

func (v *UIView) SetAutomationValueHandler(get func() (string, bool)) *UIView

func (*UIView) Superview

func (v *UIView) Superview() Container

Superview returns the container currently hosting this view, if any.

func (*UIView) View

func (v *UIView) View() *UIView

type Viewable

type Viewable interface {
	View() *UIView
}

Viewable:UIKit 风格,“能提供 UIView 的对象”

Jump to

Keyboard shortcuts

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