home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Narzedzia / AIMP2 / aimp_2.61.583.exe / $TEMP / YandexPackSetup.msi / fil65A8441CECA427B67509E0E2033CD7C1 < prev    next >
Extensible Markup Language  |  2010-07-12  |  10KB  |  238 lines

  1. <?xml version="1.0"?>
  2.  
  3. <bindings xmlns="http://www.mozilla.org/xbl"
  4.           xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  5.           xmlns:xbl="http://www.mozilla.org/xbl"
  6.           xmlns:html="http://www.w3.org/1999/xhtml">
  7.  
  8.     <binding id="dialog"
  9.              inheritstyle="false">
  10.         <resources>
  11.             <stylesheet src="dialog.css"/>
  12.         </resources>
  13.         
  14.         <content hidechrome="true">
  15.             <xul:vbox class="body">
  16.                 <xul:hbox class="title">
  17.                     <xul:label class="title-text" xbl:inherits="value=title"/>
  18.                     <xul:hbox class="title-close" onclick="close();"></xul:hbox>
  19.                 </xul:hbox>
  20.                 <xul:vbox class="content">
  21.                     <children/>
  22.                 </xul:vbox>
  23.             </xul:vbox>
  24.         </content>
  25.         
  26.         <implementation implements="nsIDOMEventListener">
  27.             <field name="nodeClose">document.getAnonymousElementByAttribute(this, "class", "title-close")</field>
  28.             <field name="nodeTitle">document.getAnonymousElementByAttribute(this, "class", "title-text")</field>
  29.             <field name="nodeBody">document.getAnonymousElementByAttribute(this, "class", "body")</field>
  30.             <field name="nodeContent">document.getAnonymousElementByAttribute(this, "class", "content")</field>
  31.             <field name="nodeDraggable">this.nodeTitle</field>
  32.             <field name="dragStartPoint">null</field>
  33.             
  34.             <field name="parameters">window.parameters</field>
  35.             
  36.             <field name="_logger">this._application.core.Log4Moz.repository.getLogger(this._application.name + ".Dialog")</field>
  37.             
  38.             <field name="platform"><![CDATA[
  39.                     var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
  40.                                             .getService(Components.interfaces.nsIXULAppInfo)
  41.                                             .QueryInterface(Components.interfaces.nsIXULRuntime);
  42.                     
  43.                     var os = "", version = "";
  44.                     
  45.                     if (/^win/i.test(appInfo.OS))
  46.                         os = "windows";
  47.                     if (/^linux/i.test(appInfo.OS))
  48.                         os = "linux";
  49.                     if (/darwin/i.test(appInfo.OS))
  50.                         os = "mac";
  51.                     
  52.                     var platform = {
  53.                         browser: {
  54.                             name: "firefox",
  55.                             version: version
  56.                         },
  57.                         
  58.                         os: {
  59.                             name: os,
  60.                             version: ""
  61.                         }
  62.                     };
  63.                     
  64.                     platform
  65.                 ]]>
  66.             </field>
  67.             
  68.             
  69.             <constructor><![CDATA[
  70.                 let shadow = false;
  71.                 let transparent = true;
  72.                 
  73.                 if (this.platform.os.name == "windows") {
  74.                     if (!!Components.interfaces.nsIWorker)
  75.                         shadow = true;
  76.                     else {
  77.                         transparent = false;
  78.                         shadow = "pseudo";
  79.                     }
  80.                 } else if (this.platform.os.name == "linux") {
  81.                     transparent = false;
  82.                     //shadow = "pseudo";
  83.                 }
  84.                 
  85.                 this.setAttribute("ex-shadow", shadow);
  86.                 this.setAttribute("ex-transparent", transparent);
  87.                 
  88.                 window.addEventListener("load", this, false);
  89.                 window.addEventListener("unload", this, false);
  90.                 
  91.                 this.parameters = window.parameters;
  92.                 if (window.parameters)
  93.                     this.init(parameters);
  94.             ]]></constructor>
  95.             
  96.             <method name="init">
  97.                 <body><![CDATA[
  98.                 ]]></body>
  99.             </method>
  100.             
  101.             <method name="sizeToContent">
  102.                 <body><![CDATA[
  103.                     this._sizeToContent();
  104.                     /*
  105.                     if (this.platform.os.name == "mac") {
  106.                         window.sizeToContent();
  107.                         setTimeout(function(me) {
  108.                             if (me && "_sizeToContent" in me)
  109.                                 me._sizeToContent();
  110.                         }, 50, this);
  111.                     } else {
  112.                         this._sizeToContent();
  113.                     }
  114.                     */
  115.                 ]]></body>
  116.             </method>
  117.             
  118.             <method name="_sizeToContent">
  119.                 <body><![CDATA[
  120.                     var rect = this.nodeBody.getBoundingClientRect();
  121.                     window.resizeTo(rect.left + rect.right, rect.top + rect.bottom);
  122.                 ]]></body>
  123.             </method>
  124.             
  125.             <method name="centerWindowOnScreen">
  126.                 <body><![CDATA[
  127.                     var xOffset = screen.availWidth/2 - window.outerWidth/2;
  128.                     var yOffset = screen.availHeight/2 - window.outerHeight/2; //(opener.outerHeight *2)/10;
  129.                     
  130.                     xOffset = xOffset > 0 ? xOffset : 0;
  131.                     yOffset = yOffset > 0 ? yOffset : 0;
  132.                     window.moveTo(xOffset, yOffset);
  133.                 ]]></body>
  134.             </method>
  135.             
  136.             <method name="contains">
  137.                 <parameter name="child"/>
  138.                 <parameter name="parent"/>
  139.                 <body><![CDATA[
  140.                   try {
  141.                       return parent && ((child == parent) ||
  142.                                         (parent.compareDocumentPosition(child) & Node.DOCUMENT_POSITION_CONTAINED_BY));
  143.                   } catch (ex) {}
  144.                   
  145.                   return false;
  146.                 ]]></body>
  147.             </method>
  148.             
  149.             <method name="move">
  150.                 <body><![CDATA[
  151.                     this.centerWindowOnScreen();
  152.                 ]]></body>
  153.             </method>
  154.             
  155.             <method name="close">
  156.                 <body><![CDATA[
  157.                     window.close();
  158.                 ]]></body>
  159.             </method>
  160.             
  161.             <method name="load">
  162.                 <parameter name="event"/>
  163.                 <body><![CDATA[
  164.                     this.sizeToContent();
  165.                     this.move();
  166.                     if (this.platform.os.name == "mac")
  167.                         setTimeout(function(context) {
  168.                             window.sizeToContent();
  169.                         }, 10, this);
  170.                 ]]></body>
  171.             </method>
  172.             
  173.             <method name="unload">
  174.                 <parameter name="event"/>
  175.                 <body><![CDATA[
  176.                 ]]></body>
  177.             </method>
  178.             
  179.             <method name="dragMouseDown">
  180.                 <parameter name="event"/>
  181.                 <body><![CDATA[
  182.                     if (this.contains(event.originalTarget, this.nodeDraggable)) {
  183.                         this.dragStartPoint = {x: event.screenX - window.screenX, y: event.screenY - window.screenY};
  184.                         window.addEventListener("mousemove", this, false);
  185.                     }
  186.                 ]]></body>
  187.             </method>
  188.             
  189.             <method name="dragMouseMove">
  190.                 <parameter name="event"/>
  191.                 <body><![CDATA[
  192.                     if (this.dragStartPoint)
  193.                         window.moveTo(event.screenX - this.dragStartPoint.x, event.screenY - this.dragStartPoint.y);
  194.                 ]]></body>
  195.             </method>
  196.             
  197.             <method name="dragMouseUp">
  198.                 <parameter name="event"/>
  199.                 <body><![CDATA[
  200.                     window.removeEventListener("mousemove", this, false);
  201.                     this.dragStartPoint = null;
  202.                 ]]></body>
  203.             </method>
  204.             
  205.             <method name="handleEvent">
  206.                 <parameter name="event"/>
  207.                 <body><![CDATA[
  208.                     switch(event.type) {
  209.                         case "mousemove":
  210.                             this.dragMouseMove(event);
  211.                             break;
  212.                         
  213.                         case "load":
  214.                             window.removeEventListener("load", this, false);
  215.                             this.load(event);
  216.                             break;
  217.                         
  218.                         case "unload":
  219.                             window.removeEventListener("unload", this, false);
  220.                             this.unload(event);
  221.                             break;
  222.                     }
  223.                 ]]></body>
  224.             </method>
  225.             
  226.         </implementation>
  227.         
  228.         <handlers>
  229.             <handler event="mousedown"><![CDATA[
  230.                 this.dragMouseDown(event);
  231.             ]]></handler>
  232.             
  233.             <handler event="mouseup"><![CDATA[
  234.                 this.dragMouseUp(event);
  235.             ]]></handler>
  236.         </handlers>
  237.     </binding>
  238. </bindings>