|
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 interface nsITreeBoxObject; |
|
7 interface nsITreeColumn; |
|
8 |
|
9 #include "nsISupports.idl" |
|
10 |
|
11 [scriptable, uuid(ab6fe746-300b-4ab4-abb9-1c0e3977874c)] |
|
12 interface nsITreeSelection : nsISupports |
|
13 { |
|
14 /** |
|
15 * The tree widget for this selection. |
|
16 */ |
|
17 attribute nsITreeBoxObject tree; |
|
18 |
|
19 /** |
|
20 * This attribute is a boolean indicating single selection. |
|
21 */ |
|
22 readonly attribute boolean single; |
|
23 |
|
24 /** |
|
25 * The number of rows currently selected in this tree. |
|
26 */ |
|
27 readonly attribute long count; |
|
28 |
|
29 /** |
|
30 * Indicates whether or not the row at the specified index is |
|
31 * part of the selection. |
|
32 */ |
|
33 boolean isSelected(in long index); |
|
34 |
|
35 /** |
|
36 * Deselect all rows and select the row at the specified index. |
|
37 */ |
|
38 void select(in long index); |
|
39 |
|
40 /** |
|
41 * Perform a timed select. |
|
42 */ |
|
43 void timedSelect(in long index, in long delay); |
|
44 |
|
45 /** |
|
46 * Toggle the selection state of the row at the specified index. |
|
47 */ |
|
48 void toggleSelect(in long index); |
|
49 |
|
50 /** |
|
51 * Select the range specified by the indices. If augment is true, |
|
52 * then we add the range to the selection without clearing out anything |
|
53 * else. If augment is false, everything is cleared except for the specified range. |
|
54 */ |
|
55 void rangedSelect(in long startIndex, in long endIndex, in boolean augment); |
|
56 |
|
57 /** |
|
58 * Clears the range. |
|
59 */ |
|
60 void clearRange(in long startIndex, in long endIndex); |
|
61 |
|
62 /** |
|
63 * Clears the selection. |
|
64 */ |
|
65 void clearSelection(); |
|
66 |
|
67 /** |
|
68 * Inverts the selection. |
|
69 */ |
|
70 void invertSelection(); |
|
71 |
|
72 /** |
|
73 * Selects all rows. |
|
74 */ |
|
75 void selectAll(); |
|
76 |
|
77 /** |
|
78 * Iterate the selection using these methods. |
|
79 */ |
|
80 long getRangeCount(); |
|
81 void getRangeAt(in long i, out long min, out long max); |
|
82 |
|
83 /** |
|
84 * Can be used to invalidate the selection. |
|
85 */ |
|
86 void invalidateSelection(); |
|
87 |
|
88 /** |
|
89 * Called when the row count changes to adjust selection indices. |
|
90 */ |
|
91 void adjustSelection(in long index, in long count); |
|
92 |
|
93 /** |
|
94 * This attribute is a boolean indicating whether or not the |
|
95 * "select" event should fire when the selection is changed using |
|
96 * one of our methods. A view can use this to temporarily suppress |
|
97 * the selection while manipulating all of the indices, e.g., on |
|
98 * a sort. |
|
99 * Note: setting this attribute to false will fire a select event. |
|
100 */ |
|
101 attribute boolean selectEventsSuppressed; |
|
102 |
|
103 /** |
|
104 * The current item (the one that gets a focus rect in addition to being |
|
105 * selected). |
|
106 */ |
|
107 attribute long currentIndex; |
|
108 |
|
109 /** |
|
110 * The current column. |
|
111 */ |
|
112 attribute nsITreeColumn currentColumn; |
|
113 |
|
114 /** |
|
115 * The selection "pivot". This is the first item the user selected as |
|
116 * part of a ranged select. |
|
117 */ |
|
118 readonly attribute long shiftSelectPivot; |
|
119 }; |
|
120 |
|
121 /** |
|
122 * The following interface is not scriptable and MUST NEVER BE MADE scriptable. |
|
123 * Native treeselections implement it, and we use this to check whether a |
|
124 * treeselection is native (and therefore suitable for use by untrusted content). |
|
125 */ |
|
126 [uuid(1bd59678-5cb3-4316-b246-31a91b19aabe)] |
|
127 interface nsINativeTreeSelection : nsITreeSelection |
|
128 { |
|
129 [noscript] void ensureNative(); |
|
130 }; |