2 * Copyright 2011, Haiku, Inc.
3 * All rights reserved. Distributed under the terms of the MIT License.
5 #ifndef COLLAPSING_LAYOUTER_H
6 #define COLLAPSING_LAYOUTER_H
15 /* This layouter wraps either a Compound, Simple or OneElement layouter, and
16 * removes elements which have no constraints, or min/max constraints of
17 * B_SIZE_UNSET. The child layouter is given only the constraints for the
18 * remaining elements. When using the LayoutInfo of this layouter,
19 * collapsed (removed) elements are given no space on screen.
21 class CollapsingLayouter
: public Layouter
{
23 CollapsingLayouter(int32 elementCount
,
25 virtual ~CollapsingLayouter();
27 virtual void AddConstraints(int32 element
, int32 length
,
28 float min
, float max
, float preferred
);
29 virtual void SetWeight(int32 element
, float weight
);
31 virtual float MinSize();
32 virtual float MaxSize();
33 virtual float PreferredSize();
35 virtual LayoutInfo
* CreateLayoutInfo();
37 virtual void Layout(LayoutInfo
* layoutInfo
, float size
);
39 virtual Layouter
* CloneLayouter();
43 class ProxyLayoutInfo
;
47 void _ValidateLayouter();
48 Layouter
* _CreateLayouter();
50 void _AddConstraints();
51 void _AddConstraints(int32 position
,
56 ElementInfo
* fElements
;
57 int32 fValidElementCount
;
58 bool fHaveMultiElementConstraints
;
64 } // namespace BPrivate
66 using BPrivate::Layout::CollapsingLayouter
;
68 #endif // COLLAPSING_LAYOUTER_H