chore: update dependencies
This commit is contained in:
parent
470d97e067
commit
9f814c1125
2 changed files with 35 additions and 9 deletions
|
@ -6,12 +6,12 @@
|
|||
// Make sure this is the same version as the one used by zenolith-sdl2.
|
||||
// See: https://git.mzte.de/zenolith/zenolith-sdl2
|
||||
.zenolith = .{
|
||||
.url = "git+https://git.mzte.de/zenolith/zenolith.git#ad388687cd205079aab75074a542eadc79490df7",
|
||||
.hash = "12201677a81b6f8133bbe9c7d3b2afc07b61bf632a070d13d57f995827022f6a1f54",
|
||||
.url = "git+https://git.mzte.de/zenolith/zenolith.git#c4ae23938d9f64ffd8dd0662314f7b478818547a",
|
||||
.hash = "1220aa2f21fb19b4cb741e0709e84308a4d079f446dd655827206b0f834da8efa350",
|
||||
},
|
||||
.zenolith_sdl2 = .{
|
||||
.url = "git+https://git.mzte.de/zenolith/zenolith-sdl2.git#d8f44c96a9f5890296c00cd346dd6e661597a528",
|
||||
.hash = "1220066e28c172156aa816790a3fe0d732576daa94218e3c15a1a4b30459d5d47aca",
|
||||
.url = "git+https://git.mzte.de/zenolith/zenolith-sdl2.git#f0b5f244affa1b5e5bbee5d1dc34b6b07f10097b",
|
||||
.hash = "122094812c10f22bdbdb73b1d6cd20528ed49b833ae859f82be7e4cb3b7b3d0d98d9",
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -18,12 +18,13 @@ pub const zenolith_options = struct {
|
|||
|
||||
/// Our root widget type. Most functions in here will be invoked by Zenolith.
|
||||
const Root = struct {
|
||||
// We use this box as our only child widget. It will contain our buttons and a label.
|
||||
// We use this box as our only direct child. It will contain our buttons and a label.
|
||||
box: *zl.widget.Widget,
|
||||
|
||||
// These aren't immediate children, we just save them have to be able to easily reference them.
|
||||
// Zenolith will take care of freeing these.
|
||||
label: *zl.widget.Widget,
|
||||
btn_box: *zl.widget.Widget,
|
||||
latte_btn: *zl.widget.Widget,
|
||||
frappe_btn: *zl.widget.Widget,
|
||||
macchiato_btn: *zl.widget.Widget,
|
||||
|
@ -48,12 +49,8 @@ const Root = struct {
|
|||
const mocha_btn = try zl.widget.Button.init(alloc, "Mocha");
|
||||
|
||||
try hbox.addChild(null, latte_btn);
|
||||
try hbox.addChild(null, try zl.widget.Spacer.init(alloc, .{ .flex = 1 }));
|
||||
try hbox.addChild(null, frappe_btn);
|
||||
try hbox.addChild(null, try zl.widget.Spacer.init(alloc, .{ .flex = 1 }));
|
||||
try hbox.addChild(null, macchiato_btn);
|
||||
try hbox.addChild(null, try zl.widget.Spacer.init(alloc, .{ .flex = 1 }));
|
||||
try hbox.addChild(null, mocha_btn);
|
||||
|
||||
try vbox.addChild(null, hbox);
|
||||
|
||||
|
@ -61,6 +58,7 @@ const Root = struct {
|
|||
.box = vbox,
|
||||
|
||||
.label = label,
|
||||
.btn_box = hbox,
|
||||
.latte_btn = latte_btn,
|
||||
.frappe_btn = frappe_btn,
|
||||
.macchiato_btn = macchiato_btn,
|
||||
|
@ -104,6 +102,34 @@ const Root = struct {
|
|||
else
|
||||
return;
|
||||
|
||||
// only show buttons that correspond to inactive themes
|
||||
{
|
||||
for (self.btn_box.children()) |_| {
|
||||
_ = try self.btn_box.removeChild(null);
|
||||
}
|
||||
for ([_]*zl.widget.Widget{
|
||||
self.latte_btn,
|
||||
self.frappe_btn,
|
||||
self.macchiato_btn,
|
||||
self.mocha_btn,
|
||||
}) |w| {
|
||||
if (w != ba.btn_widget)
|
||||
try self.btn_box.addChild(null, w);
|
||||
}
|
||||
|
||||
// After we've made changes to the widget tree, we have to make sure to re-link
|
||||
// the updated subtree as well as fire a Relayout backevent on the updated widget
|
||||
// to cause another layout pass on it. This assures that all buttens are positioned
|
||||
// and sized correctly.
|
||||
try self.btn_box.link(selfw, selfw.data.platform);
|
||||
try zl.backevent.Backevent.create(
|
||||
// Child is safe to set to undefined here, as the Relayout backevent will set it
|
||||
// before being propagated.
|
||||
zl.backevent.Relayout{ .child = undefined },
|
||||
{},
|
||||
).dispatch(self.btn_box);
|
||||
}
|
||||
|
||||
try theme.apply(selfw.data.allocator, &selfw.data.attreebutes.?);
|
||||
|
||||
const text = if (ba.btn_widget == self.latte_btn)
|
||||
|
|
Loading…
Reference in a new issue