mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-07 20:17:37 +00:00
127 lines
3.9 KiB
XML
127 lines
3.9 KiB
XML
<?xml version="1.0"?>
|
|
|
|
<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>
|
|
|
|
<binding id="toolbar" extends="chrome://global/content/widgets/toolbar.xml#toolbar-base">
|
|
<implementation>
|
|
<field name="palette">
|
|
null
|
|
</field>
|
|
<field name="afterPalette">
|
|
null
|
|
</field>
|
|
|
|
<field name="toolbarChanged">
|
|
null
|
|
</field>
|
|
|
|
<method name="rebuild">
|
|
<body>
|
|
<![CDATA[
|
|
while (this.firstChild != this.afterPalette) {
|
|
this.removeChild(this.firstChild);
|
|
}
|
|
this.buildItemsFromPalette();
|
|
this.toolbarChanged();
|
|
]]>
|
|
</body>
|
|
</method>
|
|
<method name="buildItemsFromPalette">
|
|
<body>
|
|
<![CDATA[
|
|
var currentSet = this.getAttribute("currentset");
|
|
if (!currentSet)
|
|
currentSet = this.getAttribute("defaultset");
|
|
if (!currentSet)
|
|
return;
|
|
|
|
var node = this.palette ? this.palette : this.firstChild;
|
|
|
|
if (!this.palette) {
|
|
while (node) {
|
|
if (node.localName == "toolbarpalette")
|
|
break;
|
|
node = node.nextSibling;
|
|
}
|
|
if (!node)
|
|
return;
|
|
|
|
this.afterPalette = node.nextSibling;
|
|
this.palette = node;
|
|
this.removeChild(node);
|
|
}
|
|
|
|
var items = currentSet.split(",");
|
|
for (var i = 0; i < items.length; i++) {
|
|
var item = items[i];
|
|
if (!item) continue;
|
|
|
|
if (item == "separator") {
|
|
var sep = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
|
|
"toolbarseparator");
|
|
sep.id = "separator";
|
|
this.insertBefore(sep, this.afterPalette);
|
|
continue;
|
|
}
|
|
|
|
// Attempt to locate the item within the palette's list of children.
|
|
var paletteItem = node.firstChild;
|
|
while (paletteItem) {
|
|
var paletteID = paletteItem.getAttribute("id");
|
|
if (paletteID == item) {
|
|
var newItem = paletteItem.cloneNode(true);
|
|
newItem.hidden = true;
|
|
this.insertBefore(newItem, this.afterPalette);
|
|
newItem.hidden = false;
|
|
break;
|
|
}
|
|
|
|
paletteItem = paletteItem.nextSibling;
|
|
}
|
|
}
|
|
]]>
|
|
</body>
|
|
</method>
|
|
<constructor>
|
|
<![CDATA[
|
|
this.buildItemsFromPalette();
|
|
]]>
|
|
</constructor>
|
|
</implementation>
|
|
</binding>
|
|
|
|
<binding id="toolbox" extends="chrome://global/content/widgets/toolbar.xml#toolbar-base"/>
|
|
|
|
<binding id="menubar" extends="xul:menubar">
|
|
<resources>
|
|
<stylesheet src="chrome://global/skin/toolbar.css"/>
|
|
</resources>
|
|
|
|
<implementation implements="nsIAccessibleProvider">
|
|
<property name="accessible">
|
|
<getter>
|
|
<![CDATA[
|
|
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
|
|
return accService.createXULMenubarAccessible(this);
|
|
]]>
|
|
</getter>
|
|
</property>
|
|
|
|
</implementation>
|
|
</binding>
|
|
|
|
<binding id="toolbarseparator" extends="chrome://global/content/widgets/toolbar.xml#toolbar-base"/>
|
|
|
|
<binding id="toolbarpaletteitem" extends="xul:button"/>
|
|
</bindings>
|
|
|