Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsISupports.idl" |
michael@0 | 7 | |
michael@0 | 8 | interface nsIDOMElement; |
michael@0 | 9 | interface nsITreeView; |
michael@0 | 10 | interface nsITreeSelection; |
michael@0 | 11 | interface nsITreeColumn; |
michael@0 | 12 | interface nsITreeColumns; |
michael@0 | 13 | interface nsIScriptableRegion; |
michael@0 | 14 | |
michael@0 | 15 | [scriptable, uuid(64BA5199-C4F4-4498-BBDC-F8E4C369086C)] |
michael@0 | 16 | interface nsITreeBoxObject : nsISupports |
michael@0 | 17 | { |
michael@0 | 18 | /** |
michael@0 | 19 | * Obtain the columns. |
michael@0 | 20 | */ |
michael@0 | 21 | readonly attribute nsITreeColumns columns; |
michael@0 | 22 | |
michael@0 | 23 | /** |
michael@0 | 24 | * The view that backs the tree and that supplies it with its data. |
michael@0 | 25 | * It is dynamically settable, either using a view attribute on the |
michael@0 | 26 | * tree tag or by setting this attribute to a new value. |
michael@0 | 27 | */ |
michael@0 | 28 | attribute nsITreeView view; |
michael@0 | 29 | |
michael@0 | 30 | /** |
michael@0 | 31 | * Whether or not we are currently focused. |
michael@0 | 32 | */ |
michael@0 | 33 | attribute boolean focused; |
michael@0 | 34 | |
michael@0 | 35 | /** |
michael@0 | 36 | * Obtain the treebody content node |
michael@0 | 37 | */ |
michael@0 | 38 | readonly attribute nsIDOMElement treeBody; |
michael@0 | 39 | |
michael@0 | 40 | /** |
michael@0 | 41 | * Obtain the height of a row. |
michael@0 | 42 | */ |
michael@0 | 43 | readonly attribute long rowHeight; |
michael@0 | 44 | |
michael@0 | 45 | /** |
michael@0 | 46 | * Obtain the width of a row. |
michael@0 | 47 | */ |
michael@0 | 48 | readonly attribute long rowWidth; |
michael@0 | 49 | |
michael@0 | 50 | /** |
michael@0 | 51 | * Get the pixel position of the horizontal scrollbar. |
michael@0 | 52 | */ |
michael@0 | 53 | readonly attribute long horizontalPosition; |
michael@0 | 54 | |
michael@0 | 55 | /** |
michael@0 | 56 | * Return the region for the visible parts of the selection, in device pixels. |
michael@0 | 57 | */ |
michael@0 | 58 | readonly attribute nsIScriptableRegion selectionRegion; |
michael@0 | 59 | |
michael@0 | 60 | /** |
michael@0 | 61 | * Get the index of the first visible row. |
michael@0 | 62 | */ |
michael@0 | 63 | long getFirstVisibleRow(); |
michael@0 | 64 | |
michael@0 | 65 | /** |
michael@0 | 66 | * Get the index of the last visible row. |
michael@0 | 67 | */ |
michael@0 | 68 | long getLastVisibleRow(); |
michael@0 | 69 | |
michael@0 | 70 | /** |
michael@0 | 71 | * Gets the number of possible visible rows. |
michael@0 | 72 | */ |
michael@0 | 73 | long getPageLength(); |
michael@0 | 74 | |
michael@0 | 75 | /** |
michael@0 | 76 | * Ensures that a row at a given index is visible. |
michael@0 | 77 | */ |
michael@0 | 78 | void ensureRowIsVisible(in long index); |
michael@0 | 79 | |
michael@0 | 80 | /** |
michael@0 | 81 | * Ensures that a given cell in the tree is visible. |
michael@0 | 82 | */ |
michael@0 | 83 | void ensureCellIsVisible(in long row, in nsITreeColumn col); |
michael@0 | 84 | |
michael@0 | 85 | /** |
michael@0 | 86 | * Scrolls such that the row at index is at the top of the visible view. |
michael@0 | 87 | */ |
michael@0 | 88 | void scrollToRow(in long index); |
michael@0 | 89 | |
michael@0 | 90 | /** |
michael@0 | 91 | * Scroll the tree up or down by numLines lines. Positive |
michael@0 | 92 | * values move down in the tree. Prevents scrolling off the |
michael@0 | 93 | * end of the tree. |
michael@0 | 94 | */ |
michael@0 | 95 | void scrollByLines(in long numLines); |
michael@0 | 96 | |
michael@0 | 97 | /** |
michael@0 | 98 | * Scroll the tree up or down by numPages pages. A page |
michael@0 | 99 | * is considered to be the amount displayed by the tree. |
michael@0 | 100 | * Positive values move down in the tree. Prevents scrolling |
michael@0 | 101 | * off the end of the tree. |
michael@0 | 102 | */ |
michael@0 | 103 | void scrollByPages(in long numPages); |
michael@0 | 104 | |
michael@0 | 105 | /** |
michael@0 | 106 | * Scrolls such that a given cell is visible (if possible) |
michael@0 | 107 | * at the top left corner of the visible view. |
michael@0 | 108 | */ |
michael@0 | 109 | void scrollToCell(in long row, in nsITreeColumn col); |
michael@0 | 110 | |
michael@0 | 111 | /** |
michael@0 | 112 | * Scrolls horizontally so that the specified column is |
michael@0 | 113 | * at the left of the view (if possible). |
michael@0 | 114 | */ |
michael@0 | 115 | void scrollToColumn(in nsITreeColumn col); |
michael@0 | 116 | |
michael@0 | 117 | /** |
michael@0 | 118 | * Scroll to a specific horizontal pixel position. |
michael@0 | 119 | */ |
michael@0 | 120 | void scrollToHorizontalPosition(in long horizontalPosition); |
michael@0 | 121 | |
michael@0 | 122 | /** |
michael@0 | 123 | * Invalidation methods for fine-grained painting control. |
michael@0 | 124 | */ |
michael@0 | 125 | void invalidate(); |
michael@0 | 126 | void invalidateColumn(in nsITreeColumn col); |
michael@0 | 127 | void invalidateRow(in long index); |
michael@0 | 128 | void invalidateCell(in long row, in nsITreeColumn col); |
michael@0 | 129 | void invalidateRange(in long startIndex, in long endIndex); |
michael@0 | 130 | void invalidateColumnRange(in long startIndex, in long endIndex, |
michael@0 | 131 | in nsITreeColumn col); |
michael@0 | 132 | |
michael@0 | 133 | /** |
michael@0 | 134 | * A hit test that can tell you what row the mouse is over. |
michael@0 | 135 | * returns -1 for invalid mouse coordinates. |
michael@0 | 136 | * |
michael@0 | 137 | * The coordinate system is the client coordinate system for the |
michael@0 | 138 | * document this boxObject lives in, and the units are CSS pixels. |
michael@0 | 139 | */ |
michael@0 | 140 | long getRowAt(in long x, in long y); |
michael@0 | 141 | |
michael@0 | 142 | /** |
michael@0 | 143 | * A hit test that can tell you what cell the mouse is over. Row is the row index |
michael@0 | 144 | * hit, returns -1 for invalid mouse coordinates. ColID is the column hit. |
michael@0 | 145 | * ChildElt is the pseudoelement hit: this can have values of |
michael@0 | 146 | * "cell", "twisty", "image", and "text". |
michael@0 | 147 | * |
michael@0 | 148 | * The coordinate system is the client coordinate system for the |
michael@0 | 149 | * document this boxObject lives in, and the units are CSS pixels. |
michael@0 | 150 | */ |
michael@0 | 151 | void getCellAt(in long x, in long y, out long row, out nsITreeColumn col, out ACString childElt); |
michael@0 | 152 | |
michael@0 | 153 | /** |
michael@0 | 154 | * Find the coordinates of an element within a specific cell. |
michael@0 | 155 | */ |
michael@0 | 156 | void getCoordsForCellItem(in long row, in nsITreeColumn col, in ACString element, |
michael@0 | 157 | out long x, out long y, out long width, out long height); |
michael@0 | 158 | |
michael@0 | 159 | /** |
michael@0 | 160 | * Determine if the text of a cell is being cropped or not. |
michael@0 | 161 | */ |
michael@0 | 162 | boolean isCellCropped(in long row, in nsITreeColumn col); |
michael@0 | 163 | |
michael@0 | 164 | /** |
michael@0 | 165 | * The view is responsible for calling these notification methods when |
michael@0 | 166 | * rows are added or removed. Index is the position at which the new |
michael@0 | 167 | * rows were added or at which rows were removed. For |
michael@0 | 168 | * non-contiguous additions/removals, this method should be called multiple times. |
michael@0 | 169 | */ |
michael@0 | 170 | void rowCountChanged(in long index, in long count); |
michael@0 | 171 | |
michael@0 | 172 | /** |
michael@0 | 173 | * Notify the tree that the view is about to perform a batch |
michael@0 | 174 | * update, that is, add, remove or invalidate several rows at once. |
michael@0 | 175 | * This must be followed by calling endUpdateBatch(), otherwise the tree |
michael@0 | 176 | * will get out of sync. |
michael@0 | 177 | */ |
michael@0 | 178 | void beginUpdateBatch(); |
michael@0 | 179 | |
michael@0 | 180 | /** |
michael@0 | 181 | * Notify the tree that the view has completed a batch update. |
michael@0 | 182 | */ |
michael@0 | 183 | void endUpdateBatch(); |
michael@0 | 184 | |
michael@0 | 185 | /** |
michael@0 | 186 | * Called on a theme switch to flush out the tree's style and image caches. |
michael@0 | 187 | */ |
michael@0 | 188 | void clearStyleAndImageCaches(); |
michael@0 | 189 | }; |