2 Windows, tabs, and general widgetry for SWAT.
4 Copyright (C) Deryck Hodge 2005
5 released under the GNU GPL Version 2 or later
9 /* Qooxdoo's browser sniffer doesn't distinguish IE version.
10 We'll cover IE 6 for now, but these checks need to be
11 revisited for fuller browser coverage. */
12 var browser = QxClient().engine;
14 // DocX/Y returns the width/height of the page in browser
18 if (browser != "mshtml") {
19 x = window.innerWidth;
21 x = document.documentElement.clientWidth;
29 // Less 25px to not cover the toolbar
30 if (browser != "mshtml") {
31 y = window.innerHeight - 25;
33 y = document.documentElement.clientHeight;
38 // If given a number, sizeX/Y returns in pixels a percentage of the browser
39 // window. If given a Window object, sizeX/Y returns the size of that object.
44 if (typeof(s) == 'number') {
45 sX = Math.floor(docX() * s);
56 if (typeof(s) == 'number') {
57 sY = Math.floor(docY() * s);
59 sY = s.getMinHeight();
67 var y = Math.floor( (docY() - sizeY(win)) * Math.random() );
73 var x = Math.floor( (docX() - sizeX(win)) * Math.random() );
79 var blank = new Window("New Menu");
81 blank.setVisible(true);
87 var WinWin = new QxCommand();
88 WinWin.addEventListener("execute", function() {
89 var blank = new QxWindow();
91 blank.setVisible(true);
94 var inset = new QxMenu;
95 var sub1 = new QxMenuButton("Open window in a window", null, WinWin);
100 cmenu.setVisible(false);
101 inset.setVisible(true);
104 function Window(h, src, s)
106 this.self = new QxWindow(h);
108 // Settings for all windows
110 this.self.setMinWidth(sizeX(s));
111 this.self.setMinHeight(sizeY(s));
113 this.self.setTop(getPosX(this.self));
114 this.self.setLeft(getPosY(this.self));
116 this.self.addEventListener("contextmenu", winMenu);
121 function SmallWindow(h, src)
123 this.self = new Window(h, src, .20);
127 function StandardWindow(h, src)
129 this.self = new Window(h, src, .45);
133 function LargeWindow(h, src)
135 this.self = new Window(h, src, .70);
139 Window.small = SmallWindow;
140 Window.standard = StandardWindow;
141 Window.large = LargeWindow;