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/.
10 dictionary TreeCellInfo {
12 TreeColumn? col = null;
13 DOMString childElt = "";
18 interface XULTreeElement : XULElement
20 [HTMLConstructor] constructor();
25 readonly attribute TreeColumns? columns;
28 * The view that backs the tree and that supplies it with its data.
29 * It is dynamically settable, either using a view attribute on the
30 * tree tag or by setting this attribute to a new value.
32 [SetterThrows, NeedsCallerType]
33 attribute MozTreeView? view;
36 * Whether or not we are currently focused.
38 attribute boolean focused;
41 * Obtain the treebody content node
43 readonly attribute Element? treeBody;
46 * Obtain the height of a row.
48 readonly attribute long rowHeight;
51 * Obtain the width of a row.
53 readonly attribute long rowWidth;
56 * Get the index of the first visible row.
58 long getFirstVisibleRow();
61 * Get the index of the last visible row.
63 long getLastVisibleRow();
66 * Gets the number of possible visible rows.
71 * Ensures that a row at a given index is visible.
73 undefined ensureRowIsVisible(long index);
76 * Ensures that a given cell in the tree is visible.
79 undefined ensureCellIsVisible(long row, TreeColumn? col);
82 * Scrolls such that the row at index is at the top of the visible view.
84 undefined scrollToRow(long index);
87 * Scroll the tree up or down by numLines lines. Positive
88 * values move down in the tree. Prevents scrolling off the
91 undefined scrollByLines(long numLines);
94 * Scroll the tree up or down by numPages pages. A page
95 * is considered to be the amount displayed by the tree.
96 * Positive values move down in the tree. Prevents scrolling
97 * off the end of the tree.
99 undefined scrollByPages(long numPages);
102 * Invalidation methods for fine-grained painting control.
104 undefined invalidate();
105 undefined invalidateColumn(TreeColumn? col);
106 undefined invalidateRow(long index);
107 undefined invalidateCell(long row, TreeColumn? col);
108 undefined invalidateRange(long startIndex, long endIndex);
111 * A hit test that can tell you what row the mouse is over.
112 * returns -1 for invalid mouse coordinates.
114 * The coordinate system is the client coordinate system for the
115 * document this tree lives in, and the units are CSS pixels.
117 long getRowAt(long x, long y);
120 * A hit test that can tell you what cell the mouse is over.
121 * TreeCellInfo.row is the row index hit, returns -1 for invalid mouse
122 * coordinates. TreeCellInfo.col is the column hit.
123 * TreeCellInfo.childElt is the pseudoelement hit: this can have values of
124 * "cell", "twisty", "image", and "text".
126 * The coordinate system is the client coordinate system for the
127 * document this tree lives in, and the units are CSS pixels.
130 TreeCellInfo getCellAt(long x, long y);
133 * Find the coordinates of an element within a specific cell.
136 DOMRect? getCoordsForCellItem(long row, TreeColumn col, DOMString element);
139 * Determine if the text of a cell is being cropped or not.
142 boolean isCellCropped(long row, TreeColumn? col);
145 * The view is responsible for calling these notification methods when
146 * rows are added or removed. Index is the position at which the new
147 * rows were added or at which rows were removed. For
148 * non-contiguous additions/removals, this method should be called multiple times.
150 undefined rowCountChanged(long index, long count);
153 * Notify the tree that the view is about to perform a batch
154 * update, that is, add, remove or invalidate several rows at once.
155 * This must be followed by calling endUpdateBatch(), otherwise the tree
156 * will get out of sync.
158 undefined beginUpdateBatch();
161 * Notify the tree that the view has completed a batch update.
163 undefined endUpdateBatch();
166 * Called on a theme switch to flush out the tree's style and image caches.
168 undefined clearStyleAndImageCaches();
171 * Remove an image source from the image cache to allow its invalidation.
174 undefined removeImageCacheEntry(long row, TreeColumn col);