michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: interface nsITreeBoxObject; michael@0: interface nsITreeColumn; michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: [scriptable, uuid(ab6fe746-300b-4ab4-abb9-1c0e3977874c)] michael@0: interface nsITreeSelection : nsISupports michael@0: { michael@0: /** michael@0: * The tree widget for this selection. michael@0: */ michael@0: attribute nsITreeBoxObject tree; michael@0: michael@0: /** michael@0: * This attribute is a boolean indicating single selection. michael@0: */ michael@0: readonly attribute boolean single; michael@0: michael@0: /** michael@0: * The number of rows currently selected in this tree. michael@0: */ michael@0: readonly attribute long count; michael@0: michael@0: /** michael@0: * Indicates whether or not the row at the specified index is michael@0: * part of the selection. michael@0: */ michael@0: boolean isSelected(in long index); michael@0: michael@0: /** michael@0: * Deselect all rows and select the row at the specified index. michael@0: */ michael@0: void select(in long index); michael@0: michael@0: /** michael@0: * Perform a timed select. michael@0: */ michael@0: void timedSelect(in long index, in long delay); michael@0: michael@0: /** michael@0: * Toggle the selection state of the row at the specified index. michael@0: */ michael@0: void toggleSelect(in long index); michael@0: michael@0: /** michael@0: * Select the range specified by the indices. If augment is true, michael@0: * then we add the range to the selection without clearing out anything michael@0: * else. If augment is false, everything is cleared except for the specified range. michael@0: */ michael@0: void rangedSelect(in long startIndex, in long endIndex, in boolean augment); michael@0: michael@0: /** michael@0: * Clears the range. michael@0: */ michael@0: void clearRange(in long startIndex, in long endIndex); michael@0: michael@0: /** michael@0: * Clears the selection. michael@0: */ michael@0: void clearSelection(); michael@0: michael@0: /** michael@0: * Inverts the selection. michael@0: */ michael@0: void invertSelection(); michael@0: michael@0: /** michael@0: * Selects all rows. michael@0: */ michael@0: void selectAll(); michael@0: michael@0: /** michael@0: * Iterate the selection using these methods. michael@0: */ michael@0: long getRangeCount(); michael@0: void getRangeAt(in long i, out long min, out long max); michael@0: michael@0: /** michael@0: * Can be used to invalidate the selection. michael@0: */ michael@0: void invalidateSelection(); michael@0: michael@0: /** michael@0: * Called when the row count changes to adjust selection indices. michael@0: */ michael@0: void adjustSelection(in long index, in long count); michael@0: michael@0: /** michael@0: * This attribute is a boolean indicating whether or not the michael@0: * "select" event should fire when the selection is changed using michael@0: * one of our methods. A view can use this to temporarily suppress michael@0: * the selection while manipulating all of the indices, e.g., on michael@0: * a sort. michael@0: * Note: setting this attribute to false will fire a select event. michael@0: */ michael@0: attribute boolean selectEventsSuppressed; michael@0: michael@0: /** michael@0: * The current item (the one that gets a focus rect in addition to being michael@0: * selected). michael@0: */ michael@0: attribute long currentIndex; michael@0: michael@0: /** michael@0: * The current column. michael@0: */ michael@0: attribute nsITreeColumn currentColumn; michael@0: michael@0: /** michael@0: * The selection "pivot". This is the first item the user selected as michael@0: * part of a ranged select. michael@0: */ michael@0: readonly attribute long shiftSelectPivot; michael@0: }; michael@0: michael@0: /** michael@0: * The following interface is not scriptable and MUST NEVER BE MADE scriptable. michael@0: * Native treeselections implement it, and we use this to check whether a michael@0: * treeselection is native (and therefore suitable for use by untrusted content). michael@0: */ michael@0: [uuid(1bd59678-5cb3-4316-b246-31a91b19aabe)] michael@0: interface nsINativeTreeSelection : nsITreeSelection michael@0: { michael@0: [noscript] void ensureNative(); michael@0: };