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 protected: ~nsBoxLayout()27 virtual ~nsBoxLayout() {} 28 29 public: 30 nsBoxLayout()31 nsBoxLayout() {} 32 33 NS_DECL_ISUPPORTS 34 35 NS_DECLARE_STATIC_IID_ACCESSOR(NS_BOX_LAYOUT_IID) 36 37 NS_IMETHOD XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState); 38 39 virtual nsSize GetXULPrefSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState); 40 virtual nsSize GetXULMinSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState); 41 virtual nsSize GetXULMaxSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState); 42 virtual nscoord GetAscent(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState); ChildrenInserted(nsIFrame * aBox,nsBoxLayoutState & aState,nsIFrame * aPrevBox,const nsFrameList::Slice & aNewChildren)43 virtual void ChildrenInserted(nsIFrame* aBox, nsBoxLayoutState& aState, 44 nsIFrame* aPrevBox, 45 const nsFrameList::Slice& aNewChildren) {} ChildrenAppended(nsIFrame * aBox,nsBoxLayoutState & aState,const nsFrameList::Slice & aNewChildren)46 virtual void ChildrenAppended(nsIFrame* aBox, nsBoxLayoutState& aState, 47 const nsFrameList::Slice& aNewChildren) {} ChildrenRemoved(nsIFrame * aBox,nsBoxLayoutState & aState,nsIFrame * aChildList)48 virtual void ChildrenRemoved(nsIFrame* aBox, nsBoxLayoutState& aState, nsIFrame* aChildList) {} ChildrenSet(nsIFrame * aBox,nsBoxLayoutState & aState,nsIFrame * aChildList)49 virtual void ChildrenSet(nsIFrame* aBox, nsBoxLayoutState& aState, nsIFrame* aChildList) {} IntrinsicISizesDirty(nsIFrame * aBox,nsBoxLayoutState & aState)50 virtual void IntrinsicISizesDirty(nsIFrame* aBox, nsBoxLayoutState& aState) {} 51 52 virtual void AddBorderAndPadding(nsIFrame* aBox, nsSize& aSize); 53 virtual void AddMargin(nsIFrame* aChild, nsSize& aSize); 54 virtual void AddMargin(nsSize& aSize, const nsMargin& aMargin); 55 AsGridPart()56 virtual nsIGridPart* AsGridPart() { return nullptr; } 57 58 static void AddLargestSize(nsSize& aSize, const nsSize& aToAdd); 59 static void AddSmallestSize(nsSize& aSize, const nsSize& aToAdd); 60 }; 61 62 NS_DEFINE_STATIC_IID_ACCESSOR(nsBoxLayout, NS_BOX_LAYOUT_IID) 63 64 #endif 65 66