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
8// invalid widl
9//interface 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   * Whether or not we are currently focused.
27   */
28  attribute boolean focused;
29
30  /**
31   * Obtain the treebody content node
32   */
33  readonly attribute Element? treeBody;
34
35  /**
36   * Obtain the height of a row.
37   */
38  readonly attribute long rowHeight;
39
40  /**
41   * Obtain the width of a row.
42   */
43  readonly attribute long rowWidth;
44
45  /**
46   * Get the pixel position of the horizontal scrollbar.
47   */
48  readonly attribute long horizontalPosition;
49
50  /**
51   * Return the region for the visible parts of the selection, in device pixels
52   */
53  readonly attribute nsIScriptableRegion selectionRegion;
54
55  /**
56   * Get the index of the first visible row.
57   */
58  long getFirstVisibleRow();
59
60  /**
61   * Get the index of the last visible row.
62   */
63  long getLastVisibleRow();
64
65  /**
66   * Gets the number of possible visible rows.
67   */
68  long getPageLength();
69
70  /**
71   * Ensures that a row at a given index is visible.
72   */
73  void ensureRowIsVisible(long index);
74
75  /**
76   * Ensures that a given cell in the tree is visible.
77   */
78  [Throws]
79  void ensureCellIsVisible(long row, TreeColumn? col);
80
81  /**
82   * Scrolls such that the row at index is at the top of the visible view.
83   */
84  void scrollToRow(long index);
85
86  /**
87   * Scroll the tree up or down by numLines lines. Positive
88   * values move down in the tree. Prevents scrolling off the
89   * end of the tree.
90   */
91  void scrollByLines(long numLines);
92
93  /**
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.
98   */
99  void scrollByPages(long numPages);
100
101  /**
102   * Invalidation methods for fine-grained painting control.
103   */
104  void invalidate();
105  void invalidateColumn(TreeColumn? col);
106  void invalidateRow(long index);
107  void invalidateCell(long row, TreeColumn? col);
108  void invalidateRange(long startIndex, long endIndex);
109
110  /**
111   * A hit test that can tell you what row the mouse is over.
112   * returns -1 for invalid mouse coordinates.
113   *
114   * The coordinate system is the client coordinate system for the
115   * document this boxObject lives in, and the units are CSS pixels.
116   */
117  long getRowAt(long x, long y);
118
119  /**
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".
125   *
126   * The coordinate system is the client coordinate system for the
127   * document this boxObject lives in, and the units are CSS pixels.
128   */
129  [Throws]
130  TreeCellInfo getCellAt(long x, long y);
131
132  /**
133   * DEPRECATED: please use above version
134   */
135  [Throws]
136  void getCellAt(long x, long y, object row, object column, object childElt);
137
138  /**
139   * Find the coordinates of an element within a specific cell.
140   */
141  [Throws]
142  DOMRect? getCoordsForCellItem(long row, TreeColumn col, DOMString element);
143
144  /**
145   * DEPRECATED: Please use above version
146   */
147  [Throws]
148  void getCoordsForCellItem(long row, TreeColumn col, DOMString element,
149                            object x, object y, object width, object height);
150
151  /**
152   * Determine if the text of a cell is being cropped or not.
153   */
154  [Throws]
155  boolean isCellCropped(long row, TreeColumn? col);
156
157  /**
158   * The view is responsible for calling these notification methods when
159   * rows are added or removed.  Index is the position at which the new
160   * rows were added or at which rows were removed.  For
161   * non-contiguous additions/removals, this method should be called multiple times.
162   */
163  void rowCountChanged(long index, long count);
164
165  /**
166   * Notify the tree that the view is about to perform a batch
167   * update, that is, add, remove or invalidate several rows at once.
168   * This must be followed by calling endUpdateBatch(), otherwise the tree
169   * will get out of sync.
170   */
171  void beginUpdateBatch();
172
173  /**
174   * Notify the tree that the view has completed a batch update.
175   */
176  void endUpdateBatch();
177
178  /**
179   * Called on a theme switch to flush out the tree's style and image caches.
180   */
181  void clearStyleAndImageCaches();
182
183  /**
184   * Remove an image source from the image cache to allow its invalidation.
185   */
186  [Throws]
187  void removeImageCacheEntry(long row, TreeColumn col);
188};
189