XULTreeElement.webidl (4986B)
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 * You can obtain one at http://mozilla.org/MPL/2.0/. 5 */ 6 7 interface MozTreeView; 8 9 dictionary TreeCellInfo { 10 long row = 0; 11 TreeColumn? col = null; 12 DOMString childElt = ""; 13 }; 14 15 [ChromeOnly, 16 Exposed=Window] 17 interface XULTreeElement : XULElement 18 { 19 [HTMLConstructor] constructor(); 20 21 /** 22 * Obtain the columns. 23 */ 24 readonly attribute TreeColumns? columns; 25 26 /** 27 * The view that backs the tree and that supplies it with its data. 28 * It is dynamically settable, either using a view attribute on the 29 * tree tag or by setting this attribute to a new value. 30 */ 31 [SetterThrows, NeedsCallerType] 32 attribute MozTreeView? view; 33 34 /** 35 * Whether or not we are currently focused. 36 */ 37 attribute boolean focused; 38 39 /** 40 * Obtain the treebody content node 41 */ 42 readonly attribute Element? treeBody; 43 44 /** 45 * Obtain the height of a row. 46 */ 47 readonly attribute long rowHeight; 48 49 /** 50 * Obtain the width of a row. 51 */ 52 readonly attribute long rowWidth; 53 54 /** 55 * Get the index of the first visible row. 56 */ 57 long getFirstVisibleRow(); 58 59 /** 60 * Get the index of the last visible row. 61 */ 62 long getLastVisibleRow(); 63 64 /** 65 * Gets the number of possible visible rows. 66 */ 67 long getPageLength(); 68 69 /** 70 * Ensures that a row at a given index is visible. 71 */ 72 undefined ensureRowIsVisible(long index); 73 74 /** 75 * Ensures that a given cell in the tree is visible. 76 */ 77 [Throws] 78 undefined ensureCellIsVisible(long row, TreeColumn? col); 79 80 /** 81 * Scrolls such that the row at index is at the top of the visible view. 82 */ 83 undefined scrollToRow(long index); 84 85 /** 86 * Scroll the tree up or down by numLines lines. Positive 87 * values move down in the tree. Prevents scrolling off the 88 * end of the tree. 89 */ 90 undefined scrollByLines(long numLines); 91 92 /** 93 * Scroll the tree up or down by numPages pages. A page 94 * is considered to be the amount displayed by the tree. 95 * Positive values move down in the tree. Prevents scrolling 96 * off the end of the tree. 97 */ 98 undefined scrollByPages(long numPages); 99 100 /** 101 * Invalidation methods for fine-grained painting control. 102 */ 103 undefined invalidate(); 104 undefined invalidateColumn(TreeColumn? col); 105 undefined invalidateRow(long index); 106 undefined invalidateCell(long row, TreeColumn? col); 107 undefined invalidateRange(long startIndex, long endIndex); 108 109 /** 110 * A hit test that can tell you what row the mouse is over. 111 * returns -1 for invalid mouse coordinates. 112 * 113 * The coordinate system is the client coordinate system for the 114 * document this tree lives in, and the units are CSS pixels. 115 */ 116 long getRowAt(long x, long y); 117 118 /** 119 * A hit test that can tell you what cell the mouse is over. 120 * TreeCellInfo.row is the row index hit, returns -1 for invalid mouse 121 * coordinates. TreeCellInfo.col is the column hit. 122 * TreeCellInfo.childElt is the pseudoelement hit: this can have values of 123 * "cell", "twisty", "image", and "text". 124 * 125 * The coordinate system is the client coordinate system for the 126 * document this tree lives in, and the units are CSS pixels. 127 */ 128 [Throws] 129 TreeCellInfo getCellAt(long x, long y); 130 131 /** 132 * Find the coordinates of an element within a specific cell. 133 */ 134 [Throws] 135 DOMRect? getCoordsForCellItem(long row, TreeColumn col, DOMString element); 136 137 /** 138 * Determine if the text of a cell is being cropped or not. 139 */ 140 [Throws] 141 boolean isCellCropped(long row, TreeColumn? col); 142 143 /** 144 * The view is responsible for calling these notification methods when 145 * rows are added or removed. Index is the position at which the new 146 * rows were added or at which rows were removed. For 147 * non-contiguous additions/removals, this method should be called multiple times. 148 */ 149 undefined rowCountChanged(long index, long count); 150 151 /** 152 * Notify the tree that the view is about to perform a batch 153 * update, that is, add, remove or invalidate several rows at once. 154 * This must be followed by calling endUpdateBatch(), otherwise the tree 155 * will get out of sync. 156 */ 157 undefined beginUpdateBatch(); 158 159 /** 160 * Notify the tree that the view has completed a batch update. 161 */ 162 undefined endUpdateBatch(); 163 164 /** 165 * Called on a theme switch to flush out the tree's style and image caches. 166 */ 167 undefined clearStyleAndImageCaches(); 168 169 /** 170 * Remove an image source from the image cache to allow its invalidation. 171 */ 172 [Throws] 173 undefined removeImageCacheEntry(long row, TreeColumn col); 174 175 /** The current position of the scrollbar in CSS pixels */ 176 readonly attribute long scrollbarPosition; 177 178 /** The current max position of the scrollbar in CSS pixels */ 179 readonly attribute long scrollbarMaxPosition; 180 };