layout/xul/nsStackLayout.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/xul/nsStackLayout.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,56 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +/**
    1.10 +
    1.11 +  Eric D Vaughan
    1.12 +  A frame that can have multiple children. Only one child may be displayed at one time. So the
    1.13 +  can be flipped though like a deck of cards.
    1.14 + 
    1.15 +**/
    1.16 +
    1.17 +#ifndef nsStackLayout_h___
    1.18 +#define nsStackLayout_h___
    1.19 +
    1.20 +#include "mozilla/Attributes.h"
    1.21 +#include "nsBoxLayout.h"
    1.22 +#include "nsCOMPtr.h"
    1.23 +#include "nsCoord.h"
    1.24 +
    1.25 +class nsIPresShell;
    1.26 +
    1.27 +nsresult NS_NewStackLayout(nsIPresShell* aPresShell, nsCOMPtr<nsBoxLayout>& aNewLayout);
    1.28 +
    1.29 +class nsStackLayout : public nsBoxLayout
    1.30 +{
    1.31 +public:
    1.32 +
    1.33 +  friend nsresult NS_NewStackLayout(nsIPresShell* aPresShell, nsCOMPtr<nsBoxLayout>& aNewLayout);
    1.34 +  static void Shutdown();
    1.35 +
    1.36 +  nsStackLayout();
    1.37 +
    1.38 +  NS_IMETHOD Layout(nsIFrame* aBox, nsBoxLayoutState& aState) MOZ_OVERRIDE;
    1.39 +
    1.40 +  virtual nsSize GetPrefSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE;
    1.41 +  virtual nsSize GetMinSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE;
    1.42 +  virtual nsSize GetMaxSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE;
    1.43 +  virtual nscoord GetAscent(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE;
    1.44 +
    1.45 +  // get the child offsets for aChild and set them in aMargin. Returns a
    1.46 +  // bitfield mask of the SPECIFIED_LEFT, SPECIFIED_RIGHT, SPECIFIED_TOP and
    1.47 +  // SPECIFIED_BOTTOM offsets indicating which sides have been specified by
    1.48 +  // attributes.
    1.49 +  static uint8_t GetOffset(nsBoxLayoutState& aState, nsIFrame* aChild, nsMargin& aMargin);
    1.50 +
    1.51 +private:
    1.52 +  static nsBoxLayout* gInstance;
    1.53 +
    1.54 +}; // class nsStackLayout
    1.55 +
    1.56 +
    1.57 +
    1.58 +#endif
    1.59 +

mercurial