Clean up Area header a bit more and remove unused functions.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38780 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler
2010-09-22 05:50:51 +00:00
parent 0871de7bdf
commit eb4dd1a2a9
3 changed files with 104 additions and 154 deletions
+13 -23
View File
@@ -34,40 +34,34 @@ public:
BView* View(); BView* View();
XTab* Left() const; XTab* Left() const;
void SetLeft(XTab* left);
XTab* Right() const; XTab* Right() const;
void SetRight(XTab* right);
YTab* Top() const; YTab* Top() const;
void SetTop(YTab* top);
YTab* Bottom() const; YTab* Bottom() const;
void SetLeft(XTab* left);
void SetRight(XTab* right);
void SetTop(YTab* top);
void SetBottom(YTab* bottom); void SetBottom(YTab* bottom);
Row* GetRow() const; Row* GetRow() const;
void SetRow(Row* row);
Column* GetColumn() const; Column* GetColumn() const;
void SetRow(Row* row);
void SetColumn(Column* column); void SetColumn(Column* column);
XTab* ContentLeft() const;
YTab* ContentTop() const;
XTab* ContentRight() const;
YTab* ContentBottom() const;
BSize MinContentSize() const;
double ContentAspectRatio() const; double ContentAspectRatio() const;
void SetContentAspectRatio(double ratio); void SetContentAspectRatio(double ratio);
BSize ShrinkPenalties() const; BSize ShrinkPenalties() const;
void SetShrinkPenalties(BSize shrink);
BSize GrowPenalties() const; BSize GrowPenalties() const;
void SetShrinkPenalties(BSize shrink);
void SetGrowPenalties(BSize grow); void SetGrowPenalties(BSize grow);
int32 LeftInset() const; int32 LeftInset() const;
void SetLeftInset(int32 left);
int32 TopInset() const; int32 TopInset() const;
void SetTopInset(int32 top);
int32 RightInset() const; int32 RightInset() const;
void SetRightInset(int32 right);
int32 BottomInset() const; int32 BottomInset() const;
void SetLeftInset(int32 left);
void SetTopInset(int32 top);
void SetRightInset(int32 right);
void SetBottomInset(int32 bottom); void SetBottomInset(int32 bottom);
void SetDefaultBehavior(); void SetDefaultBehavior();
@@ -83,29 +77,25 @@ public:
void InvalidateSizeConstraints(); void InvalidateSizeConstraints();
protected: private:
Area(BLayoutItem* item); Area(BLayoutItem* item);
void Init(LinearSpec* ls, XTab* left, YTab* top, void _Init(LinearSpec* ls, XTab* left, YTab* top,
XTab* right, YTab* bottom, BView* content, XTab* right, YTab* bottom, BView* content,
BSize minContentSize); BSize minContentSize);
void Init(LinearSpec* ls, Row* row, Column* column, void _Init(LinearSpec* ls, Row* row, Column* column,
BView* content, BSize minContentSize); BView* content, BSize minContentSize);
void DoLayout(); void _DoLayout();
private:
void _UpdateMinSizeConstraint(BSize min); void _UpdateMinSizeConstraint(BSize min);
void _UpdateMaxSizeConstraint(BSize max); void _UpdateMaxSizeConstraint(BSize max);
void _UpdatePreferredConstraint(BSize preferred); void _UpdatePreferredConstraint(BSize preferred);
protected:
BList fConstraints;
private: private:
BLayoutItem* fLayoutItem; BLayoutItem* fLayoutItem;
LinearSpec* fLS; LinearSpec* fLS;
BList fConstraints;
XTab* fLeft; XTab* fLeft;
XTab* fRight; XTab* fRight;
+5 -5
View File
@@ -162,7 +162,7 @@ BALMLayout::AddArea(XTab* left, YTab* top, XTab* right, YTab* bottom,
if (!area) if (!area)
return NULL; return NULL;
area->Init(&fSolver, left, top, right, bottom, content, area->_Init(&fSolver, left, top, right, bottom, content,
minContentSize); minContentSize);
return area; return area;
} }
@@ -186,7 +186,7 @@ BALMLayout::AddArea(Row* row, Column* column, BView* content,
if (!area) if (!area)
return NULL; return NULL;
area->Init(&fSolver, row, column, content, minContentSize); area->_Init(&fSolver, row, column, content, minContentSize);
return area; return area;
} }
@@ -210,7 +210,7 @@ BALMLayout::AddArea(XTab* left, YTab* top, XTab* right, YTab* bottom,
if (!area) if (!area)
return NULL; return NULL;
area->Init(&fSolver, left, top, right, bottom, content, area->_Init(&fSolver, left, top, right, bottom, content,
BSize(0, 0)); BSize(0, 0));
area->SetDefaultBehavior(); area->SetDefaultBehavior();
area->SetAutoPreferredContentSize(false); area->SetAutoPreferredContentSize(false);
@@ -234,7 +234,7 @@ BALMLayout::AddArea(Row* row, Column* column, BView* content)
if (!area) if (!area)
return NULL; return NULL;
area->Init(&fSolver, row, column, content, BSize(0, 0)); area->_Init(&fSolver, row, column, content, BSize(0, 0));
area->SetDefaultBehavior(); area->SetDefaultBehavior();
area->SetAutoPreferredContentSize(false); area->SetAutoPreferredContentSize(false);
return area; return area;
@@ -403,7 +403,7 @@ BALMLayout::DerivedLayoutItems()
// set the calculated positions and sizes for every area // set the calculated positions and sizes for every area
for (int32 i = 0; i < CountItems(); i++) for (int32 i = 0; i < CountItems(); i++)
_AreaForItem(ItemAt(i))->DoLayout(); _AreaForItem(ItemAt(i))->_DoLayout();
} }
+86 -126
View File
@@ -64,6 +64,38 @@ Area::Left() const
} }
/**
* Gets the right tab of the area.
*
* @return the right tab of the area
*/
XTab*
Area::Right() const
{
return fRight;
}
/**
* Gets the top tab of the area.
*/
YTab*
Area::Top() const
{
return fTop;
}
/**
* Gets the bottom tab of the area.
*/
YTab*
Area::Bottom() const
{
return fBottom;
}
/** /**
* Sets the left tab of the area. * Sets the left tab of the area.
* *
@@ -85,18 +117,6 @@ Area::SetLeft(XTab* left)
} }
/**
* Gets the right tab of the area.
*
* @return the right tab of the area
*/
XTab*
Area::Right() const
{
return fRight;
}
/** /**
* Sets the right tab of the area. * Sets the right tab of the area.
* *
@@ -118,16 +138,6 @@ Area::SetRight(XTab* right)
} }
/**
* Gets the top tab of the area.
*/
YTab*
Area::Top() const
{
return fTop;
}
/** /**
* Sets the top tab of the area. * Sets the top tab of the area.
*/ */
@@ -147,16 +157,6 @@ Area::SetTop(YTab* top)
} }
/**
* Gets the bottom tab of the area.
*/
YTab*
Area::Bottom() const
{
return fBottom;
}
/** /**
* Sets the bottom tab of the area. * Sets the bottom tab of the area.
*/ */
@@ -186,6 +186,16 @@ Area::GetRow() const
} }
/**
* Gets the column that defines the left and right tabs.
*/
Column*
Area::GetColumn() const
{
return fColumn;
}
/** /**
* Sets the row that defines the top and bottom tabs. * Sets the row that defines the top and bottom tabs.
* May be null. * May be null.
@@ -200,16 +210,6 @@ Area::SetRow(Row* row)
} }
/**
* Gets the column that defines the left and right tabs.
*/
Column*
Area::GetColumn() const
{
return fColumn;
}
/** /**
* Sets the column that defines the left and right tabs. * Sets the column that defines the left and right tabs.
* May be null. * May be null.
@@ -224,46 +224,6 @@ Area::SetColumn(Column* column)
} }
/**
* Left tab of the area's content. May be different from the left tab of the area.
*/
XTab*
Area::ContentLeft() const
{
return fLeft;
}
/**
* Top tab of the area's content. May be different from the top tab of the area.
*/
YTab*
Area::ContentTop() const
{
return fTop;
}
/**
* Right tab of the area's content. May be different from the right tab of the area.
*/
XTab*
Area::ContentRight() const
{
return fRight;
}
/**
* Bottom tab of the area's content. May be different from the bottom tab of the area.
*/
YTab*
Area::ContentBottom() const
{
return fBottom;
}
/** /**
* The reluctance with which the area's content shrinks below its preferred size. * The reluctance with which the area's content shrinks below its preferred size.
* The bigger the less likely is such shrinking. * The bigger the less likely is such shrinking.
@@ -275,16 +235,6 @@ Area::ShrinkPenalties() const
} }
void Area::SetShrinkPenalties(BSize shrink) {
fShrinkPenalties = shrink;
if (fPreferredContentWidth != NULL) {
fPreferredContentWidth->SetPenaltyNeg(shrink.Width());
fPreferredContentHeight->SetPenaltyNeg(shrink.Height());
}
fLayoutItem->Layout()->InvalidateLayout();
}
/** /**
* The reluctance with which the area's content grows over its preferred size. * The reluctance with which the area's content grows over its preferred size.
* The bigger the less likely is such growth. * The bigger the less likely is such growth.
@@ -296,6 +246,16 @@ Area::GrowPenalties() const
} }
void Area::SetShrinkPenalties(BSize shrink) {
fShrinkPenalties = shrink;
if (fPreferredContentWidth != NULL) {
fPreferredContentWidth->SetPenaltyNeg(shrink.Width());
fPreferredContentHeight->SetPenaltyNeg(shrink.Height());
}
fLayoutItem->Layout()->InvalidateLayout();
}
void void
Area::SetGrowPenalties(BSize grow) Area::SetGrowPenalties(BSize grow)
{ {
@@ -348,6 +308,36 @@ Area::LeftInset() const
} }
/**
* Gets top inset between area and its content.
*/
int32
Area::TopInset() const
{
return fTopInset;
}
/**
* Gets right inset between area and its content.
*/
int32
Area::RightInset() const
{
return fRightInset;
}
/**
* Gets bottom inset between area and its content.
*/
int32
Area::BottomInset() const
{
return fBottomInset;
}
/** /**
* Sets left inset between area and its content. * Sets left inset between area and its content.
*/ */
@@ -359,16 +349,6 @@ Area::SetLeftInset(int32 left)
} }
/**
* Gets top inset between area and its content.
*/
int32
Area::TopInset() const
{
return fTopInset;
}
/** /**
* Sets top inset between area and its content. * Sets top inset between area and its content.
*/ */
@@ -380,16 +360,6 @@ Area::SetTopInset(int32 top)
} }
/**
* Gets right inset between area and its content.
*/
int32
Area::RightInset() const
{
return fRightInset;
}
/** /**
* Sets right inset between area and its content. * Sets right inset between area and its content.
*/ */
@@ -400,16 +370,6 @@ Area::SetRightInset(int32 right)
} }
/**
* Gets bottom inset between area and its content.
*/
int32
Area::BottomInset() const
{
return fBottomInset;
}
/** /**
* Sets bottom inset between area and its content. * Sets bottom inset between area and its content.
*/ */
@@ -557,7 +517,7 @@ Area::Area(BLayoutItem* item)
* Initialize variables. * Initialize variables.
*/ */
void void
Area::Init(LinearSpec* ls, XTab* left, YTab* top, Area::_Init(LinearSpec* ls, XTab* left, YTab* top,
XTab* right, YTab* bottom, BView* content, BSize minContentSize) XTab* right, YTab* bottom, BView* content, BSize minContentSize)
{ {
fMaxContentWidth = NULL; fMaxContentWidth = NULL;
@@ -602,10 +562,10 @@ Area::Init(LinearSpec* ls, XTab* left, YTab* top,
void void
Area::Init(LinearSpec* ls, Row* row, Column* column, BView* content, Area::_Init(LinearSpec* ls, Row* row, Column* column, BView* content,
BSize minContentSize) BSize minContentSize)
{ {
Init(ls, column->Left(), row->Top(), column->Right(), row->Bottom(), _Init(ls, column->Left(), row->Top(), column->Right(), row->Bottom(),
content, minContentSize); content, minContentSize);
fRow = row; fRow = row;
fColumn = column; fColumn = column;
@@ -615,7 +575,7 @@ Area::Init(LinearSpec* ls, Row* row, Column* column, BView* content,
/** /**
* Perform layout on the area. * Perform layout on the area.
*/ */
void Area::DoLayout() void Area::_DoLayout()
{ {
BRect areaFrame(round(Left()->Value()), round(Top()->Value()), BRect areaFrame(round(Left()->Value()), round(Top()->Value()),
round(Right()->Value()), round(Bottom()->Value())); round(Right()->Value()), round(Bottom()->Value()));