1998-07-15 23:42:14 +00:00
|
|
|
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
|
|
|
* compliance with the NPL. You may obtain a copy of the NPL at
|
|
|
|
* http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* NPL.
|
|
|
|
*
|
|
|
|
* The Initial Developer of this code under the NPL is Netscape
|
|
|
|
* Communications Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
|
|
|
* Reserved.
|
|
|
|
*/
|
|
|
|
#ifndef nsHTMLFrameset_h___
|
|
|
|
#define nsHTMLFrameset_h___
|
|
|
|
|
|
|
|
#include "nsHTMLAtoms.h"
|
|
|
|
#include "nsHTMLContainerFrame.h"
|
|
|
|
#include "nsHTMLContainer.h"
|
|
|
|
|
|
|
|
class nsIContent;
|
|
|
|
struct nsReflowMetrics;
|
|
|
|
class nsIFrame;
|
|
|
|
class nsIPresContext;
|
|
|
|
class nsIRenderingContext;
|
|
|
|
struct nsRect;
|
|
|
|
struct nsReflowState;
|
|
|
|
struct nsSize;
|
|
|
|
class nsIAtom;
|
1998-07-18 21:47:56 +00:00
|
|
|
class nsIWebShell;
|
1998-07-15 23:42:14 +00:00
|
|
|
|
|
|
|
enum nsFramesetUnit {
|
|
|
|
eFramesetUnit_Free = 0,
|
|
|
|
eFramesetUnit_Percent,
|
|
|
|
eFramesetUnit_Pixel
|
|
|
|
};
|
|
|
|
|
|
|
|
struct nsFramesetSpec {
|
|
|
|
nsFramesetUnit mUnit;
|
|
|
|
nscoord mValue;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* nsHTMLFramesetFrame
|
|
|
|
******************************************************************************/
|
|
|
|
class nsHTMLFramesetFrame : public nsHTMLContainerFrame {
|
|
|
|
|
|
|
|
public:
|
|
|
|
nsHTMLFramesetFrame(nsIContent* aContent, nsIFrame* aParent);
|
|
|
|
|
1998-07-20 18:52:40 +00:00
|
|
|
virtual ~nsHTMLFramesetFrame();
|
|
|
|
|
1998-07-15 23:42:14 +00:00
|
|
|
static PRInt32 gMaxNumRowColSpecs;
|
|
|
|
|
1998-07-21 23:20:04 +00:00
|
|
|
void GetSizeOfChild(nsIFrame* aChild, nsSize& aSize);
|
1998-07-20 18:52:40 +00:00
|
|
|
|
1998-07-21 23:20:04 +00:00
|
|
|
void GetSizeOfChildAt(PRInt32 aIndexInParent, nsSize& aSize, nsPoint& aCellIndex);
|
1998-07-15 23:42:14 +00:00
|
|
|
|
|
|
|
static nsHTMLFramesetFrame* GetFramesetParent(nsIFrame* aChild);
|
|
|
|
|
|
|
|
NS_IMETHOD Paint(nsIPresContext& aPresContext,
|
|
|
|
nsIRenderingContext& aRenderingContext,
|
|
|
|
const nsRect& aDirtyRect);
|
|
|
|
|
|
|
|
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
|
|
|
|
nsReflowMetrics& aDesiredSize,
|
|
|
|
const nsReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void CalculateRowCol(nsIPresContext* aPresContext, nscoord aSize, PRInt32 aNumSpecs,
|
|
|
|
nsFramesetSpec* aSpecs, nscoord* aValues);
|
|
|
|
|
|
|
|
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
|
|
|
const nsReflowState& aReflowState,
|
|
|
|
nsReflowMetrics& aDesiredSize);
|
|
|
|
|
|
|
|
virtual PRIntn GetSkipSides() const;
|
|
|
|
|
1998-07-20 18:52:40 +00:00
|
|
|
void ParseRowCol(nsIAtom* aAttrType, PRInt32& aNumSpecs, nsFramesetSpec** aSpecs);
|
1998-07-15 23:42:14 +00:00
|
|
|
|
|
|
|
PRInt32 ParseRowColSpec(nsString& aSpec, PRInt32 aMaxNumValues,
|
|
|
|
nsFramesetSpec* aSpecs);
|
|
|
|
|
|
|
|
PRInt32 mNumRows;
|
|
|
|
nsFramesetSpec* mRowSpecs; // parsed, non-computed dimensions
|
|
|
|
nscoord* mRowSizes; // currently computed row sizes
|
|
|
|
PRInt32 mNumCols;
|
|
|
|
nsFramesetSpec* mColSpecs; // parsed, non-computed dimensions
|
|
|
|
nscoord* mColSizes; // currently computed col sizes
|
|
|
|
};
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* nsHTMLFrameset
|
|
|
|
******************************************************************************/
|
|
|
|
class nsHTMLFrameset : public nsHTMLContainer {
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual nsresult CreateFrame(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aParentFrame,
|
|
|
|
nsIStyleContext* aStyleContext,
|
|
|
|
nsIFrame*& aResult);
|
|
|
|
|
|
|
|
virtual void MapAttributesInto(nsIStyleContext* aContext,
|
|
|
|
nsIPresContext* aPresContext);
|
|
|
|
virtual void SetAttribute(nsIAtom* aAttribute, const nsString& aValue);
|
|
|
|
|
|
|
|
protected:
|
1998-07-18 21:47:56 +00:00
|
|
|
nsHTMLFrameset(nsIAtom* aTag, nsIWebShell* aParentWebShell);
|
1998-07-15 23:42:14 +00:00
|
|
|
virtual ~nsHTMLFrameset();
|
|
|
|
|
|
|
|
friend nsresult NS_NewHTMLFrameset(nsIHTMLContent** aInstancePtrResult,
|
1998-07-18 21:47:56 +00:00
|
|
|
nsIAtom* aTag, nsIWebShell* aWebShell);
|
1998-07-15 23:42:14 +00:00
|
|
|
//friend class nsHTMLFramesetFrame;
|
|
|
|
|
|
|
|
// this is held for a short time until the frame uses it, so it is not ref counted
|
1998-07-18 21:47:56 +00:00
|
|
|
nsIWebShell* mParentWebShell;
|
1998-07-15 23:42:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|