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);
92 function Window(h, src, s)
94 this.self = new QxWindow(h);
96 // Settings for all windows
98 this.self.setMinWidth(sizeX(s));
99 this.self.setMinHeight(sizeY(s));
101 this.self.setTop(getPosX(this.self));
102 this.self.setLeft(getPosY(this.self));
104 this.self.addEventListener("contextmenu", contextMenu);
109 function SmallWindow(h, src)
111 this.self = new Window(h, src, .20);
115 function StandardWindow(h, src)
117 this.self = new Window(h, src, .45);
121 function LargeWindow(h, src)
123 this.self = new Window(h, src, .70);
127 Window.small = SmallWindow;
128 Window.standard = StandardWindow;
129 Window.large = LargeWindow;
131 function contextMenu(e)
133 var t = e.getTarget()
134 var tObj = t.getHtmlAttribute("class")
136 if (tObj == 'QxWidget') {
137 clientContextMenu(e);
138 } else if (tObj == 'QxWindowPane') {
139 windowContextMenu(t, e);
144 window.application.main = function()
146 var doc = this.getClientWindow().getClientDocument();
147 doc.addEventListener("contextmenu", contextMenu);
150 var bar = new QxMenuBar;
156 setBackgroundColor("ThreeDFace");
159 var start = new QxMenuButton("START");
160 start.addEventListener("click", function() {
168 window.onresize = function()