2002-08-05 08:19:42 +04:00
|
|
|
<?xml version="1.0"?>
|
2012-05-21 15:12:37 +04:00
|
|
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
|
|
|
|
2002-08-05 08:19:42 +04:00
|
|
|
|
|
|
|
<bindings id="toolbarBindings"
|
|
|
|
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="toolbar-base">
|
|
|
|
<resources>
|
|
|
|
<stylesheet src="chrome://global/skin/toolbar.css"/>
|
|
|
|
</resources>
|
|
|
|
</binding>
|
|
|
|
|
2007-04-19 20:46:22 +04:00
|
|
|
<binding id="toolbox" extends="chrome://global/content/bindings/toolbar.xml#toolbar-base">
|
2002-08-05 11:21:57 +04:00
|
|
|
<implementation>
|
|
|
|
<field name="palette">
|
|
|
|
null
|
|
|
|
</field>
|
2002-08-06 11:34:59 +04:00
|
|
|
|
2002-09-27 08:06:56 +04:00
|
|
|
<field name="toolbarset">
|
2002-08-06 11:34:59 +04:00
|
|
|
null
|
|
|
|
</field>
|
2002-09-27 08:06:56 +04:00
|
|
|
|
|
|
|
<field name="customToolbarCount">
|
|
|
|
0
|
|
|
|
</field>
|
2010-09-14 01:12:48 +04:00
|
|
|
|
|
|
|
<field name="externalToolbars">
|
|
|
|
[]
|
|
|
|
</field>
|
|
|
|
|
2008-10-18 13:57:46 +04:00
|
|
|
<!-- Set by customizeToolbar.js -->
|
2009-06-13 10:03:02 +04:00
|
|
|
<property name="customizing">
|
|
|
|
<getter><![CDATA[
|
|
|
|
return this.getAttribute("customizing") == "true";
|
|
|
|
]]></getter>
|
|
|
|
<setter><![CDATA[
|
|
|
|
if (val)
|
|
|
|
this.setAttribute("customizing", "true");
|
|
|
|
else
|
|
|
|
this.removeAttribute("customizing");
|
|
|
|
return val;
|
|
|
|
]]></setter>
|
|
|
|
</property>
|
2008-10-18 13:57:46 +04:00
|
|
|
|
2002-09-27 08:06:56 +04:00
|
|
|
<constructor>
|
|
|
|
<![CDATA[
|
|
|
|
// Look to see if there is a toolbarset.
|
|
|
|
this.toolbarset = this.firstChild;
|
|
|
|
while (this.toolbarset && this.toolbarset.localName != "toolbarset")
|
|
|
|
this.toolbarset = toolbarset.nextSibling;
|
|
|
|
|
|
|
|
if (this.toolbarset) {
|
|
|
|
// Create each toolbar described by the toolbarset.
|
|
|
|
var index = 0;
|
|
|
|
while (toolbarset.hasAttribute("toolbar"+(++index))) {
|
|
|
|
var toolbarInfo = toolbarset.getAttribute("toolbar"+index);
|
|
|
|
var infoSplit = toolbarInfo.split(":");
|
|
|
|
this.appendCustomToolbar(infoSplit[0], infoSplit[1]);
|
2002-08-06 11:22:38 +04:00
|
|
|
}
|
2002-09-27 08:06:56 +04:00
|
|
|
}
|
|
|
|
]]>
|
|
|
|
</constructor>
|
|
|
|
|
|
|
|
<method name="appendCustomToolbar">
|
|
|
|
<parameter name="aName"/>
|
|
|
|
<parameter name="aCurrentSet"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
2012-03-29 19:33:52 +04:00
|
|
|
if (!this.toolbarset)
|
|
|
|
return null;
|
2002-09-27 08:06:56 +04:00
|
|
|
var toolbar = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
|
|
|
|
"toolbar");
|
2004-12-01 07:48:44 +03:00
|
|
|
toolbar.id = "__customToolbar_" + aName.replace(" ", "_");
|
2002-09-27 08:06:56 +04:00
|
|
|
toolbar.setAttribute("customizable", "true");
|
|
|
|
toolbar.setAttribute("customindex", ++this.customToolbarCount);
|
|
|
|
toolbar.setAttribute("toolbarname", aName);
|
|
|
|
toolbar.setAttribute("currentset", aCurrentSet);
|
|
|
|
toolbar.setAttribute("mode", this.getAttribute("mode"));
|
|
|
|
toolbar.setAttribute("iconsize", this.getAttribute("iconsize"));
|
|
|
|
toolbar.setAttribute("context", this.toolbarset.getAttribute("context"));
|
2003-08-11 02:48:52 +04:00
|
|
|
toolbar.setAttribute("class", "chromeclass-toolbar");
|
|
|
|
|
2002-09-27 08:06:56 +04:00
|
|
|
this.insertBefore(toolbar, this.toolbarset);
|
|
|
|
return toolbar;
|
2002-08-06 11:22:38 +04:00
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
2002-09-27 08:06:56 +04:00
|
|
|
</implementation>
|
|
|
|
</binding>
|
|
|
|
|
2003-11-20 08:14:08 +03:00
|
|
|
<binding id="toolbar" extends="chrome://global/content/bindings/toolbar.xml#toolbar-base">
|
2007-04-19 20:46:22 +04:00
|
|
|
<implementation implements="nsIAccessibleProvider">
|
|
|
|
<property name="accessibleType" readonly="true">
|
|
|
|
<getter>
|
|
|
|
return Components.interfaces.nsIAccessibleProvider.XULToolbar;
|
|
|
|
</getter>
|
|
|
|
</property>
|
2002-09-27 08:06:56 +04:00
|
|
|
|
|
|
|
<property name="toolbarName"
|
|
|
|
onget="return this.getAttribute('toolbarname');"
|
|
|
|
onset="this.setAttribute('toolbarname', val); return val;"/>
|
2009-06-15 12:18:25 +04:00
|
|
|
|
2010-09-14 01:12:48 +04:00
|
|
|
<field name="_toolbox">null</field>
|
|
|
|
<property name="toolbox" readonly="true">
|
|
|
|
<getter><![CDATA[
|
|
|
|
if (this._toolbox)
|
|
|
|
return this._toolbox;
|
|
|
|
|
|
|
|
let toolboxId = this.getAttribute("toolboxid");
|
|
|
|
if (toolboxId) {
|
|
|
|
let toolbox = document.getElementById(toolboxId);
|
2012-03-26 23:40:52 +04:00
|
|
|
if (!toolbox) {
|
|
|
|
let tbName = this.toolbarName;
|
|
|
|
if (tbName)
|
|
|
|
tbName = " (" + tbName + ")";
|
|
|
|
else
|
|
|
|
tbName = "";
|
|
|
|
throw("toolbar ID " + this.id + tbName + ": toolboxid attribute '" + toolboxId + "' points to a toolbox that doesn't exist");
|
|
|
|
}
|
2010-09-14 01:12:48 +04:00
|
|
|
|
2011-12-16 22:42:17 +04:00
|
|
|
if (toolbox.externalToolbars.indexOf(this) == -1)
|
|
|
|
toolbox.externalToolbars.push(this);
|
|
|
|
|
2010-09-14 01:12:48 +04:00
|
|
|
return this._toolbox = toolbox;
|
|
|
|
}
|
|
|
|
|
|
|
|
return this._toolbox = (this.parentNode &&
|
|
|
|
this.parentNode.localName == "toolbox") ?
|
|
|
|
this.parentNode : null;
|
|
|
|
]]></getter>
|
|
|
|
</property>
|
2009-06-15 12:18:25 +04:00
|
|
|
|
2010-02-23 21:16:16 +03:00
|
|
|
<constructor>
|
2010-12-15 22:03:00 +03:00
|
|
|
<![CDATA[
|
|
|
|
if (document.readyState == "complete") {
|
|
|
|
this._init();
|
|
|
|
} else {
|
|
|
|
// Need to wait until XUL overlays are loaded. See bug 554279.
|
|
|
|
let self = this;
|
|
|
|
document.addEventListener("readystatechange", function (event) {
|
|
|
|
if (document.readyState != "complete")
|
|
|
|
return;
|
|
|
|
document.removeEventListener("readystatechange", arguments.callee, false);
|
|
|
|
self._init();
|
|
|
|
}, false);
|
|
|
|
}
|
|
|
|
]]>
|
|
|
|
</constructor>
|
|
|
|
|
|
|
|
<method name="_init">
|
|
|
|
<body>
|
2010-02-23 21:16:16 +03:00
|
|
|
<![CDATA[
|
2002-09-27 08:06:56 +04:00
|
|
|
// Searching for the toolbox palette in the toolbar binding because
|
|
|
|
// toolbars are constructed first.
|
2010-02-23 21:16:16 +03:00
|
|
|
var toolbox = this.toolbox;
|
|
|
|
if (!toolbox)
|
|
|
|
return;
|
|
|
|
|
2002-09-27 08:06:56 +04:00
|
|
|
if (!toolbox.palette) {
|
|
|
|
// Look to see if there is a toolbarpalette.
|
|
|
|
var node = toolbox.firstChild;
|
|
|
|
while (node) {
|
|
|
|
if (node.localName == "toolbarpalette")
|
|
|
|
break;
|
|
|
|
node = node.nextSibling;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!node)
|
2002-08-06 11:03:36 +04:00
|
|
|
return;
|
|
|
|
|
2002-09-27 08:06:56 +04:00
|
|
|
// Hold on to the palette but remove it from the document.
|
2010-02-23 21:16:16 +03:00
|
|
|
toolbox.palette = node;
|
2002-09-27 08:06:56 +04:00
|
|
|
toolbox.removeChild(node);
|
|
|
|
}
|
2010-02-23 21:16:16 +03:00
|
|
|
|
2002-09-27 08:06:56 +04:00
|
|
|
// Build up our contents from the palette.
|
|
|
|
var currentSet = this.getAttribute("currentset");
|
|
|
|
if (!currentSet)
|
|
|
|
currentSet = this.getAttribute("defaultset");
|
|
|
|
if (currentSet)
|
|
|
|
this.currentSet = currentSet;
|
|
|
|
]]>
|
2010-12-15 22:03:00 +03:00
|
|
|
</body>
|
|
|
|
</method>
|
2002-09-27 08:06:56 +04:00
|
|
|
|
2010-02-23 21:16:16 +03:00
|
|
|
<method name="_idFromNode">
|
|
|
|
<parameter name="aNode"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
2012-03-25 20:10:36 +04:00
|
|
|
if (aNode.getAttribute("skipintoolbarset") == "true")
|
|
|
|
return "";
|
|
|
|
|
2010-02-23 21:16:16 +03:00
|
|
|
switch (aNode.localName) {
|
|
|
|
case "toolbarseparator":
|
|
|
|
return "separator";
|
|
|
|
case "toolbarspring":
|
|
|
|
return "spring";
|
|
|
|
case "toolbarspacer":
|
|
|
|
return "spacer";
|
|
|
|
default:
|
|
|
|
return aNode.id;
|
|
|
|
}
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
2002-09-27 08:06:56 +04:00
|
|
|
<property name="currentSet">
|
|
|
|
<getter>
|
|
|
|
<![CDATA[
|
2010-02-23 21:16:16 +03:00
|
|
|
var node = this.firstChild;
|
|
|
|
var currentSet = [];
|
|
|
|
while (node) {
|
|
|
|
var id = this._idFromNode(node);
|
|
|
|
if (id) {
|
|
|
|
currentSet.push(id);
|
2002-08-06 11:22:38 +04:00
|
|
|
}
|
2010-02-23 21:16:16 +03:00
|
|
|
node = node.nextSibling;
|
2002-09-27 08:06:56 +04:00
|
|
|
}
|
2009-06-13 10:03:02 +04:00
|
|
|
|
2010-02-23 21:16:16 +03:00
|
|
|
return currentSet.join(",") || "__empty";
|
2002-09-27 08:06:56 +04:00
|
|
|
]]>
|
|
|
|
</getter>
|
2010-02-23 21:16:16 +03:00
|
|
|
|
2002-09-27 08:06:56 +04:00
|
|
|
<setter>
|
|
|
|
<![CDATA[
|
2012-03-25 20:10:36 +04:00
|
|
|
if (val == this.currentSet)
|
2012-04-11 21:05:35 +04:00
|
|
|
return val;
|
2012-03-25 20:10:36 +04:00
|
|
|
|
2010-02-23 21:16:16 +03:00
|
|
|
var ids = (val == "__empty") ? [] : val.split(",");
|
|
|
|
|
|
|
|
var nodeidx = 0;
|
|
|
|
var paletteItems = { }, added = { };
|
|
|
|
|
|
|
|
var palette = this.toolbox ? this.toolbox.palette : null;
|
|
|
|
|
|
|
|
// build a cache of items in the toolbarpalette
|
|
|
|
var paletteChildren = palette ? palette.childNodes : [];
|
|
|
|
for (let c = 0; c < paletteChildren.length; c++) {
|
|
|
|
let curNode = paletteChildren[c];
|
|
|
|
paletteItems[curNode.id] = curNode;
|
2009-02-01 02:12:21 +03:00
|
|
|
}
|
2002-10-20 12:13:18 +04:00
|
|
|
|
2010-02-23 21:16:16 +03:00
|
|
|
var children = this.childNodes;
|
|
|
|
|
|
|
|
iter:
|
|
|
|
// iterate over the ids to use on the toolbar
|
|
|
|
for (let i = 0; i < ids.length; i++) {
|
|
|
|
let id = ids[i];
|
|
|
|
// iterate over the existing nodes on the toolbar. nodeidx is the
|
|
|
|
// spot where we want to insert items.
|
|
|
|
for (let c = nodeidx; c < children.length; c++) {
|
|
|
|
let curNode = children[c];
|
|
|
|
if (this._idFromNode(curNode) == id) {
|
|
|
|
// the node already exists. If c equals nodeidx, we haven't
|
|
|
|
// iterated yet, so the item is already in the right position.
|
|
|
|
// Otherwise, insert it here.
|
|
|
|
if (c != nodeidx) {
|
|
|
|
this.insertBefore(curNode, children[nodeidx]);
|
|
|
|
}
|
|
|
|
|
|
|
|
added[curNode.id] = true;
|
|
|
|
nodeidx++;
|
|
|
|
continue iter; // move on to the next id
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// the node isn't already on the toolbar, so add a new one.
|
|
|
|
var nodeToAdd = paletteItems[id] || this._getToolbarItem(id);
|
|
|
|
if (nodeToAdd && !(nodeToAdd.id in added)) {
|
|
|
|
added[nodeToAdd.id] = true;
|
|
|
|
this.insertBefore(nodeToAdd, children[nodeidx] || null);
|
|
|
|
nodeToAdd.setAttribute("removable", "true");
|
|
|
|
nodeidx++;
|
2009-02-01 02:12:21 +03:00
|
|
|
}
|
|
|
|
}
|
2002-10-29 03:13:49 +03:00
|
|
|
|
2010-02-23 21:16:16 +03:00
|
|
|
// remove any leftover removable nodes
|
|
|
|
for (let i = children.length - 1; i >= nodeidx; i--) {
|
|
|
|
let curNode = children[i];
|
2002-10-29 03:13:49 +03:00
|
|
|
|
2010-02-23 21:16:16 +03:00
|
|
|
let curNodeId = this._idFromNode(curNode);
|
|
|
|
// skip over fixed items
|
|
|
|
if (curNodeId && curNode.getAttribute("removable") == "true") {
|
|
|
|
if (palette)
|
|
|
|
palette.appendChild(curNode);
|
2002-10-29 03:13:49 +03:00
|
|
|
else
|
2010-02-23 21:16:16 +03:00
|
|
|
this.removeChild(curNode);
|
2002-10-29 03:13:49 +03:00
|
|
|
}
|
2002-09-27 08:06:56 +04:00
|
|
|
}
|
2007-04-19 20:46:22 +04:00
|
|
|
|
|
|
|
return val;
|
2002-09-27 08:06:56 +04:00
|
|
|
]]>
|
|
|
|
</setter>
|
|
|
|
</property>
|
2010-02-23 21:16:16 +03:00
|
|
|
|
2010-10-28 14:14:00 +04:00
|
|
|
<field name="_newElementCount">0</field>
|
2010-02-23 21:16:16 +03:00
|
|
|
<method name="_getToolbarItem">
|
|
|
|
<parameter name="aId"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
const XUL_NS = "http://www.mozilla.org/keymaster/" +
|
|
|
|
"gatekeeper/there.is.only.xul";
|
|
|
|
|
|
|
|
var newItem = null;
|
|
|
|
switch (aId) {
|
|
|
|
// Handle special cases
|
|
|
|
case "separator":
|
|
|
|
case "spring":
|
|
|
|
case "spacer":
|
|
|
|
newItem = document.createElementNS(XUL_NS, "toolbar" + aId);
|
2010-10-28 14:14:00 +04:00
|
|
|
// Due to timers resolution Date.now() can be the same for
|
|
|
|
// elements created in small timeframes. So ids are
|
|
|
|
// differentiated through a unique count suffix.
|
2011-04-13 17:35:06 +04:00
|
|
|
newItem.id = aId + Date.now() + (++this._newElementCount);
|
2010-02-23 21:16:16 +03:00
|
|
|
if (aId == "spring")
|
|
|
|
newItem.flex = 1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
var toolbox = this.toolbox;
|
|
|
|
if (!toolbox)
|
|
|
|
break;
|
|
|
|
|
|
|
|
// look for an item with the same id, as the item may be
|
|
|
|
// in a different toolbar.
|
|
|
|
var item = document.getElementById(aId);
|
2011-09-15 18:01:24 +04:00
|
|
|
if (item && item.parentNode &&
|
|
|
|
item.parentNode.localName == "toolbar" &&
|
|
|
|
item.parentNode.toolbox == toolbox) {
|
2010-02-23 21:16:16 +03:00
|
|
|
newItem = item;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (toolbox.palette) {
|
|
|
|
// Attempt to locate an item with a matching ID within
|
|
|
|
// the palette.
|
|
|
|
let paletteItem = this.toolbox.palette.firstChild;
|
|
|
|
while (paletteItem) {
|
|
|
|
if (paletteItem.id == aId) {
|
|
|
|
newItem = paletteItem;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
paletteItem = paletteItem.nextSibling;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return newItem;
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
2002-09-27 08:06:56 +04:00
|
|
|
<method name="insertItem">
|
|
|
|
<parameter name="aId"/>
|
|
|
|
<parameter name="aBeforeElt"/>
|
|
|
|
<parameter name="aWrapper"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
2010-02-23 21:16:16 +03:00
|
|
|
var newItem = this._getToolbarItem(aId);
|
|
|
|
if (!newItem)
|
|
|
|
return null;
|
2002-09-28 10:25:03 +04:00
|
|
|
|
2002-09-27 08:06:56 +04:00
|
|
|
var insertItem = newItem;
|
2010-02-23 21:16:16 +03:00
|
|
|
// make sure added items are removable
|
|
|
|
newItem.setAttribute("removable", "true");
|
2002-09-27 08:06:56 +04:00
|
|
|
|
|
|
|
// Wrap the item in another node if so inclined.
|
|
|
|
if (aWrapper) {
|
|
|
|
aWrapper.appendChild(newItem);
|
|
|
|
insertItem = aWrapper;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Insert the palette item into the toolbar.
|
2002-10-20 12:03:51 +04:00
|
|
|
if (aBeforeElt)
|
|
|
|
this.insertBefore(insertItem, aBeforeElt);
|
2002-09-27 08:06:56 +04:00
|
|
|
else
|
2005-02-25 12:07:58 +03:00
|
|
|
this.appendChild(insertItem);
|
2002-09-27 08:06:56 +04:00
|
|
|
|
|
|
|
return newItem;
|
2002-08-05 11:21:57 +04:00
|
|
|
]]>
|
|
|
|
</body>
|
2009-06-26 16:48:41 +04:00
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="hasCustomInteractiveItems">
|
|
|
|
<parameter name="aCurrentSet"/>
|
|
|
|
<body><![CDATA[
|
|
|
|
if (aCurrentSet == "__empty")
|
|
|
|
return false;
|
|
|
|
|
|
|
|
var defaultOrNoninteractive = (this.getAttribute("defaultset") || "")
|
|
|
|
.split(",")
|
|
|
|
.concat(["separator", "spacer", "spring"]);
|
|
|
|
return aCurrentSet.split(",").some(function (item) {
|
|
|
|
return defaultOrNoninteractive.indexOf(item) == -1;
|
|
|
|
});
|
|
|
|
]]></body>
|
|
|
|
</method>
|
2002-08-05 11:21:57 +04:00
|
|
|
</implementation>
|
|
|
|
</binding>
|
|
|
|
|
2009-06-13 10:03:02 +04:00
|
|
|
<binding id="toolbar-menubar-autohide"
|
|
|
|
extends="chrome://global/content/bindings/toolbar.xml#toolbar">
|
|
|
|
<implementation>
|
|
|
|
<constructor>
|
|
|
|
this._setInactive();
|
|
|
|
</constructor>
|
|
|
|
|
|
|
|
<field name="_inactiveTimeout">null</field>
|
|
|
|
|
|
|
|
<field name="_contextMenuListener"><![CDATA[({
|
|
|
|
toolbar: this,
|
|
|
|
contextMenu: null,
|
|
|
|
|
|
|
|
get active () !!this.contextMenu,
|
|
|
|
|
|
|
|
init: function (event) {
|
|
|
|
var node = event.target;
|
|
|
|
while (node != this.toolbar) {
|
|
|
|
if (node.localName == "menupopup")
|
|
|
|
return;
|
|
|
|
node = node.parentNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
var contextMenuId = this.toolbar.getAttribute("context");
|
|
|
|
if (!contextMenuId)
|
|
|
|
return;
|
|
|
|
|
|
|
|
this.contextMenu = document.getElementById(contextMenuId);
|
|
|
|
if (!this.contextMenu)
|
|
|
|
return;
|
|
|
|
|
|
|
|
this.contextMenu.addEventListener("popupshown", this, false);
|
|
|
|
this.contextMenu.addEventListener("popuphiding", this, false);
|
|
|
|
this.toolbar.addEventListener("mousemove", this, false);
|
|
|
|
},
|
|
|
|
handleEvent: function (event) {
|
|
|
|
switch (event.type) {
|
|
|
|
case "popupshown":
|
|
|
|
this.toolbar.removeEventListener("mousemove", this, false);
|
|
|
|
break;
|
|
|
|
case "popuphiding":
|
|
|
|
case "mousemove":
|
|
|
|
this.toolbar._setInactiveAsync();
|
|
|
|
this.toolbar.removeEventListener("mousemove", this, false);
|
|
|
|
this.contextMenu.removeEventListener("popuphiding", this, false);
|
|
|
|
this.contextMenu.removeEventListener("popupshown", this, false);
|
|
|
|
this.contextMenu = null;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})]]></field>
|
|
|
|
|
|
|
|
<method name="_setInactive">
|
|
|
|
<body><![CDATA[
|
|
|
|
this.setAttribute("inactive", "true");
|
|
|
|
]]></body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="_setInactiveAsync">
|
|
|
|
<body><![CDATA[
|
|
|
|
this._inactiveTimeout = setTimeout(function (self) {
|
2009-06-15 02:32:30 +04:00
|
|
|
if (self.getAttribute("autohide") == "true") {
|
|
|
|
self._inactiveTimeout = null;
|
|
|
|
self._setInactive();
|
|
|
|
}
|
2009-06-13 10:03:02 +04:00
|
|
|
}, 0, this);
|
|
|
|
]]></body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="_setActive">
|
|
|
|
<body><![CDATA[
|
|
|
|
if (this._inactiveTimeout) {
|
|
|
|
clearTimeout(this._inactiveTimeout);
|
|
|
|
this._inactiveTimeout = null;
|
|
|
|
}
|
|
|
|
this.removeAttribute("inactive");
|
|
|
|
]]></body>
|
|
|
|
</method>
|
|
|
|
</implementation>
|
|
|
|
|
|
|
|
<handlers>
|
|
|
|
<handler event="DOMMenuBarActive" action="this._setActive();"/>
|
|
|
|
<handler event="popupshowing" action="this._setActive();"/>
|
|
|
|
<handler event="mousedown" button="2" action="this._contextMenuListener.init(event);"/>
|
|
|
|
<handler event="DOMMenuBarInactive"><![CDATA[
|
|
|
|
if (!this._contextMenuListener.active)
|
|
|
|
this._setInactiveAsync();
|
|
|
|
]]></handler>
|
|
|
|
</handlers>
|
|
|
|
</binding>
|
|
|
|
|
2008-10-18 13:57:46 +04:00
|
|
|
<binding id="toolbar-drag"
|
|
|
|
extends="chrome://global/content/bindings/toolbar.xml#toolbar">
|
|
|
|
<implementation>
|
2011-01-20 18:38:26 +03:00
|
|
|
<field name="_dragBindingAlive">true</field>
|
2009-07-22 16:18:08 +04:00
|
|
|
<constructor><![CDATA[
|
2010-06-26 00:06:36 +04:00
|
|
|
if (!this._draggableStarted) {
|
|
|
|
this._draggableStarted = true;
|
|
|
|
try {
|
2010-06-29 19:09:32 +04:00
|
|
|
let tmp = {};
|
|
|
|
Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm", tmp);
|
2012-02-02 12:28:04 +04:00
|
|
|
let draggableThis = new tmp.WindowDraggingElement(this);
|
2010-06-26 00:06:36 +04:00
|
|
|
draggableThis.mouseDownCheck = function(e) {
|
2010-06-26 18:49:15 +04:00
|
|
|
// Don't move while customizing.
|
2011-01-20 18:38:26 +03:00
|
|
|
return this._dragBindingAlive &&
|
|
|
|
this.getAttribute("customizing") != "true";
|
|
|
|
};
|
2010-06-26 00:06:36 +04:00
|
|
|
} catch (e) {}
|
|
|
|
}
|
2009-07-22 16:18:08 +04:00
|
|
|
]]></constructor>
|
2008-10-18 13:57:46 +04:00
|
|
|
</implementation>
|
|
|
|
</binding>
|
|
|
|
|
2003-11-20 08:14:08 +03:00
|
|
|
<binding id="menubar" extends="chrome://global/content/bindings/toolbar.xml#toolbar-base" display="xul:menubar">
|
2002-08-05 08:19:42 +04:00
|
|
|
<implementation implements="nsIAccessibleProvider">
|
2006-07-24 20:12:08 +04:00
|
|
|
<property name="accessibleType" readonly="true">
|
2002-08-05 08:19:42 +04:00
|
|
|
<getter>
|
|
|
|
<![CDATA[
|
2006-07-24 20:12:08 +04:00
|
|
|
return Components.interfaces.nsIAccessibleProvider.XULMenubar;
|
2002-08-05 08:19:42 +04:00
|
|
|
]]>
|
|
|
|
</getter>
|
|
|
|
</property>
|
2003-08-13 05:55:39 +04:00
|
|
|
<field name="_active">false</field>
|
|
|
|
<field name="_statusbar">null</field>
|
|
|
|
<field name="_originalStatusText">null</field>
|
|
|
|
<property name="statusbar" onget="return this.getAttribute('statusbar');"
|
2007-04-19 20:46:22 +04:00
|
|
|
onset="this.setAttribute('statusbar', val); return val;"/>
|
|
|
|
<method name="_updateStatusText">
|
2003-08-13 05:55:39 +04:00
|
|
|
<parameter name="itemText"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
if (!this._active)
|
|
|
|
return;
|
|
|
|
var newText = itemText ? itemText : this._originalStatusText;
|
|
|
|
if (newText != this._statusbar.label)
|
|
|
|
this._statusbar.label = newText;
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
2002-08-05 08:19:42 +04:00
|
|
|
</implementation>
|
2003-08-13 05:55:39 +04:00
|
|
|
<handlers>
|
|
|
|
<handler event="DOMMenuBarActive">
|
2005-02-25 12:07:58 +03:00
|
|
|
<![CDATA[
|
2003-08-13 23:54:24 +04:00
|
|
|
if (!this.statusbar) return;
|
|
|
|
this._statusbar = document.getElementById(this.statusbar);
|
2003-08-13 05:55:39 +04:00
|
|
|
if (!this._statusbar)
|
2005-02-25 12:07:58 +03:00
|
|
|
return;
|
2003-08-13 05:55:39 +04:00
|
|
|
this._active = true;
|
|
|
|
this._originalStatusText = this._statusbar.label;
|
2005-02-25 12:07:58 +03:00
|
|
|
]]>
|
2003-08-13 05:55:39 +04:00
|
|
|
</handler>
|
|
|
|
<handler event="DOMMenuBarInactive">
|
|
|
|
<![CDATA[
|
|
|
|
if (!this._active)
|
2005-02-25 12:07:58 +03:00
|
|
|
return;
|
2003-08-13 05:55:39 +04:00
|
|
|
this._active = false;
|
|
|
|
this._statusbar.label = this._originalStatusText;
|
|
|
|
]]>
|
|
|
|
</handler>
|
2007-04-19 20:46:22 +04:00
|
|
|
<handler event="DOMMenuItemActive">this._updateStatusText(event.target.statusText);</handler>
|
|
|
|
<handler event="DOMMenuItemInactive">this._updateStatusText("");</handler>
|
2003-08-13 05:55:39 +04:00
|
|
|
</handlers>
|
2002-08-05 08:19:42 +04:00
|
|
|
</binding>
|
|
|
|
|
2007-04-19 20:46:22 +04:00
|
|
|
<binding id="toolbardecoration" extends="chrome://global/content/bindings/toolbar.xml#toolbar-base">
|
|
|
|
<implementation implements="nsIAccessibleProvider">
|
|
|
|
<property name="accessibleType" readonly="true">
|
|
|
|
<getter>
|
|
|
|
return Components.interfaces.nsIAccessibleProvider.XULToolbarSeparator;
|
|
|
|
</getter>
|
|
|
|
</property>
|
|
|
|
</implementation>
|
|
|
|
</binding>
|
2002-09-28 19:11:50 +04:00
|
|
|
|
2003-11-20 08:14:08 +03:00
|
|
|
<binding id="toolbarpaletteitem" extends="chrome://global/content/bindings/toolbar.xml#toolbar-base" display="xul:button">
|
2002-09-28 19:11:50 +04:00
|
|
|
<content>
|
|
|
|
<xul:hbox class="toolbarpaletteitem-box" flex="1" xbl:inherits="type,place">
|
|
|
|
<children/>
|
|
|
|
</xul:hbox>
|
|
|
|
</content>
|
|
|
|
</binding>
|
|
|
|
|
2003-11-20 08:14:08 +03:00
|
|
|
<binding id="toolbarpaletteitem-palette" extends="chrome://global/content/bindings/toolbar.xml#toolbarpaletteitem">
|
2002-09-28 19:11:50 +04:00
|
|
|
<content>
|
|
|
|
<xul:hbox class="toolbarpaletteitem-box" xbl:inherits="type,place">
|
|
|
|
<children/>
|
|
|
|
</xul:hbox>
|
|
|
|
<xul:label xbl:inherits="value=title"/>
|
|
|
|
</content>
|
|
|
|
</binding>
|
2002-08-05 08:19:42 +04:00
|
|
|
|
|
|
|
</bindings>
|
|
|
|
|