doc: update layout and widget interface documentation
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 34s
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 34s
This commit is contained in:
@@ -1,16 +1,13 @@
|
||||
//! Dynamic dispatch for layout implementations.
|
||||
//! Each layout should at least implement these functions:
|
||||
//! - handle(this: *@This(), event: Event) anyerror!*std.ArrayList(Event) {}
|
||||
//! - render(this: *@This(), renderer: *Renderer) anyerror!void {}
|
||||
//! - deinit(this: *@This()) void {}
|
||||
//! Dynamic dispatch for layout implementations. Each `Layout` has to implement
|
||||
//! the `Layout.Interface`.
|
||||
//!
|
||||
//! Create a `Layout` using `createFrom(object: anytype)` and use them through
|
||||
//! the defined interface. The layout will take care of calling the correct
|
||||
//! implementation of the corresponding underlying type.
|
||||
//! the defined `Layout.Interface`. The layout will take care of calling the
|
||||
//! correct implementation of the corresponding underlying type.
|
||||
//!
|
||||
//! Each `Layout` is responsible for clearing the allocated memory of the used
|
||||
//! widgets when deallocated. This means that `deinit()` will also deallocate
|
||||
//! every used widget too.
|
||||
//! `Element`s (union of `Layout` or `Widget`) when deallocated. This means
|
||||
//! that `deinit()` will also deallocate every used `Element` too.
|
||||
//!
|
||||
//! When `Layout.render` is called the provided `Renderer` type is expected
|
||||
//! which handles how contents are rendered for a given layout.
|
||||
@@ -95,7 +92,6 @@ pub fn Layout(comptime Event: type, comptime Renderer: type) type {
|
||||
};
|
||||
// test widget implementation satisfies the interface
|
||||
comptime Type.Interface.satisfiedBy(Type);
|
||||
// TODO: there is a dependency loop (due to the necessary `Layout` type for the `Element`)
|
||||
comptime Type.Interface.satisfiedBy(Type.HStack);
|
||||
comptime Type.Interface.satisfiedBy(Type.VStack);
|
||||
comptime Type.Interface.satisfiedBy(Type.Padding);
|
||||
|
||||
Reference in New Issue
Block a user