mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 17:23:59 +00:00
Make items droppable before and after the menubar.
This commit is contained in:
parent
616f022d79
commit
20734838c9
@ -465,7 +465,7 @@
|
||||
<toolbox id="navigator-toolbox" class="toolbox-top" mode="icons" iconsize="small">
|
||||
<!-- Menu -->
|
||||
<toolbar type="menubar" id="toolbar-menubar" class="chromeclass-menubar" customizable="true"
|
||||
defaultset=" " mode="icons" iconsize="small">
|
||||
defaultset="menubar-items" mode="icons" iconsize="small">
|
||||
<toolbaritem id="menubar-items" align="center">
|
||||
<menubar id="main-menubar" style="border:0px;padding:0px;margin:0px;-moz-appearance:none">
|
||||
<menu label="&fileMenu.label;"
|
||||
@ -899,7 +899,7 @@
|
||||
toolbarname="&navbarCmd.label;" accesskey="&navbarCmd.accesskey;"
|
||||
fullscreentoolbar="true" mode="icons" iconsize="small"
|
||||
customizable="true"
|
||||
defaultset="back-button,forward-button,reload-button,stop-button,home-button,urlbar-container,search-container"
|
||||
defaultset="back-button,forward-button,reload-button,stop-button,home-button,urlbar-container,search-container,window-controls"
|
||||
context="toolbar-context-menu">
|
||||
<hbox id="window-controls" hidden="true" fullscreencontrol="true">
|
||||
<toolbarbutton id="minimize-button" class="toolbarbutton-1"
|
||||
|
@ -70,6 +70,9 @@
|
||||
|
||||
<binding id="toolbar" extends="chrome://global/content/widgets/toolbar.xml#toolbar-base">
|
||||
<implementation>
|
||||
<field name="firstPermanentChild">
|
||||
null
|
||||
</field>
|
||||
<field name="lastPermanentChild">
|
||||
null
|
||||
</field>
|
||||
@ -80,6 +83,7 @@
|
||||
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
this.firstPermanentChild = this.firstChild;
|
||||
this.lastPermanentChild = this.lastChild;
|
||||
|
||||
// Searching for the toolbox palette in the toolbar binding because
|
||||
@ -146,7 +150,7 @@
|
||||
|
||||
<setter>
|
||||
<![CDATA[
|
||||
// Remove all items after the last permanent child.
|
||||
// Remove all items before the first permanent child and after the last permanent child.
|
||||
while (this.lastChild) {
|
||||
if (this.lastChild == this.lastPermanentChild ||
|
||||
(this.lastChild.localName == "toolbarpaletteitem" &&
|
||||
@ -155,13 +159,29 @@
|
||||
this.removeChild(this.lastChild);
|
||||
}
|
||||
|
||||
while (this.firstChild) {
|
||||
if (this.firstChild == this.firstPermanentChild ||
|
||||
(this.firstChild.localName == "toolbarpaletteitem" &&
|
||||
this.firstChild.firstChild == this.firstPermanentChild))
|
||||
break;
|
||||
this.removeChild(this.firstChild);
|
||||
}
|
||||
|
||||
var firstChildID = this.firstPermanentChild ? this.firstPermanentChild.id : "";
|
||||
var lastChildID = this.lastPermanentChild ? this.lastPermanentChild.id : "";
|
||||
|
||||
if (val == "__empty")
|
||||
return;
|
||||
|
||||
if (val) {
|
||||
var itemIds = val.split(",");
|
||||
for (var i = 0; i < itemIds.length; i++)
|
||||
this.insertItem(itemIds[i], null);
|
||||
var before = true;
|
||||
for (var i = 0; i < itemIds.length; i++) {
|
||||
if (itemIds[i] == firstChildID || itemIds[i] == lastChildID)
|
||||
before = false;
|
||||
else
|
||||
this.insertItem(itemIds[i], null, null, before);
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</setter>
|
||||
@ -171,6 +191,7 @@
|
||||
<parameter name="aId"/>
|
||||
<parameter name="aBeforeElt"/>
|
||||
<parameter name="aWrapper"/>
|
||||
<parameter name="aBeforePermanent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var newItem = null;
|
||||
@ -219,8 +240,10 @@
|
||||
// Insert the palette item into the toolbar.
|
||||
if (aBeforeElt)
|
||||
this.insertBefore(insertItem, aBeforeElt);
|
||||
else if (aBeforePermanent && this.firstPermanentChild)
|
||||
this.insertBefore(insertItem, this.firstPermanentChild);
|
||||
else
|
||||
this.appendChild(insertItem);
|
||||
this.appendChild(insertItem);
|
||||
|
||||
return newItem;
|
||||
]]>
|
||||
|
Loading…
Reference in New Issue
Block a user