/layout/html/base/src/nsContainerFrame.h

Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: NPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Netscape Public License
00006  * Version 1.1 (the "License"); you may not use this file except in
00007  * compliance with the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/NPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is 
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or 
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the NPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the NPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 #ifndef nsContainerFrame_h___
00038 #define nsContainerFrame_h___
00039 
00040 #include "nsSplittableFrame.h"
00041 #include "nsFrameList.h"
00042 
00043 // Option flags for ReflowChild() and FinishReflowChild()
00044 // member functions
00045 #define NS_FRAME_NO_MOVE_VIEW         0x0001
00046 #define NS_FRAME_NO_MOVE_FRAME        (0x0002 | NS_FRAME_NO_MOVE_VIEW)
00047 #define NS_FRAME_NO_SIZE_VIEW         0x0004
00048 #define NS_FRAME_NO_VISIBILITY        0x0008
00049 
00053 class nsContainerFrame : public nsSplittableFrame
00054 {
00055 public:
00056   // nsIFrame overrides
00057   NS_IMETHOD Init(nsIPresContext*  aPresContext,
00058                   nsIContent*      aContent,
00059                   nsIFrame*        aParent,
00060                   nsStyleContext*  aContext,
00061                   nsIFrame*        aPrevInFlow);
00062   NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext,
00063                                  nsIAtom*        aListName,
00064                                  nsIFrame*       aChildList);
00065   NS_IMETHOD FirstChild(nsIPresContext* aPresContext,
00066                         nsIAtom*        aListName,
00067                         nsIFrame**      aFirstChild) const;
00068   NS_IMETHOD GetAdditionalChildListName(PRInt32   aIndex,
00069                                         nsIAtom** aListName) const;
00070   NS_IMETHOD Destroy(nsIPresContext* aPresContext);
00071   NS_IMETHOD Paint(nsIPresContext*      aPresContext,
00072                    nsIRenderingContext& aRenderingContext,
00073                    const nsRect&        aDirtyRect,
00074                    nsFramePaintLayer    aWhichLayer,
00075                    PRUint32             aFlags = 0);
00076   NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext,
00077                               const nsPoint& aPoint, 
00078                               nsFramePaintLayer aWhichLayer,
00079                               nsIFrame**     aFrame);
00080   NS_IMETHOD ReplaceFrame(nsIPresContext* aPresContext,
00081                           nsIPresShell&   aPresShell,
00082                           nsIAtom*        aListName,
00083                           nsIFrame*       aOldFrame,
00084                           nsIFrame*       aNewFrame);
00085   NS_IMETHOD ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild);
00086 
00087 #ifdef DEBUG
00088   NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const;
00089 #endif  
00090 
00091   // nsContainerFrame methods
00092   virtual void DeleteNextInFlowChild(nsIPresContext* aPresContext,
00093                                      nsIFrame*       aNextInFlow);
00094 
00095   static PRInt32 LengthOf(nsIFrame* aFrameList) {
00096     nsFrameList tmp(aFrameList);
00097     return tmp.GetLength();
00098   }
00099 
00100   // Positions the frame's view based on the frame's origin
00101   static void PositionFrameView(nsIPresContext* aPresContext,
00102                                 nsIFrame*       aKidFrame);
00103 
00104   // Set the view's size and position after its frame has been reflowed.
00105   //
00106   // Flags:
00107   // NS_FRAME_NO_MOVE_VIEW - don't position the frame's view. Set this if you
00108   //    don't want to automatically sync the frame and view
00109   // NS_FRAME_NO_SIZE_VIEW - don't size the view
00110   static void SyncFrameViewAfterReflow(nsIPresContext* aPresContext,
00111                                        nsIFrame*       aFrame,
00112                                        nsIView*        aView,
00113                                        const nsRect*   aCombinedArea,
00114                                        PRUint32        aFlags = 0);
00115   
00116   // Sets view attributes from the frame style that depend on the view's size
00117   // (clip, transparency). This needs to be called if you change the size of
00118   // a view and the view's frame could have clipping set on it.
00119   // @param aStyleContext can be null, in which case the frame's style context is used
00120   static void SyncFrameViewAfterSizeChange(nsIPresContext*  aPresContext,
00121                                            nsIFrame*        aFrame,
00122                                            nsStyleContext*  aStyleContext,
00123                                            nsIView*         aView,
00124                                            PRUint32         aFlags = 0);
00125   
00126   // Sets the view's attributes from the frame style.
00127   // - opacity
00128   // - visibility
00129   // - content transparency
00130   // - clip
00131   // Call this when one of these styles changes or when the view has just
00132   // been created.
00133   // @param aStyleContext can be null, in which case the frame's style context is used
00134   static void SyncFrameViewProperties(nsIPresContext*  aPresContext,
00135                                       nsIFrame*        aFrame,
00136                                       nsStyleContext*  aStyleContext,
00137                                       nsIView*         aView,
00138                                       PRUint32         aFlags = 0);
00139 
00140   // Returns PR_TRUE if the frame requires a view
00141   static PRBool FrameNeedsView(nsIPresContext* aPresContext,
00142                                nsIFrame* aFrame, nsStyleContext* aStyleContext);
00143   
00155   nsresult ReflowChild(nsIFrame*                aKidFrame,
00156                        nsIPresContext*          aPresContext,
00157                        nsHTMLReflowMetrics&     aDesiredSize,
00158                        const nsHTMLReflowState& aReflowState,
00159                        nscoord                  aX,
00160                        nscoord                  aY,
00161                        PRUint32                 aFlags,
00162                        nsReflowStatus&          aStatus);
00163 
00181   static nsresult FinishReflowChild(nsIFrame*                 aKidFrame,
00182                                     nsIPresContext*           aPresContext,
00183                                     const nsHTMLReflowState*  aReflowState,
00184                                     nsHTMLReflowMetrics&      aDesiredSize,
00185                                     nscoord                   aX,
00186                                     nscoord                   aY,
00187                                     PRUint32                  aFlags);
00188 
00189   
00190   static void PositionChildViews(nsIPresContext* aPresContext,
00191                                  nsIFrame*       aFrame);
00192 
00193 protected:
00194   nsContainerFrame();
00195   ~nsContainerFrame();
00196 
00197   nsresult GetFrameForPointUsing(nsIPresContext* aPresContext,
00198                                  const nsPoint& aPoint,
00199                                  nsIAtom*       aList,
00200                                  nsFramePaintLayer aWhichLayer,
00201                                  PRBool         aConsiderSelf,
00202                                  nsIFrame**     aFrame);
00203 
00204   virtual void PaintChildren(nsIPresContext*      aPresContext,
00205                              nsIRenderingContext& aRenderingContext,
00206                              const nsRect&        aDirtyRect,
00207                              nsFramePaintLayer    aWhichLayer,
00208                              PRUint32             aFlags = 0);
00209 
00210   virtual void PaintChild(nsIPresContext*      aPresContext,
00211                           nsIRenderingContext& aRenderingContext,
00212                           const nsRect&        aDirtyRect,
00213                           nsIFrame*            aFrame,
00214                           nsFramePaintLayer    aWhichLayer,
00215                           PRUint32             aFlags = 0);
00216 
00220   nsIFrame* GetOverflowFrames(nsIPresContext* aPresContext,
00221                               PRBool          aRemoveProperty) const;
00222 
00226   nsresult SetOverflowFrames(nsIPresContext* aPresContext,
00227                              nsIFrame*       aOverflowFrames);
00228 
00238   PRBool MoveOverflowToChildList(nsIPresContext* aPresContext);
00239 
00254   void PushChildren(nsIPresContext* aPresContext,
00255                     nsIFrame*       aFromChild,
00256                     nsIFrame*       aPrevSibling);
00257 
00258   nsFrameList mFrames;
00259 };
00260 
00261 #endif /* nsContainerFrame_h___ */

Generated on Wed Sep 10 22:25:23 2003 for Mozilla SVG Project Rendering Backend by doxygen1.3