Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
nsListBoxObject Class Reference
Inheritance diagram for nsListBoxObject:
Inheritance graph
[legend]
Collaboration diagram for nsListBoxObject:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS_INHERITED
virtual
NS_DECL_NSILISTBOXOBJECT void 
ClearCachedListBoxBody ()
 Clear the cached list box body frame from this box object.
virtual nsIListBoxObjectGetListBoxBody ()
virtual nsIListBoxObjectGetListBoxBody (PRBool aFlush)
nsIListBoxObjectGetListBoxBodyImpl (PRBool aFlush)
 nsListBoxObject ()
virtual ~nsListBoxObject ()
NS_IMETHOD InvalidatePresentationStuff ()
long getRowCount ()
long getNumberOfVisibleRows ()
long getIndexOfFirstVisibleRow ()
void ensureIndexIsVisible (in long rowIndex)
void scrollToIndex (in long rowIndex)
void scrollByLines (in long numLines)
nsIDOMElement getItemAtIndex (in long index)
long getIndexOfItem (in nsIDOMElement item)
NS_IMETHOD Init (nsIContent *aContent, nsIPresShell *aPresShell)
NS_IMETHOD SetDocument (nsIDocument *aDocument)
virtual nsIFrameGetFrame ()
already_AddRefed< nsIPresShellGetPresShell ()
nsresult GetOffsetRect (nsRect &aRect)
nsresult GetScreenPosition (nsIntPoint &aPoint)
nsISupports getPropertyAsSupports (in wstring propertyName)
void setPropertyAsSupports (in wstring propertyName, in nsISupports value)
wstring getProperty (in wstring propertyName)
void setProperty (in wstring propertyName, in wstring propertyValue)
void removeProperty (in wstring propertyName)
wstring getLookAndFeelMetric (in wstring propertyName)

Static Public Member Functions

static nsresult GetPreviousSibling (nsIFrame *aParentFrame, nsIFrame *aFrame, nsIDOMElement **aResult)

Public Attributes

readonly attribute nsIListBoxObject listboxBody
readonly attribute nsIDOMElement element
attribute nsIBoxLayoutManager layoutManager
attribute nsIBoxPaintManager paintManager
readonly attribute long x
readonly attribute long y
readonly attribute long screenX
readonly attribute long screenY
readonly attribute long width
readonly attribute long height
readonly attribute nsIDOMElement parentBox
readonly attribute nsIDOMElement firstChild
readonly attribute nsIDOMElement lastChild
readonly attribute nsIDOMElement nextSibling
readonly attribute nsIDOMElement previousSibling

Protected Member Functions

nsresult GetDocShell (nsIDocShell **aDocShell)

Protected Attributes

nsIListBoxObjectmListBoxBody
nsCOMPtr< nsIBoxLayoutManagermLayoutManager
nsCOMPtr< nsIBoxPaintManagermPaintManager
nsAutoPtr< nsPresStatemPresState
nsIContentmContent
nsWeakPtr mPresShell

Detailed Description

Definition at line 51 of file nsListBoxObject.cpp.


Constructor & Destructor Documentation

Definition at line 90 of file nsListBoxObject.cpp.

{
}

Member Function Documentation

Clear the cached list box body frame from this box object.

This should be called when the frame in question is destroyed.

Implements nsPIListBoxObject.

Definition at line 179 of file nsListBoxObject.cpp.

Here is the caller graph for this function:

nsresult nsBoxObject::GetDocShell ( nsIDocShell **  aDocShell) [protected, inherited]

Definition at line 567 of file nsBoxObject.cpp.

{
  *aResult = nsnull;

  nsIFrame *frame = GetFrame();

  if (frame) {
    nsIFrameFrame *frame_frame = nsnull;
    CallQueryInterface(frame, &frame_frame);

    if (frame_frame) {
      // Ok, the frame for mContent is a nsIFrameFrame, it knows how
      // to reach the docshell, so ask it...

      return frame_frame->GetDocShell(aResult);
    }
  }

  // No nsIFrameFrame available for mContent, try if there's a mapping
  // between mContent's document to mContent's subdocument.

  if (!mContent) {
    return NS_OK;
  }

  // XXXbz sXBL/XBL2 issue -- ownerDocument or currentDocument?
  nsIDocument *doc = mContent->GetDocument();

  if (!doc) {
    return NS_OK;
  }
  
  nsIDocument *sub_doc = doc->GetSubDocumentFor(mContent);

  if (!sub_doc) {
    return NS_OK;
  }

  nsCOMPtr<nsISupports> container = sub_doc->GetContainer();

  if (!container) {
    return NS_OK;
  }

  return CallQueryInterface(container, aResult);
}

Here is the call graph for this function:

nsIFrame * nsBoxObject::GetFrame ( ) [virtual, inherited]

Definition at line 165 of file nsBoxObject.cpp.

{
  nsIFrame* frame = nsnull;
  nsCOMPtr<nsIPresShell> shell = GetPresShell();
  if (shell) {
    shell->FlushPendingNotifications(Flush_Frames);
    shell->GetPrimaryFrameFor(mContent, &frame);
  }
  return frame;
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual nsIListBoxObject* nsListBoxObject::GetListBoxBody ( ) [inline, virtual]

Implements nsPIListBoxObject.

Definition at line 60 of file nsListBoxObject.cpp.

Here is the call graph for this function:

virtual nsIListBoxObject* nsListBoxObject::GetListBoxBody ( PRBool  aFlush) [inline, virtual]

Implements nsPIListBoxObject_MOZILLA_1_8_BRANCH.

Definition at line 66 of file nsListBoxObject.cpp.

  {
    return GetListBoxBodyImpl(aFlush);
  }

Here is the call graph for this function:

Definition at line 213 of file nsListBoxObject.cpp.

{
  if (mListBoxBody) {
    return mListBoxBody;
  }

  nsIFrame* frame;
  if (aFlush) {
    frame = GetFrame(); // does Flush_Frames
  }
  else {
    frame = nsnull;
    nsCOMPtr<nsIPresShell> shell = GetPresShell();
    if (shell) {
      shell->GetPrimaryFrameFor(mContent, &frame);
    }
  }
  if (!frame)
    return nsnull;

  nsCOMPtr<nsIPresShell> shell = GetPresShell();
  if (!shell) {
    return nsnull;
  }

  // Iterate over our content model children looking for the body.
  nsCOMPtr<nsIContent> content;
  FindBodyContent(frame->GetContent(), getter_AddRefs(content));

  // this frame will be a nsGFXScrollFrame
  shell->GetPrimaryFrameFor(content, &frame);
  if (!frame)
     return nsnull;
  nsIScrollableFrame* scrollFrame;
  CallQueryInterface(frame, &scrollFrame);
  if (!scrollFrame)
    return nsnull;

  // this frame will be the one we want
  nsIFrame* yeahBaby = scrollFrame->GetScrolledFrame();
  if (!yeahBaby)
     return nsnull;

  // It's a frame. Refcounts are irrelevant.
  CallQueryInterface(yeahBaby, &mListBoxBody);
  return mListBoxBody;
}

Here is the call graph for this function:

Here is the caller graph for this function:

wstring nsIBoxObject::getLookAndFeelMetric ( in wstring  propertyName) [inherited]
nsresult nsBoxObject::GetOffsetRect ( nsRect aRect) [inherited]

Definition at line 189 of file nsBoxObject.cpp.

{
  aRect.x = aRect.y = 0;
  aRect.Empty();
 
  if (!mContent)
    return NS_ERROR_NOT_INITIALIZED;

  nsresult res = NS_OK;
  nsCOMPtr<nsIDocument> doc = mContent->GetDocument();

  if (doc) {
    // Flush all pending notifications so that our frames are uptodate.  Must
    // do this before we get the presshell, since this can destroy presshells.
    doc->FlushPendingNotifications(Flush_Layout);

    // Get Presentation shell 0
    nsIPresShell *presShell = doc->GetShellAt(0);

    if(presShell) {
      // Get the Frame for our content
      nsIFrame* frame = nsnull;
      presShell->GetPrimaryFrameFor(mContent, &frame);
      if(frame != nsnull) {
        // Get its origin
        nsPoint origin = frame->GetPosition();

        // Get the union of all rectangles in this and continuation frames
        nsRect rcFrame;
        nsIFrame* next = frame;
        do {
          rcFrame.UnionRect(rcFrame, next->GetRect());
          next = next->GetNextInFlow();
        } while (nsnull != next);
        

        // Find the frame parent whose content's tagName either matches 
        // the tagName passed in or is the document element.
        nsIContent *docElement = doc->GetRootContent();
        nsIFrame* parent = frame->GetParent();
        while (parent) {
          // If we've hit the document element, break here
          if (parent->GetContent() == docElement) {
            break;
          }

          // Add the parent's origin to our own to get to the
          // right coordinate system
          origin += parent->GetPosition();

          parent = parent->GetParent();
        }
  
        // For the origin, add in the border for the frame
        const nsStyleBorder* border = frame->GetStyleBorder();
        origin.x += border->GetBorderWidth(NS_SIDE_LEFT);
        origin.y += border->GetBorderWidth(NS_SIDE_TOP);

        // And subtract out the border for the parent
        if (parent) {
          const nsStyleBorder* parentBorder = parent->GetStyleBorder();
          origin.x -= parentBorder->GetBorderWidth(NS_SIDE_LEFT);
          origin.y -= parentBorder->GetBorderWidth(NS_SIDE_TOP);
        }

        // Get the Presentation Context from the Shell
        nsPresContext *context = presShell->GetPresContext();
        if (context) {
          // Get the scale from that Presentation Context
          float scale;
          scale = context->TwipsToPixels();
              
          // Convert to pixels using that scale
          aRect.x = NSTwipsToIntPixels(origin.x, scale);
          aRect.y = NSTwipsToIntPixels(origin.y, scale);
          aRect.width = NSTwipsToIntPixels(rcFrame.width, scale);
          aRect.height = NSTwipsToIntPixels(rcFrame.height, scale);
        }
      }
    }
  }
 
  return res;
}

Here is the call graph for this function:

Definition at line 177 of file nsBoxObject.cpp.

{
  if (!mPresShell) {
    return nsnull;
  }

  nsIPresShell* shell = nsnull;
  CallQueryReferent(mPresShell.get(), &shell);
  return shell;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsBoxObject::GetPreviousSibling ( nsIFrame aParentFrame,
nsIFrame aFrame,
nsIDOMElement **  aResult 
) [static, inherited]

Definition at line 536 of file nsBoxObject.cpp.

{
  *aPreviousOrdinalSibling = nsnull;
  nsIFrame* frame = GetFrame();
  if (!frame) return NS_OK;
  nsIFrame* parentFrame = frame->GetParent();
  if (!parentFrame) return NS_OK;
  return GetPreviousSibling(parentFrame, frame, aPreviousOrdinalSibling);
}

Here is the call graph for this function:

wstring nsIBoxObject::getProperty ( in wstring  propertyName) [inherited]
nsISupports nsIBoxObject::getPropertyAsSupports ( in wstring  propertyName) [inherited]

Definition at line 275 of file nsBoxObject.cpp.

{
  aPoint.x = aPoint.y = 0;
  
  if (!mContent)
    return NS_ERROR_NOT_INITIALIZED;

  nsCOMPtr<nsIDocument> doc = mContent->GetDocument();

  if (doc) {
    // Get Presentation shell 0
    nsIPresShell *presShell = doc->GetShellAt(0);

    if (presShell) {
      // Flush all pending notifications so that our frames are uptodate
      doc->FlushPendingNotifications(Flush_Layout);

      nsPresContext *presContext = presShell->GetPresContext();
      if (presContext) {
        nsIFrame* frame;
        presShell->GetPrimaryFrameFor(mContent, &frame);
        
        if (frame) {
          nsIntRect rect = frame->GetScreenRect();
          aPoint.x = rect.x;
          aPoint.y = rect.y;
        }
      }
    }
  }
  
  return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsBoxObject::Init ( nsIContent aContent,
nsIPresShell aPresShell 
) [virtual, inherited]

Implements nsPIBoxObject.

Reimplemented in nsTreeBoxObject, and nsEditorBoxObject.

Definition at line 135 of file nsBoxObject.cpp.

{
  mContent = aContent;
  mPresShell = do_GetWeakReference(aShell);
  return NS_OK;
}

Here is the call graph for this function:

Reimplemented from nsBoxObject.

Definition at line 262 of file nsListBoxObject.cpp.

Here is the call graph for this function:

void nsIBoxObject::removeProperty ( in wstring  propertyName) [inherited]
void nsIListBoxObject::scrollByLines ( in long  numLines) [inherited]
void nsIListBoxObject::scrollToIndex ( in long  rowIndex) [inherited]
NS_IMETHODIMP nsBoxObject::SetDocument ( nsIDocument aDocument) [virtual, inherited]

Implements nsPIBoxObject.

Reimplemented in nsTreeBoxObject, and nsEditorBoxObject.

Definition at line 143 of file nsBoxObject.cpp.

{
  mPresState = nsnull;
  if (aDocument) {
    mPresShell = do_GetWeakReference(aDocument->GetShellAt(0));
  }
  else {
    mPresShell = nsnull;
    mContent = nsnull;
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIBoxObject::setProperty ( in wstring  propertyName,
in wstring  propertyValue 
) [inherited]
void nsIBoxObject::setPropertyAsSupports ( in wstring  propertyName,
in nsISupports  value 
) [inherited]

Member Data Documentation

Definition at line 48 of file nsIBoxObject.idl.

Definition at line 68 of file nsIBoxObject.idl.

readonly attribute long nsIBoxObject::height [inherited]

Definition at line 58 of file nsIBoxObject.idl.

Definition at line 69 of file nsIBoxObject.idl.

Definition at line 50 of file nsIBoxObject.idl.

Definition at line 49 of file nsIListBoxObject.idl.

nsIContent* nsBoxObject::mContent [protected, inherited]

Definition at line 89 of file nsBoxObject.h.

Definition at line 85 of file nsBoxObject.h.

Definition at line 79 of file nsListBoxObject.cpp.

Definition at line 86 of file nsBoxObject.h.

nsWeakPtr nsBoxObject::mPresShell [protected, inherited]

Definition at line 90 of file nsBoxObject.h.

Definition at line 87 of file nsBoxObject.h.

Definition at line 70 of file nsIBoxObject.idl.

Definition at line 51 of file nsIBoxObject.idl.

Definition at line 67 of file nsIBoxObject.idl.

Definition at line 71 of file nsIBoxObject.idl.

readonly attribute long nsIBoxObject::screenX [inherited]

Definition at line 55 of file nsIBoxObject.idl.

readonly attribute long nsIBoxObject::screenY [inherited]

Definition at line 56 of file nsIBoxObject.idl.

readonly attribute long nsIBoxObject::width [inherited]

Definition at line 57 of file nsIBoxObject.idl.

readonly attribute long nsIBoxObject::x [inherited]

Definition at line 53 of file nsIBoxObject.idl.

readonly attribute long nsIBoxObject::y [inherited]

Definition at line 54 of file nsIBoxObject.idl.


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