Documentation
¶
Index ¶
- func AncestorsOfObject(c core.Canvas, obj core.CanvasObject) ([]core.CanvasObject, bool)
- func ClipBoundsForObject(c core.Canvas, obj core.CanvasObject) (geo.Rectangle, bool)
- func ObjectAtPosition(c core.Canvas, pos geo.Position) (core.CanvasObject, geo.Rectangle, bool)
- func ObjectAtPositionMatching(c core.Canvas, pos geo.Position, matches func(core.CanvasObject) bool) (core.CanvasObject, geo.Rectangle, bool)
- func RunNative(fn func(any) error) error
- type AndroidContext
- type AndroidWindowContext
- type MacWindowContext
- type NativeWindow
- type UnknownContext
- type WaylandWindowContext
- type WindowsWindowContext
- type X11WindowContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AncestorsOfObject ¶
func AncestorsOfObject(c core.Canvas, obj core.CanvasObject) ([]core.CanvasObject, bool)
AncestorsOfObject returns the chain of visible objects from a canvas root down to obj (inclusive): the first element is the canvas root that contains obj (its content or an overlay), the last element is obj itself, and every element in between is a nesting container or widget between them. ok is false when obj is not found in the canvas tree (not present, or not visible).
It is the top-down companion to ObjectAtPosition (a click → object), letting tooling answer "what encloses this object?" — e.g. testing whether any ancestor is an opt-out wrapper — reusing the same visible-tree walk the painter and hit-test use, so it descends both containers and widget-renderer internals.
Since: 2.10
func ClipBoundsForObject ¶
ClipBoundsForObject returns the bounds of the nearest clipping ancestor of obj within canvas c, in absolute canvas coordinates, with ok=true when obj is clipped. When obj is drawn against the full canvas (no clipping ancestor) ok is false.
A clipping ancestor is one a scroll container (or any [event.Scrollable]), a [bellui.Container] with ClipToBounds, or a clipping widget introduces. It is useful for sizing floating content — a popover, completion list or tooltip — to the region that will actually be visible, instead of overflowing into an area an ancestor scroll then clips.
Since: 2.10
func ObjectAtPosition ¶
ObjectAtPosition returns the deepest visible object at pos within canvas c, together with its absolute bounds in canvas coordinates. ok is false when no object is hit.
It uses the same hit-test the toolkit uses for tap dispatch: overlays are searched top-down before the content, and an input-pass-through overlay (a tooltip, Toast or Snackbar) does not block objects beneath it. This is the "pick" primitive behind the #540 widget inspector, exposed for tooling that maps a click back to the object that produced it (e.g. a design tool's pick-to-source).
To go the other way — highlight a known object — take its bounds from ObjectAtPosition here or compose [bellui.Driver.AbsolutePositionForObject] with the object's size.
Since: 2.10
func ObjectAtPositionMatching ¶
func ObjectAtPositionMatching(c core.Canvas, pos geo.Position, matches func(core.CanvasObject) bool) (core.CanvasObject, geo.Rectangle, bool)
ObjectAtPositionMatching is like ObjectAtPosition but returns the deepest object for which matches reports true, descending past objects the predicate rejects. Use it to skip renderer-internal primitives and resolve, say, the deepest object that is one of your own source-mapped widgets.
Since: 2.10
func RunNative ¶
RunNative provides a way to execute code within the platform-specific runtime context for various runtimes. This is mostly useful for Android where the JVM provides functionality that is not accessible directly in CGo. The call for most platforms will just execute passing an `UnknownContext` and returning any error reported.
Since: 2.3
Types ¶
type AndroidContext ¶
type AndroidContext struct {
VM, Env, Ctx uintptr
}
AndroidContext is passed to the RunNative callback when it is executed on an Android device. The VM, Env and Ctx pointers are required to make various calls into JVM methods.
Since: 2.3
type AndroidWindowContext ¶
type AndroidWindowContext struct {
AndroidContext
NativeWindow uintptr
}
AndroidWindowContext is passed to the NativeWindow.RunNative callback when it is executed on an Android device. The NativeWindow field is of type `*C.ANativeWindow`. The VM, Env and Ctx pointers are required to make various calls into JVM methods.
Since: 2.5
type MacWindowContext ¶
type MacWindowContext struct {
// NSWindow is the window handle for the native window.
NSWindow uintptr
}
MacWindowContext is passed to the NativeWindow.RunNative callback when it is executed on a macOS device.
Since: 2.5
type NativeWindow ¶
type NativeWindow interface {
// RunNative provides a way to execute code within the platform-specific runtime context for a window.
// The context types are defined in the `driver` package and the specific context passed will differ by platform.
RunNative(func(context any))
}
NativeWindow is an extension interface for `bellui.Window` that gives access to platform-native features of application windows.
Since: 2.5
type UnknownContext ¶
type UnknownContext struct{}
UnknownContext is passed to the RunNative callback when it is executed on devices or windows without special native context.
Since: 2.3
type WaylandWindowContext ¶
type WaylandWindowContext struct {
// WaylandSurface is the handle to the native Wayland surface.
WaylandSurface uintptr
// ExportedHandle is an xdg-foreign export handle for the window's toplevel
// (empty when the compositor does not support xdg-foreign). It is suitable as
// an xdg-foreign parent reference, e.g. an XDG portal parent_window of the
// form "wayland:<ExportedHandle>". Computing it exports the toplevel and is
// cached for the window's lifetime.
//
// Since: 2.19
ExportedHandle string
}
WaylandWindowContext is passed to the NativeWindow.RunNative callback when it is executed on a device with the Wayland windowing system.
Since: 2.5
type WindowsWindowContext ¶
type WindowsWindowContext struct {
// HWND is the window handle for the native window.
HWND uintptr
}
WindowsWindowContext is passed to the NativeWindow.RunNative callback when it is executed on a Microsoft Windows device.
Since: 2.5
type X11WindowContext ¶
type X11WindowContext struct {
// WindowHandle is the window handle for the native X11 window.
WindowHandle uintptr
}
X11WindowContext is passed to the NativeWindow.RunNative callback when it is executed on a device with the X11 windowing system.
Since: 2.5
Directories
¶
| Path | Synopsis |
|---|---|
|
Package desktop provides desktop specific driver functionality.
|
Package desktop provides desktop specific driver functionality. |
|
Package mobile provides mobile specific driver functionality.
|
Package mobile provides mobile specific driver functionality. |