summaryrefslogtreecommitdiff
path: root/swat/scripting
diff options
context:
space:
mode:
authorDeryck Hodge <deryck@samba.org>2005-08-26 13:22:56 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:34:38 -0500
commit44a27265fb2aed8ce976aa6cd5875faaa5aec4d9 (patch)
treed4eedfde19b5cbb0f1dc770fb644139fe43e3c38 /swat/scripting
parent1e2d5e64a90dd7c0cf1f9fd6a191e754f55754a2 (diff)
downloadsamba-44a27265fb2aed8ce976aa6cd5875faaa5aec4d9.tar.gz
samba-44a27265fb2aed8ce976aa6cd5875faaa5aec4d9.tar.bz2
samba-44a27265fb2aed8ce976aa6cd5875faaa5aec4d9.zip
r9651: Start to group all SWAT specific windowing, widgets, etc. in one
file. This allows basic style and event code to be set in one place, though we'll still have to override for a specific position or look. More to come... deryck (This used to be commit 9d5482d2aaff2082d85d626c288f2ad16e20b6ae)
Diffstat (limited to 'swat/scripting')
-rw-r--r--swat/scripting/client/swat.js99
1 files changed, 99 insertions, 0 deletions
diff --git a/swat/scripting/client/swat.js b/swat/scripting/client/swat.js
new file mode 100644
index 0000000000..e6a4230f10
--- /dev/null
+++ b/swat/scripting/client/swat.js
@@ -0,0 +1,99 @@
+/*
+ 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;
+
+function docX()
+{
+ var x;
+ if (browser != "mshtml") {
+ x = window.innerWidth;
+ } else {
+ x = document.documentElement.clientWidth;
+ }
+ return x;
+}
+
+function docY()
+{
+ var y;
+ // Less 25px to not cover the toolbar
+ if (browser != "mshtml") {
+ y = window.innerHeight - 25;
+ } else {
+ y = document.documentElement.clientHeight;
+ }
+ return y;
+}
+
+function sizeX()
+{
+ var sX = Math.floor(docX() * .45);
+ return sX;
+}
+
+function sizeY()
+{
+ var sY = Math.floor(docY() * .45);
+ return sY;
+}
+
+function getPosX()
+{
+ var y = Math.floor( (docY() - sizeY()) * Math.random() );
+ return y;
+}
+
+function getPosY()
+{
+ var x = Math.floor( (docX() - sizeX()) * Math.random() );
+ return x;
+}
+
+function openIn(e)
+{
+ var blank = new Window("New Menu");
+ e.add(blank);
+ blank.setVisible(true);
+}
+
+function winMenu(e)
+{
+ var self = this;
+ var WinWin = new QxCommand();
+ WinWin.addEventListener("execute", function() {
+ var blank = new QxWindow();
+ self.add(blank);
+ blank.setVisible(true);
+ });
+
+ var inset = new QxMenu;
+ var sub1 = new QxMenuButton("Open window in a window", null, WinWin);
+
+ inset.add(sub1);
+ self.add(inset)
+
+ cmenu.setVisible(false);
+ inset.setVisible(true);
+}
+
+function Window(title)
+{
+ var self = new QxWindow(title);
+ self.setTop(getPosX());
+ self.setLeft(getPosY());
+ self.setMinWidth(sizeX());
+ self.setMinHeight(sizeY());
+ self.addEventListener("contextmenu", winMenu);
+ return self;
+}
+
+