ui/appkit_mac
lib/ui/appkit_mac.vklib/ui/appkit_mac.vk
Pure-Veko macOS AppKit 22-widget desktop backend (ui/appkit_mac).
- Zero top-level mut globals: all state resides in ob/ObjcRuntime and MacWinInfo
- Direct ffi/* builtins (no use [ffi]), operating under allow-caps = [.ui]
- Deterministic headless simulation when rt.headless == true
MacWinInfo = struct { id str, ns_win i64 = ..., content_view i64 = ..., vibrancy_view i64 = ..., width i64 = ..., height i64 = ..., dpi_scale i64 = ... }
mac-ensure-app = fn [mut rt ob/ObjcRuntime]
Ensures NSApplication.sharedApplication is initialized as a regular foreground GUI app.
mac-open-window = fn [mut rt ob/ObjcRuntime, id str, title str, w i64, h i64, props map] MacWinInfo
Opens a native NSWindow (with optional NSVisualEffectView vibrancy backdrop) or returns a deterministic headless descriptor.
mac-close-window = fn [mut rt ob/ObjcRuntime, ns_win i64]
Closes an NSWindow handle.
mac-create-widget = fn [mut rt ob/ObjcRuntime, content_view i64, kind enum, text str, value_s str, value_n i64, flag bool, items block, props map] map
Creates an AppKit view for kind under content_view and returns { view = i64, sub_views = [...] }.
mac-update-widget = fn [mut rt ob/ObjcRuntime, view i64, kind enum, text str, value_s str, value_n i64, flag bool, items block, props map]
Updates an existing AppKit widget view in place without recreating its OS handle.
mac-destroy-widget = fn [mut rt ob/ObjcRuntime, view i64, sub_views block, kind enum]
Detaches and releases widget views from the AppKit view hierarchy.
mac-set-frame = fn [mut rt ob/ObjcRuntime, view i64, win_h i64, x i64, y i64, w i64, h i64]
Positions view inside an AppKit window of height win_h, flipping top-left (x, y) to bottom-left Cocoa coordinates.
mac-focus-view = fn [mut rt ob/ObjcRuntime, ns_win i64, view i64]
Moves keyboard focus to view inside ns_win.
mac-read-text = fn [mut rt ob/ObjcRuntime, view i64, kind enum] str
Reads the current text value from an AppKit widget view.
mac-read-secret = fn [mut rt ob/ObjcRuntime, view i64] secret str
Reads an NSSecureTextField directly into a .secret str without creating an unflagged plain str.
mac-present-canvas = fn [mut rt ob/ObjcRuntime, view i64, canvas_any any]
Presents an RGBA32 canvas (width, height, pixels) onto view.layer.contents via CGImageCreate.
mac-open-file-dialog = fn [mut rt ob/ObjcRuntime, title str] str
mac-save-file-dialog = fn [mut rt ob/ObjcRuntime, title str] str
mac-pick-folder-dialog = fn [mut rt ob/ObjcRuntime, title str] str
mac-alert-dialog = fn [mut rt ob/ObjcRuntime, title str, body str, kind enum] enum
Displays an NSAlert modal dialog (kind in .info | .warning | .danger | .confirm), returning .ok | .yes | .no | .cancel.
mac-pump-events = fn [mut rt ob/ObjcRuntime, timeout_ms i64]
Pumps pending NSEvent items from NSApplication (waiting up to timeout_ms on the first event).