Adds UI for separators in menu and toolbar. r=ben@mozilla.org bug=327321
git-svn-id: svn://10.0.0.236/trunk@191536 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
1dd1e23e2f
commit
30c6953af6
@ -163,6 +163,9 @@
|
||||
element.setAttribute("statustext", child.url);
|
||||
element.className = "menuitem-iconic bookmark-item";
|
||||
}
|
||||
else if (PlacesController.nodeIsSeparator(child)) {
|
||||
element = document.createElementNS(XULNS, "menuseparator");
|
||||
}
|
||||
else if (PlacesController.nodeIsContainer(child)) {
|
||||
element = document.createElementNS(XULNS, "menu");
|
||||
element.setAttribute("type", "menu");
|
||||
@ -624,6 +627,7 @@
|
||||
// Only menu and menuitems are valid nodes.
|
||||
// Filter out events coming from sub-containers that have bubbled up.
|
||||
if ((event.target.localName != "menuitem" &&
|
||||
event.target.localName != "menuseparator" &&
|
||||
event.target.localName != "menu") ||
|
||||
event.target.parentNode != this)
|
||||
return;
|
||||
@ -639,6 +643,7 @@
|
||||
// Only menu and menuitems are valid nodes.
|
||||
// Filter out events coming from sub-containers that have bubbled up.
|
||||
if ((event.target.localName != "menuitem" &&
|
||||
event.target.localName != "menuseparator" &&
|
||||
event.target.localName != "menu") ||
|
||||
event.target.parentNode != this)
|
||||
return;
|
||||
|
||||
@ -108,11 +108,14 @@
|
||||
var cc = this._result.root.childCount;
|
||||
for (var i = 0; i < cc; ++i) {
|
||||
var child = this._result.root.getChild(i);
|
||||
var button = document.createElementNS(XULNS, "toolbarbutton");
|
||||
button.setAttribute("label", child.title);
|
||||
var button = null;
|
||||
if (PlacesController.nodeIsURI(child)) {
|
||||
button = document.createElementNS(XULNS, "toolbarbutton");
|
||||
button.setAttribute("url", child.uri);
|
||||
} else if (PlacesController.nodeIsSeparator(child)) {
|
||||
button = document.createElementNS(XULNS, "toolbarseparator");
|
||||
} else if (PlacesController.nodeIsContainer(child)) {
|
||||
button = document.createElementNS(XULNS, "toolbarbutton");
|
||||
button.setAttribute("type", "menu");
|
||||
button.setAttribute("container", "true");
|
||||
var popup = document.createElementNS(XULNS, "menupopup");
|
||||
@ -127,6 +130,7 @@
|
||||
popup._result = this._result;
|
||||
popup._resultNode = child;
|
||||
}
|
||||
button.setAttribute("label", child.title);
|
||||
if (child.icon)
|
||||
button.setAttribute("image", child.icon.spec);
|
||||
button.className = "menuitem-iconic bookmark-item";
|
||||
@ -366,12 +370,12 @@
|
||||
setTimeout(hitch(this._self, this._self._rebuild), 1);
|
||||
},
|
||||
onSeparatorAdded: function TB_O_onSeparatorAdded(parent, index) {
|
||||
if (!this._numBatches)
|
||||
this._self.init();
|
||||
if (parent == this._self._bms.toolbarRoot)
|
||||
this._numBatches ? this._batchedOperation = true : this.doRebuild();
|
||||
},
|
||||
onSeparatorRemoved: function TB_O_onSeparatorRemoved(parent, index) {
|
||||
if (!this._numBatches)
|
||||
this._self.init();
|
||||
if (parent == this._self._bms.toolbarRoot)
|
||||
this._numBatches ? this._batchedOperation = true : this.doRebuild();
|
||||
}
|
||||
})]]></field>
|
||||
<field name="_DNDObserver"><![CDATA[({
|
||||
@ -640,7 +644,8 @@
|
||||
<handler event="mousedown"><![CDATA[
|
||||
// When the user clicks down on a button, set it as the selection and
|
||||
// tell the controller that we are the active view.
|
||||
if (event.target.localName == "toolbarbutton")
|
||||
if (event.target.localName == "toolbarbutton" ||
|
||||
event.target.localName == "toolbarseparator")
|
||||
this._selection = event.target.node;
|
||||
else
|
||||
this._selection = this.getResult().root;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user