tcp: Fix 64 bit build with debugging features enabled.
[haiku.git] / src / kits / interface / layouter / CollapsingLayouter.h
blobbbb7554ab7705f2811d088ddd79ab4913f17ceae
1 /*
2 * Copyright 2011, Haiku, Inc.
3 * All rights reserved. Distributed under the terms of the MIT License.
4 */
5 #ifndef COLLAPSING_LAYOUTER_H
6 #define COLLAPSING_LAYOUTER_H
8 #include "Layouter.h"
11 namespace BPrivate {
12 namespace Layout {
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 {
22 public:
23 CollapsingLayouter(int32 elementCount,
24 float spacing);
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();
42 private:
43 class ProxyLayoutInfo;
44 struct Constraint;
45 struct ElementInfo;
47 void _ValidateLayouter();
48 Layouter* _CreateLayouter();
49 void _DoCollapse();
50 void _AddConstraints();
51 void _AddConstraints(int32 position,
52 const Constraint* c);
53 void _SetWeights();
55 int32 fElementCount;
56 ElementInfo* fElements;
57 int32 fValidElementCount;
58 bool fHaveMultiElementConstraints;
59 float fSpacing;
60 Layouter* fLayouter;
63 } // namespace Layout
64 } // namespace BPrivate
66 using BPrivate::Layout::CollapsingLayouter;
68 #endif // COLLAPSING_LAYOUTER_H