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