nsStackLayout.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. Eric D Vaughan
  7. A frame that can have multiple children. Only one child may be displayed at one time. So the
  8. can be flipped though like a deck of cards.
  9. **/
  10. #ifndef nsStackLayout_h___
  11. #define nsStackLayout_h___
  12. #include "mozilla/Attributes.h"
  13. #include "nsBoxLayout.h"
  14. #include "nsCOMPtr.h"
  15. #include "nsCoord.h"
  16. class nsIPresShell;
  17. nsresult NS_NewStackLayout(nsCOMPtr<nsBoxLayout>& aNewLayout);
  18. class nsStackLayout : public nsBoxLayout
  19. {
  20. public:
  21. friend nsresult NS_NewStackLayout(nsCOMPtr<nsBoxLayout>& aNewLayout);
  22. static void Shutdown();
  23. nsStackLayout();
  24. NS_IMETHOD XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState) override;
  25. virtual nsSize GetXULPrefSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) override;
  26. virtual nsSize GetXULMinSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) override;
  27. virtual nsSize GetXULMaxSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) override;
  28. virtual nscoord GetAscent(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) override;
  29. // get the child offsets for aChild and set them in aMargin. Returns a
  30. // bitfield mask of the SPECIFIED_LEFT, SPECIFIED_RIGHT, SPECIFIED_TOP and
  31. // SPECIFIED_BOTTOM offsets indicating which sides have been specified by
  32. // attributes.
  33. static uint8_t GetOffset(nsIFrame* aChild, nsMargin& aMargin);
  34. private:
  35. static nsBoxLayout* gInstance;
  36. }; // class nsStackLayout
  37. #endif