Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes
nsTreeSelection Class Reference

#include <nsTreeSelection.h>

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

List of all members.

Public Member Functions

 nsTreeSelection (nsITreeBoxObject *aTree)
 ~nsTreeSelection ()
boolean isSelected (in long index)
 Indicates whether or not the row at the specified index is part of the selection.
void select (in long index)
 Deselect all rows and select the row at the specified index.
void timedSelect (in long index, in long delay)
 Perform a timed select.
void toggleSelect (in long index)
 Toggle the selection state of the row at the specified index.
void rangedSelect (in long startIndex, in long endIndex, in boolean augment)
 Select the range specified by the indices.
void clearRange (in long startIndex, in long endIndex)
 Clears the range.
void clearSelection ()
 Clears the selection.
void invertSelection ()
 Inverts the selection.
void selectAll ()
 Selects all rows.
long getRangeCount ()
 Iterate the selection using these methods.
void getRangeAt (in long i, out long min, out long max)
void invalidateSelection ()
 Can be used to invalidate the selection.
void adjustSelection (in long index, in long count)
 Called when the row count changes to adjust selection indices.

Public Attributes

NS_DECL_ISUPPORTS friend struct nsTreeRange
attribute nsITreeBoxObject tree
 The tree widget for this selection.
readonly attribute boolean single
 This attribute is a boolean indicating single selection.
readonly attribute long count
 The number of rows currently selected in this tree.
attribute boolean selectEventsSuppressed
 This attribute is a boolean indicating whether or not the "select" event should fire when the selection is changed using one of our methods.
attribute long currentIndex
 The current item (the one that gets a focus rect in addition to being selected).
readonly attribute long shiftSelectPivot
 The selection "pivot".

Protected Member Functions

nsresult FireOnSelectHandler ()

Static Protected Member Functions

static void SelectCallback (nsITimer *aTimer, void *aClosure)

Protected Attributes

nsITreeBoxObjectmTree
PRBool mSuppressed
PRInt32 mCurrentIndex
PRInt32 mShiftSelectPivot
nsTreeRangemFirstRange
nsCOMPtr< nsITimermSelectTimer

Detailed Description

Definition at line 51 of file nsTreeSelection.h.


Constructor & Destructor Documentation

Definition at line 256 of file nsTreeSelection.cpp.

Definition at line 265 of file nsTreeSelection.cpp.

{
  delete mFirstRange;
}

Member Function Documentation

void nsITreeSelection::adjustSelection ( in long  index,
in long  count 
) [inherited]

Called when the row count changes to adjust selection indices.

void nsITreeSelection::clearRange ( in long  startIndex,
in long  endIndex 
) [inherited]

Clears the range.

Clears the selection.

Definition at line 759 of file nsTreeSelection.cpp.

{
  if (mSuppressed)
    return NS_OK;

  nsCOMPtr<nsIBoxObject> boxObject = do_QueryInterface(mTree);
  NS_ASSERTION(boxObject, "no box object!");
  if (!boxObject)
     return NS_ERROR_UNEXPECTED;
  nsCOMPtr<nsIDOMElement> elt;
  boxObject->GetElement(getter_AddRefs(elt));

  nsCOMPtr<nsIContent> content(do_QueryInterface(elt));
  nsCOMPtr<nsIDocument> document = content->GetDocument();
  
  // we might be firing on a delay, so it's possible in rare cases that
  // the document may have been destroyed by the time it fires
  if (!document)
    return NS_OK;

  nsIPresShell *shell = document->GetShellAt(0);
  if (shell) {
    // Retrieve the context in which our DOM event will fire.
    nsCOMPtr<nsPresContext> aPresContext = shell->GetPresContext();

    nsEventStatus status = nsEventStatus_eIgnore;
    nsEvent event(PR_TRUE, NS_FORM_SELECTED);

    content->HandleDOMEvent(aPresContext, &event, nsnull, NS_EVENT_FLAG_INIT,
                            &status);
  }

  return NS_OK;
}

Here is the call graph for this function:

void nsITreeSelection::getRangeAt ( in long  i,
out long  min,
out long  max 
) [inherited]

Iterate the selection using these methods.

Can be used to invalidate the selection.

Inverts the selection.

boolean nsITreeSelection::isSelected ( in long  index) [inherited]

Indicates whether or not the row at the specified index is part of the selection.

void nsITreeSelection::rangedSelect ( in long  startIndex,
in long  endIndex,
in boolean  augment 
) [inherited]

Select the range specified by the indices.

If augment is true, then we add the range to the selection without clearing out anything else. If augment is false, everything is cleared except for the specified range.

void nsITreeSelection::select ( in long  index) [inherited]

Deselect all rows and select the row at the specified index.

Selects all rows.

void nsTreeSelection::SelectCallback ( nsITimer aTimer,
void aClosure 
) [static, protected]

Definition at line 795 of file nsTreeSelection.cpp.

{
  nsTreeSelection* self = NS_STATIC_CAST(nsTreeSelection*, aClosure);
  if (self) {
    self->FireOnSelectHandler();
    aTimer->Cancel();
    self->mSelectTimer = nsnull;
  }
}
void nsITreeSelection::timedSelect ( in long  index,
in long  delay 
) [inherited]

Perform a timed select.

void nsITreeSelection::toggleSelect ( in long  index) [inherited]

Toggle the selection state of the row at the specified index.


Member Data Documentation

readonly attribute long nsITreeSelection::count [inherited]

The number of rows currently selected in this tree.

Definition at line 60 of file nsITreeSelection.idl.

The current item (the one that gets a focus rect in addition to being selected).

Definition at line 139 of file nsITreeSelection.idl.

Definition at line 71 of file nsTreeSelection.h.

Definition at line 74 of file nsTreeSelection.h.

Definition at line 76 of file nsTreeSelection.h.

Definition at line 72 of file nsTreeSelection.h.

Definition at line 70 of file nsTreeSelection.h.

Definition at line 68 of file nsTreeSelection.h.

Definition at line 60 of file nsTreeSelection.h.

This attribute is a boolean indicating whether or not the "select" event should fire when the selection is changed using one of our methods.

A view can use this to temporarily suppress the selection while manipulating all of the indices, e.g., on a sort.

Definition at line 133 of file nsITreeSelection.idl.

The selection "pivot".

This is the first item the user selected as part of a ranged select.

Definition at line 145 of file nsITreeSelection.idl.

This attribute is a boolean indicating single selection.

Definition at line 55 of file nsITreeSelection.idl.

The tree widget for this selection.

Definition at line 50 of file nsITreeSelection.idl.


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