aboutsummaryrefslogtreecommitdiffstats
path: root/config/ags/modules/.widgethacks/popupwindow.js
blob: 26dad59c13ccddccc93820f7b6cbde19e027dc31 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import App from 'resource:///com/github/Aylur/ags/app.js';
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
const { Box, Window } = Widget;


export default ({
    name,
    child,
    showClassName = "",
    hideClassName = "",
    ...props
}) => {
    return Window({
        name,
        visible: false,
        layer: 'overlay',
        ...props,

        child: Box({
            setup: (self) => {
                self.hook(App, (self, currentName, visible) => {
                    if (currentName === name) {
                        self.toggleClassName(hideClassName, !visible);
                    }
                }).keybind("Escape", () => App.closeWindow(name))
                if (showClassName !== "" && hideClassName !== "")
                    self.className = `${showClassName} ${hideClassName}`;
            },
            child: child,
        }),
    });
}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage