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();
12 /* Qooxdoo's browser sniffer doesn't distinguish IE version.
13 We'll cover IE 6 for now, but these checks need to be
14 revisited for fuller browser coverage. */
15 var browser = QxClient().engine;
17 // DocX/Y returns the width/height of the page in browser
21 if (browser != "mshtml") {
22 x = window.innerWidth;
24 x = document.documentElement.clientWidth;
32 if (browser != "mshtml") {
33 y = window.innerHeight;
35 y = document.documentElement.clientHeight;
40 // If given a number, sizeX/Y returns in pixels a percentage of the browser
41 // window. If given a Window object, sizeX/Y returns the size of that object.
46 if (typeof(s) == 'number') {
47 sX = Math.floor(docX() * s);
58 if (typeof(s) == 'number') {
59 sY = Math.floor(docY() * s);
61 sY = s.getMinHeight();
69 var y = Math.floor( (docY() - sizeY(win)) * Math.random() );
75 var x = Math.floor( (docX() - sizeX(win)) * Math.random() );
81 var blank = new Window("New Menu");
83 blank.setVisible(true);
86 function Window(h, src, s)
88 this.self = new QxWindow(h);
90 // Settings for all windows
92 this.self.setMinWidth(sizeX(s));
93 this.self.setMinHeight(sizeY(s));
95 this.self.setTop(getPosX(this.self));
96 this.self.setLeft(getPosY(this.self));
98 this.self.addEventListener("contextmenu", contextMenu);
103 function SmallWindow(h, src)
105 this.self = new Window(h, src, .20);
109 function StandardWindow(h, src)
111 this.self = new Window(h, src, .45);
115 function LargeWindow(h, src)
117 this.self = new Window(h, src, .70);
121 Window.small = SmallWindow;
122 Window.standard = StandardWindow;
123 Window.large = LargeWindow;
125 function contextMenu(e)
127 var t = e.getTarget()
128 var tObj = t.getHtmlAttribute("class")
130 if (tObj == 'QxWidget') {
131 clientContextMenu(e);
132 } else if (tObj == 'QxWindowPane') {
133 windowContextMenu(t, e);
138 window.application.main = function()
147 var doc = this.getClientWindow().getClientDocument();
148 doc.addEventListener("contextmenu", contextMenu);
151 var bar = new QxMenuBar;
157 setBackgroundColor("ThreeDFace");
160 var start = new QxMenuButton("START");
161 start.addEventListener("click", function() {
169 window.onresize = function()