michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIDOMElement; michael@0: interface nsITreeView; michael@0: interface nsITreeSelection; michael@0: interface nsITreeColumn; michael@0: interface nsITreeColumns; michael@0: interface nsIScriptableRegion; michael@0: michael@0: [scriptable, uuid(64BA5199-C4F4-4498-BBDC-F8E4C369086C)] michael@0: interface nsITreeBoxObject : nsISupports michael@0: { michael@0: /** michael@0: * Obtain the columns. michael@0: */ michael@0: readonly attribute nsITreeColumns columns; michael@0: michael@0: /** michael@0: * The view that backs the tree and that supplies it with its data. michael@0: * It is dynamically settable, either using a view attribute on the michael@0: * tree tag or by setting this attribute to a new value. michael@0: */ michael@0: attribute nsITreeView view; michael@0: michael@0: /** michael@0: * Whether or not we are currently focused. michael@0: */ michael@0: attribute boolean focused; michael@0: michael@0: /** michael@0: * Obtain the treebody content node michael@0: */ michael@0: readonly attribute nsIDOMElement treeBody; michael@0: michael@0: /** michael@0: * Obtain the height of a row. michael@0: */ michael@0: readonly attribute long rowHeight; michael@0: michael@0: /** michael@0: * Obtain the width of a row. michael@0: */ michael@0: readonly attribute long rowWidth; michael@0: michael@0: /** michael@0: * Get the pixel position of the horizontal scrollbar. michael@0: */ michael@0: readonly attribute long horizontalPosition; michael@0: michael@0: /** michael@0: * Return the region for the visible parts of the selection, in device pixels. michael@0: */ michael@0: readonly attribute nsIScriptableRegion selectionRegion; michael@0: michael@0: /** michael@0: * Get the index of the first visible row. michael@0: */ michael@0: long getFirstVisibleRow(); michael@0: michael@0: /** michael@0: * Get the index of the last visible row. michael@0: */ michael@0: long getLastVisibleRow(); michael@0: michael@0: /** michael@0: * Gets the number of possible visible rows. michael@0: */ michael@0: long getPageLength(); michael@0: michael@0: /** michael@0: * Ensures that a row at a given index is visible. michael@0: */ michael@0: void ensureRowIsVisible(in long index); michael@0: michael@0: /** michael@0: * Ensures that a given cell in the tree is visible. michael@0: */ michael@0: void ensureCellIsVisible(in long row, in nsITreeColumn col); michael@0: michael@0: /** michael@0: * Scrolls such that the row at index is at the top of the visible view. michael@0: */ michael@0: void scrollToRow(in long index); michael@0: michael@0: /** michael@0: * Scroll the tree up or down by numLines lines. Positive michael@0: * values move down in the tree. Prevents scrolling off the michael@0: * end of the tree. michael@0: */ michael@0: void scrollByLines(in long numLines); michael@0: michael@0: /** michael@0: * Scroll the tree up or down by numPages pages. A page michael@0: * is considered to be the amount displayed by the tree. michael@0: * Positive values move down in the tree. Prevents scrolling michael@0: * off the end of the tree. michael@0: */ michael@0: void scrollByPages(in long numPages); michael@0: michael@0: /** michael@0: * Scrolls such that a given cell is visible (if possible) michael@0: * at the top left corner of the visible view. michael@0: */ michael@0: void scrollToCell(in long row, in nsITreeColumn col); michael@0: michael@0: /** michael@0: * Scrolls horizontally so that the specified column is michael@0: * at the left of the view (if possible). michael@0: */ michael@0: void scrollToColumn(in nsITreeColumn col); michael@0: michael@0: /** michael@0: * Scroll to a specific horizontal pixel position. michael@0: */ michael@0: void scrollToHorizontalPosition(in long horizontalPosition); michael@0: michael@0: /** michael@0: * Invalidation methods for fine-grained painting control. michael@0: */ michael@0: void invalidate(); michael@0: void invalidateColumn(in nsITreeColumn col); michael@0: void invalidateRow(in long index); michael@0: void invalidateCell(in long row, in nsITreeColumn col); michael@0: void invalidateRange(in long startIndex, in long endIndex); michael@0: void invalidateColumnRange(in long startIndex, in long endIndex, michael@0: in nsITreeColumn col); michael@0: michael@0: /** michael@0: * A hit test that can tell you what row the mouse is over. michael@0: * returns -1 for invalid mouse coordinates. michael@0: * michael@0: * The coordinate system is the client coordinate system for the michael@0: * document this boxObject lives in, and the units are CSS pixels. michael@0: */ michael@0: long getRowAt(in long x, in long y); michael@0: michael@0: /** michael@0: * A hit test that can tell you what cell the mouse is over. Row is the row index michael@0: * hit, returns -1 for invalid mouse coordinates. ColID is the column hit. michael@0: * ChildElt is the pseudoelement hit: this can have values of michael@0: * "cell", "twisty", "image", and "text". michael@0: * michael@0: * The coordinate system is the client coordinate system for the michael@0: * document this boxObject lives in, and the units are CSS pixels. michael@0: */ michael@0: void getCellAt(in long x, in long y, out long row, out nsITreeColumn col, out ACString childElt); michael@0: michael@0: /** michael@0: * Find the coordinates of an element within a specific cell. michael@0: */ michael@0: void getCoordsForCellItem(in long row, in nsITreeColumn col, in ACString element, michael@0: out long x, out long y, out long width, out long height); michael@0: michael@0: /** michael@0: * Determine if the text of a cell is being cropped or not. michael@0: */ michael@0: boolean isCellCropped(in long row, in nsITreeColumn col); michael@0: michael@0: /** michael@0: * The view is responsible for calling these notification methods when michael@0: * rows are added or removed. Index is the position at which the new michael@0: * rows were added or at which rows were removed. For michael@0: * non-contiguous additions/removals, this method should be called multiple times. michael@0: */ michael@0: void rowCountChanged(in long index, in long count); michael@0: michael@0: /** michael@0: * Notify the tree that the view is about to perform a batch michael@0: * update, that is, add, remove or invalidate several rows at once. michael@0: * This must be followed by calling endUpdateBatch(), otherwise the tree michael@0: * will get out of sync. michael@0: */ michael@0: void beginUpdateBatch(); michael@0: michael@0: /** michael@0: * Notify the tree that the view has completed a batch update. michael@0: */ michael@0: void endUpdateBatch(); michael@0: michael@0: /** michael@0: * Called on a theme switch to flush out the tree's style and image caches. michael@0: */ michael@0: void clearStyleAndImageCaches(); michael@0: };