r9443: We can now move windows around anywhere on our SWAT "desktop".
authorDeryck Hodge <deryck@samba.org>
Sun, 21 Aug 2005 05:41:48 +0000 (05:41 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:34:15 +0000 (13:34 -0500)
QxWidget doesn't accept percentages, so I feed the toplevel
widget the actual brower height/width onload and onresize.

deryck

swat/desktop/index.esp

index a81581bf3c26380c25efc48e3cc22d3870eb6274..aeded6ed4750da0110c50941af5b967fafa87c1c 100644 (file)
@@ -10,26 +10,69 @@ libinclude("base.js");
 
 <script type="text/javascript">
 
+/* 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 docWidth()
+{
+  var x;
+  if (browser != "mshtml") {
+    x = window.innerWidth;
+  } else {
+    x = document.documentElement.clientWidth;
+  }
+  return x;
+}
+
+function docHeight()
+{
+  var y;
+  // Less 25px to not cover the toolbar
+  if (browser != "mshtml") {
+    y = window.innerHeight - 25;
+  } else {
+    y = document.documentElement.clientHeight;
+  }
+  return y;
+}
+
 /*** init the page for qooxdoo ***/
 window.application.main = function()
 {
+  var doc = this.getClientWindow().getClientDocument();
   // Don't declare local with var
-  doc = this.getClientWindow().getClientDocument();
+  w = new QxWidget();
+  with(w) {
+    setTop(0);
+    setLeft(0);
+    setWidth(docWidth());
+    setHeight(docHeight());
+  }
+  doc.add(w);
+
+}
+
+window.onresize = function() 
+{
+      w.setWidth(docWidth());
+      w.setHeight(docHeight());
 }
 
 function showReg()
 {
        var regedit = regedit_widget("ncalrpc:");
-       doc.add(regedit);
+       w.add(regedit);
        regedit.startup();
 }
 
 function startSwat()
 {
   // Don't declare local with var (for now)
-  w1 = new QxWindow("Welcome to SWAT.");
-  w1.setSpace(100, 100, 100, 100);
-  doc.add(w1);
+  var w1 = new QxWindow("Welcome to SWAT.");
+  w1.setSpace("40%", 0, "35%", 0);
+  w.add(w1);
 
   var btn1 = new QxButton("View Registry");
   btn1.set({ top: 20, left : 30 });
@@ -40,8 +83,6 @@ function startSwat()
 }
 </script>
 
-<div id="canvas" style="overflow:hidden;position:static;margin-top:38px;margin-left:10px;margin-right:700px;width:700px"></div>
-
 <div id="toolbar">
        <h3><a href="javascript:startSwat()">SWAT (Start)</a></h3>
 </div>