layout/xul/grid/nsGridLayout2.h

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef nsGridLayout2_h___
michael@0 8 #define nsGridLayout2_h___
michael@0 9
michael@0 10 #include "mozilla/Attributes.h"
michael@0 11 #include "nsStackLayout.h"
michael@0 12 #include "nsIGridPart.h"
michael@0 13 #include "nsCoord.h"
michael@0 14 #include "nsGrid.h"
michael@0 15
michael@0 16 class nsIPresContext;
michael@0 17 class nsGridRowGroupLayout;
michael@0 18 class nsGridRowLayout;
michael@0 19 class nsGridRow;
michael@0 20 class nsBoxLayoutState;
michael@0 21 class nsGridCell;
michael@0 22
michael@0 23 /**
michael@0 24 * The nsBoxLayout implementation for a grid.
michael@0 25 */
michael@0 26 class nsGridLayout2 : public nsStackLayout,
michael@0 27 public nsIGridPart
michael@0 28 {
michael@0 29 public:
michael@0 30
michael@0 31 friend nsresult NS_NewGridLayout2(nsIPresShell* aPresShell, nsBoxLayout** aNewLayout);
michael@0 32
michael@0 33 NS_DECL_ISUPPORTS_INHERITED
michael@0 34
michael@0 35 NS_IMETHOD Layout(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE;
michael@0 36 virtual void IntrinsicWidthsDirty(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE;
michael@0 37
michael@0 38 virtual nsGridRowGroupLayout* CastToRowGroupLayout() MOZ_OVERRIDE { return nullptr; }
michael@0 39 virtual nsGridLayout2* CastToGridLayout() MOZ_OVERRIDE { return this; }
michael@0 40 virtual nsGrid* GetGrid(nsIFrame* aBox, int32_t* aIndex, nsGridRowLayout* aRequestor=nullptr) MOZ_OVERRIDE;
michael@0 41 virtual nsIGridPart* GetParentGridPart(nsIFrame* aBox, nsIFrame** aParentBox) MOZ_OVERRIDE {
michael@0 42 NS_NOTREACHED("Should not be called"); return nullptr;
michael@0 43 }
michael@0 44 virtual nsSize GetMinSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE;
michael@0 45 virtual nsSize GetMaxSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE;
michael@0 46 virtual nsSize GetPrefSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE;
michael@0 47 virtual void CountRowsColumns(nsIFrame* aBox, int32_t& aRowCount, int32_t& aComputedColumnCount) MOZ_OVERRIDE { aRowCount++; }
michael@0 48 virtual void DirtyRows(nsIFrame* aBox, nsBoxLayoutState& aState) MOZ_OVERRIDE { }
michael@0 49 virtual int32_t BuildRows(nsIFrame* aBox, nsGridRow* aRows) MOZ_OVERRIDE;
michael@0 50 virtual nsMargin GetTotalMargin(nsIFrame* aBox, bool aIsHorizontal) MOZ_OVERRIDE;
michael@0 51 virtual Type GetType() MOZ_OVERRIDE { return eGrid; }
michael@0 52 virtual void ChildrenInserted(nsIFrame* aBox, nsBoxLayoutState& aState,
michael@0 53 nsIFrame* aPrevBox,
michael@0 54 const nsFrameList::Slice& aNewChildren) MOZ_OVERRIDE;
michael@0 55 virtual void ChildrenAppended(nsIFrame* aBox, nsBoxLayoutState& aState,
michael@0 56 const nsFrameList::Slice& aNewChildren) MOZ_OVERRIDE;
michael@0 57 virtual void ChildrenRemoved(nsIFrame* aBox, nsBoxLayoutState& aState,
michael@0 58 nsIFrame* aChildList) MOZ_OVERRIDE;
michael@0 59 virtual void ChildrenSet(nsIFrame* aBox, nsBoxLayoutState& aState,
michael@0 60 nsIFrame* aChildList) MOZ_OVERRIDE;
michael@0 61
michael@0 62 virtual nsIGridPart* AsGridPart() MOZ_OVERRIDE { return this; }
michael@0 63
michael@0 64 static void AddOffset(nsBoxLayoutState& aState, nsIFrame* aChild, nsSize& aSize);
michael@0 65
michael@0 66 protected:
michael@0 67
michael@0 68 nsGridLayout2(nsIPresShell* aShell);
michael@0 69 nsGrid mGrid;
michael@0 70
michael@0 71 private:
michael@0 72 void AddWidth(nsSize& aSize, nscoord aSize2, bool aIsHorizontal);
michael@0 73
michael@0 74
michael@0 75 }; // class nsGridLayout2
michael@0 76
michael@0 77
michael@0 78 #endif
michael@0 79

mercurial