gecko-dev/layout/generic/nsContainerFrame.h

147 lines
5.5 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef nsContainerFrame_h___
#define nsContainerFrame_h___
#include "nsSplittableFrame.h"
#include "nsFrameList.h"
/**
* Implementation of a container frame.
*/
class nsContainerFrame : public nsSplittableFrame
{
public:
// nsIFrame overrides
NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const;
NS_IMETHOD Destroy(nsIPresContext& aPresContext);
NS_IMETHOD Paint(nsIPresContext& aPresContext,
nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect,
nsFramePaintLayer aWhichLayer);
NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext,
const nsPoint& aPoint,
nsIFrame** aFrame);
NS_IMETHOD ReplaceFrame(nsIPresContext& aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsIFrame* aOldFrame,
nsIFrame* aNewFrame);
#ifdef DEBUG
NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const;
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
#endif
// nsIHTMLReflow overrides
NS_IMETHOD DidReflow(nsIPresContext& aPresContext,
nsDidReflowStatus aStatus);
// nsContainerFrame methods
virtual void DeleteChildsNextInFlow(nsIPresContext& aPresContext,
nsIFrame* aChild);
static PRInt32 LengthOf(nsIFrame* aFrameList) {
nsFrameList tmp(aFrameList);
return tmp.GetLength();
}
protected:
nsContainerFrame();
~nsContainerFrame();
nsresult GetFrameForPointUsing(nsIPresContext* aPresContext,
const nsPoint& aPoint,
nsIAtom* aList,
nsIFrame** aFrame);
virtual void PaintChildren(nsIPresContext& aPresContext,
nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect,
nsFramePaintLayer aWhichLayer);
virtual void PaintChild(nsIPresContext& aPresContext,
nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect,
nsIFrame* aFrame,
nsFramePaintLayer aWhichLayer);
/**
* Queries the child frame for the nsIHTMLReflow interface and if it's
* supported invokes the WillReflow() and Reflow() member functions. If
* the reflow succeeds and the child frame is complete, deletes any
* next-in-flows using DeleteChildsNextInFlow()
*/
nsresult ReflowChild(nsIFrame* aKidFrame,
nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus);
/**
* Get the frames on the overflow list
*/
nsIFrame* GetOverflowFrames(nsIPresContext* aPresContext,
PRBool aRemoveProperty);
/**
* Set the overflow list
*/
nsresult SetOverflowFrames(nsIPresContext* aPresContext,
nsIFrame* aOverflowFrames);
/**
* Moves any frames on both the prev-in-flow's overflow list and the
* receiver's overflow to the receiver's child list.
*
* Resets the overlist pointers to nsnull, and updates the receiver's child
* count and content mapping.
*
* @return PR_TRUE if any frames were moved and PR_FALSE otherwise
*/
PRBool MoveOverflowToChildList(nsIPresContext* aPresContext);
/**
* Push aFromChild and its next siblings to the next-in-flow. Change
* the geometric parent of each frame that's pushed. If there is no
* next-in-flow the frames are placed on the overflow list (and the
* geometric parent is left unchanged).
*
* Updates the next-in-flow's child count. Does <b>not</b> update the
* pusher's child count.
*
* @param aFromChild the first child frame to push. It is disconnected from
* aPrevSibling
* @param aPrevSibling aFromChild's previous sibling. Must not be null.
* It's an error to push a parent's first child frame
*/
void PushChildren(nsIPresContext* aPresContext,
nsIFrame* aFromChild,
nsIFrame* aPrevSibling);
nsFrameList mFrames;
};
#endif /* nsContainerFrame_h___ */