layout/xul/grid/nsIGridPart.h

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef nsIGridPart_h___
michael@0 7 #define nsIGridPart_h___
michael@0 8
michael@0 9 #include "nsISupports.h"
michael@0 10
michael@0 11 class nsGridRowGroupLayout;
michael@0 12 class nsGrid;
michael@0 13 class nsGridRowLayout;
michael@0 14 class nsGridRow;
michael@0 15 class nsGridLayout2;
michael@0 16
michael@0 17 // 07373ed7-e947-4a5e-b36c-69f7c195677b
michael@0 18 #define NS_IGRIDPART_IID \
michael@0 19 { 0x07373ed7, 0xe947, 0x4a5e, \
michael@0 20 { 0xb3, 0x6c, 0x69, 0xf7, 0xc1, 0x95, 0x67, 0x7b } }
michael@0 21
michael@0 22 /**
michael@0 23 * An additional interface implemented by nsBoxLayout implementations
michael@0 24 * for parts of a grid (excluding cells, which are not special).
michael@0 25 */
michael@0 26 class nsIGridPart : public nsISupports {
michael@0 27
michael@0 28 public:
michael@0 29
michael@0 30 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IGRIDPART_IID)
michael@0 31
michael@0 32 virtual nsGridRowGroupLayout* CastToRowGroupLayout()=0;
michael@0 33 virtual nsGridLayout2* CastToGridLayout()=0;
michael@0 34
michael@0 35 /**
michael@0 36 * @param aBox [IN] The other half of the |this| parameter, i.e., the box
michael@0 37 * whose layout manager is |this|.
michael@0 38 * @param aIndex [INOUT] For callers not setting aRequestor, the value
michael@0 39 * pointed to by aIndex is incremented by the index
michael@0 40 * of the row (aBox) within its row group; if aBox
michael@0 41 * is not a row/column, it is untouched.
michael@0 42 * The implementation does this by doing the aIndex
michael@0 43 * incrementing in the call to the parent row group
michael@0 44 * when aRequestor is non-null.
michael@0 45 * @param aRequestor [IN] Non-null if and only if this is a recursive
michael@0 46 * call from the GetGrid method on a child grid part,
michael@0 47 * in which case it is a pointer to that grid part.
michael@0 48 * (This may only be non-null for row groups and
michael@0 49 * grids.)
michael@0 50 * @return The grid of which aBox (a row, row group, or grid) is a part.
michael@0 51 */
michael@0 52 virtual nsGrid* GetGrid(nsIFrame* aBox, int32_t* aIndex, nsGridRowLayout* aRequestor=nullptr)=0;
michael@0 53
michael@0 54 /**
michael@0 55 * @param aBox [IN] The other half of the |this| parameter, i.e., the box
michael@0 56 * whose layout manager is |this|.
michael@0 57 * @param aParentBox [OUT] The box representing the next level up in
michael@0 58 * the grid (i.e., row group for a row, grid for a
michael@0 59 * row group).
michael@0 60 * @returns The layout manager for aParentBox.
michael@0 61 */
michael@0 62 virtual nsIGridPart* GetParentGridPart(nsIFrame* aBox, nsIFrame** aParentBox) = 0;
michael@0 63
michael@0 64 /**
michael@0 65 * @param aBox [IN] The other half of the |this| parameter, i.e., the box
michael@0 66 * whose layout manager is |this|.
michael@0 67 * @param aRowCount [INOUT] Row count
michael@0 68 * @param aComputedColumnCount [INOUT] Column count
michael@0 69 */
michael@0 70 virtual void CountRowsColumns(nsIFrame* aBox, int32_t& aRowCount, int32_t& aComputedColumnCount)=0;
michael@0 71 virtual void DirtyRows(nsIFrame* aBox, nsBoxLayoutState& aState)=0;
michael@0 72 virtual int32_t BuildRows(nsIFrame* aBox, nsGridRow* aRows)=0;
michael@0 73 virtual nsMargin GetTotalMargin(nsIFrame* aBox, bool aIsHorizontal)=0;
michael@0 74 virtual int32_t GetRowCount() { return 1; }
michael@0 75
michael@0 76 /**
michael@0 77 * Return the level of the grid hierarchy this grid part represents.
michael@0 78 */
michael@0 79 enum Type { eGrid, eRowGroup, eRowLeaf };
michael@0 80 virtual Type GetType()=0;
michael@0 81
michael@0 82 /**
michael@0 83 * Return whether this grid part is an appropriate parent for the argument.
michael@0 84 */
michael@0 85 bool CanContain(nsIGridPart* aPossibleChild) {
michael@0 86 Type thisType = GetType(), childType = aPossibleChild->GetType();
michael@0 87 return thisType + 1 == childType || (thisType == eRowGroup && childType == eRowGroup);
michael@0 88 }
michael@0 89
michael@0 90 };
michael@0 91
michael@0 92 NS_DEFINE_STATIC_IID_ACCESSOR(nsIGridPart, NS_IGRIDPART_IID)
michael@0 93
michael@0 94 #endif
michael@0 95

mercurial