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 // The global widget we attach everything to
10 var w = new QxWidget();
18 /* Qooxdoo's browser sniffer doesn't distinguish IE version.
19 We'll cover IE 6 for now, but these checks need to be
20 revisited for fuller browser coverage. */
21 var browser = QxClient().engine;
23 // DocX/Y returns the width/height of the page in browser
27 if (browser != "mshtml") {
28 x = window.innerWidth;
30 x = document.documentElement.clientWidth;
38 if (browser != "mshtml") {
39 y = window.innerHeight;
41 y = document.documentElement.clientHeight;
46 // If given a number, sizeX/Y returns in pixels a percentage of the browser
47 // window. If given a Window object, sizeX/Y returns the size of that object.
52 if (typeof(s) == 'number') {
53 sX = Math.floor(docX() * s);
64 if (typeof(s) == 'number') {
65 sY = Math.floor(docY() * s);
67 sY = s.getMinHeight();
75 var y = Math.floor( (docY() - sizeY(win)) * Math.random() );
81 var x = Math.floor( (docX() - sizeX(win)) * Math.random() );
87 var blank = new Window("New Menu");
89 blank.setVisible(true);
95 var WinWin = new QxCommand();
96 WinWin.addEventListener("execute", function() {
97 var blank = new QxWindow();
99 blank.setVisible(true);
102 var inset = new QxMenu;
103 var sub1 = new QxMenuButton("Open window in a window", null, WinWin);
108 cmenu.setVisible(false);
109 inset.setVisible(true);
112 function Window(h, src, s)
114 this.self = new QxWindow(h);
116 // Settings for all windows
118 this.self.setMinWidth(sizeX(s));
119 this.self.setMinHeight(sizeY(s));
121 this.self.setTop(getPosX(this.self));
122 this.self.setLeft(getPosY(this.self));
124 this.self.addEventListener("contextmenu", winMenu);
129 function SmallWindow(h, src)
131 this.self = new Window(h, src, .20);
135 function StandardWindow(h, src)
137 this.self = new Window(h, src, .45);
141 function LargeWindow(h, src)
143 this.self = new Window(h, src, .70);
147 Window.small = SmallWindow;
148 Window.standard = StandardWindow;
149 Window.large = LargeWindow;
151 window.application.main = function()
153 var doc = this.getClientWindow().getClientDocument();
154 doc.addEventListener("contextmenu", showContextMenu);
157 var bar = new QxMenuBar;
163 setBackgroundColor("ThreeDFace");
166 var start = new QxMenuButton("START");
167 start.addEventListener("click", function() {
175 window.onresize = function()