зеркало из https://github.com/mozilla/gecko-dev.git
Finish forking toolkit.
This commit is contained in:
Родитель
42abcaaba1
Коммит
92128276b1
|
@ -0,0 +1,574 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="colorpickerBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="colorpicker">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/colorpicker.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<xul:vbox flex="1">
|
||||
|
||||
<xul:hbox>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #FFFFFF" color="#FFFFFF"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #FFCCCC" color="#FFCCCC"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #FFCC99" color="#FFCC99"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #FFFF99" color="#FFFF99"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #FFFFCC" color="#FFFFCC"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #99FF99" color="#99FF99"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #99FFFF" color="#99FFFF"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #CCFFFF" color="#CCFFFF"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #CCCCFF" color="#CCCCFF"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #FFCCFF" color="#FFCCFF"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #CCCCCC" color="#CCCCCC"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #FF6666" color="#FF6666"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #FF9966" color="#FF9966"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #FFFF66" color="#FFFF66"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #FFFF33" color="#FFFF33"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #66FF99" color="#66FF99"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #33FFFF" color="#33FFFF"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #66FFFF" color="#66FFFF"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #9999FF" color="#9999FF"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #FF99FF" color="#FF99FF"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #C0C0C0" color="#C0C0C0"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #FF0000" color="#FF0000"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #FF9900" color="#FF9900"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #FFCC66" color="#FFCC66"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #FFFF00" color="#FFFF00"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #33FF33" color="#33FF33"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #66CCCC" color="#66CCCC"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #33CCFF" color="#33CCFF"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #6666CC" color="#6666CC"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #CC66CC" color="#CC66CC"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #999999" color="#999999"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #CC0000" color="#CC0000"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #FF6600" color="#FF6600"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #FFCC33" color="#FFCC33"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #FFCC00" color="#FFCC00"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #33CC00" color="#33CC00"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #00CCCC" color="#00CCCC"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #3366FF" color="#3366FF"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #6633FF" color="#6633FF"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #CC33CC" color="#CC33CC"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #666666" color="#666666"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #990000" color="#990000"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #CC6600" color="#CC6600"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #CC9933" color="#CC9933"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #999900" color="#999900"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #009900" color="#009900"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #339999" color="#339999"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #3333FF" color="#3333FF"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #6600CC" color="#6600CC"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #993399" color="#993399"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #333333" color="#333333"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #660000" color="#660000"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #993300" color="#993300"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #996633" color="#996633"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #666600" color="#666600"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #006600" color="#006600"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #336666" color="#336666"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #000099" color="#000099"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #333399" color="#333399"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #663366" color="#663366"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #000000" color="#000000"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #330000" color="#330000"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #663300" color="#663300"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #663333" color="#663333"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #333300" color="#333300"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #003300" color="#003300"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #003333" color="#003333"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #000066" color="#000066"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #330099" color="#330099"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #330033" color="#330033"/>
|
||||
</xul:hbox>
|
||||
</xul:vbox>
|
||||
<!-- Something to take tab focus
|
||||
<button style="border : 0px; width: 0px; height: 0px;"/>
|
||||
-->
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
|
||||
<property name="color">
|
||||
<getter><![CDATA[
|
||||
return this.mSelectedCell ? this.mSelectedCell.getAttribute("color") : null;
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
if (!val)
|
||||
return null;
|
||||
val = val.toUpperCase();
|
||||
// Translate standard HTML color strings:
|
||||
if (val[0] != "#") {
|
||||
switch (val) {
|
||||
case "GREEN":
|
||||
val = "#008000";
|
||||
break;
|
||||
case "LIME":
|
||||
val = "#00FF00";
|
||||
break;
|
||||
case "OLIVE":
|
||||
val = "#808000";
|
||||
break;
|
||||
case "TEAL":
|
||||
val = "#008080";
|
||||
break;
|
||||
case "YELLOW":
|
||||
val = "#FFFF00";
|
||||
break;
|
||||
case "RED":
|
||||
val = "#FF0000";
|
||||
break;
|
||||
case "MAROON":
|
||||
val = "#800000";
|
||||
break;
|
||||
case "PURPLE":
|
||||
val = "#800080";
|
||||
break;
|
||||
case "FUCHSIA":
|
||||
val = "#FF00FF";
|
||||
break;
|
||||
case "NAVY":
|
||||
val = "#000080";
|
||||
break;
|
||||
case "BLUE":
|
||||
val = "#0000FF";
|
||||
break;
|
||||
case "AQUA":
|
||||
val = "#00FFFF";
|
||||
break;
|
||||
case "WHITE":
|
||||
val = "#FFFFFF";
|
||||
break;
|
||||
case "SILVER":
|
||||
val = "#CC0C0C0";
|
||||
break;
|
||||
case "GRAY":
|
||||
val = "#808080";
|
||||
break;
|
||||
default: // BLACK
|
||||
val = "#000000";
|
||||
break;
|
||||
}
|
||||
}
|
||||
var cells = this.mBox.getElementsByAttribute("color", val);
|
||||
if (cells.length > 0) {
|
||||
this.selectCell(cells[0]);
|
||||
this.hoverCell(this.mSelectedCell);
|
||||
}
|
||||
return null;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<method name="initColor">
|
||||
<parameter name="aColor"/>
|
||||
<body><![CDATA[
|
||||
// Use this to initialize color without
|
||||
// triggering the "onselect" handler,
|
||||
// which closes window when it's a popup
|
||||
this.mDoOnSelect = false;
|
||||
this.color = aColor;
|
||||
this.mDoOnSelect = true;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="initialize">
|
||||
<body><![CDATA[
|
||||
this.mSelectedCell = null;
|
||||
this.mHoverCell = null;
|
||||
this.mBox = document.getAnonymousNodes(this)[0];
|
||||
this.mIsPopup = false;
|
||||
this.mDoOnSelect = true;
|
||||
|
||||
this.hoverCell(this.mBox.childNodes[0].childNodes[0]);
|
||||
|
||||
var onselect = this.getAttribute("onselect");
|
||||
if (onselect) {
|
||||
try {
|
||||
this.onselect = new Function(onselect);
|
||||
} catch (ex) {
|
||||
// watch out for syntax errors in the function code
|
||||
}
|
||||
}
|
||||
// used to capture keydown at the document level
|
||||
this.mPickerKeyDown = function(aEvent)
|
||||
{
|
||||
document._focusedPicker.pickerKeyDown(aEvent);
|
||||
}
|
||||
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="resetHover">
|
||||
<body><![CDATA[
|
||||
if (this.mHoverCell)
|
||||
this.mHoverCell.removeAttribute("hover");
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="getColIndex">
|
||||
<parameter name="aCell"/>
|
||||
<body><![CDATA[
|
||||
var cell = aCell;
|
||||
var idx;
|
||||
for (idx = -1; cell; idx++)
|
||||
cell = cell.previousSibling;
|
||||
|
||||
return idx;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="isColorCell">
|
||||
<parameter name="aCell"/>
|
||||
<body><![CDATA[
|
||||
return aCell && aCell.hasAttribute("color");
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="hoverLeft">
|
||||
<body><![CDATA[
|
||||
var cell = this.mHoverCell.previousSibling;
|
||||
this.hoverCell(cell);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="hoverRight">
|
||||
<body><![CDATA[
|
||||
var cell = this.mHoverCell.nextSibling;
|
||||
this.hoverCell(cell);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="hoverUp">
|
||||
<body><![CDATA[
|
||||
var row = this.mHoverCell.parentNode.previousSibling;
|
||||
if (row) {
|
||||
var colIdx = this.getColIndex(this.mHoverCell);
|
||||
var cell = row.childNodes[colIdx];
|
||||
this.hoverCell(cell);
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="hoverDown">
|
||||
<body><![CDATA[
|
||||
var row = this.mHoverCell.parentNode.nextSibling;
|
||||
if (row) {
|
||||
var colIdx = this.getColIndex(this.mHoverCell);
|
||||
var cell = row.childNodes[colIdx];
|
||||
this.hoverCell(cell);
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="hoverTo">
|
||||
<parameter name="aRow"/>
|
||||
<parameter name="aCol"/>
|
||||
|
||||
<body><![CDATA[
|
||||
var row = this.mBox.childNodes[aRow];
|
||||
if (!row) return;
|
||||
var cell = row.childNodes[aCol];
|
||||
if (!cell) return;
|
||||
this.hoverCell(cell);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="hoverCell">
|
||||
<parameter name="aCell"/>
|
||||
|
||||
<body><![CDATA[
|
||||
if (this.isColorCell(aCell)) {
|
||||
this.resetHover();
|
||||
aCell.setAttribute("hover", "true");
|
||||
this.mHoverCell = aCell;
|
||||
var event = document.createEvent('Events');
|
||||
event.initEvent('DOMMenuItemActive', false, true);
|
||||
aCell.dispatchEvent(event);
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="selectHoverCell">
|
||||
<body><![CDATA[
|
||||
this.selectCell(this.mHoverCell);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="selectCell">
|
||||
<parameter name="aCell"/>
|
||||
|
||||
<body><![CDATA[
|
||||
if (this.isColorCell(aCell)) {
|
||||
if (this.mSelectedCell)
|
||||
this.mSelectedCell.removeAttribute("selected");
|
||||
|
||||
this.mSelectedCell = aCell;
|
||||
aCell.setAttribute("selected", "true");
|
||||
|
||||
if (this.mDoOnSelect && this.onselect)
|
||||
this.onselect();
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="addKeyListener">
|
||||
<body><![CDATA[
|
||||
document._focusedPicker = this;
|
||||
document.addEventListener("keydown", this.mPickerKeyDown, true);
|
||||
]]></body>
|
||||
</method>
|
||||
<method name="removeKeyListener">
|
||||
<body><![CDATA[
|
||||
document._focusedPicker = null;
|
||||
document.removeEventListener("keydown", this.mPickerKeyDown, true);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="pickerKeyDown">
|
||||
<parameter name="aEvent"/>
|
||||
<body><![CDATA[
|
||||
switch (aEvent.keyCode) {
|
||||
case 37: // left
|
||||
this.hoverLeft();
|
||||
break;
|
||||
case 38: // up
|
||||
this.hoverUp();
|
||||
break;
|
||||
case 39: // right
|
||||
this.hoverRight();
|
||||
break;
|
||||
case 40: // down
|
||||
this.hoverDown();
|
||||
break;
|
||||
case 13: // enter
|
||||
case 32: // space
|
||||
this.selectHoverCell();
|
||||
break;
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<constructor><![CDATA[
|
||||
this.initialize();
|
||||
]]></constructor>
|
||||
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="mouseover"><![CDATA[
|
||||
this.hoverCell(event.originalTarget);
|
||||
]]></handler>
|
||||
|
||||
<handler event="click"><![CDATA[
|
||||
if (event.originalTarget.hasAttribute("color")) {
|
||||
this.selectCell(event.originalTarget);
|
||||
this.hoverCell(this.mSelectedCell);
|
||||
}
|
||||
]]></handler>
|
||||
|
||||
|
||||
<handler event="focus" phase="capturing">
|
||||
<![CDATA[
|
||||
if (!mIsPopup && this.getAttribute('focused') != 'true') {
|
||||
this.setAttribute('focused','true');
|
||||
this.addKeyListener();
|
||||
if (this.mSelectedCell)
|
||||
this.hoverCell(this.mSelectedCell);
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<handler event="blur" phase="capturing">
|
||||
<![CDATA[
|
||||
if (!mIsPopup && this.getAttribute('focused') == 'true') {
|
||||
this.removeKeyListener();
|
||||
this.removeAttribute('focused');
|
||||
this.resetHover();
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="colorpicker-button">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/colorpicker.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<xul:hbox class="colorpicker-button-colorbox" anonid="colorbox" flex="1"/>
|
||||
|
||||
<xul:popupset>
|
||||
<xul:popup class="colorpicker-button-menupopup" anonid="colorpopup"
|
||||
onmousedown="event.stopPropagation()"
|
||||
onpopupshowing="this._colorPicker.onPopupShowing()"
|
||||
onpopuphiding="this._colorPicker.onPopupHiding()">
|
||||
|
||||
<xul:colorpicker xbl:inherits="palettename" allowevents="true" anonid="colorpicker"
|
||||
onselect="this.parentNode.parentNode.parentNode.pickerChange()"/>
|
||||
|
||||
</xul:popup>
|
||||
</xul:popupset>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIAccessibleProvider" >
|
||||
<property name="accessible">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
|
||||
return accService.createXULColorPickerAccessible(this);
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<property name="open" onget="return this.mOpen"/>
|
||||
|
||||
<property name="color">
|
||||
<getter><![CDATA[
|
||||
return this.getAttribute("color");
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
this.mColorBox.setAttribute("style", "background-color: " + val);
|
||||
return this.setAttribute("color", val);
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<method name="initialize">
|
||||
<body><![CDATA[
|
||||
this.mOpen = false;
|
||||
this.onchange = null;
|
||||
|
||||
this.mColorBox = document.getAnonymousElementByAttribute(this, "anonid", "colorbox");
|
||||
|
||||
var popup = document.getAnonymousElementByAttribute(this, "anonid", "colorpopup")
|
||||
popup._colorPicker = this;
|
||||
|
||||
this.mPicker = document.getAnonymousElementByAttribute(this, "anonid", "colorpicker")
|
||||
|
||||
var change = this.getAttribute("onchange");
|
||||
if (change) {
|
||||
try {
|
||||
this.onchange = new Function("event", change);
|
||||
} catch (ex) {
|
||||
// watch out for syntax errors in the function code
|
||||
}
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="getElementByanonid">
|
||||
<parameter name="aValue"/>
|
||||
<body><![CDATA[
|
||||
var nodes = document.getAnonymousNodes(this);
|
||||
var results;
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
results = nodes[i].getElementsByAttribute("anonid", aValue);
|
||||
if (results.length > 0)
|
||||
return results[0];
|
||||
}
|
||||
return null;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="showPopup">
|
||||
<body><![CDATA[
|
||||
this.mPicker.parentNode.showPopup(this, -1, -1, "popup", "bottomleft", "topleft");
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="hidePopup">
|
||||
<body><![CDATA[
|
||||
this.mPicker.parentNode.hidePopup();
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="onPopupShowing">
|
||||
<body><![CDATA[
|
||||
this.mOpen = true;
|
||||
this.setAttribute("open", "true");
|
||||
|
||||
if ("resetHover" in this.mPicker)
|
||||
this.mPicker.resetHover();
|
||||
this.mPicker.addKeyListener();
|
||||
this.mPicker.mIsPopup = true;
|
||||
// Initialize to current button's color
|
||||
this.mPicker.initColor(this.color);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="onPopupHiding">
|
||||
<body><![CDATA[
|
||||
this.mOpen = false;
|
||||
this.removeAttribute("open");
|
||||
// Removes the key listener
|
||||
this.mPicker.removeKeyListener();
|
||||
this.mPicker.mIsPopup = false;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="pickerChange">
|
||||
<body><![CDATA[
|
||||
this.color = this.mPicker.color;
|
||||
setTimeout(function(aPopup) { aPopup.hidePopup() }, 1, this.mPicker.parentNode);
|
||||
|
||||
if (this.onchange)
|
||||
this.onchange();
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<constructor><![CDATA[
|
||||
this.initialize();
|
||||
]]></constructor>
|
||||
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="keydown"><![CDATA[
|
||||
// open popup if key is space/up/left/right/down and popup is closed
|
||||
if ( (event.keyCode == 32 || (event.keyCode > 36 && event.keyCode < 41)) && !this.mOpen)
|
||||
|
||||
this.showPopup();
|
||||
]]></handler>
|
||||
|
||||
<handler event="mousedown"><![CDATA[
|
||||
// Though I would prefer the open the popup using the built-in
|
||||
// popup="_child" mechanism, I can't use that because I can't seem to
|
||||
// get it to recognize the popupalign and popupanchor attributes that way
|
||||
// So, I have to do it manually...
|
||||
this.focus();
|
||||
this.showPopup();
|
||||
]]></handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="colorpickertile">
|
||||
<implementation implements="nsIAccessibleProvider" >
|
||||
<property name="accessible">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
|
||||
return accService.createXULColorPickerTileAccessible(this);
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
|
@ -0,0 +1,325 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="dialogBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="dialog-base">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/dialog.css"/>
|
||||
</resources>
|
||||
</binding>
|
||||
|
||||
<binding id="dialog" extends="chrome://global/content/bindings/dialog.xml#dialog-base">
|
||||
<content>
|
||||
<xul:vbox class="box-inherit dialog-content-box" flex="1">
|
||||
<children/>
|
||||
</xul:vbox>
|
||||
|
||||
<xul:hbox class="dialog-button-box" pack="end"
|
||||
xbl:inherits="pack=buttonpack,align=buttonalign,dir=buttondir,orient=buttonorient">
|
||||
<xul:button dlgtype="accept" class="dialog-button"/>
|
||||
<xul:button dlgtype="extra1" class="dialog-button" hidden="true" label=""/>
|
||||
<xul:button dlgtype="extra2" class="dialog-button" hidden="true" label=""/>
|
||||
<xul:button dlgtype="cancel" class="dialog-button"/>
|
||||
<xul:button dlgtype="help" class="dialog-button" hidden="true"/>
|
||||
<xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<field name="_mStrBundle">null</field>
|
||||
<field name="_closeHandler">(function(event) {
|
||||
if (!document.documentElement.cancelDialog())
|
||||
event.preventDefault();
|
||||
})</field>
|
||||
<field name="enterDefaultAlways">false</field>
|
||||
|
||||
<property name="buttons"
|
||||
onget="return this.getAttribute('buttons');"
|
||||
onset="this._configureButtons(val); return val;"/>
|
||||
|
||||
<method name="acceptDialog">
|
||||
<body>
|
||||
<![CDATA[
|
||||
return this._doButtonCommand("accept");
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="cancelDialog">
|
||||
<body>
|
||||
<![CDATA[
|
||||
return this._doButtonCommand("cancel");
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="getButton">
|
||||
<parameter name="aDlgType"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
return this._buttons[aDlgType];
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="moveToAlertPosition">
|
||||
<body>
|
||||
<![CDATA[
|
||||
// hack. we need this so the window has something like its final size
|
||||
if (window.outerWidth == 1) {
|
||||
dump("Trying to position a sizeless window; caller should have called sizeToContent() or sizeTo(). See bug 75649.\n");
|
||||
sizeToContent();
|
||||
}
|
||||
|
||||
var xOffset = (opener.outerWidth - window.outerWidth) / 2;
|
||||
var yOffset = opener.outerHeight / 5;
|
||||
|
||||
var newX = opener.screenX + xOffset;
|
||||
var newY = opener.screenY + yOffset;
|
||||
|
||||
// ensure the window is fully onscreen (if smaller than the screen)
|
||||
if (newX < screen.availLeft)
|
||||
newX = screen.availLeft + 20;
|
||||
if ((newX + window.outerWidth) > (screen.availLeft + screen.availWidth))
|
||||
newX = (screen.availLeft + screen.availWidth) - window.outerWidth - 20;
|
||||
|
||||
if (newY < screen.availTop)
|
||||
newY = screen.availTop + 20;
|
||||
if ((newY + window.outerHeight) > (screen.availTop + screen.availHeight))
|
||||
newY = (screen.availTop + screen.availHeight) - window.outerHeight - 60;
|
||||
|
||||
window.moveTo( newX, newY );
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="centerWindowOnScreen">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var xOffset = screen.availWidth/2 - window.outerWidth/2;
|
||||
var yOffset = screen.availHeight/2 - window.outerHeight/2; //(opener.outerHeight *2)/10;
|
||||
|
||||
xOffset = xOffset > 0 ? xOffset : 0;
|
||||
yOffset = yOffset > 0 ? yOffset : 0;
|
||||
window.moveTo(xOffset, yOffset);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
this._configureButtons(this.getAttribute("buttons"));
|
||||
|
||||
// listen for when window is closed via native close buttons
|
||||
window.addEventListener("close", this._closeHandler, false);
|
||||
|
||||
// for things that we need to initialize after onload fires
|
||||
window.addEventListener("load", this.postLoadInit, false);
|
||||
|
||||
window.moveToAlertPosition = this.moveToAlertPosition;
|
||||
window.centerWindowOnScreen = this.centerWindowOnScreen;
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
<method name="postLoadInit">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var focusInit =
|
||||
function() {
|
||||
// give focus to the first focusable element in the dialog
|
||||
if (!document.commandDispatcher.focusedElement)
|
||||
document.commandDispatcher.advanceFocusIntoSubtree(document.documentElement);
|
||||
};
|
||||
|
||||
// Give focus after onload completes, see bug 103197.
|
||||
setTimeout(focusInit, 0);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<property name="mStrBundle">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
if (!this._mStrBundle) {
|
||||
// need to create string bundle manually instead of using <xul:stringbundle/>
|
||||
// see bug 63370 for details
|
||||
var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1"]
|
||||
.getService(Components.interfaces.nsILocaleService);
|
||||
var stringBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"]
|
||||
.getService(Components.interfaces.nsIStringBundleService);
|
||||
var bundleURL = "chrome://global/locale/dialog.properties";
|
||||
this._mStrBundle = stringBundleService.createBundle(bundleURL, localeService.GetApplicationLocale());
|
||||
}
|
||||
return this._mStrBundle;
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<method name="_configureButtons">
|
||||
<parameter name="aButtons"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
// by default, get all the anonymous button elements
|
||||
var buttons = {};
|
||||
this._buttons = buttons;
|
||||
buttons.accept = document.getAnonymousElementByAttribute(this, "dlgtype", "accept");
|
||||
buttons.cancel = document.getAnonymousElementByAttribute(this, "dlgtype", "cancel");
|
||||
buttons.extra1 = document.getAnonymousElementByAttribute(this, "dlgtype", "extra1");
|
||||
buttons.extra2 = document.getAnonymousElementByAttribute(this, "dlgtype", "extra2");
|
||||
buttons.help = document.getAnonymousElementByAttribute(this, "dlgtype", "help");
|
||||
buttons.disclosure = document.getAnonymousElementByAttribute(this, "dlgtype", "disclosure");
|
||||
|
||||
// look for any overriding explicit button elements
|
||||
var exBtns = this.getElementsByAttribute("dlgtype", "*");
|
||||
var dlgtype;
|
||||
var i;
|
||||
for (i = 0; i < exBtns.length; ++i) {
|
||||
dlgtype = exBtns[i].getAttribute("dlgtype");
|
||||
buttons[dlgtype].hidden = true; // hide the anonymous button
|
||||
buttons[dlgtype] = exBtns[i];
|
||||
}
|
||||
|
||||
// add the label and oncommand handler to each button
|
||||
for (dlgtype in buttons) {
|
||||
var button = buttons[dlgtype];
|
||||
buttons[dlgtype].addEventListener("command", this._handleButtonCommand, true);
|
||||
// don't override custom labels with pre-defined labels on explicit buttons
|
||||
if (!button.hasAttribute("label"))
|
||||
button.setAttribute("label", this.mStrBundle.GetStringFromName("button-"+dlgtype));
|
||||
}
|
||||
|
||||
// ensure that hitting enter triggers ondialogaccept
|
||||
buttons["accept"].setAttribute("default", "true");
|
||||
|
||||
// if there is a special button configuration, use it
|
||||
if (aButtons) {
|
||||
// expect a comma delimitd list of dlgtype values
|
||||
var list = aButtons.split(",");
|
||||
|
||||
// mark shown dlgtypes as true
|
||||
var shown = { accept: false, cancel: false, help: false,
|
||||
disclosure: false, extra1: false, extra2: false };
|
||||
for (i = 0; i < list.length; ++i)
|
||||
shown[list[i].replace(/ /g, "")] = true;
|
||||
|
||||
// hide/show the buttons we want
|
||||
for (dlgtype in shown) {
|
||||
if (shown[dlgtype])
|
||||
buttons[dlgtype].hidden = false;
|
||||
else
|
||||
buttons[dlgtype].hidden = true;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_handleButtonCommand">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
return document.documentElement._doButtonCommand(
|
||||
aEvent.target.getAttribute("dlgtype"));
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_doButtonCommand">
|
||||
<parameter name="aDlgType"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
// calling window.close() while an oncommand event
|
||||
// call is on the stack fails to close the window,
|
||||
// so we need to do this ugly setTimeout hack
|
||||
window.setTimeout(
|
||||
function(aDlgType) {
|
||||
document.documentElement._reallyDoButtonCommand(aDlgType);
|
||||
},
|
||||
0, aDlgType);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_reallyDoButtonCommand">
|
||||
<parameter name="aDlgType"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var button = this.getButton(aDlgType);
|
||||
if (!button.disabled) {
|
||||
var noCancel = this._fireButtonEvent(aDlgType);
|
||||
if (noCancel) {
|
||||
if (aDlgType == "accept" || aDlgType == "cancel")
|
||||
window.close();
|
||||
}
|
||||
return noCancel;
|
||||
}
|
||||
return true;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_fireButtonEvent">
|
||||
<parameter name="aDlgType"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent("dialog"+aDlgType, false, true);
|
||||
|
||||
// handle dom event handlers
|
||||
var noCancel = this.dispatchEvent(event);
|
||||
|
||||
// handle any xml attribute event handlers
|
||||
var handler = this.getAttribute("ondialog"+aDlgType);
|
||||
if (handler != "") {
|
||||
var fn = new Function("event", handler);
|
||||
var returned = fn(event);
|
||||
if (returned == false)
|
||||
noCancel = false;
|
||||
}
|
||||
|
||||
return noCancel;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_hitEnter">
|
||||
<body>
|
||||
<![CDATA[
|
||||
// if a button is focused, do nothing, so that activating the button
|
||||
// doesn't cause the dialog to exit
|
||||
if (!this.enterDefaultAlways) {
|
||||
var focused = document.commandDispatcher.focusedElement;
|
||||
if (focused && focused.localName == "button")
|
||||
return;
|
||||
}
|
||||
|
||||
// only accept dialog if accept button is the default
|
||||
var btn = this.getButton("accept");
|
||||
if (btn && btn.hasAttribute("default"))
|
||||
this.acceptDialog();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="keypress" keycode="VK_ENTER" action="this._hitEnter();"/>
|
||||
<handler event="keypress" keycode="VK_RETURN" action="this._hitEnter();"/>
|
||||
<handler event="keypress" keycode="VK_ESCAPE" action="this.cancelDialog();"/>
|
||||
</handlers>
|
||||
|
||||
</binding>
|
||||
|
||||
<binding id="dialogheader" extends="chrome://global/content/bindings/dialog.xml#dialog-base">
|
||||
<content>
|
||||
<xul:label class="dialogheader-title" xbl:inherits="value=title"/>
|
||||
<xul:spacer flex="1"/>
|
||||
<xul:label class="dialogheader-description" xbl:inherits="value=description"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -0,0 +1,343 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="generalBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="basetext">
|
||||
<implementation>
|
||||
<!-- public implementation -->
|
||||
<property name="label" onset="return this.setAttribute('label',val);"
|
||||
onget="return this.getAttribute('label');"/>
|
||||
<property name="crop" onset="return this.setAttribute('crop',val);"
|
||||
onget="return this.getAttribute('crop');"/>
|
||||
<property name="disabled" onset="if (val) this.setAttribute('disabled', 'true');
|
||||
else this.removeAttribute('disabled');
|
||||
return val;"
|
||||
onget="return this.hasAttribute('disabled');"/>
|
||||
<property name="image" onset="return this.setAttribute('image',val);"
|
||||
onget="return this.getAttribute('image');"/>
|
||||
<property name="accessKey" onset="return this.setAttribute('accesskey',val);"
|
||||
onget="return this.getAttribute('accesskey');"/>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="control-item" extends="chrome://global/content/bindings/general.xml#basetext">
|
||||
<implementation>
|
||||
<property name="value" onset="return this.setAttribute('value', val);"
|
||||
onget="return this.getAttribute('value');"/>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
|
||||
<!--
|
||||
Inline Editable UI Element
|
||||
- This binding forms the basis of the inline edit treecell and the inline edit
|
||||
- buttons.
|
||||
- TODO: investigate creating extensions to the wrapper widgets (tree, toolbar)
|
||||
- to make them provide some object implementing an interface similar to
|
||||
- tree's so we can build in some of the ILE behavior (such as going
|
||||
- in and out of the mode, asking isEditable etc) so as to remove some of
|
||||
- the burden from the implementor.
|
||||
-
|
||||
- Note that this widget will be no longer used in the bookmarks window once
|
||||
- tree is extended to have this functionality built in.
|
||||
-->
|
||||
<binding id="inline-edit-base" extends="chrome://global/content/bindings/general.xml#basetext">
|
||||
<implementation>
|
||||
<field name="_mode">0</field>
|
||||
<method name="setMode">
|
||||
<parameter name="val"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var ctr = document.getAnonymousElementByAttribute(this, "ileattr", "text-container");
|
||||
var txt = document.getAnonymousElementByAttribute(this, "ileattr", "text");
|
||||
this.setAttribute("mode", val);
|
||||
if (val == "edit") {
|
||||
var nodes = document.getAnonymousNodes(this);
|
||||
|
||||
if (txt.getAttribute("hidden") != "true") {
|
||||
ctr.setAttribute("mode", "edit");
|
||||
var width = ctr.boxObject.width;
|
||||
txt.setAttribute("hidden", "true");
|
||||
const kXULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
var field = document.createElementNS(kXULNS, "textbox");
|
||||
field.className = "textbox-inline-edit";
|
||||
field.setAttribute("flex", "1");
|
||||
field.setAttribute("value", txt.getAttribute("value"));
|
||||
field.setAttribute("ileattr", "field");
|
||||
field.setAttribute("rootcontent", txt.getAttribute("rootcontent"));
|
||||
field.setAttribute("style", "width: " + width + "px");
|
||||
ctr.appendChild(field);
|
||||
field.addEventListener("keydown", this.fieldKeyDown, false);
|
||||
field.addEventListener("change", this.fieldChange, false);
|
||||
field.select();
|
||||
}
|
||||
}
|
||||
else {
|
||||
nodes = document.getAnonymousNodes(this);
|
||||
var fld = document.getAnonymousElementByAttribute(this, "ileattr", "field");
|
||||
if (fld && txt.getAttribute("hidden") == "true") {
|
||||
ctr.removeAttribute("mode");
|
||||
fld.blur();
|
||||
ctr.removeChild(fld);
|
||||
txt.removeAttribute("hidden");
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<field name="_observers">
|
||||
<![CDATA[
|
||||
({
|
||||
reject: [],
|
||||
accept: []
|
||||
})
|
||||
]]>
|
||||
</field>
|
||||
<field name="valueIsRejected">false</field>
|
||||
<method name="addObserver">
|
||||
<parameter name="aObserver"/>
|
||||
<parameter name="aTopic"/>
|
||||
<parameter name="aParams"/>
|
||||
<body>
|
||||
this._observers[aTopic].push({ callback: aObserver, params: aParams });
|
||||
</body>
|
||||
</method>
|
||||
<method name="fieldKeyDown">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var rootLocalName = aEvent.target.getAttribute("rootcontent");
|
||||
if (rootLocalName) {
|
||||
// Root content is the bound element.
|
||||
var rootContent = aEvent.target;
|
||||
while (rootContent && rootContent.localName != rootLocalName)
|
||||
rootContent = rootContent.parentNode;
|
||||
|
||||
if (rootContent) {
|
||||
var ctr = document.getAnonymousElementByAttribute(rootContent, "ileattr", "text-container");
|
||||
if (aEvent.keyCode == 13) {
|
||||
rootContent.valueIsRejected = false;
|
||||
rootContent.fieldChange(aEvent);
|
||||
}
|
||||
if (aEvent.keyCode == 27) {
|
||||
rootContent.valueIsRejected = true;
|
||||
var fld = document.getAnonymousElementByAttribute(rootContent, "ileattr", "field");
|
||||
for (i = 0; i < rootContent._observers["reject"].length; ++i)
|
||||
rootContent._observers["reject"][i].callback(rootContent._observers["reject"][i].params.concat(fld.value), "reject");
|
||||
if ("setMode" in rootContent)
|
||||
rootContent.setMode("normal");
|
||||
}
|
||||
}
|
||||
}
|
||||
aEvent.preventBubble();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<field name="valueIsAccepted">false</field>
|
||||
<method name="fieldChange">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var rootLocalName = this.getAttribute("rootcontent");
|
||||
if (rootLocalName) {
|
||||
// Root content is the bound element.
|
||||
var rootContent = this;
|
||||
while (rootContent && rootContent.localName != rootLocalName)
|
||||
rootContent = rootContent.parentNode;
|
||||
|
||||
if (rootContent) {
|
||||
var ctr = document.getAnonymousElementByAttribute(rootContent, "ileattr", "text-container");
|
||||
if (!rootContent.valueIsRejected) {
|
||||
var fld = document.getAnonymousElementByAttribute(rootContent, "ileattr", "field");
|
||||
for (var i = 0; i < rootContent._observers["accept"].length; ++i)
|
||||
rootContent._observers["accept"][i].callback(rootContent._observers["accept"][i].params.concat(fld.value), "accept");
|
||||
if ("setMode" in rootContent)
|
||||
rootContent.setMode("normal");
|
||||
}
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<!-- inline editable buttons -->
|
||||
<binding id="buttonleft-ile" extends="chrome://global/content/bindings/general.xml#inline-edit-base">
|
||||
<content>
|
||||
<xul:hbox class="button-internal-box" align="center" flex="1">
|
||||
<xul:image class="button-icon" xbl:inherits="src"/>
|
||||
<xul:hbox class="button-text-container" flex="1" ileattr="text-container">
|
||||
<xul:label class="button-text" xbl:inherits="value=label,accesskey,crop,dragover-top" ileattr="text" rootcontent="button" flex="1"/>
|
||||
</xul:hbox>
|
||||
</xul:hbox>
|
||||
<children includes="menupopup"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="editor">
|
||||
<implementation>
|
||||
<property name="editorShell"
|
||||
readonly="true"
|
||||
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIEditorBoxObject).editorShell"/>
|
||||
<property name="editor"
|
||||
readonly="true"
|
||||
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIEditorBoxObject).editorShell.editor"/>
|
||||
<property name="webNavigation"
|
||||
onget="return this.docShell.QueryInterface(Components.interfaces.nsIWebNavigation);"
|
||||
readonly="true"/>
|
||||
<property name="contentDocument" readonly="true"
|
||||
onget="return this.webNavigation.document;"/>
|
||||
<property name="docShell"
|
||||
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIEditorBoxObject).docShell;"
|
||||
readonly="true"/>
|
||||
<property name="webBrowserFind"
|
||||
readonly="true"
|
||||
onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebBrowserFind);"/>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="iframe">
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<property name="accessible">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
|
||||
return accService.createIFrameAccessible(this);
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
<property name="docShell"
|
||||
readonly="true"
|
||||
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIIFrameBoxObject).docShell"/>
|
||||
<property name="contentWindow"
|
||||
readonly="true"
|
||||
onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindow);"/>
|
||||
<property name="webNavigation"
|
||||
onget="return this.docShell.QueryInterface(Components.interfaces.nsIWebNavigation);"
|
||||
readonly="true"/>
|
||||
<property name="contentDocument" readonly="true"
|
||||
onget="return this.webNavigation.document;"/>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="statusbarpanel" display="xul:button">
|
||||
<content>
|
||||
<children>
|
||||
<xul:label class="statusbarpanel-text" xbl:inherits="value=label,crop" crop="right" flex="1"/>
|
||||
</children>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<property name="label"
|
||||
onget="return this.getAttribute('label');"
|
||||
onset="this.setAttribute('label',val); return val;"/>
|
||||
<property name="src"
|
||||
onget="return this.getAttribute('src');"
|
||||
onset="this.setAttribute('src',val); return val;"/>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="statusbar">
|
||||
<content>
|
||||
<children/>
|
||||
<xul:statusbarpanel class="statusbar-resizerpanel">
|
||||
<xul:resizer dir="bottomright" style="-moz-appearance: resizer; cursor: se-resize"/>
|
||||
</xul:statusbarpanel>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<property name="accessible">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
|
||||
return accService.createXULStatusBarAccessible(this);
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="statusbarpanel-iconic" display="xul:button"
|
||||
extends="chrome://global/content/bindings/general.xml#statusbarpanel">
|
||||
<content>
|
||||
<xul:image class="statusbarpanel-icon" xbl:inherits="src"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="image">
|
||||
<implementation implements="nsIDOMXULImageElement, nsIAccessibleProvider">
|
||||
<property name="src"
|
||||
onget="return this.getAttribute('src');"
|
||||
onset="this.setAttribute('src',val); return val;"/>
|
||||
<property name="accessible">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
|
||||
return accService.createXULImageAccessible(this);
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="deck">
|
||||
<implementation>
|
||||
<property name="selectedIndex"
|
||||
onget="return this.getAttribute('selectedIndex');">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
if (this.selectedIndex == val)
|
||||
return val;
|
||||
this.setAttribute("selectedIndex", val);
|
||||
var event = document.createEvent('Events');
|
||||
event.initEvent('select', false, true);
|
||||
this.dispatchEvent(event);
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
|
||||
<property name="selectedPanel">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return this.childNodes[this.selectedIndex];
|
||||
]]>
|
||||
</getter>
|
||||
|
||||
<setter>
|
||||
<![CDATA[
|
||||
var selectedIndex = -1;
|
||||
for (var panel = val; panel != null; panel = panel.previousSibling)
|
||||
++selectedIndex;
|
||||
this.selectedIndex = selectedIndex;
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="dropmarker">
|
||||
<content>
|
||||
<xul:image class="dropmarker-icon"/>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<property name="accessible">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
|
||||
return accService.createXULDropmarkerAccessible(this);
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="groupboxBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="groupbox-base">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/groupbox.css"/>
|
||||
</resources>
|
||||
</binding>
|
||||
|
||||
<binding id="groupbox" extends="chrome://global/content/bindings/groupbox.xml#groupbox-base">
|
||||
<content>
|
||||
<xul:hbox class="groupbox-title" align="center" pack="start">
|
||||
<children includes="caption"/>
|
||||
</xul:hbox>
|
||||
<xul:box flex="1" class="groupbox-body" xbl:inherits="orient,align,pack">
|
||||
<children/>
|
||||
</xul:box>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<property name="accessible">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
|
||||
return accService.createXULGroupboxAccessible(this);
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="caption" extends="chrome://global/content/bindings/general.xml#basetext">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/groupbox.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<children>
|
||||
<xul:image class="caption-icon" xbl:inherits="src=image"/>
|
||||
<xul:label class="caption-text" flex="1"
|
||||
xbl:inherits="default,value=label,crop,accesskey"/>
|
||||
</children>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -0,0 +1,963 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="listboxBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="listbox-base">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/listbox.css"/>
|
||||
</resources>
|
||||
</binding>
|
||||
|
||||
<binding id="listbox"
|
||||
extends="chrome://global/content/bindings/listbox.xml#listbox-base">
|
||||
<content>
|
||||
<children includes="listcols">
|
||||
<xul:listcols>
|
||||
<xul:listcol flex="1"/>
|
||||
</xul:listcols>
|
||||
</children>
|
||||
<xul:listrows>
|
||||
<children includes="listhead"/>
|
||||
<xul:listboxbody xbl:inherits="rows,size,minheight">
|
||||
<children includes="listitem"/>
|
||||
</xul:listboxbody>
|
||||
</xul:listrows>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIDOMXULMultiSelectControlElement, nsIDOMXULSelectControlElement, nsIAccessibleProvider">
|
||||
<field name="_isUpSelection">0</field>
|
||||
<field name="_isDownSelection">0</field>
|
||||
<field name="_suppressOnSelect">false</field>
|
||||
<field name="_selectionStart">null</field>
|
||||
<field name="_currentItem">null</field>
|
||||
<field name="_selectTimeout">null</field>
|
||||
<field name="_lastKeyTime">0</field>
|
||||
<field name="_incrementalString">""</field>
|
||||
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
var els = this.getElementsByAttribute("selected", "true");
|
||||
this.selectedItems = [];
|
||||
for (var i = 0; i < els.length; ++i)
|
||||
this.selectedItems.push(els[i]);
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
<!-- ///////////////// nsIAccessibleProvider ///////////////// -->
|
||||
|
||||
<property name="accessible">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
|
||||
return accService.createXULListboxAccessible(this);
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<!-- ///////////////// public listbox members ///////////////// -->
|
||||
|
||||
<property name="listBoxObject"
|
||||
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIListBoxObject);"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="disableKeyNavigation"
|
||||
onget="return this.hasAttribute('disableKeyNavigation');"
|
||||
onset="if (val) this.setAttribute('disableKeyNavigation', 'true');
|
||||
else this.removeAttribute('disableKeyNavigation'); return val;"/>
|
||||
|
||||
<method name="timedSelect">
|
||||
<parameter name="item"/>
|
||||
<parameter name="timeout"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var suppress = this._suppressOnSelect;
|
||||
if (timeout != -1)
|
||||
this._suppressOnSelect = true;
|
||||
|
||||
this.selectItem(item);
|
||||
|
||||
this._suppressOnSelect = suppress;
|
||||
|
||||
if (timeout != -1) {
|
||||
if (this._selectTimeout)
|
||||
window.clearTimeout(this._selectTimeout);
|
||||
|
||||
this._selectTimeout = window.setTimeout(this._selectTimeoutHandler, timeout, this);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- ///////////////// private listbox members ///////////////// -->
|
||||
|
||||
<method name="_fireOnSelect">
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!this._suppressOnSelect && this.getAttribute("suppressonselect") != "true") {
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent("select", false, true);
|
||||
this.dispatchEvent(event);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_selectTimeoutHandler">
|
||||
<parameter name="me"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
me._fireOnSelect();
|
||||
me._selectTimeout = null;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- ///////////////// nsIDOMXULSelectControlElement ///////////////// -->
|
||||
|
||||
<property name="selType"
|
||||
onget="return this.getAttribute('seltype')"
|
||||
onset="this.setAttribute('seltype', val); return val;"/>
|
||||
|
||||
<property name="selectedIndex">
|
||||
<getter><![CDATA[
|
||||
return this.selectedItems.length > 0 ? this.getIndexOfItem(this.selectedItems[0]) : -1;
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
if (val >= 0)
|
||||
this.selectItem(this.getItemAtIndex(val));
|
||||
else
|
||||
this.clearSelection();
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="selectedItem">
|
||||
<getter><![CDATA[
|
||||
return this.selectedItems.length > 0 ? this.selectedItems[0] : null;
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
this.selectItem(val);
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="value">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
if (this.selectedItems.length > 0)
|
||||
return this.selectedItem.value;
|
||||
else
|
||||
return null;
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
var kids = this.getElementsByAttribute("value", val);
|
||||
if (kids && kids.length)
|
||||
this.selectItem(kids[0]);
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<method name="appendItem">
|
||||
<parameter name="label"/>
|
||||
<parameter name="value"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
var item = document.createElementNS(XULNS, "listitem");
|
||||
item.setAttribute("label", label);
|
||||
item.setAttribute("value", value);
|
||||
this.appendChild(item);
|
||||
return item;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="insertItemAt">
|
||||
<parameter name="index"/>
|
||||
<parameter name="label"/>
|
||||
<parameter name="value"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
var item = document.createElementNS(XULNS, "listitem");
|
||||
item.setAttribute("label", label);
|
||||
item.setAttribute("value", value);
|
||||
var before = this.childNodes[index];
|
||||
if (before)
|
||||
this.insertBefore(item, before);
|
||||
else
|
||||
this.appendChild(item);
|
||||
return item;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="removeItemAt">
|
||||
<parameter name="index"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var remove = this.childNodes[index];
|
||||
if (remove)
|
||||
this.removeChild(remove);
|
||||
return remove;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<!-- ///////////////// nsIDOMXULSelectMultipleControlElement ///////////////// -->
|
||||
|
||||
<property name="currentItem" onget="return this._currentItem;">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
if (this._currentItem)
|
||||
this._currentItem.current = false;
|
||||
this._currentItem = val;
|
||||
if (val)
|
||||
val.current = true;
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="selectedCount" onget="return this.selectedItems.length;"/>
|
||||
|
||||
<method name="getSelectedItem">
|
||||
<parameter name="index"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
return index < this.selectedItems.length ? this.selectedItems[index] : null;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="addItemToSelection">
|
||||
<parameter name="item"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (this.selType != "multiple" && this.selectedCount)
|
||||
return;
|
||||
|
||||
if (item.selected)
|
||||
return;
|
||||
|
||||
this.selectedItems.push(item);
|
||||
item.selected = true;
|
||||
|
||||
this._fireOnSelect();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="removeItemFromSelection">
|
||||
<parameter name="item"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!item.selected)
|
||||
return;
|
||||
|
||||
for (var i = 0; i < this.selectedItems.length; ++i) {
|
||||
if (this.selectedItems[i] == item) {
|
||||
this.selectedItems.splice(i, 1);
|
||||
item.selected = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this._fireOnSelect();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="toggleItemSelection">
|
||||
<parameter name="item"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (item.selected)
|
||||
this.removeItemFromSelection(item);
|
||||
else
|
||||
this.addItemToSelection(item);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="selectItem">
|
||||
<parameter name="item"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
if (this.selectedItems.length == 1 && this.selectedItems[0] == item)
|
||||
return;
|
||||
|
||||
this._selectionStart = null;
|
||||
|
||||
var suppress = this._suppressOnSelect;
|
||||
this._suppressOnSelect = true;
|
||||
|
||||
this.clearSelection();
|
||||
this.addItemToSelection(item);
|
||||
this.currentItem = item;
|
||||
|
||||
this._suppressOnSelect = suppress;
|
||||
this._fireOnSelect();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="selectItemRange">
|
||||
<parameter name="startItem"/>
|
||||
<parameter name="endItem"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (this.selType != "multiple")
|
||||
return;
|
||||
|
||||
if (!startItem)
|
||||
startItem = this._selectionStart ? this._selectionStart : this.currentItem;
|
||||
if (!startItem)
|
||||
startItem = endItem;
|
||||
|
||||
var suppressSelect = this._suppressOnSelect;
|
||||
this._suppressOnSelect = true;
|
||||
this.clearSelection();
|
||||
|
||||
this._selectionStart = startItem;
|
||||
|
||||
var currentItem;
|
||||
var startIndex = this.getIndexOfItem(startItem);
|
||||
var endIndex = this.getIndexOfItem(endItem);
|
||||
if (endIndex < startIndex) {
|
||||
currentItem = endItem;
|
||||
endItem = startItem;
|
||||
startItem = currentItem;
|
||||
} else {
|
||||
currentItem = startItem;
|
||||
}
|
||||
|
||||
while (currentItem) {
|
||||
if (currentItem.localName == "listitem")
|
||||
this.addItemToSelection(currentItem);
|
||||
if (currentItem == endItem)
|
||||
break;
|
||||
currentItem = this.getNextItem(currentItem, 1);
|
||||
}
|
||||
|
||||
this._suppressOnSelect = suppressSelect;
|
||||
|
||||
this._fireOnSelect();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="selectAll">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var suppress = this._suppressOnSelect;
|
||||
this._suppressOnSelect = true;
|
||||
|
||||
var item = this.getItemAtIndex(0);
|
||||
while (item) {
|
||||
this.addItemToSelection(item);
|
||||
item = this.getNextItem(item, 1);
|
||||
}
|
||||
|
||||
this._suppressOnSelect = suppress;
|
||||
this._fireOnSelect();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="invertSelection">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var suppress = this._suppressOnSelect;
|
||||
this._suppressOnSelect = true;
|
||||
|
||||
var item = this.getItemAtIndex(0);
|
||||
while (item) {
|
||||
if (item.selected)
|
||||
this.removeItemFromSelection(item);
|
||||
else
|
||||
this.addItemToSelection(item);
|
||||
item = this.getNextItem(item, 1);
|
||||
}
|
||||
|
||||
this._suppressOnSelect = suppress;
|
||||
this._fireOnSelect();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="clearSelection">
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (this.selectedItems)
|
||||
{
|
||||
for (var i = this.selectedItems.length-1; i >= 0; --i)
|
||||
this.selectedItems[i].selected = false;
|
||||
|
||||
this.selectedItems.splice(0, this.selectedItems.length);
|
||||
}
|
||||
this._selectionStart = null;
|
||||
this._fireOnSelect();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- ///////////////// nsIListBoxObject ///////////////// -->
|
||||
|
||||
<method name="getNextItem">
|
||||
<parameter name="startItem"/>
|
||||
<parameter name="delta"/>
|
||||
<body><![CDATA[
|
||||
while (startItem) {
|
||||
startItem = startItem.nextSibling;
|
||||
if (startItem && startItem.localName == "listitem") {
|
||||
--delta;
|
||||
if (delta == 0)
|
||||
return startItem;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
]]></body>
|
||||
</method>
|
||||
<method name="getPreviousItem">
|
||||
<parameter name="startItem"/>
|
||||
<parameter name="delta"/>
|
||||
<body><![CDATA[
|
||||
while (startItem) {
|
||||
startItem = startItem.previousSibling;
|
||||
if (startItem && startItem.localName == "listitem") {
|
||||
--delta;
|
||||
if (delta == 0)
|
||||
return startItem;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
]]></body>
|
||||
</method>
|
||||
<method name="getIndexOfItem">
|
||||
<parameter name="item"/>
|
||||
<body>
|
||||
return this.listBoxObject.getIndexOfItem(item);
|
||||
</body>
|
||||
</method>
|
||||
<method name="getItemAtIndex">
|
||||
<parameter name="index"/>
|
||||
<body>
|
||||
return this.listBoxObject.getItemAtIndex(index);
|
||||
</body>
|
||||
</method>
|
||||
<method name="ensureIndexIsVisible">
|
||||
<parameter name="index"/>
|
||||
<body>
|
||||
return this.listBoxObject.ensureIndexIsVisible(index);
|
||||
</body>
|
||||
</method>
|
||||
<method name="ensureElementIsVisible">
|
||||
<parameter name="element"/>
|
||||
<body>
|
||||
return this.ensureIndexIsVisible(this.listBoxObject.getIndexOfItem(element));
|
||||
</body>
|
||||
</method>
|
||||
<method name="scrollToIndex">
|
||||
<parameter name="index"/>
|
||||
<body>
|
||||
return this.listBoxObject.scrollToIndex(index);
|
||||
</body>
|
||||
</method>
|
||||
<method name="getNumberOfVisibleRows">
|
||||
<body>
|
||||
return this.listBoxObject.getNumberOfVisibleRows();
|
||||
</body>
|
||||
</method>
|
||||
<method name="getIndexOfFirstVisibleRow">
|
||||
<body>
|
||||
return this.listBoxObject.getIndexOfFirstVisibleRow();
|
||||
</body>
|
||||
</method>
|
||||
<method name="getRowCount">
|
||||
<body>
|
||||
return this.listBoxObject.getRowCount();
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="keypress" keycode="vk_up">
|
||||
<![CDATA[
|
||||
if (event.target != this || this.selectedItems.length < 1)
|
||||
return;
|
||||
this._isUpSelection=0;
|
||||
this._isDownSelection=0;
|
||||
var n = this.getPreviousItem(this.selectedItems[this.selectedItems.length-1], 1);
|
||||
if (n) {
|
||||
this.ensureIndexIsVisible(this.getIndexOfItem(n));
|
||||
this.timedSelect(n, 500);
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="keypress" keycode="vk_down">
|
||||
<![CDATA[
|
||||
if (event.target != this)
|
||||
return;
|
||||
|
||||
var n;
|
||||
if (this.selectedItems.length == 0) {
|
||||
n = this.getItemAtIndex(0);
|
||||
}
|
||||
else {
|
||||
this._isUpSelection=0;
|
||||
this._isDownSelection=0;
|
||||
n = this.getNextItem(this.selectedItems[this.selectedItems.length-1], 1);
|
||||
}
|
||||
|
||||
if (n) {
|
||||
this.ensureIndexIsVisible(this.getIndexOfItem(n));
|
||||
this.timedSelect(n, 500);
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="keypress" modifiers="shift" keycode="vk_up">
|
||||
<![CDATA[
|
||||
var l=this.selectedItems.length;
|
||||
if (event.target != this || l < 1 || this.selType != "multiple")
|
||||
return;
|
||||
var n = this.getPreviousItem(this.selectedItems[l-1], 1);
|
||||
if (n) {
|
||||
this.ensureElementIsVisible(n);
|
||||
if ( this._isDownSelection) {
|
||||
if ( l > 1 )
|
||||
this.removeItemFromSelection(this.selectedItems[l-1]);
|
||||
if ( l <= 2 )
|
||||
this._isDownSelection=0;
|
||||
}
|
||||
else {
|
||||
this.addItemToSelection(n);
|
||||
this._isUpSelection=1;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="keypress" modifiers="shift" keycode="vk_down">
|
||||
<![CDATA[
|
||||
var l=this.selectedItems.length;
|
||||
if (event.target != this || l < 1 || this.selType != "multiple")
|
||||
return;
|
||||
var n = this.getNextItem(this.selectedItems[l-1], 1);
|
||||
if (n) {
|
||||
this.ensureElementIsVisible(n);
|
||||
if ( this._isUpSelection) {
|
||||
if ( l > 1 )
|
||||
this.removeItemFromSelection(this.selectedItems[l-1]);
|
||||
if ( l <= 2 )
|
||||
this._isUpSelection=0;
|
||||
}
|
||||
else {
|
||||
this.addItemToSelection(n);
|
||||
this._isDownSelection=1;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="keypress" keycode="vk_page_up">
|
||||
<![CDATA[
|
||||
var l = this.selectedItems.length;
|
||||
if (event.target != this || l < 1)
|
||||
return;
|
||||
this._isUpSelection=0;
|
||||
this._isDownSelection=0;
|
||||
var i = this.getIndexOfFirstVisibleRow();
|
||||
if ( i == 0 )
|
||||
var n=this.getItemAtIndex(0);
|
||||
else {
|
||||
var v = this.getNumberOfVisibleRows();
|
||||
n = this.getPreviousItem(this.selectedItems[l-1], v);
|
||||
var newIndex = i - v;
|
||||
if ( ! n || newIndex < 0 ) {
|
||||
newIndex=0;
|
||||
n=this.getItemAtIndex(this.getIndexOfItem(this.selectedItems[l-1]) - i);
|
||||
}
|
||||
this.scrollToIndex(newIndex);
|
||||
}
|
||||
this.timedSelect(n, 500);
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="keypress" keycode="vk_page_down">
|
||||
<![CDATA[
|
||||
var l = this.selectedItems.length;
|
||||
if (event.target != this || l < 1)
|
||||
return;
|
||||
this._isUpSelection=0;
|
||||
this._isDownSelection=0;
|
||||
var i = this.getIndexOfFirstVisibleRow();
|
||||
var v = this.getNumberOfVisibleRows();
|
||||
var count = this.getRowCount();
|
||||
var n;
|
||||
if ( i >= count - v )
|
||||
n=this.getItemAtIndex(count - 1);
|
||||
else {
|
||||
n = this.getNextItem(this.selectedItems[l-1], v);
|
||||
var newIndex = i + v;
|
||||
if ( ! n || newIndex > count - v ) {
|
||||
newIndex = count - v;
|
||||
n = this.getItemAtIndex(newIndex + this.getIndexOfItem(this.selectedItems[l-1]) - i);
|
||||
}
|
||||
this.scrollToIndex(newIndex);
|
||||
}
|
||||
this.timedSelect(n, 500);
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="keypress" keycode="vk_home">
|
||||
<![CDATA[
|
||||
if (event.target != this || this.selectedItems.length < 1)
|
||||
return;
|
||||
this._isUpSelection=0;
|
||||
this._isDownSelection=0;
|
||||
this.scrollToIndex(0);
|
||||
this.selectItem(this.getItemAtIndex(0));
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="keypress" keycode="vk_end">
|
||||
<![CDATA[
|
||||
if (event.target != this || this.selectedItems.length < 1)
|
||||
return;
|
||||
this._isUpSelection=0;
|
||||
this._isDownSelection=0;
|
||||
var count = this.getRowCount();
|
||||
this.ensureIndexIsVisible(count-1);
|
||||
this.selectItem(this.getItemAtIndex(count-1));
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<handler event="keypress" key=" ">
|
||||
<![CDATA[
|
||||
if (this.currentItem &&
|
||||
this.currentItem.getAttribute("type") == "checkbox" &&
|
||||
!this.currentItem.disabled)
|
||||
this.currentItem.checked = !this.currentItem.checked;
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="keypress">
|
||||
<![CDATA[
|
||||
if (!this.disableKeyNavigation && event.charCode > 0 &&
|
||||
!event.altKey && !event.ctrlKey && !event.shiftKey && !event.metaKey) {
|
||||
var key = String.fromCharCode(event.charCode);
|
||||
key = key.toLowerCase();
|
||||
if (event.timeStamp - this._lastKeyTime > 1000)
|
||||
this._incrementalString = key;
|
||||
else {
|
||||
if (this._incrementalString.length != 1 || this._incrementalString.charAt(0) != key.charAt(0))
|
||||
this._incrementalString += key;
|
||||
}
|
||||
this._lastKeyTime = event.timeStamp;
|
||||
|
||||
var l = this.selectedItems.length;
|
||||
var c = -1;
|
||||
if (l > 0)
|
||||
c = this.getIndexOfItem(this.selectedItems[l-1]);
|
||||
var rowCount = this.getRowCount();
|
||||
var start = 1;
|
||||
|
||||
if (this._incrementalString.length > 1) {
|
||||
start = 0;
|
||||
if (c < 0)
|
||||
c = 0;
|
||||
}
|
||||
|
||||
for (var i = 0; i < rowCount; i++) {
|
||||
var k = (i + start + c) % rowCount;
|
||||
var item = this.getItemAtIndex(k); //listitem
|
||||
var cellText = item.getAttribute("label");
|
||||
cellText = cellText.toLowerCase();
|
||||
if (cellText.search(this._incrementalString) == 0) {
|
||||
this._isUpSelection=0;
|
||||
this._isDownSelection=0;
|
||||
this.ensureIndexIsVisible(k);
|
||||
this.timedSelect(item, 500);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="listrows"
|
||||
extends="chrome://global/content/bindings/listbox.xml#listbox-base">
|
||||
<implementation>
|
||||
<constructor>
|
||||
this.addEventListener("DOMMouseScroll", this._handleMouseScroll, true);
|
||||
</constructor>
|
||||
|
||||
<field name="_handleMouseScroll">
|
||||
<![CDATA[
|
||||
({
|
||||
subject: this,
|
||||
handleEvent: function(aEvent)
|
||||
{
|
||||
var listBox = this.subject.parentNode.listBoxObject;
|
||||
var rows = aEvent.detail;
|
||||
if (rows == NSUIEvent.SCROLL_PAGE_UP)
|
||||
rows = -1 * listBox.getNumberOfVisibleRows();
|
||||
else if (rows == NSUIEvent.SCROLL_PAGE_DOWN)
|
||||
rows = listBox.getNumberOfVisibleRows();
|
||||
|
||||
listBox.scrollByLines(rows);
|
||||
}
|
||||
})
|
||||
]]>
|
||||
</field>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<!-- If there is no modifier key, we select on mousedown, not
|
||||
click, so that drags work correctly. -->
|
||||
<handler event="mousedown">
|
||||
<![CDATA[
|
||||
var targetItem = event.target;
|
||||
if (targetItem.localName == "listitem" && !event.ctrlKey && !event.shiftKey && !event.metaKey) {
|
||||
if (!targetItem.selected) {
|
||||
parentNode.selectItem(targetItem);
|
||||
}
|
||||
parentNode.currentItem = targetItem;
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<!-- On a click (up+down on the same item), deselect everything
|
||||
except this item. -->
|
||||
<handler event="click">
|
||||
<![CDATA[
|
||||
if (event.button != 0) return;
|
||||
var targetItem = event.target;
|
||||
if (targetItem.localName == "listitem") {
|
||||
if (parentNode.selType != "multiple") {
|
||||
parentNode.selectItem(targetItem);
|
||||
}
|
||||
else if (event.ctrlKey || event.metaKey) {
|
||||
parentNode.toggleItemSelection(targetItem);
|
||||
parentNode.currentItem = targetItem;
|
||||
}
|
||||
else if (event.shiftKey) {
|
||||
parentNode.selectItemRange(null, targetItem);
|
||||
parentNode.currentItem = targetItem;
|
||||
}
|
||||
else {
|
||||
/* We want to deselect all the selected items except what was
|
||||
clicked, UNLESS it was a right-click. We have to do this
|
||||
in click rather than mousedown so that you can drag a
|
||||
selected group of items */
|
||||
|
||||
var selectedItems = parentNode.selectedItems;
|
||||
var didSuppressSelect = false;
|
||||
var i = 0;
|
||||
while (i < selectedItems.length) {
|
||||
if (selectedItems[i] != targetItem) {
|
||||
if (!didSuppressSelect) {
|
||||
parentNode._suppressOnSelect = true;
|
||||
didSuppressSelect = true;
|
||||
}
|
||||
parentNode.removeItemFromSelection(selectedItems[i]);
|
||||
}
|
||||
else
|
||||
i++;
|
||||
}
|
||||
if (didSuppressSelect)
|
||||
parentNode._suppressOnSelect = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (parentNode.selType != "multiple" || (!event.ctrlKey && !event.shiftKey && !event.metaKey))
|
||||
parentNode.clearSelection();
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="listitem"
|
||||
extends="chrome://global/content/bindings/general.xml#basetext">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/listbox.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<children>
|
||||
<xul:listcell xbl:inherits="label,crop,disabled,flexlabel"/>
|
||||
</children>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIDOMXULSelectControlItemElement, nsIAccessibleProvider">
|
||||
<property name="current" onget="return this.getAttribute('current') == 'true';">
|
||||
<setter><![CDATA[
|
||||
if (val)
|
||||
this.setAttribute("current", "true");
|
||||
else
|
||||
this.removeAttribute("current");
|
||||
return val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<!-- ///////////////// nsIAccessibleProvider ///////////////// -->
|
||||
|
||||
<property name="accessible">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
|
||||
return accService.createXULListitemAccessible(this);
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<!-- ///////////////// nsIDOMXULSelectControlItemElement ///////////////// -->
|
||||
|
||||
<property name="value" onget="return this.getAttribute('value');"
|
||||
onset="this.setAttribute('value', val); return val;"/>
|
||||
<property name="label" onget="return this.getAttribute('label');"
|
||||
onset="this.setAttribute('label', val); return val;"/>
|
||||
|
||||
<property name="disabled" onget="return this.getAttribute('disabled') == 'true';"
|
||||
onset="if (val) this.setAttribute('disabled', 'true'); else this.removeAttribute('disabled');"/>
|
||||
|
||||
<property name="selected" onget="return this.getAttribute('selected') == 'true';">
|
||||
<setter><![CDATA[
|
||||
if (val)
|
||||
this.setAttribute("selected", "true");
|
||||
else
|
||||
this.removeAttribute("selected");
|
||||
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent("ListitemStateChange", true, true);
|
||||
this.dispatchEvent(event);
|
||||
|
||||
return val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="control">
|
||||
<getter><![CDATA[
|
||||
var parent = this.parentNode;
|
||||
while (parent) {
|
||||
if (parent.localName == "listbox")
|
||||
return parent;
|
||||
parent = parent.parentNode;
|
||||
}
|
||||
return null;
|
||||
]]></getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="listitem-iconic"
|
||||
extends="chrome://global/content/bindings/listbox.xml#listitem">
|
||||
<content>
|
||||
<children>
|
||||
<xul:listcell class="listcell-iconic" xbl:inherits="label,image,crop,disabled,flexlabel"/>
|
||||
</children>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="listitem-checkbox"
|
||||
extends="chrome://global/content/bindings/listbox.xml#listitem">
|
||||
<content>
|
||||
<children>
|
||||
<xul:listcell type="checkbox" xbl:inherits="label,crop,checked,disabled,flexlabel"/>
|
||||
</children>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<property name="checked"
|
||||
onget="return this.getAttribute('checked') == 'true';">
|
||||
<setter><![CDATA[
|
||||
if (val)
|
||||
this.setAttribute('checked', 'true');
|
||||
else
|
||||
this.removeAttribute('checked');
|
||||
var event = document.createEvent('Events');
|
||||
event.initEvent('CheckboxStateChange', false, true);
|
||||
this.dispatchEvent(event);
|
||||
return val;
|
||||
]]></setter>
|
||||
</property>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="mousedown" button="0" action="if (!this.disabled) this.checked = !this.checked;"/>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="listitem-checkbox-iconic"
|
||||
extends="chrome://global/content/bindings/listbox.xml#listitem-checkbox">
|
||||
<content>
|
||||
<children>
|
||||
<xul:listcell type="checkbox" class="listcell-iconic" xbl:inherits="label,image,crop,checked,disabled,flexlabel"/>
|
||||
</children>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="listcell"
|
||||
extends="chrome://global/content/bindings/listbox.xml#listbox-base">
|
||||
<content>
|
||||
<children>
|
||||
<xul:label class="listcell-label" xbl:inherits="value=label,flex=flexlabel,crop,disabled" flex="1" crop="right"/>
|
||||
</children>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="listcell-iconic"
|
||||
extends="chrome://global/content/bindings/listbox.xml#listcell">
|
||||
<content>
|
||||
<children>
|
||||
<xul:image class="listcell-icon" xbl:inherits="src=image"/>
|
||||
<xul:label class="listcell-label" xbl:inherits="value=label,flex=flexlabel,crop,disabled" flex="1" crop="right"/>
|
||||
</children>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="listcell-checkbox"
|
||||
extends="chrome://global/content/bindings/listbox.xml#listcell">
|
||||
<content>
|
||||
<children>
|
||||
<xul:image class="listcell-check" xbl:inherits="checked,disabled"/>
|
||||
<xul:label class="listcell-label" xbl:inherits="value=label,flex=flexlabelcrop,disabled" flex="1" crop="right"/>
|
||||
</children>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="listcell-checkbox-iconic"
|
||||
extends="chrome://global/content/bindings/listbox.xml#listcell-checkbox">
|
||||
<content>
|
||||
<children>
|
||||
<xul:image class="listcell-check" xbl:inherits="checked,disabled"/>
|
||||
<xul:image class="listcell-icon" xbl:inherits="src=image"/>
|
||||
<xul:label class="listcell-label" xbl:inherits="value=label,flex=flexlabelcrop,disabled" flex="1" crop="right"/>
|
||||
</children>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="listhead"
|
||||
extends="chrome://global/content/bindings/listbox.xml#listbox-base">
|
||||
<content>
|
||||
<xul:listheaditem>
|
||||
<children includes="listheader"/>
|
||||
</xul:listheaditem>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="listheader" display="xul:button"
|
||||
extends="chrome://global/content/bindings/listbox.xml#listbox-base">
|
||||
<content>
|
||||
<xul:image class="listheader-icon"/>
|
||||
<xul:label class="listheader-label" xbl:inherits="value=label,crop" flex="1" crop="right"/>
|
||||
<xul:image class="listheader-sortdirection" xbl:inherits="sortDirection"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="menuitemBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="menuitem-base">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/menu.css"/>
|
||||
</resources>
|
||||
<implementation implements="nsIDOMXULSelectControlItemElement, nsIAccessibleProvider">
|
||||
<property name="accessible">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
|
||||
if (this.localName == "menuseparator")
|
||||
return accService.createXULMenuSeparatorAccessible(this);
|
||||
if (this.parentNode && this.parentNode.parentNode &&
|
||||
this.parentNode.localName == "menupopup" && this.parentNode.parentNode.localName == "menulist")
|
||||
return accService.createXULSelectOptionAccessible(this);
|
||||
return accService.createXULMenuitemAccessible(this);
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="menu" extends="chrome://global/content/bindings/menu.xml#menuitem-base">
|
||||
<content>
|
||||
<xul:label class="menu-text" flex="1" xbl:inherits="value=label,accesskey,crop" crop="right"/>
|
||||
<xul:label class="menu-accel" xbl:inherits="value=acceltext"/>
|
||||
<xul:hbox align="center" class="menu-right" xbl:inherits="_moz-menuactive,disabled">
|
||||
<xul:image/>
|
||||
</xul:hbox>
|
||||
<children includes="menupopup"/>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<property name="value" onset="this.setAttribute('value',val); return val;"
|
||||
onget="return this.getAttribute('value');"/>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="menuitem" extends="chrome://global/content/bindings/menu.xml#menuitem-base">
|
||||
<content>
|
||||
<xul:label class="menu-text" flex="1" xbl:inherits="value=label,accesskey,crop" crop="right"/>
|
||||
<xul:label class="menu-accel" xbl:inherits="value=acceltext"/>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<property name="value" onset="this.setAttribute('value',val); return val;"
|
||||
onget="return this.getAttribute('value');"/>
|
||||
<property name="label" onget="return this.getAttribute('label');"
|
||||
onset="this.setAttribute('label', val); return val;"/>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="menu-menubar" extends="chrome://global/content/bindings/menu.xml#menuitem-base">
|
||||
<content>
|
||||
<xul:label class="menubar-text" xbl:inherits="value=label,accesskey,crop" crop="right"/>
|
||||
<children includes="menupopup"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="menu-menubar-iconic" extends="chrome://global/content/bindings/menu.xml#menuitem-base">
|
||||
<content>
|
||||
<xul:image class="menubar-left" xbl:inherits="image=src"/>
|
||||
<xul:label class="menubar-text" xbl:inherits="value=label,accesskey,crop" crop="right"/>
|
||||
<children includes="menupopup"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="menuitem-iconic" extends="chrome://global/content/bindings/menu.xml#menuitem">
|
||||
<content>
|
||||
<xul:hbox class="menu-iconic-left" align="center" pack="center"
|
||||
xbl:inherits="selected,_moz-menuactive,disabled,checked">
|
||||
<xul:image class="menu-iconic-icon" xbl:inherits="src=image,validate,src"/>
|
||||
</xul:hbox>
|
||||
<xul:label class="menu-iconic-text" flex="1" xbl:inherits="value=label,accesskey,crop" crop="right"/>
|
||||
<xul:label class="menu-iconic-accel" xbl:inherits="value=acceltext"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="menuitem-iconic-noaccel" extends="chrome://global/content/bindings/menu.xml#menuitem">
|
||||
<content>
|
||||
<xul:hbox class="menu-iconic-left" align="center" pack="center"
|
||||
xbl:inherits="selected,disabled,checked">
|
||||
<xul:image class="menu-iconic-icon" xbl:inherits="src=image,validate,src"/>
|
||||
</xul:hbox>
|
||||
<xul:label class="menu-iconic-text" flex="1" xbl:inherits="value=label,accesskey,crop" crop="right"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="menu-iconic" extends="chrome://global/content/bindings/menu.xml#menuitem-base">
|
||||
<content>
|
||||
<xul:hbox class="menu-iconic-left" align="center" pack="center">
|
||||
<xul:image xbl:inherits="src=image"/>
|
||||
</xul:hbox>
|
||||
<xul:label class="menu-iconic-text" flex="1" xbl:inherits="value=label,accesskey,crop" crop="right"/>
|
||||
<xul:label class="menu-iconic-accel" xbl:inherits="value=acceltext"/>
|
||||
<xul:hbox class="menu-right" xbl:inherits="_moz-menuactive,disabled" align="center" pack="center">
|
||||
<xul:image/>
|
||||
</xul:hbox>
|
||||
<children includes="menupopup|template"/>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<property name="value" onset="this.setAttribute('value',val); return val;"
|
||||
onget="return this.getAttribute('value');"/>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="menubutton-item" extends="chrome://global/content/bindings/menu.xml#menuitem-base">
|
||||
<content>
|
||||
<xul:label class="menubutton-text" flex="1" xbl:inherits="value=label,accesskey,crop" crop="right"/>
|
||||
<children includes="menupopup"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="menuseparator" extends="chrome://global/content/bindings/menu.xml#menuitem-base"/>
|
||||
|
||||
</bindings>
|
|
@ -0,0 +1,473 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="menulistBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="menulist-base">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/menulist.css"/>
|
||||
</resources>
|
||||
</binding>
|
||||
|
||||
<binding id="menulist" display="xul:menu"
|
||||
extends="chrome://global/content/bindings/menulist.xml#menulist-base">
|
||||
<content>
|
||||
<xul:hbox class="menulist-label-box" flex="1">
|
||||
<xul:image class="menulist-icon" xbl:inherits="src"/>
|
||||
<xul:label class="menulist-label" xbl:inherits="value=label,crop,accesskey" crop="right" flex="1"/>
|
||||
</xul:hbox>
|
||||
<xul:dropmarker class="menulist-dropmarker" type="menu"/>
|
||||
<children includes="menupopup"/>
|
||||
</content>
|
||||
|
||||
<handlers>
|
||||
<handler event="command" phase="capturing"
|
||||
action="if (event.originalTarget.localName == 'menuitem') this.selectedItem = event.originalTarget;"/>
|
||||
|
||||
<handler event="popupshowing">
|
||||
<![CDATA[
|
||||
if (event.target.parentNode == this && this.selectedItem) {
|
||||
// Not ready for auto-setting the active child in hierarchies yet.
|
||||
// For now, only do this when the outermost menupopup opens.
|
||||
var menuBox = this.boxObject.QueryInterface(Components.interfaces.nsIMenuBoxObject);
|
||||
menuBox.activeChild = this.selectedItem;
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
|
||||
<implementation implements="nsIDOMXULMenuListElement, nsIDOMXULSelectControlElement, nsIAccessibleProvider">
|
||||
<constructor>
|
||||
this.setInitialSelection()
|
||||
</constructor>
|
||||
|
||||
<method name="setInitialSelection">
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.setAttribute('sizetopopup', 'pref');
|
||||
|
||||
if (this.childNodes.length) {
|
||||
// if there was a previously selected item, be sure to set our internal
|
||||
// selection memory to that item so we can un-set it properly later on
|
||||
var arr = this.firstChild.getElementsByAttribute('selected', 'true');
|
||||
if (arr.length)
|
||||
this.selectedInternal = arr[0];
|
||||
|
||||
if (!this.label && this.childNodes.length) {
|
||||
if (!arr.length && this.value)
|
||||
arr = this.firstChild.getElementsByAttribute('value', this.value);
|
||||
|
||||
if (arr.length)
|
||||
this.selectedItem = arr[0];
|
||||
else
|
||||
this.selectedIndex = 0;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<property name="value" onget="return this.getAttribute('value');">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
var arr;
|
||||
|
||||
if (this.childNodes.length)
|
||||
arr = this.firstChild.getElementsByAttribute('value', val);
|
||||
|
||||
if (arr && arr.length)
|
||||
this.selectedItem = arr[0];
|
||||
else
|
||||
this.setAttribute('value', val);
|
||||
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="crop" onset="this.setAttribute('crop',val); return val;"
|
||||
onget="return this.getAttribute('crop');"/>
|
||||
<property name="src" onset="this.setAttribute('src',val); return val;"
|
||||
onget="return this.getAttribute('src');"/>
|
||||
<property name="label" onset="this.setAttribute('label',val); return val;"
|
||||
onget="return this.getAttribute('label');"/>
|
||||
<property name="disabled" onset="if (val) this.setAttribute('disabled',true);
|
||||
else this.removeAttribute('disabled');
|
||||
return val;"
|
||||
onget="return this.hasAttribute('disabled');"/>
|
||||
|
||||
<property name="open" onset="if (val) this.setAttribute('open',true);
|
||||
else this.removeAttribute('open');
|
||||
return val;"
|
||||
onget="return this.hasAttribute('open');"/>
|
||||
|
||||
<field name="selectedInternal">
|
||||
null
|
||||
</field>
|
||||
|
||||
<property name="selectedIndex">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
// Quick and dirty. We won't deal with hierarchical menulists yet.
|
||||
if (!this.selectedItem)
|
||||
return -1;
|
||||
|
||||
var children = this.selectedItem.parentNode.childNodes;
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
if (children[i] == this.selectedItem)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
if (val < 0)
|
||||
this.selectedItem = null;
|
||||
else {
|
||||
var curr = this.firstChild;
|
||||
while (curr && curr.localName != 'menupopup')
|
||||
curr = curr.nextSibling;
|
||||
if (curr && val < curr.childNodes.length)
|
||||
this.selectedItem = curr.childNodes[val];
|
||||
}
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="selectedItem">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return this.selectedInternal;
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
if (this.selectedInternal == val)
|
||||
return val;
|
||||
|
||||
if (this.selectedInternal)
|
||||
this.selectedInternal.removeAttribute('selected');
|
||||
|
||||
this.selectedInternal = val;
|
||||
if (!this.selectedInternal) {
|
||||
this.removeAttribute('value');
|
||||
this.removeAttribute('src');
|
||||
this.removeAttribute('label');
|
||||
return val;
|
||||
}
|
||||
|
||||
val.setAttribute('selected', 'true');
|
||||
|
||||
this.setAttribute('value', val.getAttribute('value'));
|
||||
this.setAttribute('src', val.getAttribute('src'));
|
||||
this.setAttribute('label', val.getAttribute('label'));
|
||||
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<method name="appendItem">
|
||||
<parameter name="label"/>
|
||||
<parameter name="value"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var popup = this.getElementsByTagName("menupopup")[0];
|
||||
if (popup) {
|
||||
var XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
var item = document.createElementNS(XULNS, "menuitem");
|
||||
item.setAttribute("label", label);
|
||||
item.setAttribute("value", value);
|
||||
popup.appendChild(item);
|
||||
return item;
|
||||
}
|
||||
return null;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="insertItemAt">
|
||||
<parameter name="index"/>
|
||||
<parameter name="label"/>
|
||||
<parameter name="value"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var popup = this.getElementsByTagName("menupopup")[0];
|
||||
if (popup) {
|
||||
var XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
var item = document.createElementNS(XULNS, "menuitem");
|
||||
item.setAttribute("label", label);
|
||||
item.setAttribute("value", value);
|
||||
var before = popup.childNodes[index];
|
||||
if (before)
|
||||
popup.insertBefore(item, before);
|
||||
else
|
||||
popup.appendChild(item);
|
||||
return item;
|
||||
}
|
||||
return null;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="removeItemAt">
|
||||
<parameter name="index"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var popup = this.getElementsByTagName("menupopup")[0];
|
||||
if (popup) {
|
||||
var remove = popup.childNodes[index];
|
||||
if (remove)
|
||||
popup.removeChild(remove);
|
||||
return remove;
|
||||
}
|
||||
return null;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<property name="accessible">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
|
||||
return accService.createXULComboboxAccessible(this);
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="menulist-editable" extends="chrome://global/content/bindings/menulist.xml#menulist">
|
||||
<content>
|
||||
<xul:hbox class="menulist-editable-box" flex="1">
|
||||
<html:input flex="1" class="menulist-editable-input" allowevents="true"
|
||||
xbl:inherits="value=label,disabled"/>
|
||||
</xul:hbox>
|
||||
<xul:dropmarker class="menulist-dropmarker" type="menu"/>
|
||||
<children includes="menupopup"/>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<constructor><![CDATA[
|
||||
this.setInitialSelection();
|
||||
]]></constructor>
|
||||
|
||||
<method name="_selectInputFieldValueInList">
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (this.hasAttribute("disableautoselect"))
|
||||
return "";
|
||||
|
||||
// Find and select the menuitem that matches inputField's "value"
|
||||
var inputVal = this.inputField.value;
|
||||
var arr;
|
||||
|
||||
if (this.childNodes.length)
|
||||
arr = this.firstChild.getElementsByAttribute('label', inputVal);
|
||||
|
||||
if (arr && arr.length)
|
||||
this.setSelectionInternal(arr[0]);
|
||||
else
|
||||
this.setSelectionInternal(null);
|
||||
|
||||
return inputVal;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="setSelectionInternal">
|
||||
<parameter name="val"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
// This is called internally to set selected item
|
||||
// without triggering infinite loop
|
||||
// when using selectedItem's setter
|
||||
if (this.selectedInternal == val)
|
||||
return val;
|
||||
|
||||
if (this.selectedInternal)
|
||||
this.selectedInternal.removeAttribute('selected');
|
||||
|
||||
this.selectedInternal = val;
|
||||
|
||||
//Do NOT change the "value", which is owned by inputField
|
||||
if (!this.selectedInternal) {
|
||||
this.removeAttribute('src');
|
||||
return val;
|
||||
}
|
||||
val.setAttribute('selected', 'true');
|
||||
this.setAttribute('src', val.getAttribute('src'));
|
||||
|
||||
return val;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<field name="inputField" readonly="true">
|
||||
<![CDATA[
|
||||
var v = document.getAnonymousNodes(this);
|
||||
var input = null;
|
||||
for (var i = 0; i < v.length; i++) {
|
||||
try {
|
||||
var l = v[i].getElementsByTagNameNS("http://www.w3.org/1999/xhtml", "input");
|
||||
if (l.length > 0) {
|
||||
input = l[0];
|
||||
break;
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
input;
|
||||
]]>
|
||||
</field>
|
||||
<property name="label" onset="this.inputField.value = val; return val;"
|
||||
onget="return this.inputField.value;"/>
|
||||
|
||||
<property name="value" onget="return this.inputField.value;">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
// Override menulist's value setter to refer to the inputField's value
|
||||
// (Allows using "menulist.value" instead of "menulist.inputField.value")
|
||||
this.inputField.value = val;
|
||||
this.setAttribute('value', val);
|
||||
this.setAttribute('label', val);
|
||||
this._selectInputFieldValueInList();
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="selectedItem">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
// Make sure internally-selected item
|
||||
// is in sync with inputField.value
|
||||
this._selectInputFieldValueInList();
|
||||
return this.selectedInternal;
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
// This doesn't touch inputField.value or "value" and "label" attributes
|
||||
this.setSelectionInternal(val);
|
||||
|
||||
if (!this.selectedInternal) {
|
||||
this.inputField.value = "";
|
||||
this.removeAttribute('value');
|
||||
this.removeAttribute('label');
|
||||
return val;
|
||||
}
|
||||
|
||||
// Editable menulist uses "label" as its "value"
|
||||
var label = val.getAttribute('label');
|
||||
this.inputField.value = label;
|
||||
this.setAttribute('value', label);
|
||||
this.setAttribute('label', label);
|
||||
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
<property name="disableautoselect"
|
||||
onset="if (val) this.setAttribute('disableautoselect','true');
|
||||
else this.removeAttribute('disableautoselect'); return val;"
|
||||
onget="return this.hasAttribute('disableautoselect');"/>
|
||||
|
||||
<property name="open">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return this.getAttribute('open') == 'true';
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
var popups = this.getElementsByTagNameNS(
|
||||
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
|
||||
"menupopup");
|
||||
if (!popups || popups.length == 0)
|
||||
return val;
|
||||
|
||||
if (val) { // open the popup
|
||||
popups[0].showPopup(this, -1, -1, "popup", "bottomleft", "topleft");
|
||||
this._selectInputFieldValueInList();
|
||||
this.setAttribute('open', 'true');
|
||||
}
|
||||
else { // hide the popup
|
||||
popups[0].hidePopup();
|
||||
this.removeAttribute('open');
|
||||
}
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="focus" phase="capturing">
|
||||
<![CDATA[
|
||||
if (!this.hasAttribute('focused'))
|
||||
{
|
||||
this.setAttribute('focused','true');
|
||||
this.suppressFocusBlur = true;
|
||||
if (document.commandDispatcher.focusedElement != this.inputField)
|
||||
this.inputField.focus();
|
||||
this.suppressFocusBlur = false;
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<handler event="blur" phase="capturing">
|
||||
<![CDATA[
|
||||
if (!this.suppressFocusBlur && this.hasAttribute('focused')) {
|
||||
this.removeAttribute('focused');
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<handler event="popupshowing">
|
||||
<![CDATA[
|
||||
// BUG in Classic skin: doesn't shift focus when popup is opened
|
||||
// so force it to inputField here
|
||||
if (event.target.parentNode == this) {
|
||||
if (document.commandDispatcher.focusedElement != this.inputField)
|
||||
this.inputField.focus();
|
||||
|
||||
if (this.selectedItem) {
|
||||
// Not ready for auto-setting the active child in hierarchies yet.
|
||||
// For now, only do this when the outermost menupopup opens.
|
||||
var menuBox = this.boxObject.QueryInterface(Components.interfaces.nsIMenuBoxObject);
|
||||
menuBox.activeChild = this.selectedItem;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<handler event="keypress">
|
||||
<![CDATA[
|
||||
// open popup if key is up or down
|
||||
if (event.keyCode == KeyEvent.DOM_VK_UP || event.keyCode == KeyEvent.DOM_VK_DOWN ||
|
||||
(event.keyCode == KeyEvent.DOM_VK_F4 && !event.altKey && !event.ctrlKey && !event.shiftKey)) {
|
||||
event.preventDefault();
|
||||
this.open = true;
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="menulist-compact" display="xul:menu"
|
||||
extends="chrome://global/content/bindings/menulist.xml#menulist">
|
||||
<content>
|
||||
<xul:dropmarker class="menulist-dropmarker" type="menu"/>
|
||||
<xul:image class="menulist-icon" xbl:inherits="src"/>
|
||||
<xul:label class="menulist-label" xbl:inherits="value=label,crop,accesskey" crop="right" flex="1"/>
|
||||
<children includes="menupopup"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="scrollbarBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="scrollbar">
|
||||
<content>
|
||||
<xul:nativescrollbar flex="1" xbl:inherits="curpos,maxpos,pageincrement,increment,orient,sborient=orient"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -0,0 +1,650 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="popupBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="popup-base">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/popup.css"/>
|
||||
</resources>
|
||||
</binding>
|
||||
|
||||
<binding id="popup" extends="chrome://global/content/bindings/popup.xml#popup-base">
|
||||
<content>
|
||||
<xul:arrowscrollbox class="popup-internal-box" flex="1" orient="vertical">
|
||||
<children/>
|
||||
</xul:arrowscrollbox>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIDOMXULPopupElement, nsIAccessibleProvider">
|
||||
<property name="accessible">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
if (this.localName == "popup" || this.localName == "menupopup") {
|
||||
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
|
||||
return (this.parentNode.localName == "menulist")? accService.createXULSelectListAccessible(this): accService.createXULMenupopupAccessible(this);
|
||||
}
|
||||
return null;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<property name="position" onget="return this.getAttribute('position');"
|
||||
onset="this.setAttribute('position', val); return val;"/>
|
||||
<property name="popupBoxObject">
|
||||
<getter>
|
||||
return this.boxObject.QueryInterface(Components.interfaces.nsIPopupBoxObject);
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<method name="showPopup">
|
||||
<parameter name="element"/>
|
||||
<parameter name="xpos"/>
|
||||
<parameter name="ypos"/>
|
||||
<parameter name="popuptype"/>
|
||||
<parameter name="anchoralignment"/>
|
||||
<parameter name="popupalignment"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var popupBox = null;
|
||||
var menuBox = null;
|
||||
try {
|
||||
popupBox = this.popupBoxObject;
|
||||
} catch(e) {}
|
||||
try {
|
||||
menuBox = this.parentNode.boxObject.QueryInterface(Components.interfaces.nsIMenuBoxObject);
|
||||
} catch(e) {}
|
||||
if (menuBox)
|
||||
menuBox.openMenu(true);
|
||||
else if (popupBox)
|
||||
popupBox.showPopup(element, this, xpos, ypos, popuptype, anchoralignment, popupalignment);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="hidePopup">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var popupBox = null;
|
||||
var menuBox = null;
|
||||
try {
|
||||
popupBox = this.boxObject.QueryInterface(Components.interfaces.nsIPopupBoxObject);
|
||||
} catch(e) {}
|
||||
try {
|
||||
menuBox = this.parentNode.boxObject.QueryInterface(Components.interfaces.nsIMenuBoxObject);
|
||||
} catch(e) {}
|
||||
if (menuBox)
|
||||
menuBox.openMenu(false);
|
||||
else if (popupBox)
|
||||
popupBox.hidePopup();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<property name="autoPosition">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return this.popupBoxObject.autoPosition;
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
return this.popupBoxObject.autoPosition = val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<method name="enableKeyboardNavigator">
|
||||
<parameter name="aEnableKeyboardNavigator"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.popupBoxObject.enableKeyboardNavigator(aEnableKeyboardNavigator);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="enableRollup">
|
||||
<parameter name="aEnableRollup"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.popupBoxObject.enableRollup(aEnableRollup);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="sizeTo">
|
||||
<parameter name="aWidth"/>
|
||||
<parameter name="aHeight"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.popupBoxObject.sizeTo(aWidth, aHeight);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="moveTo">
|
||||
<parameter name="aLeft"/>
|
||||
<parameter name="aTop"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.popupBoxObject.moveTo(aLeft, aTop);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="contextmenu" action="event.preventDefault();"/>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="tooltip" extends="chrome://global/content/bindings/popup.xml#popup">
|
||||
<content>
|
||||
<children>
|
||||
<xul:label class="tooltip-label" xbl:inherits="value=label,crop" crop="right" flex="1"/>
|
||||
</children>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<field name="_mouseOutCount">0</field>
|
||||
<field name="_isMouseOver">false</field>
|
||||
|
||||
<property name="label"
|
||||
onget="return this.getAttribute('label');"
|
||||
onset="this.setAttribute('label', val); return val;"/>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="mouseover"><![CDATA[
|
||||
var rel = event.relatedTarget;
|
||||
//dump("ENTERING " + (rel ? rel.localName : "null") + "\n");
|
||||
if (!rel)
|
||||
return;
|
||||
|
||||
// find out if the node we entered from is one of our anonymous children
|
||||
while (rel) {
|
||||
if (rel == this)
|
||||
break;
|
||||
rel = rel.parentNode;
|
||||
}
|
||||
|
||||
// if the exited node is not a descendant of ours, we are entering for the first time
|
||||
if (rel != this)
|
||||
this._isMouseOver = true;
|
||||
]]></handler>
|
||||
|
||||
<handler event="mouseout"><![CDATA[
|
||||
var rel = event.relatedTarget;
|
||||
//dump("LEAVING " + (rel ? rel.localName : "null") + "\n");
|
||||
|
||||
// relatedTarget is null when the titletip is first shown: a mouseout event fires
|
||||
// because the mouse is exiting the main window and entering the titletip "window".
|
||||
// relatedTarget is also null when the mouse exits the main window completely,
|
||||
// so count how many times relatedTarget was null after titletip is first shown
|
||||
// and hide popup the 2nd time
|
||||
if (!rel) {
|
||||
++this._mouseOutCount;
|
||||
if (this._mouseOutCount > 1)
|
||||
this.hidePopup();
|
||||
return;
|
||||
}
|
||||
|
||||
// find out if the node we are entering is one of our anonymous children
|
||||
while (rel) {
|
||||
if (rel == this)
|
||||
break;
|
||||
rel = rel.parentNode;
|
||||
}
|
||||
|
||||
// if the entered node is not a descendant of ours, hide the tooltip
|
||||
if (rel != this && this._isMouseOver) {
|
||||
this.hidePopup();
|
||||
}
|
||||
]]></handler>
|
||||
|
||||
<handler event="popupshowing">
|
||||
<![CDATA[
|
||||
// fill in the label automatically for the default tooltip
|
||||
if (this.getAttribute("default") == "true") {
|
||||
var label = "";
|
||||
var ttNode = document.tooltipNode;
|
||||
if (ttNode && ttNode.hasAttribute("tooltiptext"))
|
||||
this.label = ttNode.getAttribute("tooltiptext");
|
||||
}
|
||||
|
||||
// This is a special consideration for tree titletips. There is a
|
||||
// case where the user moves the mouse from over the treebody to
|
||||
// completely outside of the window, while passing over a cell that
|
||||
// displays a titletip. This causes the titletip to show, even though
|
||||
// the mouse is not over the corresponding cell, so we need to check
|
||||
// if the titletip was entered by the mouse, and if not, hide it.
|
||||
// XXX commenting this out for now because it doesn't work on Mac
|
||||
// become mouseover isn't fired when the tooltip appears with the mouse over it
|
||||
//if (this.hasAttribute("titletip"))
|
||||
// window.setTimeout(function(me) { if (!me._isMouseOver) me.hidePopup(); }, 100, this);
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<handler event="popuphiding"><![CDATA[
|
||||
this._isMouseOver = false;
|
||||
this._mouseOutCount = 0;
|
||||
]]></handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<!-- XXXben this binding is not currently used -->
|
||||
<binding id="resizerbase" extends="xul:box">
|
||||
<implementation>
|
||||
<property name="popup">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var currNode = this.parentNode;
|
||||
while (currNode) {
|
||||
try {
|
||||
var bo = currNode.boxObject.QueryInterface(Components.interfaces.nsIPopupBoxObject);
|
||||
if (bo)
|
||||
return currNode;
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
currNode = currNode.parentNode;
|
||||
}
|
||||
return null;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<method name="handleMouseMove">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<field name="screenLeft">0</field>
|
||||
<field name="screenTop">0</field>
|
||||
<field name="resizerDirection">0</field>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="mousedown" phase="capturing">
|
||||
<![CDATA[
|
||||
var popup = event.target.popup;
|
||||
var boxObject = popup.boxObject;
|
||||
boxObject.captureMouseEvents = true;
|
||||
event.target.screenLeft = event.screenX;
|
||||
event.target.screenTop = event.screenY;
|
||||
event.target.setMode();
|
||||
event.preventDefault();
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="mouseup" phase="capturing">
|
||||
<![CDATA[
|
||||
var popup = event.target.popup;
|
||||
var boxObject = popup.boxObject;
|
||||
boxObject.captureMouseEvents = false;
|
||||
event.target.screenLeft = event.screenX;
|
||||
event.target.screenTop = event.screenY;
|
||||
event.target.direction = 0;
|
||||
event.preventDefault();
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="mousemove" phase="capturing">
|
||||
<![CDATA[
|
||||
event.target.handleMouseMove(event);
|
||||
event.preventDefault();
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<!-- East-West resizer -->
|
||||
<binding id="ew-resizer" extends="xul:box"> <!-- extends="chrome://global/content/bindings/popup.xml#resizerbase"> -->
|
||||
<content>
|
||||
<xul:hbox class="ew-resizer-box" flex="1"/>
|
||||
</content>
|
||||
<!--
|
||||
<implementation>
|
||||
<method name="handleMouseMove">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var boxObject = aEvent.target.boxObject;
|
||||
if (boxObject.captureMouseEvents && this.resizerDirection == "right") {
|
||||
var delta = aEvent.screenX - this.screenLeft;
|
||||
this.screenLeft = aEvent.screenX;
|
||||
|
||||
// We can set this directly as we're only modifying one dimension
|
||||
aEvent.target.width += delta;
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="setMode">
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.resizerDirection = "right";
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
-->
|
||||
</binding>
|
||||
|
||||
<!-- North-South resizer -->
|
||||
<binding id="ns-resizer" extends="xul:box"> <!-- extends="chrome://global/content/bindings/popup.xml#resizerbase"> -->
|
||||
<content>
|
||||
<xul:hbox class="ns-resizer-box" flex="1"/>
|
||||
</content>
|
||||
<!--
|
||||
<implementation>
|
||||
<method name="handleMouseMove">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var boxObject = aEvent.target.boxObject;
|
||||
if (boxObject.captureMouseEvents && this.resizerDirection == "bottom") {
|
||||
var delta = aEvent.screenY - this.screenTop;
|
||||
this.screenTop = aEvent.screenY;
|
||||
var currWidth = aEvent.target.boxObject.width;
|
||||
|
||||
// We can set this directly as we're only modifying one dimension
|
||||
aEvent.target.height += delta;
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="setMode">
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.resizerDirection = "bottom";
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
-->
|
||||
</binding>
|
||||
|
||||
<!-- Diagonal resizer -->
|
||||
<binding id="diag-resizer" extends="xul:box"> <!-- extends="chrome://global/content/bindings/popup.xml#resizerbase"> -->
|
||||
<content>
|
||||
<xul:hbox class="diag-resizer-box" align="center" flex="1">
|
||||
<xul:image class="diag-resizer-image"/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
<!--
|
||||
<implementation>
|
||||
<method name="handleMouseMove">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var boxObject = aEvent.target.boxObject;
|
||||
if (boxObject.captureMouseEvents && this.resizerDirection == "bottomright") {
|
||||
if (!this.screenLeft || !this.screenTop) {
|
||||
this.screenLeft = aEvent.screenX;
|
||||
this.screenTop = aEvent.screenY;
|
||||
}
|
||||
var deltaX = aEvent.screenX - this.screenLeft;
|
||||
var deltaY = aEvent.screenY - this.screenTop;
|
||||
this.screenLeft = aEvent.screenX;
|
||||
this.screenTop = aEvent.screenY;
|
||||
var currWidth = aEvent.target.boxObject.width;
|
||||
var currHeight = aEvent.target.boxObject.height;
|
||||
aEvent.target.sizeTo(currWidth + deltaX, currHeight + deltaY);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="setMode">
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.resizerDirection = "bottomright";
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
-->
|
||||
</binding>
|
||||
|
||||
<binding id="titlebar" extends="xul:box"> <!-- extends="chrome://global/content/bindings/popup.xml#resizerbase"> -->
|
||||
<content>
|
||||
<xul:hbox class="titlebar-box" flex="1">
|
||||
<xul:hbox class="titlebar-title-box" flex="1" tooltiptext="Click and drag to float">
|
||||
<xul:label class="titlebar-title" xbl:inherits="value=title" flex="1" crop="right"/>
|
||||
</xul:hbox>
|
||||
<xul:button class="popupClose" tooltiptext="Close"/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
<!--
|
||||
<implementation>
|
||||
<method name="handleMouseMove">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!this.popup) this.popup = aEvent.target.popup;
|
||||
var boxObject = this.popup.boxObject;
|
||||
if (boxObject.captureMouseEvents && this.direction == "titlebar") {
|
||||
if (!this.screenLeft || !this.screenTop) {
|
||||
this.screenLeft = aEvent.screenX;
|
||||
this.screenTop = aEvent.screenY;
|
||||
}
|
||||
var deltaX = aEvent.screenX - this.screenLeft;
|
||||
var deltaY = aEvent.screenY - this.screenTop;
|
||||
this.screenLeft = aEvent.screenX;
|
||||
this.screenTop = aEvent.screenY;
|
||||
var currX = aEvent.target.boxObject.screenX;
|
||||
var currY = aEvent.target.boxObject.screenY;
|
||||
aEvent.target.moveTo(currX + deltaX, currY + deltaY);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="setMode">
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.direction = "titlebar";
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
-->
|
||||
</binding>
|
||||
|
||||
<binding id="floater-base" display="xul:popup" extends="chrome://global/content/bindings/popup.xml#popup">
|
||||
<implementation>
|
||||
|
||||
<!-- Popup Manipulation Constants -->
|
||||
<field name="MANIPULATE_NONE" readonly="true">0</field>
|
||||
<field name="MANIPULATE_MOVE" readonly="true">1</field>
|
||||
<field name="MANIPULATE_SIZE_EW" readonly="true">2</field>
|
||||
<field name="MANIPULATE_SIZE_NS" readonly="true">3</field>
|
||||
<field name="MANIPULATE_SIZE_DIAG" readonly="true">4</field>
|
||||
|
||||
<method name="handleMouseMove">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var boxObject = this.boxObject;
|
||||
if (boxObject.captureMouseEvents) {
|
||||
var dX, dY;
|
||||
var eScreenX = aEvent.screenX;
|
||||
var eScreenY = aEvent.screenY;
|
||||
switch (this.manipulateMode) {
|
||||
case this.MANIPULATE_SIZE_EW:
|
||||
var width = boxObject.width;
|
||||
dX = eScreenX - this.screenLeft;
|
||||
this.sizeTo(width + dX, this.height);
|
||||
break;
|
||||
case this.MANIPULATE_SIZE_NS:
|
||||
var height = boxObject.height;
|
||||
dY = eScreenY - this.screenTop;
|
||||
this.sizeTo(this.width, height + dY);
|
||||
break;
|
||||
case this.MANIPULATE_SIZE_DIAG:
|
||||
dX = eScreenX - this.screenLeft;
|
||||
dY = eScreenY - this.screenTop;
|
||||
this.sizeTo(this.width + dX, this.height + dY);
|
||||
break;
|
||||
case this.MANIPULATE_MOVE:
|
||||
// XXXben this may not yet be complete. When we drag away from the
|
||||
// owner, we set some properties to ensure that we aren't
|
||||
// positioned as a menu, automatically closed or steal
|
||||
// keyboard navigation in an inappropriate way.
|
||||
this.autoPosition = false;
|
||||
this.enableRollup(false);
|
||||
this.enableKeyboardNavigator(false);
|
||||
dX = eScreenX - this.screenLeft;
|
||||
dY = eScreenY - this.screenTop;
|
||||
this.moveTo(this.left + dX, this.top + dY);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
this.screenLeft = eScreenX;
|
||||
this.screenTop = eScreenY;
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="findParentByLocalName">
|
||||
<parameter name="aNode"/>
|
||||
<parameter name="aLocalName"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var parent = aNode;
|
||||
var names = [].concat(aLocalName);
|
||||
while (parent) {
|
||||
for (var i = 0; i < names.length; ++i) {
|
||||
if (parent.localName == names[i])
|
||||
return parent;
|
||||
}
|
||||
parent = parent.parentNode;
|
||||
}
|
||||
return null;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="setMode">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var widget = this.findParentByLocalName(aEvent.originalTarget, ["resizer", "titlebar"]);
|
||||
if (widget) {
|
||||
if (widget.localName == "titlebar")
|
||||
this.manipulateMode = this.MANIPULATE_MOVE;
|
||||
else
|
||||
this.sizeDirection = widget.getAttribute("direction");
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="cleanUp">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.boxObject.captureMouseEvents = false;
|
||||
this.screenLeft = aEvent.screenX;
|
||||
this.screenTop = aEvent.screenY;
|
||||
this.manipulateMode = this.MANIPULATE_NONE;
|
||||
aEvent.preventDefault();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<field name="screenLeft">0</field>
|
||||
<field name="screenTop">0</field>
|
||||
<field name="manipulateMode">0</field>
|
||||
</implementation>
|
||||
<handlers>
|
||||
<handler event="mousedown" phase="capturing">
|
||||
<![CDATA[
|
||||
this.boxObject.captureMouseEvents = true;
|
||||
this.screenLeft = event.screenX;
|
||||
this.screenTop = event.screenY;
|
||||
this.setMode(event);
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="mouseup" phase="capturing">
|
||||
<![CDATA[
|
||||
this.cleanUp(event);
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="mousemove" phase="capturing">
|
||||
<![CDATA[
|
||||
this.handleMouseMove(event);
|
||||
event.preventDefault();
|
||||
]]>
|
||||
</handler>
|
||||
<!-- clean up, release the mouse, etc -->
|
||||
<handler event="popuphiding">
|
||||
<![CDATA[
|
||||
this.cleanUp(event);
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="click">
|
||||
<![CDATA[
|
||||
// Hide the popup if the [X] box is clicked.
|
||||
// XXXben this may not really belong here, but rather in a derived binding.
|
||||
if (event.originalTarget.className.indexOf("popupClose") != -1)
|
||||
this.popupBoxObject.hidePopup();
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="popup-scrollbars" extends="chrome://global/content/bindings/popup.xml#popup">
|
||||
<content>
|
||||
<xul:hbox class="popup-internal-box" flex="1" orient="vertical" style="overflow: auto;">
|
||||
<children/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="floater-normal" extends="chrome://global/content/bindings/popup.xml#floater-base">
|
||||
<content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" >
|
||||
<vbox class="floater-box" flex="1">
|
||||
<box class="floater-box-top">
|
||||
<titlebar flex="1" xbl:inherits="title" style="border: 1px outset grey; background-color: grey;"/>
|
||||
</box>
|
||||
<box class="floater-box-center" flex="1">
|
||||
<box class="floater-children" flex="1">
|
||||
<children/>
|
||||
</box>
|
||||
</box>
|
||||
<box class="floater-box-bottom">
|
||||
<resizer direction="bottom" flex="1"/>
|
||||
<resizer direction="bottomright" tooltiptext="Click and drag to resize"/>
|
||||
</box>
|
||||
</vbox>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="floater-dock-left" extends="chrome://global/content/bindings/popup.xml#floater-base">
|
||||
<content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" >
|
||||
<vbox class="floater-box" flex="1">
|
||||
<box class="floater-box-top">
|
||||
<titlebar flex="1" xbl:inherits="title"/>
|
||||
</box>
|
||||
<box class="floater-box-center" flex="1">
|
||||
<box class="floater-children" flex="1">
|
||||
<children/>
|
||||
</box>
|
||||
<resizer direction="right" tooltiptext="Click and drag to resize"/>
|
||||
</box>
|
||||
</vbox>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="close-button" extends="chrome://global/content/bindings/button.xml#button-base">
|
||||
<content>
|
||||
<xul:hbox align="center" flex="1">
|
||||
<xul:image class="close-button-x"/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="scrollbarBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="thumb" extends="xul:button">
|
||||
<content>
|
||||
<xul:gripper/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="scrollbar">
|
||||
<content>
|
||||
<xul:scrollbarbutton sbattr="scrollbar-up-top" type="decrement" xbl:inherits="sborient=orient"/>
|
||||
<xul:scrollbarbutton sbattr="scrollbar-down-top" type="increment" hidden="true" xbl:inherits="sborient=orient"/>
|
||||
<xul:slider flex="1" xbl:inherits="curpos,maxpos,pageincrement,increment,orient,sborient=orient">
|
||||
<xul:thumb sbattr="scrollbar-thumb" xbl:inherits="orient,sborient=orient"
|
||||
align="center" pack="center" flex="1"/>
|
||||
</xul:slider>
|
||||
<xul:scrollbarbutton sbattr="scrollbar-up-bottom" type="decrement" hidden="true" xbl:inherits="sborient=orient"/>
|
||||
<xul:scrollbarbutton sbattr="scrollbar-down-bottom" type="increment" xbl:inherits="sborient=orient"/>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<constructor>
|
||||
if (navigator.platform.indexOf("Mac") != -1)
|
||||
this.initScrollbar();
|
||||
</constructor>
|
||||
|
||||
<method name="initScrollbar">
|
||||
<body>
|
||||
<![CDATA[
|
||||
try {
|
||||
var scrollbarStyle = this.boxObject.getLookAndFeelMetric("scrollbarStyle");
|
||||
var thumbStyle = this.boxObject.getLookAndFeelMetric("thumbStyle");
|
||||
var downTop;
|
||||
var upBottom;
|
||||
if ( scrollbarStyle == "double" ) {
|
||||
downTop = document.getAnonymousElementByAttribute(this, "sbattr", "scrollbar-down-top");
|
||||
upBottom = document.getAnonymousElementByAttribute(this, "sbattr", "scrollbar-up-bottom");
|
||||
downTop.removeAttribute("hidden");
|
||||
upBottom.removeAttribute("hidden");
|
||||
}
|
||||
else if ( scrollbarStyle == "doubletop" ) {
|
||||
downTop = document.getAnonymousElementByAttribute(this, "sbattr", "scrollbar-down-top");
|
||||
var downBottom = document.getAnonymousElementByAttribute(this, "sbattr", "scrollbar-down-bottom");
|
||||
downTop.removeAttribute("hidden");
|
||||
downBottom.setAttribute("hidden","true");
|
||||
}
|
||||
else if ( scrollbarStyle == "doublebottom" ) {
|
||||
var upTop = document.getAnonymousElementByAttribute(this, "sbattr", "scrollbar-up-top");
|
||||
upBottom = document.getAnonymousElementByAttribute(this, "sbattr", "scrollbar-up-bottom");
|
||||
upTop.setAttribute("hidden","true");
|
||||
upBottom.removeAttribute("hidden");
|
||||
}
|
||||
if ( thumbStyle == "fixed" ) {
|
||||
var thumb = document.getAnonymousElementByAttribute(this, "sbattr","scrollbar-thumb");
|
||||
if ( thumb )
|
||||
thumb.removeAttribute("flex");
|
||||
}
|
||||
}
|
||||
catch ( x ) {
|
||||
//throw "Scrollbars in this skin are not properly supporting mac smart-scrolling prefs!";
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="contextmenu" preventdefault="true"/>
|
||||
</handlers>
|
||||
</binding>
|
||||
</bindings>
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="arrowscrollboxBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="scrollbox-base">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/scrollbox.css"/>
|
||||
</resources>
|
||||
</binding>
|
||||
|
||||
<binding id="scrollbox" extends="chrome://global/content/bindings/scrollbox.xml#scrollbox-base">
|
||||
<content>
|
||||
<xul:box class="box-inherit scrollbox-innerbox" xbl:inherits="orient,align,pack,dir">
|
||||
<children/>
|
||||
</xul:box>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="arrowscrollbox" extends="chrome://global/content/bindings/scrollbox.xml#scrollbox-base">
|
||||
<content>
|
||||
<xul:autorepeatbutton class="autorepeatbutton-up" scrolldir="up" collapsed="true"/>
|
||||
<xul:scrollbox xbl:inherits="orient,align,pack,dir" flex="1">
|
||||
<children/>
|
||||
</xul:scrollbox>
|
||||
<xul:autorepeatbutton class="autorepeatbutton-down" scrolldir="down" collapsed="true"/>
|
||||
</content>
|
||||
|
||||
<handlers>
|
||||
<handler event="underflow"><![CDATA[
|
||||
var kids = document.getAnonymousNodes(this);
|
||||
kids[0].collapsed = true;
|
||||
kids[2].collapsed = true;
|
||||
event.preventBubble();
|
||||
]]></handler>
|
||||
|
||||
<handler event="overflow"><![CDATA[
|
||||
var kids = document.getAnonymousNodes(this);
|
||||
kids[0].collapsed = false;
|
||||
kids[2].collapsed = false;
|
||||
event.preventBubble();
|
||||
]]></handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="autorepeatbutton" extends="chrome://global/content/bindings/scrollbox.xml#scrollbox-base">
|
||||
<content>
|
||||
<xul:image class="autorepeatbutton-icon"/>
|
||||
</content>
|
||||
|
||||
<handlers>
|
||||
<handler event="command"><![CDATA[
|
||||
if (!("mScrollBox" in this)) {
|
||||
var kids = document.getAnonymousNodes(parentNode);
|
||||
this.mScrollBox = kids[1];
|
||||
}
|
||||
|
||||
var dir = this.getAttribute("scrolldir");
|
||||
var bx = this.mScrollBox.boxObject.QueryInterface(Components.interfaces.nsIScrollBoxObject);
|
||||
bx.scrollByIndex(dir == "up" ? -1 : 1);
|
||||
]]></handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
- The contents of this file are subject to the Mozilla Public
|
||||
- License Version 1.1 (the "License"); you may not use this file
|
||||
- except in compliance with the License. You may obtain a copy of
|
||||
- the License at http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS
|
||||
- IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
- implied. See the License for the specific language governing
|
||||
- rights and limitations under the License.
|
||||
-
|
||||
- The Original Code is Mozilla.org code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is Håkan Waara.
|
||||
- Portions created by Håkan Waara are Copyright (C),
|
||||
- Håkan Waara. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s): Håkan Waara (Original Author)
|
||||
-->
|
||||
|
||||
<bindings id="spinbuttonsBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="spinbuttons"
|
||||
extends="chrome://global/content/bindings/spinbuttons.xml#spinbuttons-baseline">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/spinbuttons.css"/>
|
||||
</resources>
|
||||
</binding>
|
||||
|
||||
<binding id="spinbuttons-baseline">
|
||||
<content>
|
||||
<xul:vbox flex="1" align="center">
|
||||
<xul:image xbl:inherits="onclick=onup" id="upButton" class="up"/>
|
||||
<xul:image xbl:inherits="onclick=ondown" id="downButton" class="down"/>
|
||||
</xul:vbox>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="splitterBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<binding id="splitter" extends="xul:splitter">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/splitter.css"/>
|
||||
</resources>
|
||||
</binding>
|
||||
|
||||
<binding id="grippy">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/splitter.css"/>
|
||||
</resources>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -0,0 +1,85 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="stringBundleBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<binding id="stringbundleset" extends="xul:box"/>
|
||||
|
||||
<binding id="stringbundle" extends="xul:spacer">
|
||||
<implementation name="XStringBundle">
|
||||
|
||||
<method name="getString">
|
||||
<parameter name="aStringKey"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
return this.stringBundle.GetStringFromName(aStringKey);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="getFormattedString">
|
||||
<parameter name="aStringKey"/>
|
||||
<parameter name="aStringsArray"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
return this.stringBundle.formatStringFromName(aStringKey, aStringsArray, aStringsArray.length);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<property name="stringBundle" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
if (!this._bundle) {
|
||||
try {
|
||||
var stringBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"]
|
||||
.getService(Components.interfaces.nsIStringBundleService);
|
||||
this._bundle = stringBundleService.createBundle(this.src, this.appLocale);
|
||||
}
|
||||
catch (e) {
|
||||
dump("Failed to get stringbundle:\n");
|
||||
dump(e + "\n");
|
||||
}
|
||||
}
|
||||
return this._bundle;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<property name="src">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return this.getAttribute("src");
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
this._bundle = null;
|
||||
this.setAttribute("src", val);
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="appLocale">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
try {
|
||||
var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1"]
|
||||
.getService(Components.interfaces.nsILocaleService);
|
||||
return localeService.GetApplicationLocale();
|
||||
}
|
||||
catch (ex) {
|
||||
return null;
|
||||
}
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<field name="_bundle">null</field>
|
||||
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="textBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<!-- bound to <description>s -->
|
||||
<binding id="text-base">
|
||||
<implementation implements="nsIDOMXULDescriptionElement, nsIAccessibleProvider">
|
||||
<property name="accessible">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
|
||||
return accService.createXULTextAccessible(this);
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
<property name="disabled" onget="return this.hasAttribute('disabled');"
|
||||
onset="if (val) this.setAttribute('disabled', 'true');
|
||||
else this.removeAttribute('disabled');
|
||||
return val;"/>
|
||||
<property name="value" onget="return this.getAttribute('value');"
|
||||
onset="this.setAttribute('value', val); return val;"/>
|
||||
<property name="crop" onget="return this.getAttribute('crop');"
|
||||
onset="this.setAttribute('crop', val); return val;"/>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="text-label" extends="chrome://global/content/bindings/text.xml#text-base">
|
||||
<implementation implements="nsIDOMXULLabelElement">
|
||||
<property name="accessKey" onget="return this.getAttribute('accesskey');"
|
||||
onset="this.setAttribute('accesskey', val); return val;"/>
|
||||
<property name="control" onget="return this.getAttribute('control');"
|
||||
onset="this.setAttribute('control', val); return val;"/>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="label-control" extends="chrome://global/content/bindings/text.xml#text-label">
|
||||
<handlers>
|
||||
<handler event="click" action="if (this.disabled) return;
|
||||
var controlElementID = this.getAttribute('control');
|
||||
var controlElement;
|
||||
if (controlElementID)
|
||||
controlElement = document.getElementById(controlElementID);
|
||||
if(controlElement)
|
||||
controlElementID.focus();
|
||||
"/>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="text-link" extends="chrome://global/content/bindings/text.xml#text-label">
|
||||
<handlers>
|
||||
<handler event="keypress" keycode="VK_ENTER" action="this.click()" />
|
||||
<handler event="keypress" keycode="VK_RETURN" action="this.click()" />
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,505 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="wizardBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="wizard-base">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/wizard.css"/>
|
||||
</resources>
|
||||
</binding>
|
||||
|
||||
<binding id="wizard" extends="chrome://global/content/bindings/wizard.xml#wizard-base">
|
||||
<content width="500" height="380" persist="x y width height">
|
||||
<xul:hbox class="wizard-header" anonid="Header"/>
|
||||
|
||||
<xul:deck class="wizard-page-box" flex="1" anonid="Deck">
|
||||
<children includes="wizardpage"/>
|
||||
</xul:deck>
|
||||
<children/>
|
||||
|
||||
<xul:hbox class="wizard-buttons" anonid="Buttons" xbl:inherits="pagestep,firstpage,lastpage"/>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<property name="title" onget="return this.getAttribute('title')"
|
||||
onset="this.setAttribute('title', val);"/>
|
||||
|
||||
<property name="canAdvance" onget="return this._canAdvance;"
|
||||
onset="this._canAdvance=val; this._nextButton.setAttribute('disabled', !val);"/>
|
||||
<property name="canRewind" onget="return this._canRewind;"
|
||||
onset="this._canRewind=val; this._backButton.setAttribute('disabled', !val);"/>
|
||||
|
||||
<property name="pageStep" onget="return this._pageStack.length"/>
|
||||
|
||||
<field name="pageCount">0</field>
|
||||
|
||||
<field name="_accessMethod">null</field>
|
||||
<field name="_pageStack">null</field>
|
||||
<field name="_currentPage">null</field>
|
||||
|
||||
<property name="wizardPages">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var xulns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
return this.getElementsByTagNameNS(xulns, "wizardpage");
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<property name="currentPage" onget="return this._currentPage">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
if (!val)
|
||||
return val;
|
||||
|
||||
this._currentPage = val;
|
||||
|
||||
// Setting this attribute allows wizard's clients to dynamically
|
||||
// change the styles of each page based on purpose of the page.
|
||||
this.setAttribute("currentpageid", val.pageid);
|
||||
|
||||
if (this.onFirstPage) {
|
||||
this.canRewind = false;
|
||||
this.setAttribute("firstpage", "true");
|
||||
} else {
|
||||
this.canRewind = true;
|
||||
this.setAttribute("firstpage", "false");
|
||||
}
|
||||
|
||||
if (this.onLastPage) {
|
||||
this.canAdvance = true;
|
||||
this.setAttribute("lastpage", "true");
|
||||
} else {
|
||||
this.setAttribute("lastpage", "false");
|
||||
}
|
||||
|
||||
this._deck.setAttribute("selectedIndex", val.pageIndex);
|
||||
this._advanceFocusToPage(val);
|
||||
|
||||
this._adjustWizardHeader();
|
||||
this._wizardButtons.onPageChange();
|
||||
|
||||
this._fireEvent(val, "pageshow");
|
||||
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="pageIndex" onget="return this._pageIndex;">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
if (val < 0 || val >= this.pageCount)
|
||||
return this._pageIndex;
|
||||
|
||||
this.currentPage = this.wizardPages[val];
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="onFirstPage"
|
||||
onget="return this._pageStack.length == 1;"/>
|
||||
|
||||
<property name="onLastPage">
|
||||
<getter><![CDATA[
|
||||
var cp = this.currentPage;
|
||||
return cp && ((this._accessMethod == "sequential" && cp.pageIndex == this.pageCount-1) ||
|
||||
(this._accessMethod == "random" && cp.next == ""));
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<method name="getButton">
|
||||
<parameter name="aDlgType"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var btns = this.getElementsByAttribute("dlgtype", aDlgType);
|
||||
return btns.length > 0 ? btns[0] : document.getAnonymousElementByAttribute(this._wizardButtons, "dlgtype", aDlgType);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<field name="_canAdvance"/>
|
||||
<field name="_canRewind"/>
|
||||
<field name="_wizardHeader"/>
|
||||
<field name="_wizardButtons"/>
|
||||
<field name="_deck"/>
|
||||
<field name="_backButton"/>
|
||||
<field name="_nextButton"/>
|
||||
<field name="_cancelButton"/>
|
||||
|
||||
<!-- functions to be added as oncommand listeners to the wizard buttons -->
|
||||
<field name="_backFunc">(function() { document.documentElement.rewind(); })</field>
|
||||
<field name="_nextFunc">(function() { document.documentElement.advance(); })</field>
|
||||
<field name="_finishFunc">(function() { document.documentElement.advance(); })</field>
|
||||
<field name="_cancelFunc">(function() { document.documentElement.cancel(); })</field>
|
||||
|
||||
<field name="_closeHandler">(function(event) {
|
||||
if (document.documentElement.cancel())
|
||||
event.preventDefault();
|
||||
})</field>
|
||||
|
||||
<constructor><![CDATA[
|
||||
this._canAdvance = true;
|
||||
this._canRewind = false;
|
||||
this._hasLoaded = false;
|
||||
|
||||
this._pageStack = [];
|
||||
|
||||
// need to create string bundle manually instead of using <xul:stringbundle/>
|
||||
// see bug 63370 for details
|
||||
var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1"]
|
||||
.getService(Components.interfaces.nsILocaleService);
|
||||
var stringBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Components.interfaces.nsIStringBundleService);
|
||||
var bundleURL = "chrome://global-platform/locale/wizard.properties";
|
||||
this._bundle = stringBundleService.createBundle(bundleURL, localeService.GetApplicationLocale());
|
||||
|
||||
// get anonymous content references
|
||||
this._wizardHeader = document.getAnonymousElementByAttribute(this, "anonid", "Header");
|
||||
this._wizardButtons = document.getAnonymousElementByAttribute(this, "anonid", "Buttons");
|
||||
this._deck = document.getAnonymousElementByAttribute(this, "anonid", "Deck");
|
||||
|
||||
this._initWizardButton("back");
|
||||
this._initWizardButton("next");
|
||||
this._initWizardButton("finish");
|
||||
this._initWizardButton("cancel");
|
||||
|
||||
this._initPages();
|
||||
|
||||
window.addEventListener("close", this._closeHandler, false);
|
||||
|
||||
// start off on the first page
|
||||
this.pageCount = this.wizardPages.length;
|
||||
this.advance();
|
||||
|
||||
// give focus to the first focusable element in the dialog
|
||||
window.addEventListener("load", this._setInitialFocus, false);
|
||||
]]></constructor>
|
||||
|
||||
<method name="getPageById">
|
||||
<parameter name="aPageId"/>
|
||||
<body><![CDATA[
|
||||
var els = this.getElementsByAttribute("pageid", aPageId);
|
||||
return els.length > 0 ? els[0] : null;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="rewind">
|
||||
<body><![CDATA[
|
||||
if (!this.canRewind)
|
||||
return;
|
||||
|
||||
if (this.currentPage && !this._fireEvent(this.currentPage, "pagehide"))
|
||||
return;
|
||||
|
||||
if (this.currentPage && !this._fireEvent(this.currentPage, "pagerewound"))
|
||||
return;
|
||||
|
||||
if (!this._fireEvent(this, "wizardback"))
|
||||
return;
|
||||
|
||||
|
||||
this._pageStack.pop();
|
||||
this.currentPage = this._pageStack[this._pageStack.length-1];
|
||||
this.setAttribute("pagestep", this._pageStack.length);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="advance">
|
||||
<parameter name="aPageId"/>
|
||||
<body><![CDATA[
|
||||
if (!this.canAdvance)
|
||||
return;
|
||||
|
||||
if (this.currentPage && !this._fireEvent(this.currentPage, "pagehide"))
|
||||
return;
|
||||
|
||||
if (this.currentPage && !this._fireEvent(this.currentPage, "pageadvanced"))
|
||||
return;
|
||||
|
||||
if (this.onLastPage) {
|
||||
if (this._fireEvent(this, "wizardfinish"))
|
||||
window.setTimeout(function() {window.close();}, 1);
|
||||
} else {
|
||||
if (!this._fireEvent(this, "wizardnext"))
|
||||
return;
|
||||
|
||||
var page;
|
||||
if (aPageId)
|
||||
page = this.getPageById(aPageId);
|
||||
else {
|
||||
if (this.currentPage) {
|
||||
if (this._accessMethod == "random")
|
||||
page = this.getPageById(this.currentPage.next);
|
||||
else
|
||||
page = this.wizardPages[this.currentPage.pageIndex+1];
|
||||
} else
|
||||
page = this.wizardPages[0];
|
||||
}
|
||||
|
||||
if (page) {
|
||||
this._pageStack.push(page);
|
||||
this.setAttribute("pagestep", this._pageStack.length);
|
||||
|
||||
this.currentPage = page;
|
||||
}
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="goTo">
|
||||
<parameter name="aPageId"/>
|
||||
<body><![CDATA[
|
||||
var page = this.getPageById(aPageId);
|
||||
if (page) {
|
||||
this._pageStack[this._pageStack.length-1] = page;
|
||||
this.currentPage = page;
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="cancel">
|
||||
<body><![CDATA[
|
||||
if (!this._fireEvent(this, "wizardcancel"))
|
||||
return true;
|
||||
|
||||
window.close();
|
||||
window.setTimeout(function() {window.close();}, 1);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="_setInitialFocus">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
document.documentElement._hasLoaded = true;
|
||||
var focusInit =
|
||||
function() {
|
||||
// give focus to the first focusable element in the dialog
|
||||
if (!document.commandDispatcher.focusedElement)
|
||||
document.commandDispatcher.advanceFocusIntoSubtree(document.documentElement);
|
||||
};
|
||||
|
||||
// Give focus after onload completes, see bug 103197.
|
||||
setTimeout(focusInit, 0);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_advanceFocusToPage">
|
||||
<parameter name="aPage"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!this._hasLoaded)
|
||||
return;
|
||||
|
||||
document.commandDispatcher.advanceFocusIntoSubtree(aPage);
|
||||
|
||||
// if advanceFocusIntoSubtree tries to focus one of our
|
||||
// dialog buttons, then remove it and put it on the root
|
||||
var focused = document.commandDispatcher.focusedElement;
|
||||
if (focused && focused.hasAttribute("dlgtype"))
|
||||
this.focus();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_initPages">
|
||||
<body><![CDATA[
|
||||
var meth = "sequential";
|
||||
var pages = this.wizardPages;
|
||||
for (var i = 0; i < pages.length; ++i) {
|
||||
var page = pages[i];
|
||||
page.pageIndex = i;
|
||||
if (page.next != "")
|
||||
meth = "random";
|
||||
}
|
||||
this._accessMethod = meth;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="_initWizardButton">
|
||||
<parameter name="aName"/>
|
||||
<body><![CDATA[
|
||||
var btn = document.getAnonymousElementByAttribute(this._wizardButtons, "dlgtype", aName);
|
||||
if (btn) {
|
||||
btn.addEventListener("command", this["_"+aName+"Func"], false);
|
||||
btn.setAttribute("label", this._bundle.GetStringFromName("button-"+aName));
|
||||
this["_"+aName+"Button"] = btn;
|
||||
}
|
||||
return btn;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="_adjustWizardHeader">
|
||||
<body><![CDATA[
|
||||
var label = this.currentPage.getAttribute("label");
|
||||
if (!label && this.onFirstPage)
|
||||
label = this._bundle.formatStringFromName("default-first-title", [this.title], 1);
|
||||
else if (!label && this.onLastPage)
|
||||
label = this._bundle.formatStringFromName("default-last-title", [this.title], 1);
|
||||
this._wizardHeader.setAttribute("label", label);
|
||||
this._wizardHeader.setAttribute("description", this.currentPage.getAttribute("description"));
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="_hitEnter">
|
||||
<body>
|
||||
<![CDATA[
|
||||
// if a button is focused, dispatch its command instead
|
||||
// of advancing the wizard
|
||||
var focused = document.commandDispatcher.focusedElement;
|
||||
if (!(focused && focused.localName == "button" && focused.hasAttribute("dlgtype")))
|
||||
this.advance();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_fireEvent">
|
||||
<parameter name="aTarget"/>
|
||||
<parameter name="aType"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent(aType, false, true);
|
||||
|
||||
// handle dom event handlers
|
||||
var noCancel = aTarget.dispatchEvent(event);
|
||||
|
||||
// handle any xml attribute event handlers
|
||||
var handler = aTarget.getAttribute("on"+aType);
|
||||
if (handler != "") {
|
||||
var fn = new Function("event", handler);
|
||||
var returned = fn.apply(aTarget, [event]);
|
||||
if (returned == false)
|
||||
noCancel = false;
|
||||
}
|
||||
|
||||
return noCancel;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="keypress" keycode="VK_ENTER" action="this._hitEnter()"/>
|
||||
<handler event="keypress" keycode="VK_RETURN" action="this._hitEnter()"/>
|
||||
<handler event="keypress" keycode="VK_ESCAPE" action="this.cancel();"/>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="wizardpage" extends="chrome://global/content/bindings/wizard.xml#wizard-base">
|
||||
<implementation>
|
||||
<field name="pageIndex">null</field>
|
||||
|
||||
<property name="pageid" onget="return this.getAttribute('pageid');"
|
||||
onset="this.setAttribute('pageid', val);"/>
|
||||
|
||||
<property name="next" onget="return this.getAttribute('next');"
|
||||
onset="this.setAttribute('next', val);
|
||||
this.parentNode._accessMethod = 'random';
|
||||
return val;"/>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="wizard-header" extends="chrome://global/content/bindings/wizard.xml#wizard-base">
|
||||
<content>
|
||||
<xul:hbox class="wizard-header-box-1" flex="1">
|
||||
<xul:vbox class="wizard-header-box-text" flex="1">
|
||||
<xul:label class="wizard-header-label" xbl:inherits="value=label"/>
|
||||
<xul:label class="wizard-header-description" xbl:inherits="value=description"/>
|
||||
</xul:vbox>
|
||||
<xul:image class="wizard-header-icon" xbl:inherits="src=iconsrc"/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="wizard-buttons" extends="chrome://global/content/bindings/wizard.xml#wizard-base">
|
||||
<content>
|
||||
<xul:vbox class="wizard-buttons-box-1" flex="1">
|
||||
<xul:separator class="wizard-buttons-separator groove"/>
|
||||
<xul:hbox class="wizard-buttons-box-2">
|
||||
<xul:spacer flex="1"/>
|
||||
<xul:button class="wizard-button" dlgtype="back"/>
|
||||
<xul:deck class="wizard-next-deck" anonid="WizardButtonDeck">
|
||||
<xul:hbox>
|
||||
<xul:button class="wizard-button" dlgtype="finish" default="true" flex="1"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox>
|
||||
<xul:button class="wizard-button" dlgtype="next" default="true" flex="1"/>
|
||||
</xul:hbox>
|
||||
</xul:deck>
|
||||
<xul:button class="wizard-button" dlgtype="cancel"/>
|
||||
</xul:hbox>
|
||||
</xul:vbox>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<constructor>
|
||||
this._wizardButtonDeck = document.getAnonymousElementByAttribute(this, "anonid", "WizardButtonDeck");
|
||||
</constructor>
|
||||
|
||||
<method name="onPageChange">
|
||||
<body><![CDATA[
|
||||
if (this.getAttribute("lastpage") == "true") {
|
||||
this._wizardButtonDeck.setAttribute("selectedIndex", 0);
|
||||
} else {
|
||||
this._wizardButtonDeck.setAttribute("selectedIndex", 1);
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="wizard-header-mac" extends="chrome://global/content/bindings/wizard.xml#wizard-base">
|
||||
<content>
|
||||
<xul:stack class="wizard-header-stack" flex="1">
|
||||
<xul:vbox class="wizard-header-box-1">
|
||||
<xul:vbox class="wizard-header-box-2">
|
||||
<xul:vbox class="wizard-header-box-text">
|
||||
<xul:label class="wizard-header-label" xbl:inherits="value=label"/>
|
||||
</xul:vbox>
|
||||
</xul:vbox>
|
||||
</xul:vbox>
|
||||
<xul:hbox class="wizard-header-box-icon">
|
||||
<xul:spacer flex="1"/>
|
||||
<xul:image class="wizard-header-icon" xbl:inherits="src=iconsrc"/>
|
||||
</xul:hbox>
|
||||
</xul:stack>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="wizard-buttons-mac" extends="chrome://global/content/bindings/wizard.xml#wizard-base">
|
||||
<content>
|
||||
<xul:vbox flex="1">
|
||||
<xul:hbox class="wizard-buttons-top" xbl:inherits="hidden=hidetoprow">
|
||||
<xul:spacer flex="1"/>
|
||||
<xul:button class="wizard-button" dlgtype="cancel"/>
|
||||
<xul:button class="wizard-button" dlgtype="finish" default="true"/>
|
||||
</xul:hbox>
|
||||
<xul:separator class="wizard-buttons-separator groove"/>
|
||||
<xul:hbox class="wizard-buttons-btm">
|
||||
<xul:spacer flex="1"/>
|
||||
<xul:button class="wizard-button wizard-nav-button" dlgtype="back"/>
|
||||
<xul:hbox class="wizard-label-box" align="center">
|
||||
<xul:label class="wizard-page-label" xbl:inherits="value=pagestep"/>
|
||||
</xul:hbox>
|
||||
<xul:button class="wizard-button wizard-nav-button" dlgtype="next" default="true" xbl:inherits="disabled=lastpage"/>
|
||||
</xul:hbox>
|
||||
</xul:vbox>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<method name="onPageChange">
|
||||
<body><![CDATA[
|
||||
this.setAttribute("hidetoprow", !(this.getAttribute("lastpage") == "true"));
|
||||
]]></body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -8,7 +8,7 @@ toolkit.jar:
|
|||
* content/global/customizeToolbar.xul (content/customizeToolbar.xul)
|
||||
* content/global/customizeToolbar.js (content/customizeToolbar.js)
|
||||
content/global/customizeToolbar.css (content/customizeToolbar.css)
|
||||
*+ content/global/viewZoomOverlay.js (content/viewZoomOverlay.js)
|
||||
*+ content/global/viewZoomOverlay.js (content/viewZoomOverlay.js)
|
||||
content/global/widgets/autocomplete.xml (content/widgets/autocomplete.xml)
|
||||
content/global/widgets/browser.xml (content/widgets/browser.xml)
|
||||
content/global/widgets/tabbrowser.xml (content/widgets/tabbrowser.xml)
|
||||
|
@ -18,7 +18,27 @@ toolkit.jar:
|
|||
content/global/widgets/checkbox.xml (content/widgets/checkbox.xml)
|
||||
content/global/widgets/button.xml (content/widgets/button.xml)
|
||||
content/global/widgets/toolbarbutton.xml (content/widgets/toolbarbutton.xml)
|
||||
|
||||
content/global/widgets/button.xml (content/widgets/button.xml)
|
||||
content/global/widgets/checkbox.xml (content/widgets/checkbox.xml)
|
||||
content/global/widgets/colorpicker.xml (content/widgets/colorpicker.xml)
|
||||
content/global/widgets/dialog.xml (content/widgets/dialog.xml)
|
||||
content/global/widgets/general.xml (content/widgets/general.xml)
|
||||
content/global/widgets/groupbox.xml (content/widgets/groupbox.xml)
|
||||
content/global/widgets/listbox.xml (content/widgets/listbox.xml)
|
||||
content/global/widgets/menu.xml (content/widgets/menu.xml)
|
||||
content/global/widgets/menulist.xml (content/widgets/menulist.xml)
|
||||
content/global/widgets/popup.xml (content/widgets/popup.xml)
|
||||
content/global/widgets/progressmeter.xml (content/widgets/progressmeter.xml)
|
||||
content/global/widgets/scrollbar.xml (content/widgets/scrollbar.xml)
|
||||
content/global/widgets/nativescrollbar.xml (content/widgets/nativescrollbar.xml)
|
||||
content/global/widgets/scrollbox.xml (content/widgets/scrollbox.xml)
|
||||
content/global/widgets/splitter.xml (content/widgets/splitter.xml)
|
||||
content/global/widgets/spinbuttons.xml (content/widgets/spinbuttons.xml)
|
||||
content/global/widgets/stringbundle.xml (content/widgets/stringbundle.xml)
|
||||
content/global/widgets/text.xml (content/widgets/text.xml)
|
||||
content/global/widgets/tree.xml (content/widgets/tree.xml)
|
||||
content/global/widgets/wizard.xml (content/widgets/wizard.xml)
|
||||
*+ content/global/nsDragAndDrop.js (content/nsDragAndDrop.js)
|
||||
en-US.jar:
|
||||
+ locale/en-US/global/charset.dtd (locale/charset.dtd)
|
||||
+ locale/en-US/global/finddialog.dtd (locale/finddialog.dtd)
|
||||
|
|
Загрузка…
Ссылка в новой задаче