Added Popups method to Session interface

This commit is contained in:
Alexei Anoshenko 2026-06-13 19:19:08 +03:00
parent bee9992582
commit 91860d799d
2 changed files with 16 additions and 1 deletions

View File

@ -3,7 +3,7 @@
* Removed "style-disabled" property and GetDisabledStyle function * Removed "style-disabled" property and GetDisabledStyle function
* Added GoogleFonts field to AppParams * Added GoogleFonts field to AppParams
* Added functions: GetWhiteSpace, GetWordBreak, ScrollIntoViewIfNeeded * 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 DismissWithoutAnimation add SetHotKey methods to Popup interface
* Added ToBoundsProperty method to Bounds struct * Added ToBoundsProperty method to Bounds struct

View File

@ -3,6 +3,7 @@ package rui
import ( import (
"fmt" "fmt"
"net/url" "net/url"
"slices"
"strconv" "strconv"
"strings" "strings"
) )
@ -115,6 +116,9 @@ type Session interface {
// Returns the default value for the properties: "show-transform", "show-opacity", "show-duration" and "show-timing". // 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() (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. // SetPopupShowAnimation sets default popup animation parameters.
// Sets the default value for the properties: "show-transform", "show-opacity", "show-duration" and "show-timing". // Sets the default value for the properties: "show-transform", "show-opacity", "show-duration" and "show-timing".
SetPopupShowAnimation(transform TransformProperty, opacity, duration float64, timing string) SetPopupShowAnimation(transform TransformProperty, opacity, duration float64, timing string)
@ -436,6 +440,17 @@ func (session *sessionData) popupManager() *popupManager {
return session.popups 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 { func (session *sessionData) imageManager() *imageManager {
if session.images == nil { if session.images == nil {
session.images = new(imageManager) session.images = new(imageManager)