michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /** michael@0: michael@0: Eric D Vaughan michael@0: A frame that can have multiple children. Only one child may be displayed at one time. So the michael@0: can be flipped though like a deck of cards. michael@0: michael@0: **/ michael@0: michael@0: #ifndef nsStackLayout_h___ michael@0: #define nsStackLayout_h___ michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsBoxLayout.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsCoord.h" michael@0: michael@0: class nsIPresShell; michael@0: michael@0: nsresult NS_NewStackLayout(nsIPresShell* aPresShell, nsCOMPtr& aNewLayout); michael@0: michael@0: class nsStackLayout : public nsBoxLayout michael@0: { michael@0: public: michael@0: michael@0: friend nsresult NS_NewStackLayout(nsIPresShell* aPresShell, nsCOMPtr& aNewLayout); michael@0: static void Shutdown(); michael@0: michael@0: nsStackLayout(); michael@0: michael@0: NS_IMETHOD Layout(nsIFrame* aBox, nsBoxLayoutState& aState) MOZ_OVERRIDE; michael@0: michael@0: virtual nsSize GetPrefSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE; michael@0: virtual nsSize GetMinSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE; michael@0: virtual nsSize GetMaxSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE; michael@0: virtual nscoord GetAscent(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE; michael@0: michael@0: // get the child offsets for aChild and set them in aMargin. Returns a michael@0: // bitfield mask of the SPECIFIED_LEFT, SPECIFIED_RIGHT, SPECIFIED_TOP and michael@0: // SPECIFIED_BOTTOM offsets indicating which sides have been specified by michael@0: // attributes. michael@0: static uint8_t GetOffset(nsBoxLayoutState& aState, nsIFrame* aChild, nsMargin& aMargin); michael@0: michael@0: private: michael@0: static nsBoxLayout* gInstance; michael@0: michael@0: }; // class nsStackLayout michael@0: michael@0: michael@0: michael@0: #endif michael@0: