nsITreeBoxObject.idl 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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. #include "nsISupports.idl"
  6. interface nsIDOMElement;
  7. interface nsITreeView;
  8. interface nsITreeSelection;
  9. interface nsITreeColumn;
  10. interface nsITreeColumns;
  11. interface nsIScriptableRegion;
  12. [scriptable, uuid(f3da0c5e-51f5-45f0-b2cd-6be3ab6847ae)]
  13. interface nsITreeBoxObject : nsISupports
  14. {
  15. /**
  16. * Obtain the columns.
  17. */
  18. readonly attribute nsITreeColumns columns;
  19. /**
  20. * The view that backs the tree and that supplies it with its data.
  21. * It is dynamically settable, either using a view attribute on the
  22. * tree tag or by setting this attribute to a new value.
  23. */
  24. attribute nsITreeView view;
  25. /**
  26. * Whether or not we are currently focused.
  27. */
  28. attribute boolean focused;
  29. /**
  30. * Obtain the treebody content node
  31. */
  32. readonly attribute nsIDOMElement treeBody;
  33. /**
  34. * Obtain the height of a row.
  35. */
  36. readonly attribute long rowHeight;
  37. /**
  38. * Obtain the width of a row.
  39. */
  40. readonly attribute long rowWidth;
  41. /**
  42. * Get the pixel position of the horizontal scrollbar.
  43. */
  44. readonly attribute long horizontalPosition;
  45. /**
  46. * Return the region for the visible parts of the selection, in device pixels.
  47. */
  48. readonly attribute nsIScriptableRegion selectionRegion;
  49. /**
  50. * Get the index of the first visible row.
  51. */
  52. long getFirstVisibleRow();
  53. /**
  54. * Get the index of the last visible row.
  55. */
  56. long getLastVisibleRow();
  57. /**
  58. * Gets the number of possible visible rows.
  59. */
  60. long getPageLength();
  61. /**
  62. * Ensures that a row at a given index is visible.
  63. */
  64. void ensureRowIsVisible(in long index);
  65. /**
  66. * Ensures that a given cell in the tree is visible.
  67. */
  68. void ensureCellIsVisible(in long row, in nsITreeColumn col);
  69. /**
  70. * Scrolls such that the row at index is at the top of the visible view.
  71. */
  72. void scrollToRow(in long index);
  73. /**
  74. * Scroll the tree up or down by numLines lines. Positive
  75. * values move down in the tree. Prevents scrolling off the
  76. * end of the tree.
  77. */
  78. void scrollByLines(in long numLines);
  79. /**
  80. * Scroll the tree up or down by numPages pages. A page
  81. * is considered to be the amount displayed by the tree.
  82. * Positive values move down in the tree. Prevents scrolling
  83. * off the end of the tree.
  84. */
  85. void scrollByPages(in long numPages);
  86. /**
  87. * Scrolls such that a given cell is visible (if possible)
  88. * at the top left corner of the visible view.
  89. */
  90. void scrollToCell(in long row, in nsITreeColumn col);
  91. /**
  92. * Scrolls horizontally so that the specified column is
  93. * at the left of the view (if possible).
  94. */
  95. void scrollToColumn(in nsITreeColumn col);
  96. /**
  97. * Scroll to a specific horizontal pixel position.
  98. */
  99. void scrollToHorizontalPosition(in long horizontalPosition);
  100. /**
  101. * Invalidation methods for fine-grained painting control.
  102. */
  103. void invalidate();
  104. void invalidateColumn(in nsITreeColumn col);
  105. void invalidateRow(in long index);
  106. void invalidateCell(in long row, in nsITreeColumn col);
  107. void invalidateRange(in long startIndex, in long endIndex);
  108. void invalidateColumnRange(in long startIndex, in long endIndex,
  109. in nsITreeColumn col);
  110. /**
  111. * A hit test that can tell you what row the mouse is over.
  112. * returns -1 for invalid mouse coordinates.
  113. *
  114. * The coordinate system is the client coordinate system for the
  115. * document this boxObject lives in, and the units are CSS pixels.
  116. */
  117. long getRowAt(in long x, in long y);
  118. /**
  119. * A hit test that can tell you what cell the mouse is over. Row is the row index
  120. * hit, returns -1 for invalid mouse coordinates. ColID is the column hit.
  121. * ChildElt is the pseudoelement hit: this can have values of
  122. * "cell", "twisty", "image", and "text".
  123. *
  124. * The coordinate system is the client coordinate system for the
  125. * document this boxObject lives in, and the units are CSS pixels.
  126. */
  127. void getCellAt(in long x, in long y, out long row, out nsITreeColumn col, out AString childElt);
  128. /**
  129. * Find the coordinates of an element within a specific cell.
  130. */
  131. void getCoordsForCellItem(in long row, in nsITreeColumn col, in AString element,
  132. out long x, out long y, out long width, out long height);
  133. /**
  134. * Determine if the text of a cell is being cropped or not.
  135. */
  136. boolean isCellCropped(in long row, in nsITreeColumn col);
  137. /**
  138. * The view is responsible for calling these notification methods when
  139. * rows are added or removed. Index is the position at which the new
  140. * rows were added or at which rows were removed. For
  141. * non-contiguous additions/removals, this method should be called multiple times.
  142. */
  143. void rowCountChanged(in long index, in long count);
  144. /**
  145. * Notify the tree that the view is about to perform a batch
  146. * update, that is, add, remove or invalidate several rows at once.
  147. * This must be followed by calling endUpdateBatch(), otherwise the tree
  148. * will get out of sync.
  149. */
  150. void beginUpdateBatch();
  151. /**
  152. * Notify the tree that the view has completed a batch update.
  153. */
  154. void endUpdateBatch();
  155. /**
  156. * Called on a theme switch to flush out the tree's style and image caches.
  157. */
  158. void clearStyleAndImageCaches();
  159. };