From 7fff7817e1af0a08a6143e68928c2c0103139a28 Mon Sep 17 00:00:00 2001 From: retrozinndev Date: Wed, 21 May 2025 14:53:43 -0300 Subject: [PATCH] :sparkles: feat(popup-window): add `onClickOutside` prop this method replaces close-on-click-outside behavior for the one defined --- ags/widget/PopupWindow.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ags/widget/PopupWindow.ts b/ags/widget/PopupWindow.ts index 755f51f..4b382d1 100644 --- a/ags/widget/PopupWindow.ts +++ b/ags/widget/PopupWindow.ts @@ -8,6 +8,7 @@ type PopupWindowSpecificProps = { onButtonPressEvent?: (self: Gtk.Widget, event: Gdk.Event) => void; /** Stylesheet for the background of the popup-window */ cssBackgroundWindow?: string; + onClickedOutside?: (self: Widget.Window) => void; }; export type PopupWindowProps = Pick (allocation.x + allocation.width)) || (y < allocation.y || y > (allocation.y + allocation.height))) { - self.close(); + if(!props.onClickedOutside) { + self.close(); + return; + } + + props.onClickedOutside?.(self); } } },