nsBoxLayout.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. #ifndef nsBoxLayout_h___
  6. #define nsBoxLayout_h___
  7. #include "nsISupports.h"
  8. #include "nsCoord.h"
  9. #include "nsFrameList.h"
  10. class nsIFrame;
  11. class nsBoxLayoutState;
  12. struct nsSize;
  13. struct nsMargin;
  14. #define NS_BOX_LAYOUT_IID \
  15. { 0x09d522a7, 0x304c, 0x4137, \
  16. { 0xaf, 0xc9, 0xe0, 0x80, 0x2e, 0x89, 0xb7, 0xe8 } }
  17. class nsIGridPart;
  18. class nsBoxLayout : public nsISupports {
  19. protected:
  20. virtual ~nsBoxLayout() {}
  21. public:
  22. nsBoxLayout() {}
  23. NS_DECL_ISUPPORTS
  24. NS_DECLARE_STATIC_IID_ACCESSOR(NS_BOX_LAYOUT_IID)
  25. NS_IMETHOD XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState);
  26. virtual nsSize GetXULPrefSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState);
  27. virtual nsSize GetXULMinSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState);
  28. virtual nsSize GetXULMaxSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState);
  29. virtual nscoord GetAscent(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState);
  30. virtual void ChildrenInserted(nsIFrame* aBox, nsBoxLayoutState& aState,
  31. nsIFrame* aPrevBox,
  32. const nsFrameList::Slice& aNewChildren) {}
  33. virtual void ChildrenAppended(nsIFrame* aBox, nsBoxLayoutState& aState,
  34. const nsFrameList::Slice& aNewChildren) {}
  35. virtual void ChildrenRemoved(nsIFrame* aBox, nsBoxLayoutState& aState, nsIFrame* aChildList) {}
  36. virtual void ChildrenSet(nsIFrame* aBox, nsBoxLayoutState& aState, nsIFrame* aChildList) {}
  37. virtual void IntrinsicISizesDirty(nsIFrame* aBox, nsBoxLayoutState& aState) {}
  38. virtual void AddBorderAndPadding(nsIFrame* aBox, nsSize& aSize);
  39. virtual void AddMargin(nsIFrame* aChild, nsSize& aSize);
  40. virtual void AddMargin(nsSize& aSize, const nsMargin& aMargin);
  41. virtual nsIGridPart* AsGridPart() { return nullptr; }
  42. static void AddLargestSize(nsSize& aSize, const nsSize& aToAdd);
  43. static void AddSmallestSize(nsSize& aSize, const nsSize& aToAdd);
  44. };
  45. NS_DEFINE_STATIC_IID_ACCESSOR(nsBoxLayout, NS_BOX_LAYOUT_IID)
  46. #endif