diff options
author | Derrell Lipman <derrell@samba.org> | 2006-12-31 20:12:12 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:35:23 -0500 |
commit | d1e09e2e6f9db62bbab84abb53e23ee73764178a (patch) | |
tree | 18e57f756611c9d3e10fb41bf7c09eeb795028dd /swat.obsolete/scripting/client/desktop.js | |
parent | 710dfce70ca9024d2f026518638bb193e914f4a0 (diff) | |
download | samba-d1e09e2e6f9db62bbab84abb53e23ee73764178a.tar.gz samba-d1e09e2e6f9db62bbab84abb53e23ee73764178a.tar.bz2 samba-d1e09e2e6f9db62bbab84abb53e23ee73764178a.zip |
r20446: rename swat directory to swat.obsolete; keeping it around since there is lots of useful info in it.
(This used to be commit 5f9f72a9cfab80561b23284001b67c4ea961757b)
Diffstat (limited to 'swat.obsolete/scripting/client/desktop.js')
-rw-r--r-- | swat.obsolete/scripting/client/desktop.js | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/swat.obsolete/scripting/client/desktop.js b/swat.obsolete/scripting/client/desktop.js new file mode 100644 index 0000000000..9e1a342936 --- /dev/null +++ b/swat.obsolete/scripting/client/desktop.js @@ -0,0 +1,121 @@ +/* + Windows, tabs, and general widgetry for SWAT. + + Copyright (C) Deryck Hodge 2005 + released under the GNU GPL Version 2 or later +*/ + +/* Qooxdoo's browser sniffer doesn't distinguish IE version. +We'll cover IE 6 for now, but these checks need to be +revisited for fuller browser coverage. */ +var browser = QxClient().engine; + +// DocX/Y returns the width/height of the page in browser +function docX() +{ + var x; + if (browser != "mshtml") { + x = window.innerWidth; + } else { + x = document.documentElement.clientWidth; + } + return x; +} + +function docY() +{ + var y; + if (browser != "mshtml") { + y = window.innerHeight; + } else { + y = document.documentElement.clientHeight; + } + return y; +} + +// If given a number, sizeX/Y returns in pixels a percentage of the browser +// window. If given a Window object, sizeX/Y returns the size of that object. +function sizeX(s) +{ + var sX; + + if (typeof(s) == 'number') { + sX = Math.floor(docX() * s); + } else { + sX = s.getMinWidth(); + } + + return sX; +} + +function sizeY(s) +{ + var sY; + if (typeof(s) == 'number') { + sY = Math.floor(docY() * s); + } else { + sY = s.getMinHeight(); + } + + return sY; +} + +function getPosX(win) +{ + var y = Math.floor( (docY() - sizeY(win)) * Math.random() ); + return y; +} + +function getPosY(win) +{ + var x = Math.floor( (docX() - sizeX(win)) * Math.random() ); + return x; +} + +function openIn(e) +{ + var blank = new Window("New Menu"); + e.add(blank); + blank.setVisible(true); +} + +function Window(h, src, s) +{ + this.self = new QxWindow(h); + + // Settings for all windows + if (s) { + this.self.setMinWidth(sizeX(s)); + this.self.setMinHeight(sizeY(s)); + } + this.self.setTop(getPosX(this.self)); + this.self.setLeft(getPosY(this.self)); + + this.self.addEventListener("contextmenu", contextMenu); + + return this.self; +} + +function SmallWindow(h, src) +{ + this.self = new Window(h, src, .20); + return this.self; +} + +function StandardWindow(h, src) +{ + this.self = new Window(h, src, .45); + return this.self; +} + +function LargeWindow(h, src) +{ + this.self = new Window(h, src, .70); + return this.self; +} + +Window.small = SmallWindow; +Window.standard = StandardWindow; +Window.large = LargeWindow; + + |