diff -r 000000000000 -r 6474c204b198 toolkit/content/widgets/richlistbox.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toolkit/content/widgets/richlistbox.xml Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,588 @@ + + + + + + + + + + + + + + + + + + + + + document.getAnonymousElementByAttribute(this, "anonid", "main-box"); + + + this._scrollbox.boxObject.QueryInterface(Components.interfaces.nsIScrollBoxObject); + + + + + + + + + + + + + -1) + this._currentIndex = this.currentIndex + 1; + + var event = document.createEvent("Events"); + event.initEvent("select", true, true); + this.dispatchEvent(event); + + // always call this (allows a commandupdater without controller) + document.commandDispatcher.updateCommands("richlistbox-select"); + ]]> + + + + + + + + + + + + + + + + + + + + + + + + return this.insertItemAt(-1, aLabel, aValue); + + + + + + + + + const XULNS = + "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; + + var item = + this.ownerDocument.createElementNS(XULNS, "richlistitem"); + item.setAttribute("value", aValue); + + var label = this.ownerDocument.createElementNS(XULNS, "label"); + label.setAttribute("value", aLabel); + label.setAttribute("flex", "1"); + label.setAttribute("crop", "end"); + item.appendChild(label); + + var before = this.getItemAtIndex(aIndex); + if (!before) + this.appendChild(item); + else + this.insertBefore(item, before); + + return item; + + + + + + + + + + + + + + + + return this.children[aIndex] || null; + + + + + + + + + + + + + + = 0) { + // scrollRect.bottom wouldn't take a horizontal scroll bar into account + let scrollRectBottom = scrollRect.top + this._scrollbox.clientHeight; + offset = targetRect.bottom - scrollRectBottom; + if (offset <= 0) + return; + } + this._scrollbox.scrollTop += offset; + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + height) + break; // we've reached the desired distance + index = ix; + } + + return index != this.currentIndex ? index - this.currentIndex : aDirection; + ]]> + + + + + + + + + + + + + + + + + = 0; i--) { + if (this.selectedItems[i] && this.selectedItems[i].id) + this.selectedItems[i] = document.getElementById(this.selectedItems[i].id); + else + this.selectedItems[i] = null; + if (!this.selectedItems[i]) + this.selectedItems.splice(i, 1); + } + } + if (this.currentItem && this.currentItem.id) + this.currentItem = document.getElementById(this.currentItem.id); + else + this.currentItem = null; + + // if we have no previously current item or if the above check fails to + // find the previous nodes (which causes it to clear selection) + if (!this.currentItem && this.selectedCount == 0) { + this.currentIndex = this._currentIndex ? this._currentIndex - 1 : 0; + + // cf. listbox constructor: + // select items according to their attributes + var children = this.children; + for (var i = 0; i < children.length; ++i) { + if (children[i].getAttribute("selected") == "true") + this.selectedItems.push(children[i]); + } + } + + if (this.selType != "multiple" && this.selectedCount == 0) + this.selectedItem = this.currentItem; + ]]> + + + + + + + y.value) && + (aItem.boxObject.y < y.value + this.scrollBoxObject.height); + ]]> + + + + null + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +