Expand description
AppKit (macOS) backend for mitsuami.
- Containers are flipped
NSViews that do no layout of their own; the core positions every child withsetFrame:. - 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:
tweakfor raw settings of built-in controls,NativeRenderfor custom widgets,NativeViewfor anyNSView, and a rasterizer for drawn custom widgets. - Control actions and delegate callbacks become
UiEvents. rundrives the app: a run-loop observer callsUi::tickbefore 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§
- AppKit
Backend - AppKit
Cx - What a native render or native view gets while its view is created.
- AppKit
Handle - Shared access to an
AppKitBackendafter it was moved into aUi. - AppKit
Services - Backend
Options - 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.
- Native
View - Any
NSViewin the shared tree. It takes part in layout like other leaves; the core seesWidgetKind::Native. - Number
Field - A text field with an
NSStepperbeside 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 withfieldandstepper.
Traits§
- Native
Render - A custom widget’s AppKit render: one per widget, next to its shared
definition (e.g.
rating/macos.rs). Hand it to the widget’sRenderimpl withnative. - 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:
setupcreates 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)). SeeTweak. - tweak_
with - Raw settings made from a value, applied again whenever it changes:
appkit::tweak_with(tint, |b: &NSButton, tint| ..).