From 91860d799d66f091977763dd369943b98f7b2027 Mon Sep 17 00:00:00 2001 From: Alexei Anoshenko <2277098+anoshenko@users.noreply.github.com> Date: Sat, 13 Jun 2026 19:19:08 +0300 Subject: [PATCH] Added Popups method to Session interface --- CHANGELOG.md | 2 +- session.go | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e38bfd..8910e02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ * Removed "style-disabled" property and GetDisabledStyle function * Added GoogleFonts field to AppParams * Added functions: GetWhiteSpace, GetWordBreak, ScrollIntoViewIfNeeded -* Added PopupShowAnimation and SetPopupShowAnimation methods to Session interface +* Added Popups, PopupShowAnimation, and SetPopupShowAnimation methods to Session interface * Added DismissWithoutAnimation add SetHotKey methods to Popup interface * Added ToBoundsProperty method to Bounds struct diff --git a/session.go b/session.go index cf2b940..61fc448 100644 --- a/session.go +++ b/session.go @@ -3,6 +3,7 @@ package rui import ( "fmt" "net/url" + "slices" "strconv" "strings" ) @@ -115,6 +116,9 @@ type Session interface { // Returns the default value for the properties: "show-transform", "show-opacity", "show-duration" and "show-timing". PopupShowAnimation() (transform TransformProperty, opacity, duration float64, timing string) + // PopupShowAnimation returns a list of displayed popups or nil if there are no displayed popups. + Popups() []Popup + // SetPopupShowAnimation sets default popup animation parameters. // Sets the default value for the properties: "show-transform", "show-opacity", "show-duration" and "show-timing". SetPopupShowAnimation(transform TransformProperty, opacity, duration float64, timing string) @@ -436,6 +440,17 @@ func (session *sessionData) popupManager() *popupManager { return session.popups } +func (session *sessionData) Popups() []Popup { + popups := session.popupManager() + + count := len(popups.popups) + if count == 0 { + return nil + } + + return slices.Clone(popups.popups) +} + func (session *sessionData) imageManager() *imageManager { if session.images == nil { session.images = new(imageManager)