home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / xulrunner-1.9.0.14 / chrome / toolkit.jar / content / global / bindings / popup.xml < prev    next >
Encoding:
Extensible Markup Language  |  2008-01-23  |  24.5 KB  |  749 lines

  1. <?xml version="1.0"?>
  2.  
  3. <bindings id="popupBindings"
  4.    xmlns="http://www.mozilla.org/xbl"
  5.    xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  6.    xmlns:xbl="http://www.mozilla.org/xbl">
  7.  
  8.   <binding id="popup-base">
  9.     <resources>
  10.       <stylesheet src="chrome://global/skin/popup.css"/>
  11.     </resources>
  12.  
  13.     <implementation implements="nsIDOMXULPopupElement">
  14.       <property name="position" onget="return this.getAttribute('position');"
  15.                                 onset="this.setAttribute('position', val); return val;"/>
  16.       <property name="popupBoxObject">
  17.         <getter>
  18.           return this.boxObject.QueryInterface(Components.interfaces.nsIPopupBoxObject);
  19.         </getter>
  20.       </property>
  21.  
  22.       <property name="state" readonly="true"
  23.                 onget="return this.popupBoxObject.popupState"/>
  24.  
  25.       <method name="openPopup">
  26.         <parameter name="aAnchorElement"/>
  27.         <parameter name="aPosition"/>
  28.         <parameter name="aX"/>
  29.         <parameter name="aY"/>
  30.         <parameter name="aIsContextMenu"/>
  31.         <parameter name="aAttributesOverride"/>
  32.         <body>
  33.         <![CDATA[
  34.           try {
  35.             var popupBox = this.popupBoxObject;
  36.             if (popupBox)
  37.               popupBox.openPopup(aAnchorElement, aPosition, aX, aY,
  38.                                  aIsContextMenu, aAttributesOverride);
  39.           } catch(e) {}
  40.         ]]>
  41.         </body>
  42.       </method>
  43.  
  44.       <method name="openPopupAtScreen">
  45.         <parameter name="aX"/>
  46.         <parameter name="aY"/>
  47.         <parameter name="aIsContextMenu"/>
  48.         <body>
  49.         <![CDATA[
  50.           try {
  51.             var popupBox = this.popupBoxObject;
  52.             if (popupBox)
  53.               popupBox.openPopupAtScreen(aX, aY, aIsContextMenu);
  54.           } catch(e) {}
  55.         ]]>
  56.         </body>
  57.       </method>
  58.       
  59.       <method name="showPopup">
  60.         <parameter name="element"/>
  61.         <parameter name="xpos"/>
  62.         <parameter name="ypos"/>
  63.         <parameter name="popuptype"/>
  64.         <parameter name="anchoralignment"/>
  65.         <parameter name="popupalignment"/>
  66.         <body>
  67.         <![CDATA[
  68.           var popupBox = null;
  69.           var menuBox = null;
  70.           try {
  71.             popupBox = this.popupBoxObject;
  72.           } catch(e) {}
  73.           try {
  74.             menuBox = this.parentNode.boxObject.QueryInterface(Components.interfaces.nsIMenuBoxObject);
  75.           } catch(e) {}
  76.           if (menuBox)
  77.             menuBox.openMenu(true);
  78.           else if (popupBox)
  79.             popupBox.showPopup(element, this, xpos, ypos, popuptype, anchoralignment, popupalignment);
  80.         ]]>
  81.         </body>
  82.       </method>
  83.       
  84.       <method name="hidePopup">
  85.         <body>
  86.         <![CDATA[
  87.           var popupBox = null;
  88.           var menuBox = null;
  89.           try {
  90.             popupBox = this.boxObject.QueryInterface(Components.interfaces.nsIPopupBoxObject);
  91.           } catch(e) {}
  92.           try {
  93.             menuBox = this.parentNode.boxObject.QueryInterface(Components.interfaces.nsIMenuBoxObject);
  94.           } catch(e) {}
  95.           if (menuBox)
  96.             menuBox.openMenu(false);
  97.           else if (popupBox)
  98.             popupBox.hidePopup();
  99.         ]]>
  100.         </body>
  101.       </method>
  102.  
  103.       <property name="autoPosition">
  104.         <getter>
  105.         <![CDATA[
  106.           return this.popupBoxObject.autoPosition;
  107.         ]]>
  108.         </getter>
  109.         <setter>
  110.         <![CDATA[
  111.           return this.popupBoxObject.autoPosition = val;
  112.         ]]>
  113.         </setter>
  114.       </property>
  115.       
  116.       <method name="enableKeyboardNavigator">
  117.         <parameter name="aEnableKeyboardNavigator"/>
  118.         <body>
  119.         <![CDATA[
  120.           this.popupBoxObject.enableKeyboardNavigator(aEnableKeyboardNavigator);
  121.         ]]>
  122.         </body>
  123.       </method>
  124.       
  125.       <method name="enableRollup">
  126.         <parameter name="aEnableRollup"/>
  127.         <body>
  128.         <![CDATA[
  129.           this.popupBoxObject.enableRollup(aEnableRollup);
  130.         ]]>
  131.         </body>
  132.       </method>
  133.       
  134.       <method name="sizeTo">
  135.         <parameter name="aWidth"/>
  136.         <parameter name="aHeight"/>
  137.         <body>
  138.         <![CDATA[
  139.           this.popupBoxObject.sizeTo(aWidth, aHeight);
  140.         ]]>
  141.         </body>
  142.       </method>
  143.       
  144.       <method name="moveTo">
  145.         <parameter name="aLeft"/>
  146.         <parameter name="aTop"/>
  147.         <body>
  148.         <![CDATA[
  149.           this.popupBoxObject.moveTo(aLeft, aTop);
  150.         ]]>
  151.         </body>
  152.       </method>
  153.     </implementation>     
  154.  
  155.   </binding>
  156.  
  157.   <binding id="popup"
  158.            extends="chrome://global/content/bindings/popup.xml#popup-base">
  159.     
  160.     <content>
  161.       <xul:arrowscrollbox class="popup-internal-box" flex="1" orient="vertical">
  162.         <children/>
  163.       </xul:arrowscrollbox>
  164.     </content>
  165.  
  166.     <implementation implements="nsIAccessibleProvider">
  167.       <property name="accessibleType" readonly="true">
  168.         <getter>
  169.           <![CDATA[
  170.               return Components.interfaces.nsIAccessibleProvider.XULMenupopup;
  171.             ]]>
  172.         </getter>
  173.       </property>
  174.     </implementation>
  175.  
  176.     <handlers>
  177.       <handler event="contextmenu" action="event.preventDefault();"/>
  178.  
  179.       <handler event="popupshowing" phase="target">
  180.         <![CDATA[
  181.           var array = [];
  182.           var width = 0;
  183.           for (var menuitem = this.firstChild; menuitem; menuitem = menuitem.nextSibling) {
  184.             if (menuitem.localName == "menuitem" && menuitem.hasAttribute("acceltext")) {
  185.               var accel = document.getAnonymousElementByAttribute(menuitem, "anonid", "accel");
  186.               if (accel && accel.boxObject) {
  187.                 array.push(accel);
  188.                 if (accel.boxObject.width > width)
  189.                   width = accel.boxObject.width;
  190.               }
  191.             }
  192.           }
  193.           for (var i = 0; i < array.length; i++)
  194.             array[i].width = width;
  195.         ]]>
  196.       </handler>
  197.     </handlers>
  198.   </binding>
  199.  
  200.   <binding id="panel"
  201.            extends="chrome://global/content/bindings/popup.xml#popup-base">
  202.     <!-- This separate binding for dialog-like panels - not menu, list or autocomplete popups
  203.          exposes the popup as an alert or a pane, depending on whether it is always intended
  204.          to get keyboard navigation when it opens -->
  205.     <implementation implements="nsIDOMXULPopupElement, nsIAccessibleProvider">
  206.       <property name="accessibleType" readonly="true">
  207.         <getter>
  208.           <![CDATA[
  209.           return (this.getAttribute("noautofocus") == "true") ?
  210.                        Components.interfaces.nsIAccessibleProvider.XULAlert :
  211.                        Components.interfaces.nsIAccessibleProvider.XULPane;
  212.         ]]></getter>
  213.       </property>
  214.       <field name="_prevFocus">0</field>
  215.     </implementation>
  216.     
  217.     <handlers>
  218.       <handler event="popupshowing"><![CDATA[
  219.         // Capture the previous focus before has a chance to get set inside the panel
  220.         try {
  221.           this._prevFocus = document.commandDispatcher.focusedElement;
  222.           if (!this._prevFocus)  // Content window has focus
  223.             this._prevFocus = document.commandDispatcher.focusedWindow;
  224.         } catch (ex) {}
  225.        ]]></handler>
  226.       <handler event="popupshown"><![CDATA[
  227.         // Fire event for accessibility APIs
  228.         var alertEvent = document.createEvent("Events");
  229.         alertEvent.initEvent("AlertActive", true, true);
  230.         this.dispatchEvent(alertEvent);
  231.        ]]></handler>
  232.       <handler event="popuphiding"><![CDATA[
  233.         function restoreFocusIfInPanel(aPanel, currentFocus, prevFocus) {
  234.           try {
  235.             if (document.commandDispatcher.focusedWindow != window)
  236.               return; // Focus has already been set to a window outside of this panel
  237.           } catch(ex) {}
  238.           var ancestorOfFocus = currentFocus;
  239.           while (ancestorOfFocus) {
  240.             if (ancestorOfFocus == aPanel) {
  241.               // Focus was set on an element inside this panel,
  242.               // so we need to move it back to where it was previously
  243.               prevFocus.focus();
  244.               return;
  245.             }
  246.             ancestorOfFocus = ancestorOfFocus.parentNode;
  247.           }
  248.         }
  249.         try {
  250.           if (this._prevFocus && this.getAttribute("norestorefocus") != "true")
  251.             setTimeout(restoreFocusIfInPanel, 0, this, document.commandDispatcher.focusedElement,
  252.                        this._prevFocus);
  253.         } catch(ex) { }
  254.       ]]></handler>
  255.     </handlers>
  256.   </binding>
  257.  
  258.   <binding id="tooltip" extends="chrome://global/content/bindings/popup.xml#popup">
  259.     <content>
  260.       <children>
  261.         <xul:label class="tooltip-label" xbl:inherits="xbl:text=label" flex="1"/>
  262.       </children>
  263.     </content>
  264.     
  265.     <implementation implements="nsIAccessibleProvider">
  266.       <property name="accessibleType" readonly="true">
  267.         <getter>
  268.           return Components.interfaces.nsIAccessibleProvider.XULTooltip;
  269.         </getter>
  270.       </property>
  271.  
  272.       <field name="_mouseOutCount">0</field>
  273.       <field name="_isMouseOver">false</field>
  274.       
  275.       <property name="label"
  276.                 onget="return this.getAttribute('label');"
  277.                 onset="this.setAttribute('label', val); return val;"/>
  278.     </implementation>
  279.  
  280.     <handlers>
  281.       <handler event="mouseover"><![CDATA[
  282.         var rel = event.relatedTarget;
  283.         //dump("ENTERING " + (rel ? rel.localName : "null") + "\n");
  284.         if (!rel)
  285.           return;
  286.           
  287.         // find out if the node we entered from is one of our anonymous children
  288.         while (rel) {
  289.           if (rel == this)
  290.             break;
  291.           rel = rel.parentNode;
  292.         }
  293.  
  294.         // if the exited node is not a descendant of ours, we are entering for the first time
  295.         if (rel != this)
  296.           this._isMouseOver = true;
  297.       ]]></handler>
  298.  
  299.       <handler event="mouseout"><![CDATA[
  300.         var rel = event.relatedTarget;
  301.         //dump("LEAVING " + (rel ? rel.localName : "null") + "\n");
  302.  
  303.         // relatedTarget is null when the titletip is first shown: a mouseout event fires
  304.         // because the mouse is exiting the main window and entering the titletip "window".
  305.         // relatedTarget is also null when the mouse exits the main window completely,
  306.         // so count how many times relatedTarget was null after titletip is first shown 
  307.         // and hide popup the 2nd time
  308.         if (!rel) {
  309.           ++this._mouseOutCount;
  310.           if (this._mouseOutCount > 1)
  311.             this.hidePopup();
  312.           return;
  313.         }
  314.           
  315.         // find out if the node we are entering is one of our anonymous children
  316.         while (rel) {
  317.           if (rel == this)
  318.             break;
  319.           rel = rel.parentNode;
  320.         }
  321.         
  322.         // if the entered node is not a descendant of ours, hide the tooltip
  323.         if (rel != this && this._isMouseOver) {
  324.           this.hidePopup();
  325.         }        
  326.       ]]></handler>
  327.  
  328.       <handler event="popuphiding"><![CDATA[
  329.         this._isMouseOver = false;
  330.         this._mouseOutCount = 0;
  331.       ]]></handler>
  332.     </handlers>
  333.   </binding>
  334.   
  335.   <!-- XXXben this binding is not currently used -->
  336.   <binding id="resizerbase" extends="xul:box">
  337.     <implementation>
  338.       <property name="popup">
  339.         <getter>
  340.         <![CDATA[
  341.           var currNode = this.parentNode;
  342.           while (currNode) {
  343.             try {
  344.               var bo = currNode.boxObject.QueryInterface(Components.interfaces.nsIPopupBoxObject);
  345.               if (bo)
  346.                 return currNode;
  347.             }
  348.             catch (e) {
  349.             }
  350.             currNode = currNode.parentNode;
  351.           }
  352.           return null;
  353.         ]]>
  354.         </getter>
  355.       </property>
  356.       
  357.       <method name="handleMouseMove">
  358.         <parameter name="aEvent"/>
  359.         <body>
  360.         <![CDATA[
  361.           throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
  362.         ]]>
  363.         </body>
  364.       </method> 
  365.       
  366.       <field name="screenLeft">0</field>
  367.       <field name="screenTop">0</field>
  368.       <field name="resizerDirection">0</field>
  369.     </implementation>
  370.     
  371.     <handlers>
  372.       <handler event="mousedown" phase="capturing"> 
  373.       <![CDATA[
  374.         var popup = event.target.popup;
  375.         var boxObject = popup.boxObject;
  376.         boxObject.captureMouseEvents = true;
  377.         event.target.screenLeft = event.screenX;
  378.         event.target.screenTop = event.screenY;
  379.         event.target.setMode();
  380.         event.preventDefault();
  381.       ]]>
  382.       </handler>
  383.       <handler event="mouseup" phase="capturing">
  384.       <![CDATA[
  385.         var popup = event.target.popup;
  386.         var boxObject = popup.boxObject;
  387.         boxObject.captureMouseEvents = false;
  388.         event.target.screenLeft = event.screenX;
  389.         event.target.screenTop = event.screenY;
  390.         event.target.direction = 0;
  391.         event.preventDefault();
  392.       ]]>
  393.       </handler>
  394.       <handler event="mousemove" phase="capturing">
  395.       <![CDATA[
  396.         event.target.handleMouseMove(event);
  397.         event.preventDefault();
  398.       ]]>
  399.       </handler>
  400.     </handlers>
  401.   </binding>
  402.   
  403.   <!-- East-West resizer -->
  404.   <binding id="ew-resizer" extends="xul:box"> <!-- extends="chrome://global/content/bindings/popup.xml#resizerbase"> -->
  405.     <content>
  406.       <xul:hbox class="ew-resizer-box" flex="1"/>
  407.     </content>
  408.     <!--
  409.     <implementation>
  410.       <method name="handleMouseMove">
  411.         <parameter name="aEvent"/>
  412.         <body>
  413.         <![CDATA[
  414.           var boxObject = aEvent.target.boxObject;
  415.           if (boxObject.captureMouseEvents && this.resizerDirection == "right") {
  416.             var delta = aEvent.screenX - this.screenLeft;
  417.             this.screenLeft = aEvent.screenX;
  418.             
  419.             // We can set this directly as we're only modifying one dimension
  420.             aEvent.target.width += delta;
  421.           }
  422.         ]]>
  423.         </body>
  424.       </method>
  425.       <method name="setMode">
  426.         <body>
  427.         <![CDATA[
  428.           this.resizerDirection = "right";
  429.         ]]>
  430.         </body>
  431.       </method>
  432.     </implementation>
  433.     -->
  434.   </binding>
  435.   
  436.   <!-- North-South resizer -->
  437.   <binding id="ns-resizer" extends="xul:box"> <!-- extends="chrome://global/content/bindings/popup.xml#resizerbase"> -->
  438.     <content>
  439.       <xul:hbox class="ns-resizer-box" flex="1"/>
  440.     </content>
  441.     <!--
  442.     <implementation>
  443.       <method name="handleMouseMove">
  444.         <parameter name="aEvent"/>
  445.         <body>
  446.         <![CDATA[
  447.           var boxObject = aEvent.target.boxObject;
  448.           if (boxObject.captureMouseEvents && this.resizerDirection == "bottom") {
  449.             var delta = aEvent.screenY - this.screenTop;
  450.             this.screenTop = aEvent.screenY;
  451.             var currWidth = aEvent.target.boxObject.width;
  452.             
  453.             // We can set this directly as we're only modifying one dimension
  454.             aEvent.target.height += delta;
  455.           }
  456.         ]]>
  457.         </body>
  458.       </method>
  459.       <method name="setMode">
  460.         <body>
  461.         <![CDATA[
  462.           this.resizerDirection = "bottom";
  463.         ]]>
  464.         </body>
  465.       </method>
  466.     </implementation>
  467.     -->
  468.   </binding>
  469.   
  470.   <!-- Diagonal resizer -->
  471.   <binding id="diag-resizer" extends="xul:box"> <!-- extends="chrome://global/content/bindings/popup.xml#resizerbase"> -->
  472.     <content>
  473.       <xul:hbox class="diag-resizer-box" align="center" flex="1">
  474.         <xul:image class="diag-resizer-image"/>
  475.       </xul:hbox>
  476.     </content>
  477.     <!--
  478.     <implementation>
  479.       <method name="handleMouseMove">
  480.         <parameter name="aEvent"/>
  481.         <body>
  482.         <![CDATA[
  483.           var boxObject = aEvent.target.boxObject;
  484.           if (boxObject.captureMouseEvents && this.resizerDirection == "bottomright") {
  485.             if (!this.screenLeft || !this.screenTop) {
  486.               this.screenLeft = aEvent.screenX; 
  487.               this.screenTop = aEvent.screenY;
  488.             }
  489.             var deltaX = aEvent.screenX - this.screenLeft;
  490.             var deltaY = aEvent.screenY - this.screenTop;
  491.             this.screenLeft = aEvent.screenX;
  492.             this.screenTop = aEvent.screenY;
  493.             var currWidth = aEvent.target.boxObject.width;
  494.             var currHeight = aEvent.target.boxObject.height;
  495.             aEvent.target.sizeTo(currWidth + deltaX, currHeight + deltaY);
  496.           }
  497.         ]]>
  498.         </body>
  499.       </method>
  500.       <method name="setMode">
  501.         <body>
  502.         <![CDATA[
  503.           this.resizerDirection = "bottomright";
  504.         ]]>
  505.         </body>
  506.       </method>
  507.     </implementation>
  508.     -->
  509.   </binding>
  510.   
  511.   <binding id="titlebar" extends="xul:box"> <!-- extends="chrome://global/content/bindings/popup.xml#resizerbase"> -->
  512.     <content>
  513.       <xul:hbox class="titlebar-box" flex="1">
  514.         <xul:hbox class="titlebar-title-box" flex="1" tooltiptext="Click and drag to float">
  515.           <xul:label class="titlebar-title" xbl:inherits="value=title" flex="1" crop="right"/>
  516.         </xul:hbox>
  517.         <xul:button class="popupClose" tooltiptext="Close"/>
  518.       </xul:hbox>
  519.     </content>
  520.     <!--
  521.     <implementation>
  522.       <method name="handleMouseMove">
  523.         <parameter name="aEvent"/>
  524.         <body>
  525.         <![CDATA[
  526.           if (!this.popup) this.popup = aEvent.target.popup;
  527.           var boxObject = this.popup.boxObject;
  528.           if (boxObject.captureMouseEvents && this.direction == "titlebar") {
  529.             if (!this.screenLeft || !this.screenTop) {
  530.               this.screenLeft = aEvent.screenX; 
  531.               this.screenTop = aEvent.screenY;
  532.             }
  533.             var deltaX = aEvent.screenX - this.screenLeft;
  534.             var deltaY = aEvent.screenY - this.screenTop;
  535.             this.screenLeft = aEvent.screenX;
  536.             this.screenTop = aEvent.screenY;
  537.             var currX = aEvent.target.boxObject.screenX;
  538.             var currY = aEvent.target.boxObject.screenY;
  539.             aEvent.target.moveTo(currX + deltaX, currY + deltaY);
  540.           }
  541.         ]]>
  542.         </body>
  543.       </method>
  544.       <method name="setMode">
  545.         <body>
  546.         <![CDATA[
  547.           this.direction = "titlebar";
  548.         ]]>
  549.         </body>
  550.       </method>
  551.     </implementation>
  552.     -->
  553.   </binding>          
  554.  
  555.   <binding id="floater-base" display="xul:popup" extends="chrome://global/content/bindings/popup.xml#popup">
  556.     <implementation>
  557.       
  558.       <!-- Popup Manipulation Constants -->
  559.       <field name="MANIPULATE_NONE"      readonly="true">0</field>
  560.       <field name="MANIPULATE_MOVE"      readonly="true">1</field>
  561.       <field name="MANIPULATE_SIZE_EW"   readonly="true">2</field>
  562.       <field name="MANIPULATE_SIZE_NS"   readonly="true">3</field>
  563.       <field name="MANIPULATE_SIZE_DIAG" readonly="true">4</field>
  564.       
  565.       <method name="handleMouseMove">
  566.         <parameter name="aEvent"/>
  567.         <body>
  568.         <![CDATA[
  569.           var boxObject = this.boxObject;
  570.           if (boxObject.captureMouseEvents) {
  571.             var dX, dY;
  572.             var eScreenX = aEvent.screenX; 
  573.             var eScreenY = aEvent.screenY;
  574.             switch (this.manipulateMode) {
  575.               case this.MANIPULATE_SIZE_EW:
  576.                 var width = boxObject.width;
  577.                 dX = eScreenX - this.screenLeft;
  578.                 this.sizeTo(width + dX, this.height);
  579.                 break;
  580.               case this.MANIPULATE_SIZE_NS:
  581.                 var height = boxObject.height;
  582.                 dY = eScreenY - this.screenTop;
  583.                 this.sizeTo(this.width, height + dY);
  584.                 break;
  585.               case this.MANIPULATE_SIZE_DIAG:
  586.                 dX = eScreenX - this.screenLeft;
  587.                 dY = eScreenY - this.screenTop;
  588.                 this.sizeTo(this.width + dX, this.height + dY);
  589.                 break;
  590.               case this.MANIPULATE_MOVE:
  591.                 // XXXben this may not yet be complete. When we drag away from the 
  592.                 //        owner, we set some properties to ensure that we aren't
  593.                 //        positioned as a menu, automatically closed or steal
  594.                 //        keyboard navigation in an inappropriate way. 
  595.                 this.autoPosition = false;
  596.                 this.enableRollup(false);
  597.                 this.enableKeyboardNavigator(false);
  598.                 dX = eScreenX - this.screenLeft;
  599.                 dY = eScreenY - this.screenTop;
  600.                 this.moveTo(this.left + dX, this.top + dY);
  601.                 break;
  602.               default:
  603.                 break;                      
  604.             }
  605.             this.screenLeft = eScreenX;
  606.             this.screenTop = eScreenY;
  607.           }
  608.         ]]>
  609.         </body>
  610.       </method> 
  611.       <method name="findParentByLocalName">
  612.         <parameter name="aNode"/>
  613.         <parameter name="aLocalName"/>
  614.         <body>
  615.         <![CDATA[
  616.           var parent = aNode;
  617.           var names = [].concat(aLocalName);
  618.           while (parent) {
  619.             for (var i = 0; i < names.length; ++i) {
  620.               if (parent.localName == names[i])
  621.                 return parent;
  622.             }
  623.             parent = parent.parentNode;
  624.           }
  625.           return null;
  626.         ]]>
  627.         </body>
  628.       </method>
  629.       <method name="setMode">
  630.         <parameter name="aEvent"/>
  631.         <body>
  632.         <![CDATA[
  633.           var widget = this.findParentByLocalName(aEvent.originalTarget, ["resizer", "titlebar"]);
  634.           if (widget) {
  635.             if (widget.localName == "titlebar")
  636.               this.manipulateMode = this.MANIPULATE_MOVE;
  637.             else 
  638.               this.sizeDirection = widget.getAttribute("direction");
  639.           }
  640.         ]]>
  641.         </body>
  642.       </method>
  643.       <method name="cleanUp">
  644.         <parameter name="aEvent"/>
  645.         <body>
  646.         <![CDATA[
  647.           this.boxObject.captureMouseEvents = false;
  648.           this.screenLeft = aEvent.screenX;
  649.           this.screenTop = aEvent.screenY;
  650.           this.manipulateMode = this.MANIPULATE_NONE;
  651.           aEvent.preventDefault();
  652.         ]]>
  653.         </body>
  654.       </method>
  655.       <field name="screenLeft">0</field>
  656.       <field name="screenTop">0</field>
  657.       <field name="manipulateMode">0</field>
  658.     </implementation>
  659.     <handlers>
  660.       <handler event="mousedown" phase="capturing"> 
  661.       <![CDATA[
  662.         this.boxObject.captureMouseEvents = true;
  663.         this.screenLeft = event.screenX;
  664.         this.screenTop = event.screenY;
  665.         this.setMode(event);
  666.       ]]>
  667.       </handler>
  668.       <handler event="mouseup" phase="capturing">
  669.       <![CDATA[
  670.         this.cleanUp(event);
  671.       ]]>
  672.       </handler>
  673.       <handler event="mousemove" phase="capturing">
  674.       <![CDATA[
  675.         this.handleMouseMove(event);
  676.         event.preventDefault();
  677.       ]]>
  678.       </handler>
  679.       <!-- clean up, release the mouse, etc -->
  680.       <handler event="popuphiding">
  681.       <![CDATA[
  682.         this.cleanUp(event);
  683.       ]]>
  684.       </handler>
  685.       <handler event="click">
  686.       <![CDATA[
  687.         // Hide the popup if the [X] box is clicked. 
  688.         // XXXben this may not really belong here, but rather in a derived binding. 
  689.         if (event.originalTarget.className.indexOf("popupClose") != -1)
  690.           this.popupBoxObject.hidePopup();
  691.       ]]>
  692.       </handler>
  693.     </handlers>
  694.   </binding>
  695.  
  696.   <binding id="popup-scrollbars" extends="chrome://global/content/bindings/popup.xml#popup">
  697.     <content>
  698.       <xul:hbox class="popup-internal-box" flex="1" orient="vertical" style="overflow: auto;">
  699.         <children/>
  700.       </xul:hbox>
  701.     </content>
  702.   </binding>
  703.  
  704.   <binding id="floater-normal" extends="chrome://global/content/bindings/popup.xml#floater-base">
  705.     <content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" >
  706.       <vbox class="floater-box" flex="1">
  707.         <box class="floater-box-top">
  708.           <titlebar flex="1" xbl:inherits="title" style="border: 1px outset grey; background-color: grey;"/>
  709.         </box>
  710.         <box class="floater-box-center" flex="1">
  711.           <box class="floater-children" flex="1"> 
  712.             <children/>
  713.           </box>
  714.         </box>
  715.         <box class="floater-box-bottom">
  716.           <resizer direction="bottom" flex="1"/>
  717.           <resizer direction="bottomright" tooltiptext="Click and drag to resize"/>
  718.         </box>
  719.       </vbox>
  720.     </content>
  721.   </binding>
  722.  
  723.   <binding id="floater-dock-left" extends="chrome://global/content/bindings/popup.xml#floater-base">
  724.     <content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" >
  725.       <vbox class="floater-box" flex="1">
  726.         <box class="floater-box-top">
  727.           <titlebar flex="1" xbl:inherits="title"/>
  728.         </box>
  729.         <box class="floater-box-center" flex="1">
  730.           <box class="floater-children" flex="1"> 
  731.             <children/>
  732.           </box>
  733.           <resizer direction="right" tooltiptext="Click and drag to resize"/>
  734.         </box>
  735.       </vbox>
  736.     </content>
  737.   </binding>  
  738.   
  739.   <binding id="close-button" extends="chrome://global/content/bindings/button.xml#button-base">
  740.     <content>
  741.       <xul:hbox align="center" flex="1">
  742.         <xul:image class="close-button-x"/>
  743.       </xul:hbox>
  744.     </content>
  745.   </binding>
  746.  
  747. </bindings>
  748.  
  749.