pub struct AppKit { /* private fields */ }Implementations§
Trait Implementations§
Source§impl Platform for AppKit
impl Platform for AppKit
Source§const TARGET: &'static str = "macos-appkit"
const TARGET: &'static str = "macos-appkit"
"macos-appkit".fn run(self, options: WindowOptions, ready: Box<dyn FnOnce(Self, Handle, Size)>)
Source§fn post(f: Box<dyn FnOnce() + Send>)
fn post(f: Box<dyn FnOnce() + Send>)
Setter deliveries ride (§3.3).Source§fn post_delayed(ms: u32, f: Box<dyn FnOnce() + Send>)
fn post_delayed(ms: u32, f: Box<dyn FnOnce() + Send>)
f onto the native main loop after (at least) ms milliseconds: the timer
door behind day::sleep (docs/async.md). Every shipped backend overrides it with the
loop’s own timer (dispatch_after, Handler.postDelayed, g_timeout_add,
QTimer::singleShot, SetTimer, setTimeout), so a sleep costs no thread. The
default is the fallback for a backend without one: a helper thread that sleeps the
whole delay and rides Platform::post home. It is correct, but a thread per sleep
adds up under a ticking loop, so the first use says so once in the log.Source§fn locale_hints(&self) -> Vec<String>
fn locale_hints(&self) -> Vec<String>
Source§const RUN_ENDS_APP: bool = true
const RUN_ENDS_APP: bool = true
Platform::run returning means the app is over. True for a backend that
drives the native loop itself until the app quits (GTK, Qt, XAML; AppKit’s never
returns). False where the host owns the loop and run hands back at once, with the
app still to come (ArkUI’s ability, Android’s activity, the web page, the mock’s test):
their DidExit is the host’s last callback, not the return (docs/lifecycle.md).Source§impl Toolkit for AppKit
impl Toolkit for AppKit
Source§fn ui_idle(&mut self) -> bool
fn ui_idle(&mut self) -> bool
Settled unless a toolbar edit is still painting (toolbar.rs CHROME_SETTLE); AppKit’s
own transitions (sheets, nav pushes) complete within the turn that starts them.
Source§fn system_color(&mut self, role: SystemColor) -> Color
fn system_color(&mut self, role: SystemColor) -> Color
Every role’s AppKit color (color::role_color), resolved in sRGB for the app’s
effective appearance: what Palette::current holds and day::resolve answers.
Source§fn reduce_motion(&mut self) -> bool
fn reduce_motion(&mut self) -> bool
System Settings › Accessibility › Display › “Reduce motion”, as NSWorkspace reports it
(docs/accessibility.md). install_reduce_motion_observer re-reads it on a flip.
Source§fn set_app_badge(&mut self, badge: &AppBadge)
fn set_app_badge(&mut self, badge: &AppBadge)
macOS is the one platform whose badge takes arbitrary text: NSDockTile.badgeLabel is a
String, so Text renders literally and a count is just its decimal form. A nil label
clears it (docs/badge.md).
Source§fn release_piece(&mut self, kind: PieceKind, h: &Self::Handle)
fn release_piece(&mut self, kind: PieceKind, h: &Self::Handle)
Offer a satellite piece its teardown hook before release frees the handle (§15.2).
Source§fn set_opacity(&mut self, h: &Handle, opacity: f64, anim: Option<&AnimSpec>)
fn set_opacity(&mut self, h: &Handle, opacity: f64, anim: Option<&AnimSpec>)
The whole AnimSpec on the layer’s opacity (docs/tween.md; see motion).
Source§fn read_displayed(&self, h: &Handle) -> Displayed
fn read_displayed(&self, h: &Handle) -> Displayed
What the layer shows mid-animation (docs/tween.md “Toolkit support”; see motion).
Source§fn text_scale(&mut self, _style: Font) -> f64
fn text_scale(&mut self, _style: Font) -> f64
macOS has no system text-size setting that NSFont.preferredFont(forTextStyle:)
follows, so every style is at its default size (docs/text.md “Text scale”).
Source§fn set_layout_direction(
&mut self,
h: &Handle,
kind: PieceKind,
direction: LayoutDirection,
)
fn set_layout_direction( &mut self, h: &Handle, kind: PieceKind, direction: LayoutDirection, )
A leaf control’s reading direction (docs/localization.md “Direction of a subtree”):
userInterfaceLayoutDirection on the view and its cell (a slider’s fill side, a
switch’s on side, a pop-up’s arrow), and for text the base writing direction, which
NSTextAlignment.natural and Day’s Trailing follow. Containers, scroll views, lists
and other hosts are skipped: Day places their children and mirrors them itself.
Source§fn first_baseline(
&mut self,
h: &Handle,
kind: PieceKind,
size: Size,
) -> Option<f64>
fn first_baseline( &mut self, h: &Handle, kind: PieceKind, size: Size, ) -> Option<f64>
Where the control actually draws its first line of text (docs/baseline.md).
AppKit publishes firstBaselineOffsetFromTop, but it is measured from the top of the
view’s alignment rect and it is rounded to whole points, and that rounding is visible.
An NSDatePicker in a 26pt frame insets its alignment rect 4pt and answers 15, i.e. 19
in frame terms, while it paints at 19.9; a label beside it then sits a point high, which
is exactly the drift baseline alignment exists to remove.
So derive it from the metrics AppKit rounded: a single line of the control’s own font, centered in its alignment rect, with the baseline an ascender below the line’s top. That reproduces AppKit’s own numbers for a plain label and a bezeled field (12.91 → its 13, 19.91 → its 20) while keeping the fractional part that makes a picker land on the line. Controls with no font of their own keep AppKit’s answer.
Source§fn list_row_metrics(&mut self, _h: &Handle) -> RowMetrics
fn list_row_metrics(&mut self, _h: &Handle) -> RowMetrics
A macOS table row: the dense rows of a Finder or Mail list, 28pt for an icon and a line of body text.
Source§fn scroll_to(&mut self, h: &Handle, target: Rect, animated: bool)
fn scroll_to(&mut self, h: &Handle, target: Rect, animated: bool)
The least scroll that shows target (scrollRectToVisible:’s rule), through the clip
view’s animator when animated, else a jump that also stops a running animation.
Source§fn list_scroll(&mut self, h: &Handle, to: ListScroll) -> bool
fn list_scroll(&mut self, h: &Handle, to: ListScroll) -> bool
Place the row where to.align says from its rectOfRow: and the clip view’s bounds
(docs/list.md “Programmatic scrolling”), animated through the clip view’s animator or a
jump; then realize the rows it exposed and report the viewport. Deferred one turn, as
the patches were: the scroll tiles rows synchronously, outside this borrow.
Source§fn gesture_support(&self, kind: GestureKind) -> Support
fn gesture_support(&self, kind: GestureKind) -> Support
Press, long press and double tap are AppKit’s own (see enable_gesture). Touches stay
derived: a Mac’s pointer is one mouse, and a trackpad’s touches are not contacts on the
screen.
Source§fn set_drag_axis(&mut self, _h: &Handle, _node: NodeId, _axis: Option<DragAxis>)
fn set_drag_axis(&mut self, _h: &Handle, _node: NodeId, _axis: Option<DragAxis>)
Nothing to do on a Mac (docs/gestures.md “Gestures inside a scroll view”): an
NSScrollView scrolls on the wheel and the trackpad’s two-finger scroll
(scrollWheel:), never on a mouse drag, so a drag is never contested and a trackpad
scroll over the node still reaches the scroll view behind it. day-core withholds the
cross-axis drags from the handler.
Source§fn primary_pointer(&self) -> PointerKind
fn primary_pointer(&self) -> PointerKind
A Mac’s pointer is a mouse or a trackpad until a pen says otherwise.
Source§fn announce(&mut self, text: &str, urgent: bool)
fn announce(&mut self, text: &str, urgent: bool)
The announcement request goes out from the primary window (any live element will do; the app object stands in before the window exists). Without VoiceOver nothing observes the notification, so posting is free.
Source§fn decode_image(&mut self, req: u64, id: BitmapId, bytes: &[u8])
fn decode_image(&mut self, req: u64, id: BitmapId, bytes: &[u8])
Decode bytes into an NSImage (docs/images.md).
NSBitmapImageRep is asked first and kept: it is what actually reads the container, it
answers in PIXELS (NSImage.size is in points and reports a 144-DPI photo at
two-thirds its real width), and it is the only thing here that can re-encode later.
Source§fn image_properties(&mut self, id: BitmapId) -> Option<ImageProperties>
fn image_properties(&mut self, id: BitmapId) -> Option<ImageProperties>
The container’s own metadata (docs/images.md).
DPI is DERIVED rather than read from a tag: AppKit has already resolved the file’s resolution into the rep’s point size, so pixels-per-point × 72 is the number the platform itself believes — and it is right for containers that record resolution in ways EXIF does not.
Source§fn encode_formats(&mut self) -> Vec<ImageFormat>
fn encode_formats(&mut self) -> Vec<ImageFormat>
What NSBitmapImageRep WRITES. It reads more than this — WebP and HEIF among them — and
the asymmetry is the platform’s own, which is exactly why this duty exists instead of
letting Cap::ImageEncode imply every format round-trips.
Source§fn render_bitmap(
&mut self,
req: u64,
id: BitmapId,
ops: &[DrawOp],
size: Size,
scale: f64,
)
fn render_bitmap( &mut self, req: u64, id: BitmapId, ops: &[DrawOp], size: Size, scale: f64, )
Replay ops offscreen through the canvas’s own painter (docs/canvas.md “Exporting”) and
keep the result in the decode table, so image, encode_image and DrawOp::Image take
it like any decoded bitmap.
The paint runs on a day_spec::offscreen thread: CoreGraphics draws into a bitmap
context from any thread, so a long replay (a map tile of a thousand paths) no longer
holds a frame. The images and fonts the ops need are resolved here first, the painted
CGImage comes back on the main queue, and the table insert and the answer happen
there, in that order.
Source§fn font_families(&mut self) -> Vec<FontFamilyInfo>
fn font_families(&mut self) -> Vec<FontFamilyInfo>
NSFontManager.availableFontFamilies + availableMembersOfFontFamily:, whose members
are [postscriptName, styleName, weight 0 … 15, traits] (docs/fonts.md). The .-prefixed
families are the system’s private UI faces and are skipped, as Font Book skips them.
Source§fn measure_text(
&mut self,
text: &str,
size: f64,
font: &CanvasFont,
) -> Option<TextMetrics>
fn measure_text( &mut self, text: &str, size: f64, font: &CanvasFont, ) -> Option<TextMetrics>
sizeWithAttributes: with the attributes replay draws with; the ascent is the
font’s own, so at.y + ascent is where the glyphs’ baseline lands.
Source§fn set_launcher_shortcuts(&mut self, _shortcuts: &[LauncherShortcut])
fn set_launcher_shortcuts(&mut self, _shortcuts: &[LauncherShortcut])
The Dock menu lists them: day-core folds the run-time shortcuts into the model it sends
through set_dock_menu, so there is nothing more to install here.
type Handle = Retained<NSView>
fn dark_mode(&mut self) -> bool
Source§fn set_appearance(&mut self, dark: Option<bool>)
fn set_appearance(&mut self, dark: Option<bool>)
Some(true) forces dark, Some(false) forces light,
None returns to following the system. Backends restyle their native widgets in
place and answer the override from dark_mode; app-painted
surfaces pick it up on their next rebuild. Cap::Appearance reports whether the
backend honors this; the default ignores the call.Source§fn attach_refresh(&mut self, handle: &Self::Handle, host: NodeId)
fn attach_refresh(&mut self, handle: &Self::Handle, host: NodeId)
Source§fn set_presented(&mut self, handle: &Self::Handle, visible: bool)
fn set_presented(&mut self, handle: &Self::Handle, visible: bool)
fn capability(&self, cap: Cap) -> Support
fn realize(&mut self, kind: PieceKind, props: &dyn Any, id: NodeId) -> Handle
fn update( &mut self, h: &Handle, kind: PieceKind, patch: &dyn Any, anim: Option<&AnimSpec>, )
Source§fn release(&mut self, h: Handle)
fn release(&mut self, h: Handle)
fn insert(&mut self, parent: &Handle, child: &Handle, _index: usize)
fn remove(&mut self, parent: &Handle, child: &Handle)
Source§fn move_child(&mut self, parent: &Handle, child: &Handle, _to: usize)
fn move_child(&mut self, parent: &Handle, child: &Handle, _to: usize)
child at index to among parent’s native children: day’s z-order resync, which
walks the whole sibling row and asks for every position in turn. A child already at to
must therefore cost nothing: a backend that re-parents unconditionally pays for the
untouched siblings too, and where re-parenting means detach-then-add (no ViewGroup move
primitive on Android) the detach resigns the focus of everything inside the subtree,
which is how a text field being typed into loses the keyboard (docs/focus.md).fn measure(&mut self, h: &Handle, kind: PieceKind, p: Proposal) -> Size
fn set_transform( &mut self, h: &Handle, t: Transform, _size: Size, anim: Option<&AnimSpec>, )
fn set_selectable(&mut self, h: &Handle, selectable: bool) -> Option<Handle>
fn set_input_traits( &mut self, h: &Handle, traits: &InputTraits, ) -> Option<Handle>
fn set_cursor(&mut self, h: &Handle, cursor: Cursor)
fn set_frame(&mut self, h: &Handle, frame: Rect, anim: Option<&AnimSpec>)
fn set_scroll_content(&mut self, h: &Handle, content: Size)
fn scroll_offset(&mut self, h: &Handle) -> Point
fn focus(&mut self, h: &Handle, _node: NodeId, focused: bool)
fn set_focusable(&mut self, h: &Handle, node: NodeId, focusable: bool)
fn set_event_sink(&mut self, sink: EventSink)
fn set_edit_state(&mut self, state: &EditState)
fn modifiers(&mut self) -> Modifiers
fn set_undo_state(&mut self, state: &UndoState)
fn attach_list(&mut self, host: &Handle, source: ListSource)
fn attach_tree(&mut self, host: &Handle, source: TreeSource)
fn adopt(&mut self, raw: RawHandle) -> Handle
Source§fn update_toolbar(&mut self, h: &Handle, patch: &ToolbarPatch)
fn update_toolbar(&mut self, h: &Handle, patch: &ToolbarPatch)
UIMenuBuilder main menu on iPadOS/Catalyst). Replaces any previous app menu.h, shown on secondary-click (desktop) or long-press (mobile). Passing an
empty slice removes it.fn set_drag_source(&mut self, h: &Handle, source: Source)
fn set_drop_target(&mut self, h: &Handle, target: Target)
h (a kinds::BUTTON node) a pull-down menu button (docs/menus.md
“Menu buttons”): its primary press (a click, a tap, the keyboard’s Space or Return, the
accessibility press) asks f for the menu at that moment and shows it under the button
with the toolkit’s own menu, instead of reporting Event::Pressed. f is called on
the UI thread, outside any day-core borrow, with Point::ZERO (where on the button
the press landed does not change its menu); an empty result shows nothing. Chosen items
fire Event::MenuAction as a context menu’s do. Read morefn enable_gesture(&mut self, h: &Handle, node: NodeId, kind: GestureKind)
fn set_hit_slop(&mut self, h: &Handle, _node: NodeId, slop: Insets)
fn set_subtree_enabled(&mut self, h: &Handle, _node: NodeId, enabled: bool)
Source§fn set_a11y(&mut self, h: &Handle, a11y: &A11yProps)
fn set_a11y(&mut self, h: &Handle, a11y: &A11yProps)
Source§fn read_native(&self, h: &Handle) -> NativeSnapshot
fn read_native(&self, h: &Handle) -> NativeSnapshot
a11y_audit and
assert_native (§14.2, docs/testing.md) to diff against Day’s expectation. Default:
nothing read; the audit skips the node and assert_native records each field as unread.Source§fn request_frame(&mut self, host: &Handle, cb: FrameCallback) -> CancelFrame
fn request_frame(&mut self, host: &Handle, cb: FrameCallback) -> CancelFrame
host. Never call inline. Each native source
must stop after delivery unless requested again; no polling timer. Hidden/unmapped windows
may defer delivery until visible. Native callbacks must reach the UI thread before calling
Rust. The returned closure cancels safely, including when the window has closed.
The mock intentionally stays pending: tests inject a manual scheduler in day-core.fn replay(&mut self, h: &Handle, ops: &[DrawOp], _size: Size)
host, which is what the sidebar
affordance a nav(Sidebar) contributes for itself drives (SIDEBAR_TOGGLE_ID).
false when host has no pane to toggle (a stack, a tab bar, no sidebar concept at all). Read moreSource§fn snapshot_window(&mut self) -> Result<Vec<u8>, String>
fn snapshot_window(&mut self) -> Result<Vec<u8>, String>
screenshot
step, docs/window-image.md). Read moreSource§fn image_info(&mut self, id: BitmapId) -> Option<BitmapInfo>
fn image_info(&mut self, id: BitmapId) -> Option<BitmapInfo>
BitmapInfo). Read moreSource§fn encode_image(&mut self, req: u64, id: BitmapId, spec: &EncodeSpec)
fn encode_image(&mut self, req: u64, id: BitmapId, spec: &EncodeSpec)
spec, answering req with
Event::ImageEncoded. A format outside Self::encode_formats answers
ImageError::Encode rather than silently substituting another one. Read moreSource§fn release_image(&mut self, id: BitmapId)
fn release_image(&mut self, id: BitmapId)
Source§fn render_pdf(&mut self, req: u64, pages: &[PdfPage], info: &PdfInfo)
fn render_pdf(&mut self, req: u64, pages: &[PdfPage], info: &PdfInfo)
req with Event::PdfRendered.
Units are PDF points, top-left origin; shapes and text stay vector, and images embed at
their pixel size. pages is never empty. Defaulted to nothing: day-core probes
Cap::CanvasPdf first.Source§fn snapshot_window_chrome(&mut self) -> Result<Vec<u8>, String>
fn snapshot_window_chrome(&mut self) -> Result<Vec<u8>, String>
Source§fn snapshot_window_of(&mut self, host: &Handle) -> Result<Vec<u8>, String>
fn snapshot_window_of(&mut self, host: &Handle) -> Result<Vec<u8>, String>
host (the dayscript screenshot
step’s window: target). The default answers the primary snapshot, so backends that
never open windows stay correct without changes. Read moreSource§fn open_window(
&mut self,
id: NodeId,
options: &WindowOptions,
kind: WindowKind,
) -> WindowOpenReply<Handle>
fn open_window( &mut self, id: NodeId, options: &WindowOptions, kind: WindowKind, ) -> WindowOpenReply<Handle>
options + kind: create and show the window, wire its
events to id (WindowResized with the content size in points, WindowClosed after
the native close, WindowFocused on key/active changes), and answer with its content
container handle, the same contract as the ready root container. Backends whose
window creation is asynchronous (a scene, an activity, an ability) answer
WindowOpenReply::Pending and complete later through
day_core::finish_window_open(id, raw, size), which goes through Toolkit::adopt.
The default answers Unsupported; day-core then presents the content as a
fullscreen cover in the primary window instead.Source§fn native_window_tabs(&self) -> bool
fn native_window_tabs(&self) -> bool
Source§fn group_windows(&mut self, hosts: &[Handle])
fn group_windows(&mut self, hosts: &[Handle])
Source§fn window_tab_order(&self, host: &Handle) -> Vec<NodeId>
fn window_tab_order(&self, host: &Handle) -> Vec<NodeId>
Source§fn close_window(&mut self, host: &Handle)
fn close_window(&mut self, host: &Handle)
host (a handle open_window
produced). Asynchronous: the platform confirms with Event::WindowClosed on the
window’s root node, and only then does day-core tear the subtree down. Idempotent; unknown
hosts are ignored. Never called with the primary window’s container.Source§fn focus_window(&mut self, host: &Handle)
fn focus_window(&mut self, host: &Handle)
host to front and make it key/active:
the focus half of open-or-focus singleton windows. Default no-op.Source§fn fit_window(&mut self, host: &Handle, size: Size)
fn fit_window(&mut self, host: &Handle, size: Size)
host to fit size of content, and pin it
there: what WindowOptions::size_to_fit asks for (docs/windows.md). Read moreSource§fn set_window_title(&mut self, host: &Handle, title: &str)
fn set_window_title(&mut self, host: &Handle, title: &str)
host. Default no-op.Source§fn apply_window(&mut self, host: &Handle, change: &WindowChange)
fn apply_window(&mut self, host: &Handle, change: &WindowChange)
host
(docs/windows.md “Window properties”). The primary window arrives with its root container,
like set_window_title. Read moreSource§fn window_frame(&self, host: &Handle) -> Option<Rect>
fn window_frame(&self, host: &Handle) -> Option<Rect>
host, in points on the
desktop’s coordinate space (top-left origin), or None where the platform does not say
(a phone, Wayland’s positions). Read when the app asks for it and when day-core saves a
remembered frame (WindowOptions::remember_frame).Source§fn monitors(&self) -> Vec<Monitor>
fn monitors(&self) -> Vec<Monitor>
Cap::Monitors; the default
answers none, and day-core then describes the primary window’s own size as one display.[[shortcuts]] and its dock_menu(..) entries. Same item model and dispatch as
set_app_menu; an empty slice removes the menu. Cap::DockMenu
reports support; the default ignores the call.Source§fn set_drag_region(&mut self, h: &Handle, drag: bool)
fn set_drag_region(&mut self, h: &Handle, drag: bool)
h move its window when the user drags it, as a title bar does
(.window_drag_region(), docs/window-chrome.md): the region’s own background starts a
native window drag (with the platform’s snapping and edge tiling), a double click does
what the user’s title-bar double-click setting says, and controls inside the region keep
receiving their own clicks. false releases it. Cap::DragRegion; the default ignores
the call, so on a phone the region is an ordinary view.Source§fn set_status_items(&mut self, items: &[StatusItemSpec])
fn set_status_items(&mut self, items: &[StatusItemSpec])
id is new, update the ones that changed, remove the ones no longer listed.
A click on an item runs its activate action or opens its menu; menu choices dispatch
Event::MenuAction like the app menu’s. Cap::StatusItem; the default ignores the
call, which is what a phone and the web do.Source§fn set_app_progress(&mut self, progress: AppProgress)
fn set_app_progress(&mut self, progress: AppProgress)
progress on the app’s Dock or taskbar icon (docs/status-item.md).
Cap::AppProgress; the default ignores it.Source§fn set_dock_visible(&mut self, visible: bool)
fn set_dock_visible(&mut self, visible: bool)
Cap::DockVisibility; the default ignores it.Source§fn set_keep_running(&mut self, keep: bool)
fn set_keep_running(&mut self, keep: bool)
true, the backend must not end the app on its own as windows close: it
reports every close, the first window’s included, as Event::WindowClosed, and day-core
decides whether to call quit_app. When false, the backend keeps its
platform’s own rule. A backend whose process lifetime is not its own (a phone, a browser
tab) ignores it, which is the default.Source§fn quit_app(&mut self)
fn quit_app(&mut self)
WindowRole::Primary has closed
(docs/windows.md). day-core decides when, since it owns the window registry and the role
each window carries; the backend supplies only the platform’s exit:
NSApplication.terminate, QCoreApplication::quit, GtkApplication.quit,
PostQuitMessage. Everything day-core wanted to happen first (secondary windows
disposed, WillTerminate delivered) already has by the time this is called. Read morefn present(&mut self, req: u64, spec: &PresentSpec)
fn dismiss(&mut self, req: u64)
Source§fn application_handlers(
&mut self,
query: &HandlerQuery,
) -> Result<ApplicationHandlers, ApplicationError>
fn application_handlers( &mut self, query: &HandlerQuery, ) -> Result<ApplicationHandlers, ApplicationError>
Source§fn open_url_with_application(
&mut self,
url: &str,
application: &str,
completion: OpenApplicationCompletion,
)
fn open_url_with_application( &mut self, url: &str, application: &str, completion: OpenApplicationCompletion, )
application_handlers.spec (docs/sharing.md). True means presentation
started, not that sharing completed. Never sends data without the user’s choice of a
target. Where the chooser can carry the app’s own actions (Cap::ShareActions), each
of spec.actions appears with its title and glyph, and choosing one enqueues
Event::MenuAction(action.id); elsewhere the actions are left out. anchor is the
control the chooser points at where it is a popover (iPad, macOS); without one the
chooser uses the window’s top trailing corner.Source§fn open_url(&mut self, url: &str)
fn open_url(&mut self, url: &str)
url in the platform’s default handler: the system browser for http(s), the mail
client for mailto:, etc. Backs the link piece. Fire and
forget: there is no result, and an unopenable URL is ignored. The default no-ops so a
backend that hasn’t wired it up still compiles.fn scroll_bar_inset(&mut self, _h: &Self::Handle, _vertical: bool) -> f64
fn set_route(&mut self, _route: &str)
fn supports_lifecycle(&self, phase: Lifecycle) -> bool
Source§fn snapshot_origin(&mut self, _root: &Self::Handle) -> Option<Point>
fn snapshot_origin(&mut self, _root: &Self::Handle) -> Option<Point>
root, the primary window’s root container, sits in Self::snapshot_window’s
image, in points from its top-left. A reader of the capture (dayscript sample_pixel)
maps Day’s frames into it with this; it matters where the capture spans more than Day’s
content on more than one side, as Android’s edge-to-edge content does (status bar
above, navigation bar below). Read moreSource§fn prepare_snapshot(
&mut self,
_host: Option<&Self::Handle>,
_revision: u32,
) -> Result<Readiness, String>
fn prepare_snapshot( &mut self, _host: Option<&Self::Handle>, _revision: u32, ) -> Result<Readiness, String>
revision is stable across retries and unique to the request; host selects a
secondary window, or None for the primary. Never block the UI thread waiting for
a frame. Pending requests are retried within the dayscript deadline. Read moreSource§fn native_back(&mut self) -> bool
fn native_back(&mut self) -> bool
nav_back() does not do: that is Day’s rail, which pops the model and lets the
backend follow, while this runs the native path first (the bar’s shouldPop, the
dispatcher’s callbacks, the pop itself) and lets the backend report it to Day as a user
back, guard and all. dayscript’s nav_back: { native: true } drives it, so a walkthrough
can cover the code that a real tap runs and Day’s rail never reaches. false when this
toolkit has no native back or nothing is popped by it. Defaulted, so a desktop needs no
code. docs/navigation.md.Source§fn set_system_back(&mut self, _armed: bool)
fn set_system_back(&mut self, _armed: bool)
true) or release (false) the platform’s system back for the app’s own
handlers (Decorate::on_system_back):
day-core arms it while at least one mounted handler is enabled. Armed, a system back that
nothing native consumes first (a presented cover, a pushed page, an armed guard) reaches
Day as Event::NavBack on WINDOW_NODE instead of leaving the app; released, the
platform’s default runs, predictive-back preview and all. Android registers an
OnBackPressedCallback beneath its own; HarmonyOS consumes the page’s onBackPress.
Defaulted, so a toolkit with no system back (desktop, iOS, the web) needs no code.
docs/navigation.md “Handling the system Back”.Source§fn defer_system_gestures(&mut self, _edges: Edges)
fn defer_system_gestures(&mut self, _edges: Edges)
edges (docs/cover.md):
the union requested by every mounted defers_system_gestures modifier, re-sent whenever
that set changes (Edges::NONE when the last one unmounts). iOS defers the home
indicator / notification edges; Android enters swipe-to-reveal immersive mode while
non-empty. The default no-ops (desktop has no system edge gestures).true) or show the system status bar (docs/cover.md): whether any mounted
status_bar_hidden modifier currently asks for it hidden, re-sent whenever that answer
may have changed (false when the last request unmounts). iOS answers the root and
cover view controllers’ prefersStatusBarHidden; Android and HarmonyOS hide the status
bar through their window inset controls. The default no-ops (desktop and web have no
status bar); report Cap::StatusBarHidden alongside an implementation.fn on_suspend(&mut self)
fn on_resume(&mut self)
fn on_memory_warning(&mut self)
Source§fn native_document_tabs(&self) -> bool
fn native_document_tabs(&self) -> bool
Auto Trait Implementations§
impl !RefUnwindSafe for AppKit
impl !Send for AppKit
impl !Sync for AppKit
impl !UnwindSafe for AppKit
impl Forget for AppKit
impl Freeze for AppKit
impl Move for AppKit
impl Unpin for AppKit
impl UnsafeUnpin for AppKit
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more