1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/xul/tree/nsITreeBoxObject.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,189 @@ 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 +#include "nsISupports.idl" 1.10 + 1.11 +interface nsIDOMElement; 1.12 +interface nsITreeView; 1.13 +interface nsITreeSelection; 1.14 +interface nsITreeColumn; 1.15 +interface nsITreeColumns; 1.16 +interface nsIScriptableRegion; 1.17 + 1.18 +[scriptable, uuid(64BA5199-C4F4-4498-BBDC-F8E4C369086C)] 1.19 +interface nsITreeBoxObject : nsISupports 1.20 +{ 1.21 + /** 1.22 + * Obtain the columns. 1.23 + */ 1.24 + readonly attribute nsITreeColumns columns; 1.25 + 1.26 + /** 1.27 + * The view that backs the tree and that supplies it with its data. 1.28 + * It is dynamically settable, either using a view attribute on the 1.29 + * tree tag or by setting this attribute to a new value. 1.30 + */ 1.31 + attribute nsITreeView view; 1.32 + 1.33 + /** 1.34 + * Whether or not we are currently focused. 1.35 + */ 1.36 + attribute boolean focused; 1.37 + 1.38 + /** 1.39 + * Obtain the treebody content node 1.40 + */ 1.41 + readonly attribute nsIDOMElement treeBody; 1.42 + 1.43 + /** 1.44 + * Obtain the height of a row. 1.45 + */ 1.46 + readonly attribute long rowHeight; 1.47 + 1.48 + /** 1.49 + * Obtain the width of a row. 1.50 + */ 1.51 + readonly attribute long rowWidth; 1.52 + 1.53 + /** 1.54 + * Get the pixel position of the horizontal scrollbar. 1.55 + */ 1.56 + readonly attribute long horizontalPosition; 1.57 + 1.58 + /** 1.59 + * Return the region for the visible parts of the selection, in device pixels. 1.60 + */ 1.61 + readonly attribute nsIScriptableRegion selectionRegion; 1.62 + 1.63 + /** 1.64 + * Get the index of the first visible row. 1.65 + */ 1.66 + long getFirstVisibleRow(); 1.67 + 1.68 + /** 1.69 + * Get the index of the last visible row. 1.70 + */ 1.71 + long getLastVisibleRow(); 1.72 + 1.73 + /** 1.74 + * Gets the number of possible visible rows. 1.75 + */ 1.76 + long getPageLength(); 1.77 + 1.78 + /** 1.79 + * Ensures that a row at a given index is visible. 1.80 + */ 1.81 + void ensureRowIsVisible(in long index); 1.82 + 1.83 + /** 1.84 + * Ensures that a given cell in the tree is visible. 1.85 + */ 1.86 + void ensureCellIsVisible(in long row, in nsITreeColumn col); 1.87 + 1.88 + /** 1.89 + * Scrolls such that the row at index is at the top of the visible view. 1.90 + */ 1.91 + void scrollToRow(in long index); 1.92 + 1.93 + /** 1.94 + * Scroll the tree up or down by numLines lines. Positive 1.95 + * values move down in the tree. Prevents scrolling off the 1.96 + * end of the tree. 1.97 + */ 1.98 + void scrollByLines(in long numLines); 1.99 + 1.100 + /** 1.101 + * Scroll the tree up or down by numPages pages. A page 1.102 + * is considered to be the amount displayed by the tree. 1.103 + * Positive values move down in the tree. Prevents scrolling 1.104 + * off the end of the tree. 1.105 + */ 1.106 + void scrollByPages(in long numPages); 1.107 + 1.108 + /** 1.109 + * Scrolls such that a given cell is visible (if possible) 1.110 + * at the top left corner of the visible view. 1.111 + */ 1.112 + void scrollToCell(in long row, in nsITreeColumn col); 1.113 + 1.114 + /** 1.115 + * Scrolls horizontally so that the specified column is 1.116 + * at the left of the view (if possible). 1.117 + */ 1.118 + void scrollToColumn(in nsITreeColumn col); 1.119 + 1.120 + /** 1.121 + * Scroll to a specific horizontal pixel position. 1.122 + */ 1.123 + void scrollToHorizontalPosition(in long horizontalPosition); 1.124 + 1.125 + /** 1.126 + * Invalidation methods for fine-grained painting control. 1.127 + */ 1.128 + void invalidate(); 1.129 + void invalidateColumn(in nsITreeColumn col); 1.130 + void invalidateRow(in long index); 1.131 + void invalidateCell(in long row, in nsITreeColumn col); 1.132 + void invalidateRange(in long startIndex, in long endIndex); 1.133 + void invalidateColumnRange(in long startIndex, in long endIndex, 1.134 + in nsITreeColumn col); 1.135 + 1.136 + /** 1.137 + * A hit test that can tell you what row the mouse is over. 1.138 + * returns -1 for invalid mouse coordinates. 1.139 + * 1.140 + * The coordinate system is the client coordinate system for the 1.141 + * document this boxObject lives in, and the units are CSS pixels. 1.142 + */ 1.143 + long getRowAt(in long x, in long y); 1.144 + 1.145 + /** 1.146 + * A hit test that can tell you what cell the mouse is over. Row is the row index 1.147 + * hit, returns -1 for invalid mouse coordinates. ColID is the column hit. 1.148 + * ChildElt is the pseudoelement hit: this can have values of 1.149 + * "cell", "twisty", "image", and "text". 1.150 + * 1.151 + * The coordinate system is the client coordinate system for the 1.152 + * document this boxObject lives in, and the units are CSS pixels. 1.153 + */ 1.154 + void getCellAt(in long x, in long y, out long row, out nsITreeColumn col, out ACString childElt); 1.155 + 1.156 + /** 1.157 + * Find the coordinates of an element within a specific cell. 1.158 + */ 1.159 + void getCoordsForCellItem(in long row, in nsITreeColumn col, in ACString element, 1.160 + out long x, out long y, out long width, out long height); 1.161 + 1.162 + /** 1.163 + * Determine if the text of a cell is being cropped or not. 1.164 + */ 1.165 + boolean isCellCropped(in long row, in nsITreeColumn col); 1.166 + 1.167 + /** 1.168 + * The view is responsible for calling these notification methods when 1.169 + * rows are added or removed. Index is the position at which the new 1.170 + * rows were added or at which rows were removed. For 1.171 + * non-contiguous additions/removals, this method should be called multiple times. 1.172 + */ 1.173 + void rowCountChanged(in long index, in long count); 1.174 + 1.175 + /** 1.176 + * Notify the tree that the view is about to perform a batch 1.177 + * update, that is, add, remove or invalidate several rows at once. 1.178 + * This must be followed by calling endUpdateBatch(), otherwise the tree 1.179 + * will get out of sync. 1.180 + */ 1.181 + void beginUpdateBatch(); 1.182 + 1.183 + /** 1.184 + * Notify the tree that the view has completed a batch update. 1.185 + */ 1.186 + void endUpdateBatch(); 1.187 + 1.188 + /** 1.189 + * Called on a theme switch to flush out the tree's style and image caches. 1.190 + */ 1.191 + void clearStyleAndImageCaches(); 1.192 +};