Aria 2.0.0
C++23 MVVM framework (C++20 minimum) — reactive, coroutine-first, ABI-layered
Loading...
Searching...
No Matches
aria::adapters::appkit::AppKitAdapter Class Reference

#include <AppKitAdapter.hpp>

Inheritance diagram for aria::adapters::appkit::AppKitAdapter:
[legend]

Instance Methods

() - AppKitAdapter
() - ~AppKitAdapter
() - AppKitAdapter
(AppKitAdapter &) - operator=
(std::string_view) - platform_name
(AppKitView &) - view_for
 Wrap a native NSView* as an IView owned by this adapter.
(void) - release_view
 Drop the cached AppKitView for view, if any.
(void) - set_text
(std::string) - get_text
(::aria::Subscription- on_text_changed
(void) - set_bool
(bool) - get_bool
(::aria::Subscription- on_bool_changed
(void) - set_int
(int) - get_int
(::aria::Subscription- on_int_changed
(void) - set_int64
(std::int64_t) - get_int64
(::aria::Subscription- on_int64_changed
(void) - set_uint64
(std::uint64_t) - get_uint64
(::aria::Subscription- on_uint64_changed
(void) - set_float
(float) - get_float
(::aria::Subscription- on_float_changed
(void) - set_double
(double) - get_double
(::aria::Subscription- on_double_changed
(void) - set_visible
(void) - set_enabled
(::aria::Subscription- on_click
Instance Methods inherited from aria::binding::IViewAdapter
virtual ~IViewAdapter ()

Constructor & Destructor Documentation

◆ AppKitAdapter [1/2]

- adapters:

◆ ~AppKitAdapter

- adapters:

◆ AppKitAdapter [2/2]

- adapters: (const AppKitAdapter &)

Method Documentation

◆ operator=

- (AppKitAdapter &) adapters: (const AppKitAdapter &)

◆ platform_name

- (string_view) aria: const

◆ view_for

- (AppKitView &) adapters: (NSView *) view

Wrap a native NSView* as an IView owned by this adapter.

Every host used to hand-roll this: allocate an AppKitView, then park it in a std::vector<std::unique_ptr<AppKitView>> because BindingEngine takes IView& and does not own its views. The adapter already keeps a per-view registry for its ObjC signal bridges, so it is the natural owner.

engine.bind_text(vm.name, adapter->view_for(nameField));

Calling - view_for twice for the same NSView* returns the same AppKitView, so multiple bindings on one control share a single per-view subscription bucket in BindingEngine.

Lifetime — differs from the Qt adapter, deliberately: AppKitView retains its NSView* via ARC, so a cached view keeps the control alive and there is no "native handle died first" event to evict on. Entries therefore live until the adapter is destroyed (which fires each IView's destroy signal and releases the bindings), or until - release_view is called explicitly for a control the host is discarding early.

Passing nil is a programming error and throws std::invalid_argument.

◆ release_view

- (void) adapters: (NSView *) view

Drop the cached AppKitView for view, if any.

Fires that view's destroy signal, so BindingEngine releases every binding wired to it, and releases the adapter's ARC reference to the control. Use this when a host tears down part of its UI while keeping the adapter alive (a closed panel, a recycled row). Calling it for an unknown view is a harmless no-op.

◆ set_text

- (void) adapters: (::aria::binding::IView &) v
(std::string_view) text 

◆ get_text

- (string) aria: (::aria::binding::IView &) v

◆ on_text_changed

- aria: (::aria::binding::IView &) v
(std::function< void(std::string_view)>) cb 

◆ set_bool

- (void) adapters: (::aria::binding::IView &) v
(bool) value 

◆ get_bool

- (bool) adapters: (::aria::binding::IView &) v

◆ on_bool_changed

- aria: (::aria::binding::IView &) v
(std::function< void(bool)>) cb 

◆ set_int

- (void) adapters: (::aria::binding::IView &) v
(int) value 

◆ get_int

- (int) adapters: (::aria::binding::IView &) v

◆ on_int_changed

- aria: (::aria::binding::IView &) v
(std::function< void(int)>) cb 

◆ set_int64

- (void) adapters: (::aria::binding::IView &) v
(std::int64_t) value 

◆ get_int64

- (int64_t) aria: (::aria::binding::IView &) v

◆ on_int64_changed

- aria: (::aria::binding::IView &) v
(std::function< void(std::int64_t)>) cb 

◆ set_uint64

- (void) adapters: (::aria::binding::IView &) v
(std::uint64_t) value 

◆ get_uint64

- (uint64_t) aria: (::aria::binding::IView &) v

◆ on_uint64_changed

- aria: (::aria::binding::IView &) v
(std::function< void(std::uint64_t)>) cb 

◆ set_float

- (void) adapters: (::aria::binding::IView &) v
(float) value 

◆ get_float

- (float) adapters: (::aria::binding::IView &) v

◆ on_float_changed

- aria: (::aria::binding::IView &) v
(std::function< void(float)>) cb 

◆ set_double

- (void) adapters: (::aria::binding::IView &) v
(double) value 

◆ get_double

- (double) adapters: (::aria::binding::IView &) v

◆ on_double_changed

- aria: (::aria::binding::IView &) v
(std::function< void(double)>) cb 

◆ set_visible

- (void) adapters: (::aria::binding::IView &) v
(bool) visible 

◆ set_enabled

- (void) adapters: (::aria::binding::IView &) v
(bool) enabled 

◆ on_click

- aria: (::aria::binding::IView &) v
(std::function< void()>) cb 

The documentation for this class was generated from the following file: