nsITreeBoxObject

IID:55f3b431-1aa8-4e23-ad3d-a9f5644bdaa6
Inherits From:nsISupports

Properties

readonly nsITreeColumns columns

Obtain the columns.

PRBool focused

Whether or not we are currently focused.

readonly PRInt32 rowHeight

Obtain the height of a row.

readonly nsIDOMElement treeBody

Obtain the treebody content node

nsITreeView view

The view that backs the tree and that supplies it with its data. It is dynamically settable, either using a view attribute on the tree tag or by setting this attribute to a new value.


Methods

void beginUpdateBatch ( ) void clearStyleAndImageCaches ( ) void endUpdateBatch ( ) void ensureRowIsVisible ( PRInt32 index ) void getCellAt ( PRInt32 x , PRInt32 y , out PRInt32 row , out nsITreeColumn col , out ACString childElt ) void getCoordsForCellItem ( PRInt32 row , nsITreeColumn col , ACString element , out PRInt32 x , out PRInt32 y , out PRInt32 width , out PRInt32 height ) PRInt32 getFirstVisibleRow ( ) PRInt32 getLastVisibleRow ( ) PRInt32 getPageLength ( ) PRInt32 getRowAt ( PRInt32 x , PRInt32 y ) void invalidate ( ) void invalidateCell ( PRInt32 row , nsITreeColumn col ) void invalidateColumn ( nsITreeColumn col ) void invalidateRange ( PRInt32 startIndex , PRInt32 endIndex ) void invalidateRow ( PRInt32 index ) PRBool isCellCropped ( PRInt32 row , nsITreeColumn col ) void rowCountChanged ( PRInt32 index , PRInt32 count ) void scrollByLines ( PRInt32 numLines ) void scrollByPages ( PRInt32 numPages ) void scrollToRow ( PRInt32 index )

void beginUpdateBatch ( )

Notify the tree that the view is about to perform a batch update, that is, add, remove or invalidate several rows at once. This must be followed by calling endUpdateBatch(), otherwise the tree will get out of sync.


void clearStyleAndImageCaches ( )

Called on a theme switch to flush out the tree's style and image caches.


void endUpdateBatch ( )

Notify the tree that the view has completed a batch update.


void ensureRowIsVisible ( PRInt32 index )

Ensures that a row at a given index is visible.

Arguments:
index

void getCellAt ( PRInt32 x , PRInt32 y , out PRInt32 row , out nsITreeColumn col , out ACString childElt )

A hit test that can tell you what cell the mouse is over. Row is the row index hit, returns -1 for invalid mouse coordinates. ColID is the column hit. ChildElt is the pseudoelement hit: this can have values of "cell", "twisty", "image", and "text".

The coordinate system is the client coordinate system for the document this boxObject lives in, and the units are CSS pixels.

Arguments:
x
y
row
col
childElt

void getCoordsForCellItem ( PRInt32 row , nsITreeColumn col , ACString element , out PRInt32 x , out PRInt32 y , out PRInt32 width , out PRInt32 height )

Find the coordinates of an element within a specific cell.

Arguments:
row
col
element
x
y
width
height

PRInt32 getFirstVisibleRow ( )

Get the index of the first visible row.


PRInt32 getLastVisibleRow ( )

Get the index of the last visible row.


PRInt32 getPageLength ( )

Gets the number of possible visible rows.


PRInt32 getRowAt ( PRInt32 x , PRInt32 y )

A hit test that can tell you what row the mouse is over. returns -1 for invalid mouse coordinates.

The coordinate system is the client coordinate system for the document this boxObject lives in, and the units are CSS pixels.

Arguments:
x
y

void invalidate ( )

Invalidation methods for fine-grained painting control.


void invalidateCell ( PRInt32 row , nsITreeColumn col )

Arguments:
row
col

void invalidateColumn ( nsITreeColumn col )

Arguments:
col

void invalidateRange ( PRInt32 startIndex , PRInt32 endIndex )

Arguments:
startIndex
endIndex

void invalidateRow ( PRInt32 index )

Arguments:
index

PRBool isCellCropped ( PRInt32 row , nsITreeColumn col )

Determine if the text of a cell is being cropped or not.

Arguments:
row
col

void rowCountChanged ( PRInt32 index , PRInt32 count )

The view is responsible for calling these notification methods when rows are added or removed. Index is the position at which the new rows were added or at which rows were removed. For non-contiguous additions/removals, this method should be called multiple times.

Arguments:
index
count

void scrollByLines ( PRInt32 numLines )

Scroll the tree up or down by numLines lines. Positive values move down in the tree. Prevents scrolling off the end of the tree.

Arguments:
numLines

void scrollByPages ( PRInt32 numPages )

Scroll the tree up or down by numPages pages. A page is considered to be the amount displayed by the tree. Positive values move down in the tree. Prevents scrolling off the end of the tree.

Arguments:
numPages

void scrollToRow ( PRInt32 index )

Scrolls such that the row at index is at the top of the visible view.

Arguments:
index

References

This interface is the type of the following properties:

nsITreeColumns.tree, nsITreeSelection.tree

This interface is passed as an argument to the following methods:

nsITreeView.setTree

Reference documentation is generated from Mozilla's source.

Add a note User Contributed Notes
May 18, 2005, 11:17 am trev at gtchat dot de
Method invalidatePrimaryCell() has been removed from Gecko 1.8, you have to call invalidateCell() with a column that you get from treeBoxObject.columns.getPrimaryCell().
October 4, 2004, 12:22 pm edwin at bitstorm dot org
When removing rows from the tree and notify it with rowCountChanged(), you should use a negative count. For example:
rowCountChanged( oldRowCount-1, -linesRemovedCount );

Sometimes the tree went blank. I could prevent that with this code:
if ( this.tree.view.selection.count )
this.tree.view.selection.clearSelection();

Copyright © 1999 - 2005 XULPlanet.com