|
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 nsStackLayout_h___ |
|
15 #define nsStackLayout_h___ |
|
16 |
|
17 #include "mozilla/Attributes.h" |
|
18 #include "nsBoxLayout.h" |
|
19 #include "nsCOMPtr.h" |
|
20 #include "nsCoord.h" |
|
21 |
|
22 class nsIPresShell; |
|
23 |
|
24 nsresult NS_NewStackLayout(nsIPresShell* aPresShell, nsCOMPtr<nsBoxLayout>& aNewLayout); |
|
25 |
|
26 class nsStackLayout : public nsBoxLayout |
|
27 { |
|
28 public: |
|
29 |
|
30 friend nsresult NS_NewStackLayout(nsIPresShell* aPresShell, nsCOMPtr<nsBoxLayout>& aNewLayout); |
|
31 static void Shutdown(); |
|
32 |
|
33 nsStackLayout(); |
|
34 |
|
35 NS_IMETHOD Layout(nsIFrame* aBox, nsBoxLayoutState& aState) MOZ_OVERRIDE; |
|
36 |
|
37 virtual nsSize GetPrefSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE; |
|
38 virtual nsSize GetMinSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE; |
|
39 virtual nsSize GetMaxSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE; |
|
40 virtual nscoord GetAscent(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE; |
|
41 |
|
42 // get the child offsets for aChild and set them in aMargin. Returns a |
|
43 // bitfield mask of the SPECIFIED_LEFT, SPECIFIED_RIGHT, SPECIFIED_TOP and |
|
44 // SPECIFIED_BOTTOM offsets indicating which sides have been specified by |
|
45 // attributes. |
|
46 static uint8_t GetOffset(nsBoxLayoutState& aState, nsIFrame* aChild, nsMargin& aMargin); |
|
47 |
|
48 private: |
|
49 static nsBoxLayout* gInstance; |
|
50 |
|
51 }; // class nsStackLayout |
|
52 |
|
53 |
|
54 |
|
55 #endif |
|
56 |