Documentation
¶
Index ¶
- Variables
- func AbsolutePositionForObject(object core.CanvasObject, trees []core.CanvasObject) geo.Position
- func ClipBoundsForObject(object core.CanvasObject, trees []core.CanvasObject) (geo.Rectangle, bool)
- func FindObjectAtPositionMatching(mouse geo.Position, matches func(object core.CanvasObject) bool, ...) (core.CanvasObject, geo.Position, int)
- func HandleEscape(c core.Canvas) bool
- func IsClip(o core.CanvasObject) bool
- func IsPathClip(o core.CanvasObject) (any, bool)
- func IsRepaintBoundary(o core.CanvasObject) bool
- func IsRoundedClip(o core.CanvasObject) (bool, float32)
- func MoveTabFocus(c TabFocuser, mods event.KeyModifier) bool
- func PopDirectionScope(obj core.CanvasObject)
- func PushDirectionScope(obj core.CanvasObject)
- func ReverseWalkVisibleObjectTree(obj core.CanvasObject, ...) bool
- func TabDirection(focused event.Focusable, mods event.KeyModifier) int
- func WalkCompleteObjectTree(obj core.CanvasObject, ...) bool
- func WalkVisibleObjectTree(obj core.CanvasObject, ...) bool
- type InputPassThrough
- type ObjectAtPosition
- type ScrollConsumer
- type TabFocuser
- type WithContext
Constants ¶
This section is empty.
Variables ¶
NoClipBounds is the open clip rectangle walkObjectTree starts with: an object reached with this clip size has crossed no clipping ancestor.
Functions ¶
func AbsolutePositionForObject ¶
func AbsolutePositionForObject(object core.CanvasObject, trees []core.CanvasObject) geo.Position
AbsolutePositionForObject returns the absolute position of an object in a set of object trees. If the object is not part of any of the trees, the position (0,0) is returned.
func ClipBoundsForObject ¶
func ClipBoundsForObject(object core.CanvasObject, trees []core.CanvasObject) (geo.Rectangle, bool)
ClipBoundsForObject returns the bounds of the nearest clipping ancestor of object within the given trees, in absolute canvas coordinates. ok is false when object is not found, or when no ancestor clips it (it is drawn against the full canvas). A clipping ancestor is one IsClip reports — a event.Scrollable, a bellui.Container with ClipToBounds, or a widget whose renderer clips. It reuses the same clip tracking the hit-test walk uses, so a caller can size content (e.g. a popover) to the region that will actually be visible rather than overflowing into a clipped area.
func FindObjectAtPositionMatching ¶
func FindObjectAtPositionMatching(mouse geo.Position, matches func(object core.CanvasObject) bool, overlays []core.CanvasObject, roots ...core.CanvasObject) (core.CanvasObject, geo.Position, int)
FindObjectAtPositionMatching is used to find an object in a canvas at the specified position. The matches function determines of the type of object that is found at this position is of a suitable type. The various canvas roots and overlays that can be searched are also passed in.
func HandleEscape ¶
HandleEscape gives the Escape key its default meaning — close the innermost pop-up, menu or dialog — and reports whether it consumed the key. Drivers call it before delivering the key press, so a canvas-hosted dialog dismisses even though nothing inside it is focused.
The focused widget gets first refusal through event.EscapeHandler: while a text field is composing, or a cell is being edited in place, Escape belongs to that widget and no overlay closes. Everything else falls through, which is why a focused text field inside a dialog does not trap the user in it.
func IsClip ¶
func IsClip(o core.CanvasObject) bool
func IsPathClip ¶
func IsPathClip(o core.CanvasObject) (any, bool)
IsPathClip checks if a canvas object's renderer implements path-based stencil clipping. Returns the clip path (as any to avoid import cycles) and true if the renderer supports path clipping.
func IsRepaintBoundary ¶
func IsRepaintBoundary(o core.CanvasObject) bool
IsRepaintBoundary checks if a canvas object's renderer implements the RepaintBoundary marker interface, indicating its subtree should be rendered into a cached FBO for dirty-region isolation.
func IsRoundedClip ¶
func IsRoundedClip(o core.CanvasObject) (bool, float32)
IsRoundedClip checks if a canvas object's renderer implements rounded-corner stencil clipping. Returns the corner radius if so.
func MoveTabFocus ¶ added in v1.1.0
func MoveTabFocus(c TabFocuser, mods event.KeyModifier) bool
MoveTabFocus moves c's focus as TabDirection says for a Tab press with mods, and reports whether it did. A press it reports false for belongs to the focused widget or the shortcut path.
func PopDirectionScope ¶
func PopDirectionScope(obj core.CanvasObject)
PopDirectionScope balances PushDirectionScope for obj. A non-scope obj is a no-op.
func PushDirectionScope ¶
func PushDirectionScope(obj core.CanvasObject)
PushDirectionScope pushes obj's ambient layout direction onto the per-goroutine uidir stack when obj is a direction scope, so paint-time text base direction and leading/trailing alignment inside the subtree resolve against the scope rather than the process-global direction. It is the paint-time mirror of the layout hook in common.Canvas.EnsureMinSize and must be balanced by PopDirectionScope in the matching after-children callback. A non-scope obj is a no-op.
func ReverseWalkVisibleObjectTree ¶
func ReverseWalkVisibleObjectTree( obj core.CanvasObject, beforeChildren func(core.CanvasObject, geo.Position, geo.Position, geo.Size) bool, afterChildren func(core.CanvasObject, geo.Position, core.CanvasObject), ) bool
ReverseWalkVisibleObjectTree will walk an object tree in reverse order for all visible objects executing the passed functions following the following rules: - beforeChildren is called for the start obj before traversing its children - the obj's children are traversed by calling walkObjects on each of the visible items - afterChildren is called for the obj after traversing the obj's children The walk can be aborted by returning true in one of the functions:
- if beforeChildren returns true, further traversing is stopped immediately, the after function will not be called for the obj where the walk stopped, however, it will be called for all its parents
func TabDirection ¶ added in v1.1.0
func TabDirection(focused event.Focusable, mods event.KeyModifier) int
TabDirection reports how a Tab key press moves window focus: 1 to the next focusable object, -1 to the previous one, or 0 to leave focus alone so the key reaches the focused widget or the shortcut path.
Plain Tab and Shift+Tab move focus, unless the focused object keeps Tab for itself (an event.Tabbable whose AcceptsTab reports true, such as a multi-line Entry or a DAG canvas). Such an object would otherwise trap a keyboard user, so for it Ctrl+Tab and Ctrl+Shift+Tab move focus instead. On any other object Ctrl+Tab is left alone, so an app can still bind it as a shortcut. Alt and Super never move focus.
func WalkCompleteObjectTree ¶
func WalkCompleteObjectTree( obj core.CanvasObject, beforeChildren func(core.CanvasObject, geo.Position, geo.Position, geo.Size) bool, afterChildren func(core.CanvasObject, geo.Position, core.CanvasObject), ) bool
WalkCompleteObjectTree will walk an object tree for all objects (ignoring visible state) executing the passed functions following the following rules: - beforeChildren is called for the start obj before traversing its children - the obj's children are traversed by calling walkObjects on each of the items - afterChildren is called for the obj after traversing the obj's children The walk can be aborted by returning true in one of the functions:
- if beforeChildren returns true, further traversing is stopped immediately, the after function will not be called for the obj where the walk stopped, however, it will be called for all its parents
func WalkVisibleObjectTree ¶
func WalkVisibleObjectTree( obj core.CanvasObject, beforeChildren func(core.CanvasObject, geo.Position, geo.Position, geo.Size) bool, afterChildren func(core.CanvasObject, geo.Position, core.CanvasObject), ) bool
WalkVisibleObjectTree will walk an object tree for all visible objects executing the passed functions following the following rules: - beforeChildren is called for the start obj before traversing its children - the obj's children are traversed by calling walkObjects on each of the visible items - afterChildren is called for the obj after traversing the obj's children The walk can be aborted by returning true in one of the functions:
- if beforeChildren returns true, further traversing is stopped immediately, the after function will not be called for the obj where the walk stopped, however, it will be called for all its parents
Types ¶
type InputPassThrough ¶
type InputPassThrough interface {
PassesInputThrough() bool
}
InputPassThrough is implemented by overlay roots that must not block input to the content beneath them — a tooltip, not a dialog. When the top overlay reports true, hit-testing falls through to the lower roots wherever the overlay itself has no match at the position.
type ObjectAtPosition ¶
type ObjectAtPosition struct {
Object core.CanvasObject
Position geo.Position
}
ObjectAtPosition holds an object found at a position along with the mouse position relative to it.
func FindAllObjectsAtPositionMatching ¶
func FindAllObjectsAtPositionMatching(mouse geo.Position, matches func(object core.CanvasObject) bool, overlay core.CanvasObject, roots ...core.CanvasObject) []ObjectAtPosition
FindAllObjectsAtPositionMatching is like FindObjectAtPositionMatching but returns ALL matching objects at the position, ordered from deepest (innermost) to shallowest (outermost). This is used for scroll event propagation where the deepest scrollable gets first chance to handle the event, and if it doesn't consume it, the next parent scrollable tries.
type ScrollConsumer ¶
type ScrollConsumer interface {
event.Scrollable
TryScrolled(ev *event.ScrollEvent) bool
}
ScrollConsumer is an optional interface for Scrollable objects that can report whether a scroll event was consumed. If TryScrolled returns false, the scroll event may propagate to a parent scrollable.
type TabFocuser ¶ added in v1.1.0
TabFocuser is the part of a canvas MoveTabFocus needs.
type WithContext ¶
type WithContext interface {
RunWithContext(f func())
RescaleContext()
Context() any
}
WithContext allows drivers to execute within another context. Mostly this helps GLFW code execute within the painter's GL context.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package glfw provides a full Bellui desktop driver that uses the system OpenGL libraries.
|
Package glfw provides a full Bellui desktop driver that uses the system OpenGL libraries. |
|
app
Package app lets you write portable all-Go apps for Android and iOS.
|
Package app lets you write portable all-Go apps for Android and iOS. |
|
event/composition
Package composition defines the IME composition (preedit) event used by the mobile driver to carry input-method composition state from the native platform layer to the focused widget.
|
Package composition defines the IME composition (preedit) event used by the mobile driver to carry input-method composition state from the native platform layer to the focused widget. |
|
event/config
Package config defines the event that reports an in-place configuration change to the mobile driver.
|
Package config defines the event that reports an in-place configuration change to the mobile driver. |
|
event/key
Package key defines an event for physical keyboard keys.
|
Package key defines an event for physical keyboard keys. |
|
event/lifecycle
Package lifecycle defines an event for an app's lifecycle.
|
Package lifecycle defines an event for an app's lifecycle. |
|
event/paint
Package paint defines an event for the app being ready to paint.
|
Package paint defines an event for the app being ready to paint. |
|
event/size
Package size defines an event for the dimensions, physical resolution and orientation of the app's window.
|
Package size defines an event for the dimensions, physical resolution and orientation of the app's window. |
|
event/textedit
Package textedit defines the committed text-edit event used by the mobile driver to carry a native IME/keyboard edit — a range replacement — from the platform layer to the focused editor through the text-input mirror seam (pre-rebrand tracker #771).
|
Package textedit defines the committed text-edit event used by the mobile driver to carry a native IME/keyboard edit — a range replacement — from the platform layer to the focused editor through the text-input mirror seam (pre-rebrand tracker #771). |
|
event/touch
Package touch defines an event for touch input.
|
Package touch defines an event for touch input. |
|
event/undoredo
Package undoredo defines the native undo/redo invocation event used by the mobile driver to carry a platform-initiated undo or redo — the iPad soft keyboard's undo/redo bar keys, the three-finger swipe gestures or shake-to-undo, all of which drive the first responder's NSUndoManager — from the platform layer to the focused editor (pre-rebrand tracker #1134).
|
Package undoredo defines the native undo/redo invocation event used by the mobile driver to carry a platform-initiated undo or redo — the iPad soft keyboard's undo/redo bar keys, the three-finger swipe gestures or shake-to-undo, all of which drive the first responder's NSUndoManager — from the platform layer to the focused editor (pre-rebrand tracker #1134). |
|
gl
Package gl implements Go bindings for OpenGL ES 2.0 and ES 3.0.
|
Package gl implements Go bindings for OpenGL ES 2.0 and ES 3.0. |
|
mobileinit
Package mobileinit contains common initialization logic for mobile platforms that is relevant to both all-Go apps and gobind-based apps.
|
Package mobileinit contains common initialization logic for mobile platforms that is relevant to both all-Go apps and gobind-based apps. |