Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes | Friends
nsTreeContentView Class Reference

#include <nsTreeContentView.h>

Inheritance diagram for nsTreeContentView:
Inheritance graph
[legend]
Collaboration diagram for nsTreeContentView:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsTreeContentView (void)
 ~nsTreeContentView (void)
NS_DECL_ISUPPORTS
NS_DECL_NSITREEVIEW NS_IMETHOD 
EnsureNative ()
virtual
NS_DECL_NSITREECONTENTVIEW
void 
ContentStatesChanged (nsIDocument *aDocument, nsIContent *aContent1, nsIContent *aContent2, PRInt32 aStateMask)
 Notification that the state of a content node has changed.
virtual void AttributeChanged (nsIDocument *aDocument, nsIContent *aContent, PRInt32 aNameSpaceID, nsIAtom *aAttribute, PRInt32 aModType)
 Notification that the content model has changed.
virtual void ContentAppended (nsIDocument *aDocument, nsIContent *aContainer, PRInt32 aNewIndexInContainer)
 Notifcation that the content model has had data appended to the given content object.
virtual void ContentInserted (nsIDocument *aDocument, nsIContent *aContainer, nsIContent *aChild, PRInt32 aIndexInContainer)
 Notification that content has been inserted.
virtual void ContentRemoved (nsIDocument *aDocument, nsIContent *aContainer, nsIContent *aChild, PRInt32 aIndexInContainer)
 Content has just been removed.
virtual void DocumentWillBeDestroyed (nsIDocument *aDocument)
 The document is in the process of being destroyed.
void ensureNative ()
void getRowProperties (in long index, in nsISupportsArray properties)
 An atomized list of properties for a given row.
void getCellProperties (in long row, in nsITreeColumn col, in nsISupportsArray properties)
 An atomized list of properties for a given cell.
void getColumnProperties (in nsITreeColumn col, in nsISupportsArray properties)
 Called to get properties to paint a column background.
boolean isContainer (in long index)
 Methods that can be used to test whether or not a twisty should be drawn, and if so, whether an open or closed twisty should be used.
boolean isContainerOpen (in long index)
boolean isContainerEmpty (in long index)
boolean isSeparator (in long index)
 isSeparator is used to determine if the row at index is a separator.
boolean isSorted ()
 Specifies if there is currently a sort on any column.
boolean canDrop (in long index, in long orientation)
 Methods used by the drag feedback code to determine if a drag is allowable at the current location.
void drop (in long row, in long orientation)
 Called when the user drops something on this view.
long getParentIndex (in long rowIndex)
 Methods used by the tree to draw thread lines in the tree.
boolean hasNextSibling (in long rowIndex, in long afterIndex)
 hasNextSibling is used to determine if the row at rowIndex has a nextSibling that occurs after the index specified by afterIndex.
long getLevel (in long index)
 The level is an integer value that represents the level of indentation.
AString getImageSrc (in long row, in nsITreeColumn col)
 The image path for a given cell.
long getProgressMode (in long row, in nsITreeColumn col)
AString getCellValue (in long row, in nsITreeColumn col)
 The value for a given cell.
AString getCellText (in long row, in nsITreeColumn col)
 The text for a given cell.
void setTree (in nsITreeBoxObject tree)
 Called during initialization to link the view to the front end box object.
void toggleOpenState (in long index)
 Called on the view when an item is opened or closed.
void cycleHeader (in nsITreeColumn col)
 Called on the view when a header is clicked.
void selectionChanged ()
 Should be called from a XUL onselect handler whenever the selection changes.
void cycleCell (in long row, in nsITreeColumn col)
 Called on the view when a cell in a non-selectable cycling column (e.g., unread/flag/etc.) is clicked.
boolean isEditable (in long row, in nsITreeColumn col)
 isEditable is called to ask the view if the cell contents are editable.
void setCellValue (in long row, in nsITreeColumn col, in AString value)
 setCellValue is called when the value of the cell has been set by the user.
void setCellText (in long row, in nsITreeColumn col, in AString value)
 setCellText is called when the contents of the cell have been edited by the user.
void performAction (in wstring action)
 A command API that can be used to invoke commands on the selection.
void performActionOnRow (in wstring action, in long row)
 A command API that can be used to invoke commands on a specific row.
void performActionOnCell (in wstring action, in long row, in nsITreeColumn col)
 A command API that can be used to invoke commands on a specific cell.
nsIDOMElement getItemAtIndex (in long index)
 Retrieve the content item associated with the specified index.
long getIndexOfItem (in nsIDOMElement item)
 Retrieve the index associated with the specified content item.
virtual void BeginUpdate (nsIDocument *aDocument, nsUpdateType aUpdateType)=0
 Notify that a content model update is beginning.
virtual void EndUpdate (nsIDocument *aDocument, nsUpdateType aUpdateType)=0
 Notify that a content model update is finished.
virtual void BeginLoad (nsIDocument *aDocument)=0
 Notify the observer that a document load is beginning.
virtual void EndLoad (nsIDocument *aDocument)=0
 Notify the observer that a document load has finished.
virtual void BeginReflow (nsIDocument *aDocument, nsIPresShell *aShell)=0
 Notify the observer that the document is being reflowed in the given presentation shell.
virtual void EndReflow (nsIDocument *aDocument, nsIPresShell *aShell)=0
 Notify the observer that the document is done being reflowed in the given presentation shell.
virtual void CharacterDataChanged (nsIDocument *aDocument, nsIContent *aContent, PRBool aAppend)=0
 Notification that the content model has changed.
virtual void StyleSheetAdded (nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, PRBool aDocumentSheet)=0
 A StyleSheet has just been added to the document.
virtual void StyleSheetRemoved (nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, PRBool aDocumentSheet)=0
 A StyleSheet has just been removed from the document.
virtual void StyleSheetApplicableStateChanged (nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, PRBool aApplicable)=0
 A StyleSheet has just changed its applicable state.
virtual void StyleRuleChanged (nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, nsIStyleRule *aOldStyleRule, nsIStyleRule *aNewStyleRule)=0
 A StyleRule has just been modified within a style sheet.
virtual void StyleRuleAdded (nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, nsIStyleRule *aStyleRule)=0
 A StyleRule has just been added to a style sheet.
virtual void StyleRuleRemoved (nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, nsIStyleRule *aStyleRule)=0
 A StyleRule has just been removed from a style sheet.

Public Attributes

readonly attribute long rowCount
 The total number of rows in the tree (including the offscreen rows).
attribute nsITreeSelection selection
 The selection for this view.
const short DROP_BEFORE = -1
const short DROP_ON = 0
const short DROP_AFTER = 1
const short PROGRESS_NORMAL = 1
 The progress mode for a given cell.
const short PROGRESS_UNDETERMINED = 2
const short PROGRESS_NONE = 3

Protected Member Functions

void Serialize (nsIContent *aContent, PRInt32 aParentIndex, PRInt32 *aIndex, nsVoidArray &aRows)
void SerializeItem (nsIContent *aContent, PRInt32 aParentIndex, PRInt32 *aIndex, nsVoidArray &aRows)
void SerializeSeparator (nsIContent *aContent, PRInt32 aParentIndex, PRInt32 *aIndex, nsVoidArray &aRows)
void SerializeOption (nsIContent *aContent, PRInt32 aParentIndex, PRInt32 *aIndex, nsVoidArray &aRows)
void SerializeOptGroup (nsIContent *aContent, PRInt32 aParentIndex, PRInt32 *aIndex, nsVoidArray &aRows)
void GetIndexInSubtree (nsIContent *aContainer, nsIContent *aContent, PRInt32 *aResult)
PRInt32 EnsureSubtree (PRInt32 aIndex)
PRInt32 RemoveSubtree (PRInt32 aIndex)
PRInt32 InsertRow (PRInt32 aParentIndex, PRInt32 aIndex, nsIContent *aContent)
void InsertRowFor (nsIContent *aParent, nsIContent *aChild)
PRInt32 RemoveRow (PRInt32 aIndex)
void ClearRows ()
void OpenContainer (PRInt32 aIndex)
void CloseContainer (PRInt32 aIndex)
PRInt32 FindContent (nsIContent *aContent)
void UpdateSubtreeSizes (PRInt32 aIndex, PRInt32 aCount)
void UpdateParentIndexes (PRInt32 aIndex, PRInt32 aSkip, PRInt32 aCount)
nsIContentGetCell (nsIContent *aContainer, nsITreeColumn *aCol)

Private Attributes

nsCOMPtr< nsITreeBoxObjectmBoxObject
nsCOMPtr< nsITreeSelectionmSelection
nsCOMPtr< nsIContentmRoot
nsIDocumentmDocument
nsFixedSizeAllocator mAllocator
nsVoidArray mRows
PRPackedBool mUpdateSelection

Friends

nsresult NS_NewTreeContentView (nsITreeContentView **aResult)

Detailed Description

Definition at line 53 of file nsTreeContentView.h.


Constructor & Destructor Documentation

Definition at line 128 of file nsTreeContentView.cpp.

                                         :
  mBoxObject(nsnull),
  mSelection(nsnull),
  mRoot(nsnull),
  mDocument(nsnull),
  mUpdateSelection(PR_FALSE)
{
  static const size_t kBucketSizes[] = {
    sizeof(Row)
  };
  static const PRInt32 kNumBuckets = sizeof(kBucketSizes) / sizeof(size_t);
  static const PRInt32 kInitialSize = 16;

  mAllocator.Init("nsTreeContentView", kBucketSizes, kNumBuckets, kInitialSize);
}

Here is the caller graph for this function:

Definition at line 144 of file nsTreeContentView.cpp.

{
  // Remove ourselves from mDocument's observers.
  if (mDocument)
    mDocument->RemoveObserver(this);
}

Here is the call graph for this function:


Member Function Documentation

void nsTreeContentView::AttributeChanged ( nsIDocument aDocument,
nsIContent aContent,
PRInt32  aNameSpaceID,
nsIAtom aAttribute,
PRInt32  aModType 
) [virtual]

Notification that the content model has changed.

This method is called automatically by content objects when an attribute's value has changed (therefore there is normally no need to invoke this method directly). The notification is passed to any IDocumentObservers document observers.

Parameters:
aDocumentThe document being observed
aContentthe piece of content whose attribute changed
aAttributethe atom name of the attribute
aModTypeWhether or not the attribute was added, changed, or removed. The constants are defined in nsIDOMMutationEvent.h.

Implements nsIDocumentObserver.

Definition at line 734 of file nsTreeContentView.cpp.

{
  // Make sure this notification concerns us.
  // First check the tag to see if it's one that we care about.
  nsIAtom *tag = aContent->Tag();

  if (aContent->IsContentOfType(nsIContent::eXUL)) {
    if (tag != nsXULAtoms::treecol &&
        tag != nsXULAtoms::treeitem &&
        tag != nsXULAtoms::treeseparator &&
        tag != nsXULAtoms::treerow &&
        tag != nsXULAtoms::treecell)
      return;
  }
  else {
    return;
  }

  // If we have a legal tag, go up to the tree and make sure that it's ours.
  nsCOMPtr<nsIContent> parent = aContent;
  nsINodeInfo *ni = nsnull;
  do {
    parent = parent->GetParent();
    if (parent)
      ni = parent->GetNodeInfo();
  } while (parent && !ni->Equals(nsXULAtoms::tree, kNameSpaceID_XUL));

  if (parent != mRoot) {
    // This is not for us, we can bail out.
    return;
  }

  // Handle changes of the hidden attribute.
  if (aAttribute == nsHTMLAtoms::hidden &&
     (tag == nsXULAtoms::treeitem || tag == nsXULAtoms::treeseparator)) {
    nsAutoString hiddenString;
    aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::hidden, hiddenString);
    PRBool hidden = hiddenString.EqualsLiteral("true");
 
    PRInt32 index = FindContent(aContent);
    if (hidden && index >= 0) {
      // Hide this row along with its children.
      PRInt32 count = RemoveRow(index);
      if (mBoxObject)
        mBoxObject->RowCountChanged(index, -count);
    }
    else if (!hidden && index < 0) {
      // Show this row along with its children.
      nsCOMPtr<nsIContent> parent = aContent->GetParent();
      if (parent) {
        InsertRowFor(parent, aContent);
      }
    }

    return;
  }

  if (tag == nsXULAtoms::treecol) {
    if (aAttribute == nsXULAtoms::properties) {
      if (mBoxObject) {
        nsCOMPtr<nsITreeColumns> cols;
        mBoxObject->GetColumns(getter_AddRefs(cols));
        if (cols) {
          nsCOMPtr<nsIDOMElement> element = do_QueryInterface(aContent);
          nsCOMPtr<nsITreeColumn> col;
          cols->GetColumnFor(element, getter_AddRefs(col));
          mBoxObject->InvalidateColumn(col);
        }
      }
    }
  }
  else if (tag == nsXULAtoms::treeitem) {
    PRInt32 index = FindContent(aContent);
    if (index >= 0) {
      Row* row = (Row*)mRows[index];
      if (aAttribute == nsXULAtoms::container) {
        nsAutoString container;
        aContent->GetAttr(kNameSpaceID_None, nsXULAtoms::container, container);
        PRBool isContainer = container.EqualsLiteral("true");
        row->SetContainer(isContainer);
        if (mBoxObject)
          mBoxObject->InvalidateRow(index);
      }
      else if (aAttribute == nsXULAtoms::open) {
        nsAutoString open;
        aContent->GetAttr(kNameSpaceID_None, nsXULAtoms::open, open);
        PRBool isOpen = open.EqualsLiteral("true");
        PRBool wasOpen = row->IsOpen();
        if (! isOpen && wasOpen)
          CloseContainer(index);
        else if (isOpen && ! wasOpen)
          OpenContainer(index);
      }
      else if (aAttribute == nsXULAtoms::empty) {
        nsAutoString empty;
        aContent->GetAttr(kNameSpaceID_None, nsXULAtoms::empty, empty);
        PRBool isEmpty = empty.EqualsLiteral("true");
        row->SetEmpty(isEmpty);
        if (mBoxObject)
          mBoxObject->InvalidateRow(index);
      }
    }
  }
  else if (tag == nsXULAtoms::treeseparator) {
    PRInt32 index = FindContent(aContent);
    if (index >= 0) {
      if (aAttribute == nsXULAtoms::properties && mBoxObject) {
        mBoxObject->InvalidateRow(index);
      }
    }
  }
  else if (tag == nsXULAtoms::treerow) {
    if (aAttribute == nsXULAtoms::properties) {
      nsCOMPtr<nsIContent> parent = aContent->GetParent();
      if (parent) {
        PRInt32 index = FindContent(parent);
        if (index >= 0 && mBoxObject) {
          mBoxObject->InvalidateRow(index);
        }
      }
    }
  }
  else if (tag == nsXULAtoms::treecell) {
    if (aAttribute == nsXULAtoms::ref ||
        aAttribute == nsXULAtoms::properties ||
        aAttribute == nsXULAtoms::mode ||
        aAttribute == nsHTMLAtoms::src ||
        aAttribute == nsHTMLAtoms::value ||
        aAttribute == nsHTMLAtoms::label) {
      nsIContent* parent = aContent->GetParent();
      if (parent) {
        nsCOMPtr<nsIContent> grandParent = parent->GetParent();
        if (grandParent) {
          PRInt32 index = FindContent(grandParent);
          if (index >= 0 && mBoxObject) {
            // XXX Should we make an effort to invalidate only cell ?
            mBoxObject->InvalidateRow(index);
          }
        }
      }
    }
  }
}

Here is the call graph for this function:

virtual void nsIDocumentObserver::BeginLoad ( nsIDocument aDocument) [pure virtual, inherited]

Notify the observer that a document load is beginning.

Implemented in PresShell.

virtual void nsIDocumentObserver::BeginReflow ( nsIDocument aDocument,
nsIPresShell aShell 
) [pure virtual, inherited]

Notify the observer that the document is being reflowed in the given presentation shell.

virtual void nsIDocumentObserver::BeginUpdate ( nsIDocument aDocument,
nsUpdateType  aUpdateType 
) [pure virtual, inherited]

Notify that a content model update is beginning.

This call can be nested.

Implemented in nsFragmentObserver, PresShell, HTMLContentSink, and nsXMLPrettyPrinter.

boolean nsITreeView::canDrop ( in long  index,
in long  orientation 
) [inherited]

Methods used by the drag feedback code to determine if a drag is allowable at the current location.

To get the behavior where drops are only allowed on items, such as the mailNews folder pane, always return false when the orientation is not DROP_ON.

virtual void nsIDocumentObserver::CharacterDataChanged ( nsIDocument aDocument,
nsIContent aContent,
PRBool  aAppend 
) [pure virtual, inherited]

Notification that the content model has changed.

This method is called automatically by content objects when their state is changed (therefore there is normally no need to invoke this method directly). The notification is passed to any IDocumentObservers. The notification is passed on to all of the document observers.

This notification is not sent when a piece of content is added/removed from the document (the other notifications are used for that).

Parameters:
aDocumentThe document being observed
aContentthe piece of content that changed
aAppendWhether the change was an append

Implemented in PresShell.

Definition at line 1387 of file nsTreeContentView.cpp.

{
  for (PRInt32 i = 0; i < mRows.Count(); i++)
    Row::Destroy(mAllocator, (Row*)mRows[i]);
  mRows.Clear();
  mRoot = nsnull;
} 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1409 of file nsTreeContentView.cpp.

{
  Row* row = (Row*)mRows[aIndex];
  row->SetOpen(PR_FALSE);

  PRInt32 count = RemoveSubtree(aIndex);
  if (mBoxObject) {
    mBoxObject->InvalidateRow(aIndex);
    mBoxObject->RowCountChanged(aIndex + 1, -count);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsTreeContentView::ContentAppended ( nsIDocument aDocument,
nsIContent aContainer,
PRInt32  aNewIndexInContainer 
) [virtual]

Notifcation that the content model has had data appended to the given content object.

This method is called automatically by the content container objects when a new content object is appended to the container (therefore there is normally no need to invoke this method directly). The notification is passed on to all of the document observers.

Parameters:
aDocumentThe document being observed
aContainerthe container that had a new child appended
aNewIndexInContainerthe index in the container of the first new child

Implements nsIDocumentObserver.

Definition at line 883 of file nsTreeContentView.cpp.

{
  PRUint32 childCount = aContainer->GetChildCount();
  while ((PRUint32)aNewIndexInContainer < childCount) {
    nsIContent *child = aContainer->GetChildAt(aNewIndexInContainer);
    ContentInserted(aDocument, aContainer, child, aNewIndexInContainer);
    aNewIndexInContainer++;
  }
}

Here is the call graph for this function:

void nsTreeContentView::ContentInserted ( nsIDocument aDocument,
nsIContent aContainer,
nsIContent aChild,
PRInt32  aIndexInContainer 
) [virtual]

Notification that content has been inserted.

This method is called automatically by the content container objects when a new content object is inserted in the container (therefore there is normally no need to invoke this method directly). The notification is passed on to all of the document observers.

Parameters:
aDocumentThe document being observed
aContainerthe container that now contains aChild
aChildthe child that was inserted
aIndexInContainerthe index of the child in the container

Implements nsIDocumentObserver.

Definition at line 896 of file nsTreeContentView.cpp.

{
  NS_ASSERTION(aChild, "null ptr");

  // Make sure this notification concerns us.
  // First check the tag to see if it's one that we care about.
  nsIAtom *childTag = aChild->Tag();

  if (aChild->IsContentOfType(nsIContent::eHTML)) {
    if (childTag != nsHTMLAtoms::option &&
        childTag != nsHTMLAtoms::optgroup)
      return;
  }
  else if (aChild->IsContentOfType(nsIContent::eXUL)) {
    if (childTag != nsXULAtoms::treeitem &&
        childTag != nsXULAtoms::treeseparator &&
        childTag != nsXULAtoms::treechildren &&
        childTag != nsXULAtoms::treerow &&
        childTag != nsXULAtoms::treecell)
      return;
  }
  else {
    return;
  }

  // If we have a legal tag, go up to the tree/select and make sure
  // that it's ours.

  for (nsIContent* element = aContainer; element != mRoot; element = element->GetParent()) {
    if (!element)
      return; // this is not for us
    nsIAtom *parentTag = element->Tag();
    if ((element->IsContentOfType(nsIContent::eXUL) && parentTag == nsXULAtoms::tree) ||
        (element->IsContentOfType(nsIContent::eHTML) && parentTag == nsHTMLAtoms::select))
      return; // this is not for us
  }

  if (childTag == nsXULAtoms::treechildren) {
    PRInt32 index = FindContent(aContainer);
    if (index >= 0) {
      Row* row = (Row*)mRows[index];
      row->SetEmpty(PR_FALSE);
      if (mBoxObject)
        mBoxObject->InvalidateRow(index);
      if (row->IsContainer() && row->IsOpen()) {
        PRInt32 count = EnsureSubtree(index);
        if (mBoxObject)
          mBoxObject->RowCountChanged(index + 1, count);
      }
    }
  }
  else if (childTag == nsXULAtoms::treeitem ||
           childTag == nsXULAtoms::treeseparator) {
    InsertRowFor(aContainer, aChild);
  }
  else if (childTag == nsXULAtoms::treerow) {
    PRInt32 index = FindContent(aContainer);
    if (index >= 0 && mBoxObject)
      mBoxObject->InvalidateRow(index);
  }
  else if (childTag == nsXULAtoms::treecell) {
    nsCOMPtr<nsIContent> parent = aContainer->GetParent();
    if (parent) {
      PRInt32 index = FindContent(parent);
      if (index >= 0 && mBoxObject)
        mBoxObject->InvalidateRow(index);
    }
  }
  else if (childTag == nsHTMLAtoms::optgroup) {
    InsertRowFor(aContainer, aChild);
  }
  else if (childTag == nsHTMLAtoms::option) {
    PRInt32 parentIndex = FindContent(aContainer);
    PRInt32 count = InsertRow(parentIndex, aIndexInContainer, aChild);
    if (mBoxObject)
      mBoxObject->RowCountChanged(parentIndex + aIndexInContainer + 1, count);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsTreeContentView::ContentRemoved ( nsIDocument aDocument,
nsIContent aContainer,
nsIContent aChild,
PRInt32  aIndexInContainer 
) [virtual]

Content has just been removed.

This method is called automatically by content container objects when a content object has just been removed from the container (therefore there is normally no need to invoke this method directly). The notification is passed on to all of the document observers.

Parameters:
aDocumentThe document being observed
aContainerthe container that had a child removed
aChildthe child that was just removed
aIndexInContainerthe index of the child in the container before it was removed

Implements nsIDocumentObserver.

Definition at line 979 of file nsTreeContentView.cpp.

{
  NS_ASSERTION(aChild, "null ptr");

  // Make sure this notification concerns us.
  // First check the tag to see if it's one that we care about.
  nsIAtom *tag = aChild->Tag();

  if (aChild->IsContentOfType(nsIContent::eHTML)) {
    if (tag != nsHTMLAtoms::option &&
        tag != nsHTMLAtoms::optgroup)
      return;
  }
  else if (aChild->IsContentOfType(nsIContent::eXUL)) {
    if (tag != nsXULAtoms::treeitem &&
        tag != nsXULAtoms::treeseparator &&
        tag != nsXULAtoms::treechildren &&
        tag != nsXULAtoms::treerow &&
        tag != nsXULAtoms::treecell)
      return;
  }
  else {
    return;
  }

  // If we have a legal tag, go up to the tree/select and make sure
  // that it's ours.

  for (nsIContent* element = aContainer; element != mRoot; element = element->GetParent()) {
    if (!element)
      return; // this is not for us
    nsIAtom *parentTag = element->Tag();
    if ((element->IsContentOfType(nsIContent::eXUL) && parentTag == nsXULAtoms::tree) || 
        (element->IsContentOfType(nsIContent::eHTML) && parentTag == nsHTMLAtoms::select))
      return; // this is not for us
  }

  if (tag == nsXULAtoms::treechildren) {
    PRInt32 index = FindContent(aContainer);
    if (index >= 0) {
      Row* row = (Row*)mRows[index];
      row->SetEmpty(PR_TRUE);
      PRInt32 count = RemoveSubtree(index);
      // Invalidate also the row to update twisty.
      if (mBoxObject) {
        mBoxObject->InvalidateRow(index);
        mBoxObject->RowCountChanged(index + 1, -count);
      }
    }
    else if (aContainer->Tag() == nsXULAtoms::tree) {
      PRInt32 count = mRows.Count();
      ClearRows();
      if (count && mBoxObject)
        mBoxObject->RowCountChanged(0, -count);
    }
  }
  else if (tag == nsXULAtoms::treeitem ||
           tag == nsXULAtoms::treeseparator ||
           tag == nsHTMLAtoms::option ||
           tag == nsHTMLAtoms::optgroup
          ) {
    PRInt32 index = FindContent(aChild);
    if (index >= 0) {
      PRInt32 count = RemoveRow(index);
      if (mBoxObject)
        mBoxObject->RowCountChanged(index, -count);
    }
  }
  else if (tag == nsXULAtoms::treerow) {
    PRInt32 index = FindContent(aContainer);
    if (index >= 0 && mBoxObject)
      mBoxObject->InvalidateRow(index);
  }
  else if (tag == nsXULAtoms::treecell) {
    nsCOMPtr<nsIContent> parent = aContainer->GetParent();
    if (parent) {
      PRInt32 index = FindContent(parent);
      if (index >= 0 && mBoxObject)
        mBoxObject->InvalidateRow(index);
    }
  }
}

Here is the call graph for this function:

void nsTreeContentView::ContentStatesChanged ( nsIDocument aDocument,
nsIContent aContent1,
nsIContent aContent2,
PRInt32  aStateMask 
) [virtual]

Notification that the state of a content node has changed.

(ie: gained or lost focus, became active or hovered over) This method is called automatically by content objects when their state is changed (therefore there is normally no need to invoke this method directly). The notification is passed to any IDocumentObservers. The notification is passed on to all of the document observers.

This notification is not sent when a piece of content is added/removed from the document or the content itself changed (the other notifications are used for that).

The optional second content node is to allow optimization of the case where state moves from one node to another (as is likely for :focus and :hover)

Either content node may be nsnull, but not both

Parameters:
aDocumentThe document being observed
aContent1the piece of content that changed
aContent2optional second piece of content that changed

Implements nsIDocumentObserver.

Definition at line 715 of file nsTreeContentView.cpp.

{
  if (!aContent1 || !mSelection ||
      !aContent1->IsContentOfType(nsIContent::eHTML) ||
      !(aStateMask & NS_EVENT_STATE_CHECKED))
    return;

  if (aContent1->Tag() == nsHTMLAtoms::option) {
    // update the selected state for this node
    PRInt32 index = FindContent(aContent1);
    if (index >= 0)
      mSelection->ToggleSelect(index);
  }
}

Here is the call graph for this function:

void nsITreeView::cycleCell ( in long  row,
in nsITreeColumn  col 
) [inherited]

Called on the view when a cell in a non-selectable cycling column (e.g., unread/flag/etc.) is clicked.

Called on the view when a header is clicked.

The document is in the process of being destroyed.

This method is called automatically during document destruction.

Parameters:
aDocumentThe document being observed

Implements nsIDocumentObserver.

Definition at line 1066 of file nsTreeContentView.cpp.

{
  // Remove ourselves from mDocument's observers.
  if (mDocument) {
    mDocument->RemoveObserver(this);
    mDocument = nsnull;
  }

  ClearRows();
}

Here is the call graph for this function:

void nsITreeView::drop ( in long  row,
in long  orientation 
) [inherited]

Called when the user drops something on this view.

The |orientation| param specifies before/on/after the given |row|.

virtual void nsIDocumentObserver::EndLoad ( nsIDocument aDocument) [pure virtual, inherited]

Notify the observer that a document load has finished.

Note that the associated reflow of the document will be done before EndLoad is invoked, not after.

Implemented in PresShell.

virtual void nsIDocumentObserver::EndReflow ( nsIDocument aDocument,
nsIPresShell aShell 
) [pure virtual, inherited]

Notify the observer that the document is done being reflowed in the given presentation shell.

virtual void nsIDocumentObserver::EndUpdate ( nsIDocument aDocument,
nsUpdateType  aUpdateType 
) [pure virtual, inherited]

Notify that a content model update is finished.

This call can be nested.

Implemented in PresShell, HTMLContentSink, and nsXMLPrettyPrinter.

Definition at line 68 of file nsTreeContentView.h.

{ return NS_OK; }

Definition at line 1247 of file nsTreeContentView.cpp.

{
  Row* row = (Row*)mRows[aIndex];

  nsCOMPtr<nsIContent> child;
  if (row->mContent->Tag() == nsHTMLAtoms::optgroup)
    child = row->mContent;
  else {
    nsTreeUtils::GetImmediateChild(row->mContent, nsXULAtoms::treechildren, getter_AddRefs(child));
    if (! child) {
      return 0;
    }
  }

  nsAutoVoidArray rows;
  PRInt32 index = 0;
  Serialize(child, aIndex, &index, rows);
  mRows.InsertElementsAt(rows, aIndex + 1);
  PRInt32 count = rows.Count();

  row->mSubtreeSize += count;
  UpdateSubtreeSizes(row->mParentIndex, count);

  // Update parent indexes, but skip newly added rows.
  // They already have correct values.
  UpdateParentIndexes(aIndex, count + 1, count);

  return count;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsTreeContentView::FindContent ( nsIContent aContent) [protected]

Definition at line 1422 of file nsTreeContentView.cpp.

{
  for (PRInt32 i = 0; i < mRows.Count(); i++) {
    if (((Row*)mRows[i])->mContent == aContent) {
      return i;
    }
  }

  return -1;
}

Here is the caller graph for this function:

nsIContent * nsTreeContentView::GetCell ( nsIContent aContainer,
nsITreeColumn aCol 
) [protected]

Definition at line 1456 of file nsTreeContentView.cpp.

{
  const PRUnichar* colID;
  PRInt32 colIndex;
  aCol->GetIdConst(&colID);
  aCol->GetIndex(&colIndex);

  // Traverse through cells, try to find the cell by "ref" attribute or by cell
  // index in a row. "ref" attribute has higher priority.
  nsIContent* result = nsnull;
  PRInt32 j = 0;
  ChildIterator iter, last;
  for (ChildIterator::Init(aContainer, &iter, &last); iter != last; ++iter) {
    nsCOMPtr<nsIContent> cell = *iter;

    if (cell->Tag() == nsXULAtoms::treecell) {
      nsAutoString ref;
      cell->GetAttr(kNameSpaceID_None, nsXULAtoms::ref, ref);
      if (!ref.IsEmpty() && ref.Equals(colID)) {
        result = cell;
        break;
      }
      else if (j == colIndex) {
        result = cell;
      }
      j++;
    }
  }

  return result;
}

Here is the call graph for this function:

void nsITreeView::getCellProperties ( in long  row,
in nsITreeColumn  col,
in nsISupportsArray  properties 
) [inherited]

An atomized list of properties for a given cell.

Each property, x, that the view gives back will cause the pseudoclass :moz-tree-cell-x to be matched on the ::moz-tree-cell pseudoelement.

AString nsITreeView::getCellText ( in long  row,
in nsITreeColumn  col 
) [inherited]

The text for a given cell.

If a column consists only of an image, then the empty string is returned.

AString nsITreeView::getCellValue ( in long  row,
in nsITreeColumn  col 
) [inherited]

The value for a given cell.

This method is only called for columns of type other than |text|.

Called to get properties to paint a column background.

For shading the sort column, etc.

AString nsITreeView::getImageSrc ( in long  row,
in nsITreeColumn  col 
) [inherited]

The image path for a given cell.

For defining an icon for a cell. If the empty string is returned, the :moz-tree-image pseudoelement will be used.

void nsTreeContentView::GetIndexInSubtree ( nsIContent aContainer,
nsIContent aContent,
PRInt32 aResult 
) [protected]

Definition at line 1196 of file nsTreeContentView.cpp.

{
  PRUint32 childCount = aContainer->GetChildCount();
  for (PRUint32 i = 0; i < childCount; i++) {
    nsIContent *content = aContainer->GetChildAt(i);

    if (content == aContent)
      break;

    nsIAtom *tag = content->Tag();

    if (content->IsContentOfType(nsIContent::eXUL)) {
      if (tag == nsXULAtoms::treeitem) {
        nsAutoString hidden;
        content->GetAttr(kNameSpaceID_None, nsHTMLAtoms::hidden, hidden);
        if (! hidden.EqualsLiteral("true")) {
          (*aIndex)++;
          nsAutoString container;
          content->GetAttr(kNameSpaceID_None, nsXULAtoms::container, container);
          if (container.EqualsLiteral("true")) {
            nsAutoString open;
            content->GetAttr(kNameSpaceID_None, nsXULAtoms::open, open);
            if (open.EqualsLiteral("true")) {
              nsCOMPtr<nsIContent> child;
              nsTreeUtils::GetImmediateChild(content, nsXULAtoms::treechildren, getter_AddRefs(child));
              if (child)
                GetIndexInSubtree(child, aContent, aIndex);
            }
          }
        }
      }
      else if (tag == nsXULAtoms::treeseparator) {
        nsAutoString hidden;
        content->GetAttr(kNameSpaceID_None, nsHTMLAtoms::hidden, hidden);
        if (! hidden.EqualsLiteral("true"))
          (*aIndex)++;
      }
    }
    else if (content->IsContentOfType(nsIContent::eHTML)) {
      if (tag == nsHTMLAtoms::optgroup) {
        (*aIndex)++;
        GetIndexInSubtree(content, aContent, aIndex);
      }
      else if (tag == nsHTMLAtoms::option)
        (*aIndex)++;
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Retrieve the index associated with the specified content item.

Retrieve the content item associated with the specified index.

long nsITreeView::getLevel ( in long  index) [inherited]

The level is an integer value that represents the level of indentation.

It is multiplied by the width specified in the :moz-tree-indentation pseudoelement to compute the exact indendation.

long nsITreeView::getParentIndex ( in long  rowIndex) [inherited]

Methods used by the tree to draw thread lines in the tree.

getParentIndex is used to obtain the index of a parent row. If there is no parent row, getParentIndex returns -1.

long nsITreeView::getProgressMode ( in long  row,
in nsITreeColumn  col 
) [inherited]
void nsITreeView::getRowProperties ( in long  index,
in nsISupportsArray  properties 
) [inherited]

An atomized list of properties for a given row.

Each property, x, that the view gives back will cause the pseudoclass :moz-tree-row-x to be matched on the pseudoelement ::moz-tree-row.

boolean nsITreeView::hasNextSibling ( in long  rowIndex,
in long  afterIndex 
) [inherited]

hasNextSibling is used to determine if the row at rowIndex has a nextSibling that occurs after the index specified by afterIndex.

Code that is forced to march down the view looking at levels can optimize the march by starting at afterIndex+1.

PRInt32 nsTreeContentView::InsertRow ( PRInt32  aParentIndex,
PRInt32  aIndex,
nsIContent aContent 
) [protected]

Definition at line 1336 of file nsTreeContentView.cpp.

{
  nsAutoVoidArray rows;
  nsIAtom *tag = aContent->Tag();
  if (aContent->IsContentOfType(nsIContent::eXUL)) {
    if (tag == nsXULAtoms::treeitem)
      SerializeItem(aContent, aParentIndex, &aIndex, rows);
    else if (tag == nsXULAtoms::treeseparator)
      SerializeSeparator(aContent, aParentIndex, &aIndex, rows);
  }
  else if (aContent->IsContentOfType(nsIContent::eHTML)) {
    if (tag == nsHTMLAtoms::option)
      SerializeOption(aContent, aParentIndex, &aIndex, rows);
    else if (tag == nsHTMLAtoms::optgroup)
      SerializeOptGroup(aContent, aParentIndex, &aIndex, rows);
  }

  mRows.InsertElementsAt(rows, aParentIndex + aIndex + 1);
  PRInt32 count = rows.Count();

  UpdateSubtreeSizes(aParentIndex, count);

  // Update parent indexes, but skip added rows.
  // They already have correct values.
  UpdateParentIndexes(aParentIndex + aIndex, count + 1, count);

  return count;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsTreeContentView::InsertRowFor ( nsIContent aParent,
nsIContent aChild 
) [protected]

Definition at line 1298 of file nsTreeContentView.cpp.

{
  PRInt32 grandParentIndex = -1;
  PRBool insertRow = PR_FALSE;

  nsCOMPtr<nsIContent> grandParent = aParent->GetParent();
  nsIAtom* grandParentTag = grandParent->Tag();

  if ((grandParent->IsContentOfType(nsIContent::eXUL) && grandParentTag == nsXULAtoms::tree) ||
      (grandParent->IsContentOfType(nsIContent::eHTML) && grandParentTag == nsHTMLAtoms::select)
     ) {
    // Allow insertion to the outermost container.
    insertRow = PR_TRUE;
  }
  else {
    // Test insertion to an inner container.

    // First try to find this parent in our array of rows, if we find one
    // we can be sure that all other parents are open too.
    grandParentIndex = FindContent(grandParent);
    if (grandParentIndex >= 0) {
      // Got it, now test if it is open.
      if (((Row*)mRows[grandParentIndex])->IsOpen())
        insertRow = PR_TRUE;
    }
  }

  if (insertRow) {
    PRInt32 index = 0;
    GetIndexInSubtree(aParent, aChild, &index);

    PRInt32 count = InsertRow(grandParentIndex, index, aChild);
    if (mBoxObject)
      mBoxObject->RowCountChanged(grandParentIndex + index + 1, count);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

boolean nsITreeView::isContainer ( in long  index) [inherited]

Methods that can be used to test whether or not a twisty should be drawn, and if so, whether an open or closed twisty should be used.

Here is the caller graph for this function:

boolean nsITreeView::isContainerEmpty ( in long  index) [inherited]
boolean nsITreeView::isContainerOpen ( in long  index) [inherited]
boolean nsITreeView::isEditable ( in long  row,
in nsITreeColumn  col 
) [inherited]

isEditable is called to ask the view if the cell contents are editable.

A value of true will result in the tree popping up a text field when the user tries to inline edit the cell.

boolean nsITreeView::isSeparator ( in long  index) [inherited]

isSeparator is used to determine if the row at index is a separator.

A value of true will result in the tree drawing a horizontal separator. The tree uses the ::moz-tree-separator pseudoclass to draw the separator.

boolean nsITreeView::isSorted ( ) [inherited]

Specifies if there is currently a sort on any column.

Used mostly by dragdrop to affect drop feedback.

Definition at line 1396 of file nsTreeContentView.cpp.

{
  Row* row = (Row*)mRows[aIndex];
  row->SetOpen(PR_TRUE);

  PRInt32 count = EnsureSubtree(aIndex);
  if (mBoxObject) {
    mBoxObject->InvalidateRow(aIndex);
    mBoxObject->RowCountChanged(aIndex + 1, count);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsITreeView::performAction ( in wstring  action) [inherited]

A command API that can be used to invoke commands on the selection.

The tree will automatically invoke this method when certain keys are pressed. For example, when the DEL key is pressed, performAction will be called with the "delete" string.

void nsITreeView::performActionOnCell ( in wstring  action,
in long  row,
in nsITreeColumn  col 
) [inherited]

A command API that can be used to invoke commands on a specific cell.

void nsITreeView::performActionOnRow ( in wstring  action,
in long  row 
) [inherited]

A command API that can be used to invoke commands on a specific row.

PRInt32 nsTreeContentView::RemoveRow ( PRInt32  aIndex) [protected]

Definition at line 1366 of file nsTreeContentView.cpp.

{
  Row* row = (Row*)mRows[aIndex];
  PRInt32 count = row->mSubtreeSize + 1;
  PRInt32 parentIndex = row->mParentIndex;

  Row::Destroy(mAllocator, row);
  for(PRInt32 i = 1; i < count; i++) {
    Row* nextRow = (Row*)mRows[aIndex + i];
    Row::Destroy(mAllocator, nextRow);
  }
  mRows.RemoveElementsAt(aIndex, count);

  UpdateSubtreeSizes(parentIndex, -count);
  
  UpdateParentIndexes(aIndex, 0, -count);

  return count;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1278 of file nsTreeContentView.cpp.

{
  Row* row = (Row*)mRows[aIndex];
  PRInt32 count = row->mSubtreeSize;

  for(PRInt32 i = 0; i < count; i++) {
    Row* nextRow = (Row*)mRows[aIndex + i + 1];
    Row::Destroy(mAllocator, nextRow);
  }
  mRows.RemoveElementsAt(aIndex + 1, count);

  row->mSubtreeSize -= count;
  UpdateSubtreeSizes(row->mParentIndex, -count);

  UpdateParentIndexes(aIndex, 0, -count);

  return count;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Should be called from a XUL onselect handler whenever the selection changes.

void nsTreeContentView::Serialize ( nsIContent aContent,
PRInt32  aParentIndex,
PRInt32 aIndex,
nsVoidArray aRows 
) [protected]

Definition at line 1080 of file nsTreeContentView.cpp.

{
  ChildIterator iter, last;
  for (ChildIterator::Init(aContent, &iter, &last); iter != last; ++iter) {
    nsCOMPtr<nsIContent> content = *iter;
    nsIAtom *tag = content->Tag();
    PRInt32 count = aRows.Count();

    if (content->IsContentOfType(nsIContent::eXUL)) {
      if (tag == nsXULAtoms::treeitem)
        SerializeItem(content, aParentIndex, aIndex, aRows);
      else if (tag == nsXULAtoms::treeseparator)
        SerializeSeparator(content, aParentIndex, aIndex, aRows);
    }
    else if (content->IsContentOfType(nsIContent::eHTML)) {
      if (tag == nsHTMLAtoms::option)
        SerializeOption(content, aParentIndex, aIndex, aRows);
      else if (tag == nsHTMLAtoms::optgroup)
        SerializeOptGroup(content, aParentIndex, aIndex, aRows);
    }
    *aIndex += aRows.Count() - count;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsTreeContentView::SerializeItem ( nsIContent aContent,
PRInt32  aParentIndex,
PRInt32 aIndex,
nsVoidArray aRows 
) [protected]

Definition at line 1105 of file nsTreeContentView.cpp.

{
  nsAutoString hidden;
  aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::hidden, hidden);
  if (hidden.EqualsLiteral("true"))
    return;

  Row* row = Row::Create(mAllocator, aContent, aParentIndex);
  aRows.AppendElement(row);

  nsAutoString container;
  aContent->GetAttr(kNameSpaceID_None, nsXULAtoms::container, container);
  if (container.EqualsLiteral("true")) {
    row->SetContainer(PR_TRUE);
    nsAutoString open;
    aContent->GetAttr(kNameSpaceID_None, nsXULAtoms::open, open);
    if (open.EqualsLiteral("true")) {
      row->SetOpen(PR_TRUE);
      nsCOMPtr<nsIContent> child;
      nsTreeUtils::GetImmediateChild(aContent, nsXULAtoms::treechildren, getter_AddRefs(child));
      if (child) {
        // Now, recursively serialize our child.
        PRInt32 count = aRows.Count();
        PRInt32 index = 0;
        Serialize(child, aParentIndex + *aIndex + 1, &index, aRows);
        row->mSubtreeSize += aRows.Count() - count;
      }
      else
        row->SetEmpty(PR_TRUE);
    } else {
      nsAutoString empty;
      aContent->GetAttr(kNameSpaceID_None, nsXULAtoms::empty, empty);
      if (empty.EqualsLiteral("true"))
        row->SetEmpty(PR_TRUE);
    }
  } 
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsTreeContentView::SerializeOptGroup ( nsIContent aContent,
PRInt32  aParentIndex,
PRInt32 aIndex,
nsVoidArray aRows 
) [protected]

Definition at line 1174 of file nsTreeContentView.cpp.

{
  Row* row = Row::Create(mAllocator, aContent, aParentIndex);
  aRows.AppendElement(row);
  row->SetContainer(PR_TRUE);
  row->SetOpen(PR_TRUE);

  nsCOMPtr<nsIContent> child;
  nsTreeUtils::GetImmediateChild(aContent, nsHTMLAtoms::option, getter_AddRefs(child));
  if (child) {
    // Now, recursively serialize our child.
    PRInt32 count = aRows.Count();
    PRInt32 index = 0;
    Serialize(aContent, aParentIndex + *aIndex + 1, &index, aRows);
    row->mSubtreeSize += aRows.Count() - count;
  }
  else
    row->SetEmpty(PR_TRUE);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsTreeContentView::SerializeOption ( nsIContent aContent,
PRInt32  aParentIndex,
PRInt32 aIndex,
nsVoidArray aRows 
) [protected]

Definition at line 1157 of file nsTreeContentView.cpp.

{
  Row* row = Row::Create(mAllocator, aContent, aParentIndex);
  aRows.AppendElement(row);

  // This will happen before the TreeSelection is hooked up.  So, cache the selected
  // state in the row properties and update the selection when it is attached.

  nsCOMPtr<nsIDOMHTMLOptionElement> optEl = do_QueryInterface(aContent);
  PRBool isSelected;
  optEl->GetSelected(&isSelected);
  if (isSelected)
    mUpdateSelection = PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsTreeContentView::SerializeSeparator ( nsIContent aContent,
PRInt32  aParentIndex,
PRInt32 aIndex,
nsVoidArray aRows 
) [protected]

Definition at line 1144 of file nsTreeContentView.cpp.

{
  nsAutoString hidden;
  aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::hidden, hidden);
  if (hidden.EqualsLiteral("true"))
    return;

  Row* row = Row::Create(mAllocator, aContent, aParentIndex);
  row->SetSeparator(PR_TRUE);
  aRows.AppendElement(row);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsITreeView::setCellText ( in long  row,
in nsITreeColumn  col,
in AString  value 
) [inherited]

setCellText is called when the contents of the cell have been edited by the user.

void nsITreeView::setCellValue ( in long  row,
in nsITreeColumn  col,
in AString  value 
) [inherited]

setCellValue is called when the value of the cell has been set by the user.

This method is only called for columns of type other than |text|.

Called during initialization to link the view to the front end box object.

virtual void nsIDocumentObserver::StyleRuleAdded ( nsIDocument aDocument,
nsIStyleSheet aStyleSheet,
nsIStyleRule aStyleRule 
) [pure virtual, inherited]

A StyleRule has just been added to a style sheet.

This method is called automatically when the rule gets added to the sheet. The style sheet passes this notification to the document. The notification is passed on to all of the document observers.

Parameters:
aDocumentThe document being observed
aStyleSheetthe StyleSheet that has been modified
aStyleRulethe rule that was added

Implemented in PresShell.

virtual void nsIDocumentObserver::StyleRuleChanged ( nsIDocument aDocument,
nsIStyleSheet aStyleSheet,
nsIStyleRule aOldStyleRule,
nsIStyleRule aNewStyleRule 
) [pure virtual, inherited]

A StyleRule has just been modified within a style sheet.

This method is called automatically when the rule gets modified. The style sheet passes this notification to the document. The notification is passed on to all of the document observers.

Since nsIStyleRule objects are immutable, there is a new object replacing the old one. However, the use of this method (rather than StyleRuleAdded and StyleRuleRemoved) implies that the new rule matches the same elements and has the same priority (weight, origin, specificity) as the old one. (However, if it is a CSS style rule, there may be a change in whether it has an important rule.)

Parameters:
aDocumentThe document being observed
aStyleSheetthe StyleSheet that contians the rule
aOldStyleRuleThe rule being removed. This rule may not be fully valid anymore -- however, it can still be used for pointer comparison and |QueryInterface|.
aNewStyleRuleThe rule being added.

Implemented in PresShell.

virtual void nsIDocumentObserver::StyleRuleRemoved ( nsIDocument aDocument,
nsIStyleSheet aStyleSheet,
nsIStyleRule aStyleRule 
) [pure virtual, inherited]

A StyleRule has just been removed from a style sheet.

This method is called automatically when the rule gets removed from the sheet. The style sheet passes this notification to the document. The notification is passed on to all of the document observers.

Parameters:
aDocumentThe document being observed
aStyleSheetthe StyleSheet that has been modified
aStyleRulethe rule that was removed

Implemented in PresShell.

virtual void nsIDocumentObserver::StyleSheetAdded ( nsIDocument aDocument,
nsIStyleSheet aStyleSheet,
PRBool  aDocumentSheet 
) [pure virtual, inherited]

A StyleSheet has just been added to the document.

This method is called automatically when a StyleSheet gets added to the document, even if the stylesheet is not applicable. The notification is passed on to all of the document observers.

Parameters:
aDocumentThe document being observed
aStyleSheetthe StyleSheet that has been added
aDocumentSheetTrue if sheet is in document's style sheet list, false if sheet is not (i.e., UA or user sheet)

Implemented in PresShell, and nsDOMStyleSheetList.

virtual void nsIDocumentObserver::StyleSheetApplicableStateChanged ( nsIDocument aDocument,
nsIStyleSheet aStyleSheet,
PRBool  aApplicable 
) [pure virtual, inherited]

A StyleSheet has just changed its applicable state.

This method is called automatically when the applicable state of a StyleSheet gets changed. The style sheet passes this notification to the document. The notification is passed on to all of the document observers.

Parameters:
aDocumentThe document being observed
aStyleSheetthe StyleSheet that has changed state
aApplicablePR_TRUE if the sheet is applicable, PR_FALSE if it is not applicable

Implemented in PresShell.

virtual void nsIDocumentObserver::StyleSheetRemoved ( nsIDocument aDocument,
nsIStyleSheet aStyleSheet,
PRBool  aDocumentSheet 
) [pure virtual, inherited]

A StyleSheet has just been removed from the document.

This method is called automatically when a StyleSheet gets removed from the document, even if the stylesheet is not applicable. The notification is passed on to all of the document observers.

Parameters:
aDocumentThe document being observed
aStyleSheetthe StyleSheet that has been removed
aDocumentSheetTrue if sheet is in document's style sheet list, false if sheet is not (i.e., UA or user sheet)

Implemented in PresShell, and nsDOMStyleSheetList.

void nsITreeView::toggleOpenState ( in long  index) [inherited]

Called on the view when an item is opened or closed.

void nsTreeContentView::UpdateParentIndexes ( PRInt32  aIndex,
PRInt32  aSkip,
PRInt32  aCount 
) [protected]

Definition at line 1444 of file nsTreeContentView.cpp.

{
  PRInt32 count = mRows.Count();
  for (PRInt32 i = aIndex + aSkip; i < count; i++) {
    Row* row = (Row*)mRows[i];
    if (row->mParentIndex > aIndex) {
      row->mParentIndex += aCount;
    }
  }
}

Here is the caller graph for this function:

void nsTreeContentView::UpdateSubtreeSizes ( PRInt32  aIndex,
PRInt32  aCount 
) [protected]

Definition at line 1434 of file nsTreeContentView.cpp.

{
  while (aParentIndex >= 0) {
    Row* row = (Row*)mRows[aParentIndex];
    row->mSubtreeSize += count;
    aParentIndex = row->mParentIndex;
  }
}

Here is the caller graph for this function:


Friends And Related Function Documentation

Definition at line 152 of file nsTreeContentView.cpp.

{
  *aResult = new nsTreeContentView;
  if (! *aResult)
    return NS_ERROR_OUT_OF_MEMORY;
  NS_ADDREF(*aResult);
  return NS_OK;
}

Member Data Documentation

const short nsITreeView::DROP_AFTER = 1 [inherited]

Definition at line 103 of file nsITreeView.idl.

const short nsITreeView::DROP_BEFORE = -1 [inherited]

Definition at line 101 of file nsITreeView.idl.

const short nsITreeView::DROP_ON = 0 [inherited]

Definition at line 102 of file nsITreeView.idl.

nsFixedSizeAllocator nsTreeContentView::mAllocator [private]

Definition at line 138 of file nsTreeContentView.h.

Definition at line 134 of file nsTreeContentView.h.

Definition at line 137 of file nsTreeContentView.h.

Definition at line 136 of file nsTreeContentView.h.

Definition at line 139 of file nsTreeContentView.h.

Definition at line 135 of file nsTreeContentView.h.

Definition at line 141 of file nsTreeContentView.h.

const short nsITreeView::PROGRESS_NONE = 3 [inherited]

Definition at line 153 of file nsITreeView.idl.

const short nsITreeView::PROGRESS_NORMAL = 1 [inherited]

The progress mode for a given cell.

This method is only called for columns of type |progressmeter|.

Definition at line 151 of file nsITreeView.idl.

Definition at line 152 of file nsITreeView.idl.

readonly attribute long nsITreeView::rowCount [inherited]

The total number of rows in the tree (including the offscreen rows).

Definition at line 53 of file nsITreeView.idl.

The selection for this view.

Definition at line 58 of file nsITreeView.idl.


The documentation for this class was generated from the following files: