nsDeckFrame.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 nsDeckFrame_h___
  11. #define nsDeckFrame_h___
  12. #include "mozilla/Attributes.h"
  13. #include "nsBoxFrame.h"
  14. class nsDeckFrame : public nsBoxFrame
  15. {
  16. public:
  17. NS_DECL_QUERYFRAME_TARGET(nsDeckFrame)
  18. NS_DECL_QUERYFRAME
  19. NS_DECL_FRAMEARENA_HELPERS
  20. friend nsIFrame* NS_NewDeckFrame(nsIPresShell* aPresShell,
  21. nsStyleContext* aContext);
  22. virtual nsresult AttributeChanged(int32_t aNameSpaceID,
  23. nsIAtom* aAttribute,
  24. int32_t aModType) override;
  25. NS_IMETHOD DoXULLayout(nsBoxLayoutState& aState) override;
  26. virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
  27. const nsDisplayListSet& aLists) override;
  28. virtual void RemoveFrame(ChildListID aListID,
  29. nsIFrame* aOldFrame) override;
  30. virtual void BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,
  31. const nsDisplayListSet& aLists) override;
  32. virtual void Init(nsIContent* aContent,
  33. nsContainerFrame* aParent,
  34. nsIFrame* aPrevInFlow) override;
  35. virtual nsIAtom* GetType() const override;
  36. #ifdef DEBUG_FRAME_DUMP
  37. virtual nsresult GetFrameName(nsAString& aResult) const override
  38. {
  39. return MakeFrameName(NS_LITERAL_STRING("Deck"), aResult);
  40. }
  41. #endif
  42. explicit nsDeckFrame(nsStyleContext* aContext);
  43. nsIFrame* GetSelectedBox();
  44. protected:
  45. void IndexChanged();
  46. int32_t GetSelectedIndex();
  47. void HideBox(nsIFrame* aBox);
  48. private:
  49. int32_t mIndex;
  50. }; // class nsDeckFrame
  51. #endif