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 // Less 25px to not cover the toolbar
39 if (browser != "mshtml") {
40 y = window.innerHeight - 25;
42 y = document.documentElement.clientHeight;
47 // If given a number, sizeX/Y returns in pixels a percentage of the browser
48 // window. If given a Window object, sizeX/Y returns the size of that object.
53 if (typeof(s) == 'number') {
54 sX = Math.floor(docX() * s);
65 if (typeof(s) == 'number') {
66 sY = Math.floor(docY() * s);
68 sY = s.getMinHeight();
76 var y = Math.floor( (docY() - sizeY(win)) * Math.random() );
82 var x = Math.floor( (docX() - sizeX(win)) * Math.random() );
88 var blank = new Window("New Menu");
90 blank.setVisible(true);
96 var WinWin = new QxCommand();
97 WinWin.addEventListener("execute", function() {
98 var blank = new QxWindow();
100 blank.setVisible(true);
103 var inset = new QxMenu;
104 var sub1 = new QxMenuButton("Open window in a window", null, WinWin);
109 cmenu.setVisible(false);
110 inset.setVisible(true);
113 function Window(h, src, s)
115 this.self = new QxWindow(h);
117 // Settings for all windows
119 this.self.setMinWidth(sizeX(s));
120 this.self.setMinHeight(sizeY(s));
122 this.self.setTop(getPosX(this.self));
123 this.self.setLeft(getPosY(this.self));
125 this.self.addEventListener("contextmenu", winMenu);
130 function SmallWindow(h, src)
132 this.self = new Window(h, src, .20);
136 function StandardWindow(h, src)
138 this.self = new Window(h, src, .45);
142 function LargeWindow(h, src)
144 this.self = new Window(h, src, .70);
148 Window.small = SmallWindow;
149 Window.standard = StandardWindow;
150 Window.large = LargeWindow;
152 window.application.main = function()
154 var doc = this.getClientWindow().getClientDocument();
155 doc.addEventListener("contextmenu", showContextMenu);
159 window.onresize = function()