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