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