gecko-dev/layout/xul/base/src/nsBox.h

129 lines
4.7 KiB
C
Raw Normal View History

2000-03-31 07:02:06 +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.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 Communicator client 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.
*
* Author:
* Eric D Vaughan
*
* Contributor(s):
*/
#ifndef nsBox_h___
#define nsBox_h___
#include "nsIBox.h"
class nsBox : public nsIBox {
public:
NS_DECL_ISUPPORTS_INHERITED
2000-03-31 07:02:06 +00:00
NS_IMETHOD GetChildBox(nsIBox** aBox);
NS_IMETHOD GetNextBox(nsIBox** aBox);
NS_IMETHOD SetNextBox(nsIBox* aBox);
NS_IMETHOD GetParentBox(nsIBox** aParent);
NS_IMETHOD SetParentBox(nsIBox* aParent);
NS_IMETHOD IsDirty(PRBool& aIsDirty);
NS_IMETHOD HasDirtyChildren(PRBool& aIsDirty);
NS_IMETHOD MarkDirty(nsBoxLayoutState& aState);
NS_IMETHOD MarkDirtyChildren(nsBoxLayoutState& aState);
NS_IMETHOD SetDebug(nsBoxLayoutState& aState, PRBool aDebug);
NS_IMETHOD SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRect);
NS_IMETHOD GetBounds(nsRect& aRect);
NS_IMETHOD GetBorderAndPadding(nsMargin& aBorderAndPadding);
NS_IMETHOD GetBorder(nsMargin& aBorderAndPadding);
NS_IMETHOD GetPadding(nsMargin& aBorderAndPadding);
NS_IMETHOD GetMargin(nsMargin& aMargin);
NS_IMETHOD SetLayoutManager(nsIBoxLayout* aLayout);
NS_IMETHOD GetLayoutManager(nsIBoxLayout** aLayout);
NS_IMETHOD GetContentRect(nsRect& aContentRect);
NS_IMETHOD GetClientRect(nsRect& aContentRect);
NS_IMETHOD GetVAlign(Valignment& aAlign);
NS_IMETHOD GetHAlign(Halignment& aAlign);
NS_IMETHOD GetInset(nsMargin& aInset);
NS_IMETHOD GetOrientation(PRBool& aIsHorizontal);
NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
NS_IMETHOD GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
NS_IMETHOD GetMaxSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
NS_IMETHOD GetFlex(nsBoxLayoutState& aBoxLayoutState, nscoord& aFlex);
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
NS_IMETHOD IsCollapsed(nsBoxLayoutState& aBoxLayoutState, PRBool& aCollapsed);
NS_IMETHOD Collapse(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD UnCollapse(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD Layout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD Redraw(nsBoxLayoutState& aState, const nsRect* aRect = nsnull, PRBool aImmediate = PR_FALSE);
NS_IMETHOD NeedsRecalc();
NS_IMETHOD GetDebugBoxAt(const nsPoint& aPoint, nsIBox** aBox);
NS_IMETHOD GetDebug(PRBool& aDebug);
NS_IMETHOD RelayoutDirtyChild(nsBoxLayoutState& aState, nsIBox* aChild);
NS_IMETHOD GetMouseThrough(PRBool& aMouseThrough);
2000-03-31 07:02:06 +00:00
2000-04-04 06:29:20 +00:00
// XXX Eventually these will move into nsIFrame.
// These methods are used for XBL <children>.
NS_IMETHOD GetInsertionPoint(nsIFrame** aFrame) { return NS_OK; };
NS_IMETHOD SetInsertionPoint(nsIFrame* aFrame) { return NS_OK; };
2000-03-31 07:02:06 +00:00
nsBox(nsIPresShell* aShell);
virtual nsresult SyncLayout(nsBoxLayoutState& aBoxLayoutState);
virtual PRBool DoesNeedRecalc(const nsSize& aSize);
virtual PRBool DoesNeedRecalc(nscoord aCoord);
virtual void SizeNeedsRecalc(nsSize& aSize);
virtual void CoordNeedsRecalc(nscoord& aCoord);
virtual void AddBorderAndPadding(nsSize& aSize);
virtual void AddInset(nsSize& aSize);
virtual void AddMargin(nsSize& aSize);
static void AddBorderAndPadding(nsIBox* aBox, nsSize& aSize);
static void AddInset(nsIBox* aBox, nsSize& aSize);
static void AddMargin(nsIBox* aChild, nsSize& aSize);
static void AddMargin(nsSize& aSize, const nsMargin& aMargin);
static nsresult UnCollapseChild(nsBoxLayoutState& aState, nsIBox* aFrame);
static nsresult CollapseChild(nsBoxLayoutState& aState, nsIFrame* aFrame, PRBool aHide);
static void BoundsCheck(nsSize& aMinSize, nsSize& aPrefSize, nsSize& aMaxSize);
protected:
virtual PRBool GetWasCollapsed(nsBoxLayoutState& aState);
virtual void SetWasCollapsed(nsBoxLayoutState& aState, PRBool aWas);
virtual PRBool GetDefaultFlex(PRInt32& aFlex);
2000-03-31 07:02:06 +00:00
enum eMouseThrough {
unset,
2000-03-31 07:02:06 +00:00
never,
always
};
eMouseThrough mMouseThrough;
private:
nsIBox* mNextChild;
nsIBox* mParentBox;
//nscoord mX;
//nscoord mY;
};
#endif