layout/xul/nsBoxLayout.h

branch
TOR_BUG_9701
changeset 8
97036ab72558
equal deleted inserted replaced
-1:000000000000 0:8ccbead18313
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 #ifndef nsBoxLayout_h___
7 #define nsBoxLayout_h___
8
9 #include "nsISupports.h"
10 #include "nsCoord.h"
11 #include "nsFrameList.h"
12
13 class nsIFrame;
14 class nsBoxLayoutState;
15 struct nsSize;
16 struct nsMargin;
17
18 #define NS_BOX_LAYOUT_IID \
19 { 0x09d522a7, 0x304c, 0x4137, \
20 { 0xaf, 0xc9, 0xe0, 0x80, 0x2e, 0x89, 0xb7, 0xe8 } }
21
22 class nsIGridPart;
23
24 class nsBoxLayout : public nsISupports {
25
26 public:
27
28 nsBoxLayout() {}
29 virtual ~nsBoxLayout() {}
30
31 NS_DECL_ISUPPORTS
32
33 NS_DECLARE_STATIC_IID_ACCESSOR(NS_BOX_LAYOUT_IID)
34
35 NS_IMETHOD Layout(nsIFrame* aBox, nsBoxLayoutState& aState);
36
37 virtual nsSize GetPrefSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState);
38 virtual nsSize GetMinSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState);
39 virtual nsSize GetMaxSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState);
40 virtual nscoord GetAscent(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState);
41 virtual void ChildrenInserted(nsIFrame* aBox, nsBoxLayoutState& aState,
42 nsIFrame* aPrevBox,
43 const nsFrameList::Slice& aNewChildren) {}
44 virtual void ChildrenAppended(nsIFrame* aBox, nsBoxLayoutState& aState,
45 const nsFrameList::Slice& aNewChildren) {}
46 virtual void ChildrenRemoved(nsIFrame* aBox, nsBoxLayoutState& aState, nsIFrame* aChildList) {}
47 virtual void ChildrenSet(nsIFrame* aBox, nsBoxLayoutState& aState, nsIFrame* aChildList) {}
48 virtual void IntrinsicWidthsDirty(nsIFrame* aBox, nsBoxLayoutState& aState) {}
49
50 virtual void AddBorderAndPadding(nsIFrame* aBox, nsSize& aSize);
51 virtual void AddMargin(nsIFrame* aChild, nsSize& aSize);
52 virtual void AddMargin(nsSize& aSize, const nsMargin& aMargin);
53
54 virtual nsIGridPart* AsGridPart() { return nullptr; }
55
56 static void AddLargestSize(nsSize& aSize, const nsSize& aToAdd);
57 static void AddSmallestSize(nsSize& aSize, const nsSize& aToAdd);
58 };
59
60 NS_DEFINE_STATIC_IID_ACCESSOR(nsBoxLayout, NS_BOX_LAYOUT_IID)
61
62 #endif
63

mercurial