Skip to main content

Crate mitsuami_appkit

Crate mitsuami_appkit 

Source
Expand description

AppKit (macOS) backend for mitsuami.

  • Containers are flipped NSViews that do no layout of their own; the core positions every child with setFrame:.
  • Leaf widgets are stock AppKit controls, measured through their cells.
  • Lists are view-based NSTableViews whose cells are the core’s row hosts.
  • Escape hatches: tweak for raw settings of built-in controls, NativeRender for custom widgets, NativeView for any NSView, and a rasterizer for drawn custom widgets.
  • Control actions and delegate callbacks become UiEvents.
  • run drives the app: a run-loop observer calls Ui::tick before the loop sleeps, in all common modes (so live resize relayouts).

Re-exports§

pub use objc2;
pub use objc2_app_kit;
pub use objc2_foundation;

Structs§

AppKitBackend
AppKitCx
What a native render or native view gets while its view is created.
AppKitHandle
Shared access to an AppKitBackend after it was moved into a Ui.
AppKitServices
BackendOptions
How the backend behaves; apps and tests want different things.
Emitter
Sends events from native callbacks to the widget’s handlers. Cheap to clone; keep one in closures that outlive creation.
NativeView
Any NSView in the shared tree. It takes part in layout like other leaves; the core sees WidgetKind::Native.
NumberField
A text field with an NSStepper beside it, kept in step: the stepper holds the number, its range and its increment, and the field shows the number and commits what’s typed into it when editing ends. Tweaks get this view: reach the parts with field and stepper.

Traits§

NativeRender
A custom widget’s AppKit render: one per widget, next to its shared definition (e.g. rating/macos.rs). Hand it to the widget’s Render impl with native.
Tweakable
A built-in widget, and the AppKit control that shows it.

Functions§

ad_hoc
The renderer for a widget AppKit has no control for, built ad hoc from AppKit views the way Mac apps build it. Not labelled native.
init_for_tests
Prepares AppKit for tests: no Dock icon, no menu bar takeover.
native
The renderer for a widget whose AppKit render is AppKit’s own control.
run
Starts the app: setup creates the windows, then AppKit’s run loop takes over. Returns when the last window closes.
tweak
Raw settings for a built-in widget’s AppKit control: appkit::tweak(|b: &NSButton| b.setControlSize(NSControlSize::Large)). See Tweak.
tweak_with
Raw settings made from a value, applied again whenever it changes: appkit::tweak_with(tint, |b: &NSButton, tint| ..).