Line data Source code
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 : /**
7 :
8 : Eric D Vaughan
9 : A frame that can have multiple children. Only one child may be displayed at one time. So the
10 : can be flipped though like a deck of cards.
11 :
12 : **/
13 :
14 : #ifndef nsDeckFrame_h___
15 : #define nsDeckFrame_h___
16 :
17 : #include "mozilla/Attributes.h"
18 : #include "nsBoxFrame.h"
19 :
20 1 : class nsDeckFrame final : public nsBoxFrame
21 : {
22 : public:
23 : NS_DECL_QUERYFRAME
24 190 : NS_DECL_FRAMEARENA_HELPERS(nsDeckFrame)
25 :
26 : friend nsIFrame* NS_NewDeckFrame(nsIPresShell* aPresShell,
27 : nsStyleContext* aContext);
28 :
29 : virtual nsresult AttributeChanged(int32_t aNameSpaceID,
30 : nsIAtom* aAttribute,
31 : int32_t aModType) override;
32 :
33 : NS_IMETHOD DoXULLayout(nsBoxLayoutState& aState) override;
34 :
35 : virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
36 : const nsRect& aDirtyRect,
37 : const nsDisplayListSet& aLists) override;
38 :
39 : virtual void RemoveFrame(ChildListID aListID,
40 : nsIFrame* aOldFrame) override;
41 :
42 : virtual void BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,
43 : const nsRect& aDirtyRect,
44 : const nsDisplayListSet& aLists) override;
45 :
46 : virtual void Init(nsIContent* aContent,
47 : nsContainerFrame* aParent,
48 : nsIFrame* aPrevInFlow) override;
49 :
50 : #ifdef DEBUG_FRAME_DUMP
51 0 : virtual nsresult GetFrameName(nsAString& aResult) const override
52 : {
53 0 : return MakeFrameName(NS_LITERAL_STRING("Deck"), aResult);
54 : }
55 : #endif
56 :
57 : explicit nsDeckFrame(nsStyleContext* aContext);
58 :
59 : nsIFrame* GetSelectedBox();
60 :
61 : protected:
62 :
63 : void IndexChanged();
64 : int32_t GetSelectedIndex();
65 : void HideBox(nsIFrame* aBox);
66 :
67 : private:
68 :
69 : int32_t mIndex;
70 :
71 : }; // class nsDeckFrame
72 :
73 : #endif
74 :
|