2 * Copyright 2006 - 2010, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
9 #include <Referenceable.h>
19 namespace LinearProgramming
{
40 class RowColumnManager
;
44 * Rectangular area in the GUI, defined by a tab on each side.
59 void SetLeft(BReference
<XTab
> left
);
60 void SetRight(BReference
<XTab
> right
);
61 void SetTop(BReference
<YTab
> top
);
62 void SetBottom(BReference
<YTab
> bottom
);
65 Column
* GetColumn() const;
67 double ContentAspectRatio() const;
68 void SetContentAspectRatio(double ratio
);
70 BSize
ShrinkPenalties() const;
71 BSize
GrowPenalties() const;
72 void SetShrinkPenalties(BSize shrink
);
73 void SetGrowPenalties(BSize grow
);
75 void GetInsets(float* left
, float* top
, float* right
,
77 float LeftInset() const;
78 float TopInset() const;
79 float RightInset() const;
80 float BottomInset() const;
82 void SetInsets(float insets
);
83 void SetInsets(float horizontal
, float vertical
);
84 void SetInsets(float left
, float top
, float right
,
86 void SetLeftInset(float left
);
87 void SetTopInset(float top
);
88 void SetRightInset(float right
);
89 void SetBottomInset(float bottom
);
91 BString
ToString() const;
93 LinearProgramming::Constraint
*
94 SetWidthAs(Area
* area
, float factor
= 1.0f
);
96 LinearProgramming::Constraint
*
97 SetHeightAs(Area
* area
, float factor
= 1.0f
);
99 void InvalidateSizeConstraints();
104 Area(BLayoutItem
* item
);
106 void _Init(LinearProgramming::LinearSpec
* ls
,
107 XTab
* left
, YTab
* top
, XTab
* right
,
108 YTab
* bottom
, RowColumnManager
* manager
);
109 void _Init(LinearProgramming::LinearSpec
* ls
,
110 Row
* row
, Column
* column
,
111 RowColumnManager
* manager
);
113 void _DoLayout(const BPoint
& offset
);
115 void _UpdateMinSizeConstraint(BSize min
);
116 void _UpdateMaxSizeConstraint(BSize max
);
118 friend class BALMLayout
;
119 friend class RowColumnManager
;
120 friend class BPrivate::SharedSolver
;
122 BLayoutItem
* fLayoutItem
;
125 LinearProgramming::LinearSpec
* fLS
;
127 BReference
<XTab
> fLeft
;
128 BReference
<XTab
> fRight
;
129 BReference
<YTab
> fTop
;
130 BReference
<YTab
> fBottom
;
135 BSize fShrinkPenalties
;
136 BSize fGrowPenalties
;
139 BSize fRightBottomInset
;
141 double fContentAspectRatio
;
142 RowColumnManager
* fRowColumnManager
;
144 LinearProgramming::Constraint
* fMinContentWidth
;
145 LinearProgramming::Constraint
* fMaxContentWidth
;
146 LinearProgramming::Constraint
* fMinContentHeight
;
147 LinearProgramming::Constraint
* fMaxContentHeight
;
148 LinearProgramming::Constraint
* fContentAspectRatioC
;