diff -r 000000000000 -r 6474c204b198 toolkit/content/widgets/listbox.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toolkit/content/widgets/listbox.xml Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,1145 @@ + + + + + + + + + + + 0 + "" + + + + + 0 ? this.selectedItems[0] : null; + ]]> + + + + + + 0) + return this.getIndexOfItem(this.selectedItems[0]); + return -1; + ]]> + + + = 0) { + this.selectItem(this.getItemAtIndex(val)); + } else { + this.clearSelection(); + this.currentItem = null; + } + ]]> + + + + + + 0) + return this.selectedItem.value; + return null; + ]]> + + + + + + + + + + + + + + + + + + + if (this._currentItem == val) + return val; + + if (this._currentItem) + this._currentItem.current = false; + this._currentItem = val; + + if (val) + val.current = true; + + return val; + + + + + + return this.currentItem ? this.getIndexOfItem(this.currentItem) : -1; + + + = 0) + this.currentItem = this.getItemAtIndex(val); + else + this.currentItem = null; + ]]> + + + + [] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + this._selectionStart = null; + + var suppress = this._suppressOnSelect; + this._suppressOnSelect = true; + + var item = this.getItemAtIndex(0); + while (item) { + this.addItemToSelection(item); + item = this.getNextItem(item, 1); + } + + this._suppressOnSelect = suppress; + this._fireOnSelect(); + + + + + + this._selectionStart = null; + + var suppress = this._suppressOnSelect; + this._suppressOnSelect = true; + + var item = this.getItemAtIndex(0); + while (item) { + if (item.selected) + this.removeItemFromSelection(item); + else + this.addItemToSelection(item); + item = this.getNextItem(item, 1); + } + + this._suppressOnSelect = suppress; + this._fireOnSelect(); + + + + + + = 0; --i) + this.selectedItems[i].selected = false; + + this.selectedItems.length = 0; + } + + this._selectionStart = null; + this._fireOnSelect(); + ]]> + + + + + + + + + + + + + + + + if (val) + this.setAttribute("disableKeyNavigation", "true"); + else + this.removeAttribute("disableKeyNavigation"); + return val; + + + + + + + + + + + + + + + + + + + + + numItems - 1) + newIndex = numItems - 1; + + var newItem = this.getItemAtIndex(newIndex); + // make sure that the item is actually visible/selectable + if (this._userSelecting && newItem && !this._canUserSelect(newItem)) + newItem = + aOffset > 0 ? this.getNextItem(newItem, 1) || this.getPreviousItem(newItem, 1) : + this.getPreviousItem(newItem, 1) || this.getNextItem(newItem, 1); + if (newItem) { + this.ensureIndexIsVisible(this.getIndexOfItem(newItem)); + if (aIsSelectingRange) + this.selectItemRange(null, newItem); + else if (aIsSelecting) + this.selectItem(newItem); + + this.currentItem = newItem; + } + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + aMe._fireOnSelect(); + aMe._selectTimeout = null; + + + + false + false + false + null + null + null + + + + + + + + + + + + + + + + + + + + + + 0) { + if (this.currentIndex == -1) { + this.currentIndex = this.getIndexOfFirstVisibleRow(); + } + else { + this.currentItem._fireEvent("DOMMenuItemActive"); + } + } + this._lastKeyTime = 0; + ]]> + + + 1000) + this._incrementalString = ""; + + var key = String.fromCharCode(event.charCode).toLowerCase(); + this._incrementalString += key; + this._lastKeyTime = event.timeStamp; + + // If all letters in the incremental string are the same, just + // try to match the first one + var incrementalString = /^(.)\1+$/.test(this._incrementalString) ? + RegExp.$1 : this._incrementalString; + var length = incrementalString.length; + + var rowCount = this.getRowCount(); + var l = this.selectedItems.length; + var start = l > 0 ? this.getIndexOfItem(this.selectedItems[l - 1]) : -1; + // start from the first element if none was selected or from the one + // following the selected one if it's a new or a repeated-letter search + if (start == -1 || length == 1) + start++; + + for (var i = 0; i < rowCount; i++) { + var k = (start + i) % rowCount; + var listitem = this.getItemAtIndex(k); + if (!this._canUserSelect(listitem)) + continue; + // allow richlistitems to specify the string being searched for + var searchText = "searchLabel" in listitem ? listitem.searchLabel : + listitem.getAttribute("label"); // (see also bug 250123) + searchText = searchText.substring(0, length).toLowerCase(); + if (searchText == incrementalString) { + this.ensureIndexIsVisible(k); + this.timedSelect(listitem, this._selectDelay); + break; + } + } + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + const XULNS = + "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; + + var item = this.ownerDocument.createElementNS(XULNS, "listitem"); + item.setAttribute("label", aLabel); + item.setAttribute("value", aValue); + this.appendChild(item); + return item; + + + + + + + + + const XULNS = + "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; + + var item = this.ownerDocument.createElementNS(XULNS, "listitem"); + item.setAttribute("label", aLabel); + item.setAttribute("value", aValue); + var before = this.getItemAtIndex(aIndex); + if (before) + this.insertBefore(item, before); + else + this.appendChild(item); + return item; + + + + + + + + + + return this.listBoxObject.getIndexOfItem(item); + + + + + + return this.listBoxObject.getItemAtIndex(index); + + + + + + return this.listBoxObject.ensureIndexIsVisible(index); + + + + + + return this.ensureIndexIsVisible(this.listBoxObject.getIndexOfItem(element)); + + + + + + return this.listBoxObject.scrollToIndex(index); + + + + + return this.listBoxObject.getNumberOfVisibleRows(); + + + + + return this.listBoxObject.getIndexOfFirstVisibleRow(); + + + + + return this.listBoxObject.getRowCount(); + + + + + + + = 0 && i > maxTop; i--) { + item = this.getItemAtIndex(i); + if (item && !this._canUserSelect(item)) + maxTop--; + } + if (newTop >= maxTop) + newTop = maxTop; + } + if (newTop < 0) + newTop = 0; + this.scrollToIndex(newTop); + return pageOffset; + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +