nsITreeSelection.idl 3.3 KB

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