From d203255ec20bb6e3b2917dd4aee53dee3a090137 Mon Sep 17 00:00:00 2001 From: Aylur Date: Wed, 11 Sep 2024 22:39:15 +0000 Subject: add: stack widget --- core/gjs/src/astalify.ts | 6 +++++- core/gjs/src/jsx/jsx-runtime.ts | 2 +- core/gjs/src/widgets.ts | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'core/gjs/src') diff --git a/core/gjs/src/astalify.ts b/core/gjs/src/astalify.ts index be395ee..612239e 100644 --- a/core/gjs/src/astalify.ts +++ b/core/gjs/src/astalify.ts @@ -20,11 +20,15 @@ function setChildren(parent: Gtk.Widget, children: Gtk.Widget[]) { parent.remove(ch) } - // FIXME: add rest of the edge cases like Stack + // TODO: add more container types if (parent instanceof Astal.Box) { parent.set_children(children) } + else if (parent instanceof Astal.Stack) { + parent.set_children(children) + } + else if (parent instanceof Astal.CenterBox) { parent.startWidget = children[0] parent.centerWidget = children[1] diff --git a/core/gjs/src/jsx/jsx-runtime.ts b/core/gjs/src/jsx/jsx-runtime.ts index 02fd39d..73aaf63 100644 --- a/core/gjs/src/jsx/jsx-runtime.ts +++ b/core/gjs/src/jsx/jsx-runtime.ts @@ -49,7 +49,7 @@ const ctors = { revealer: Widget.Revealer, scrollable: Widget.Scrollable, slider: Widget.Slider, - // TODO: stack + stack: Widget.Stack, switch: Widget.Switch, window: Widget.Window, } diff --git a/core/gjs/src/widgets.ts b/core/gjs/src/widgets.ts index 0a71d8b..82d3b8f 100644 --- a/core/gjs/src/widgets.ts +++ b/core/gjs/src/widgets.ts @@ -100,7 +100,10 @@ export type SliderProps = ConstructProps -// TODO: Stack +// Stack +export type Stack = Widget +export const Stack = astalify(Astal.Stack) +export type StackProps = ConstructProps // Switch export type Switch = Widget -- cgit v1.2.3