refactor: improve WidgetList.addP style
This commit is contained in:
parent
07fdf30e9f
commit
c5e7b1f896
1 changed files with 5 additions and 3 deletions
|
@ -16,7 +16,7 @@ pub const Layout = Widget.Layout;
|
||||||
|
|
||||||
const WidgetState = struct {
|
const WidgetState = struct {
|
||||||
widget: Widget,
|
widget: Widget,
|
||||||
layout: Layout = .{},
|
layout: Layout = .dynamic,
|
||||||
};
|
};
|
||||||
|
|
||||||
plane: Plane,
|
plane: Plane,
|
||||||
|
@ -85,8 +85,10 @@ pub fn add(self: *Self, w_: Widget) !void {
|
||||||
|
|
||||||
pub fn addP(self: *Self, w_: Widget) !*Widget {
|
pub fn addP(self: *Self, w_: Widget) !*Widget {
|
||||||
var w: *WidgetState = try self.widgets.addOne();
|
var w: *WidgetState = try self.widgets.addOne();
|
||||||
w.widget = w_;
|
w.* = .{
|
||||||
w.layout = w_.layout();
|
.widget = w_,
|
||||||
|
.layout = w_.layout(),
|
||||||
|
};
|
||||||
return &w.widget;
|
return &w.widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue