layout/xul/tree/nsITreeSelection.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/xul/tree/nsITreeSelection.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,130 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +interface nsITreeBoxObject;
    1.10 +interface nsITreeColumn;
    1.11 +
    1.12 +#include "nsISupports.idl"
    1.13 +
    1.14 +[scriptable, uuid(ab6fe746-300b-4ab4-abb9-1c0e3977874c)]
    1.15 +interface nsITreeSelection : nsISupports
    1.16 +{
    1.17 +  /**
    1.18 +   * The tree widget for this selection.
    1.19 +   */
    1.20 +  attribute nsITreeBoxObject tree;
    1.21 +
    1.22 +  /**
    1.23 +   * This attribute is a boolean indicating single selection.
    1.24 +   */
    1.25 +  readonly attribute boolean single;
    1.26 +
    1.27 +  /**
    1.28 +   * The number of rows currently selected in this tree.
    1.29 +   */
    1.30 +  readonly attribute long count;
    1.31 +
    1.32 +  /**
    1.33 +   * Indicates whether or not the row at the specified index is
    1.34 +   * part of the selection.
    1.35 +   */
    1.36 +  boolean isSelected(in long index);
    1.37 +
    1.38 +  /**
    1.39 +   * Deselect all rows and select the row at the specified index. 
    1.40 +   */
    1.41 +  void select(in long index);
    1.42 +
    1.43 +  /**
    1.44 +   * Perform a timed select.
    1.45 +   */
    1.46 +  void timedSelect(in long index, in long delay);
    1.47 +
    1.48 +  /**
    1.49 +   * Toggle the selection state of the row at the specified index.
    1.50 +   */
    1.51 +  void toggleSelect(in long index);
    1.52 +
    1.53 +  /**
    1.54 +   * Select the range specified by the indices.  If augment is true,
    1.55 +   * then we add the range to the selection without clearing out anything
    1.56 +   * else.  If augment is false, everything is cleared except for the specified range.
    1.57 +   */
    1.58 +  void rangedSelect(in long startIndex, in long endIndex, in boolean augment);
    1.59 +
    1.60 +  /**
    1.61 +   * Clears the range.
    1.62 +   */
    1.63 +  void clearRange(in long startIndex, in long endIndex);
    1.64 +
    1.65 +  /**
    1.66 +   * Clears the selection.
    1.67 +   */
    1.68 +  void clearSelection();
    1.69 +
    1.70 +  /**
    1.71 +   * Inverts the selection.
    1.72 +   */
    1.73 +  void invertSelection();
    1.74 +
    1.75 +  /**
    1.76 +   * Selects all rows.
    1.77 +   */
    1.78 +  void selectAll();
    1.79 +
    1.80 +  /**
    1.81 +   * Iterate the selection using these methods.
    1.82 +   */
    1.83 +  long getRangeCount();
    1.84 +  void getRangeAt(in long i, out long min, out long max);
    1.85 +
    1.86 +  /**
    1.87 +   * Can be used to invalidate the selection.
    1.88 +   */
    1.89 +  void invalidateSelection();
    1.90 +
    1.91 +  /**
    1.92 +   * Called when the row count changes to adjust selection indices.
    1.93 +   */
    1.94 +  void adjustSelection(in long index, in long count);
    1.95 +
    1.96 +  /**
    1.97 +   * This attribute is a boolean indicating whether or not the
    1.98 +   * "select" event should fire when the selection is changed using
    1.99 +   * one of our methods.  A view can use this to temporarily suppress
   1.100 +   * the selection while manipulating all of the indices, e.g., on 
   1.101 +   * a sort.
   1.102 +   * Note: setting this attribute to false will fire a select event.
   1.103 +   */
   1.104 +  attribute boolean selectEventsSuppressed;
   1.105 +
   1.106 +  /**
   1.107 +   * The current item (the one that gets a focus rect in addition to being
   1.108 +   * selected).
   1.109 +   */
   1.110 +  attribute long currentIndex;
   1.111 +
   1.112 +  /**
   1.113 +   * The current column.
   1.114 +   */
   1.115 +  attribute nsITreeColumn currentColumn;
   1.116 +
   1.117 +  /**
   1.118 +   * The selection "pivot".  This is the first item the user selected as
   1.119 +   * part of a ranged select.
   1.120 +   */
   1.121 +  readonly attribute long shiftSelectPivot;
   1.122 +};
   1.123 +
   1.124 +/**
   1.125 + * The following interface is not scriptable and MUST NEVER BE MADE scriptable.
   1.126 + * Native treeselections implement it, and we use this to check whether a
   1.127 + * treeselection is native (and therefore suitable for use by untrusted content).
   1.128 + */
   1.129 +[uuid(1bd59678-5cb3-4316-b246-31a91b19aabe)]
   1.130 +interface nsINativeTreeSelection : nsITreeSelection
   1.131 +{
   1.132 +  [noscript] void ensureNative();
   1.133 +};

mercurial