gecko-dev/layout/xul/nsBox.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

85 строки
3.0 KiB
C
Исходник Обычный вид История

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
2012-05-21 15:12:37 +04:00
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
2000-03-31 11:02:06 +04:00
#ifndef nsBox_h___
#define nsBox_h___
#include "mozilla/Attributes.h"
#include "mozilla/StaticPtr.h"
#include "nsIFrame.h"
2000-03-31 11:02:06 +04:00
class nsBox : public nsIFrame {
2000-03-31 11:02:06 +04:00
public:
friend class nsIFrame;
virtual nsSize GetXULPrefSize(nsBoxLayoutState& aBoxLayoutState) override;
virtual nsSize GetXULMinSize(nsBoxLayoutState& aBoxLayoutState) override;
virtual nsSize GetXULMaxSize(nsBoxLayoutState& aBoxLayoutState) override;
virtual nscoord GetXULFlex() override;
virtual nscoord GetXULBoxAscent(nsBoxLayoutState& aBoxLayoutState) override;
virtual nsSize GetXULMinSizeForScrollArea(
nsBoxLayoutState& aBoxLayoutState) override;
virtual bool IsXULCollapsed() override;
2000-03-31 11:02:06 +04:00
virtual void SetXULBounds(nsBoxLayoutState& aBoxLayoutState,
const nsRect& aRect,
bool aRemoveOverflowAreas = false) override;
virtual nsresult GetXULBorder(nsMargin& aBorderAndPadding) override;
virtual nsresult GetXULPadding(nsMargin& aBorderAndPadding) override;
virtual nsresult GetXULMargin(nsMargin& aMargin) override;
virtual Valignment GetXULVAlign() const override { return vAlign_Top; }
virtual Halignment GetXULHAlign() const override { return hAlign_Left; }
2000-03-31 11:02:06 +04:00
virtual nsresult XULRelayoutChildAtOrdinal(nsIFrame* aChild) override;
nsBox(ComputedStyle*, nsPresContext*, ClassID);
virtual ~nsBox();
2000-03-31 11:02:06 +04:00
/**
* Returns true if this box clips its children, e.g., if this box is an
* scrollbox.
*/
virtual bool DoesClipChildren();
virtual bool ComputesOwnOverflowArea() = 0;
nsresult SyncLayout(nsBoxLayoutState& aBoxLayoutState);
2000-03-31 11:02:06 +04:00
bool DoesNeedRecalc(const nsSize& aSize);
bool DoesNeedRecalc(nscoord aCoord);
void SizeNeedsRecalc(nsSize& aSize);
void CoordNeedsRecalc(nscoord& aCoord);
2000-03-31 11:02:06 +04:00
void AddBorderAndPadding(nsSize& aSize);
2000-03-31 11:02:06 +04:00
static void AddBorderAndPadding(nsIFrame* aBox, nsSize& aSize);
static void AddMargin(nsIFrame* aChild, nsSize& aSize);
2000-03-31 11:02:06 +04:00
static void AddMargin(nsSize& aSize, const nsMargin& aMargin);
static nsSize BoundsCheckMinMax(const nsSize& aMinSize,
const nsSize& aMaxSize);
static nsSize BoundsCheck(const nsSize& aMinSize, const nsSize& aPrefSize,
const nsSize& aMaxSize);
static nscoord BoundsCheck(nscoord aMinSize, nscoord aPrefSize,
nscoord aMaxSize);
2000-03-31 11:02:06 +04:00
static nsIFrame* GetChildXULBox(const nsIFrame* aFrame);
static nsIFrame* GetNextXULBox(const nsIFrame* aFrame);
static nsIFrame* GetParentXULBox(const nsIFrame* aFrame);
2000-03-31 11:02:06 +04:00
protected:
nsresult BeginXULLayout(nsBoxLayoutState& aState);
NS_IMETHOD DoXULLayout(nsBoxLayoutState& aBoxLayoutState);
nsresult EndXULLayout(nsBoxLayoutState& aState);
2000-03-31 11:02:06 +04:00
enum eMouseThrough { unset, never, always };
};
#endif