SetDefaultBehavior is not needed since all views handled in this function have min and max size equal the pref size (despite of the status bar length, which is ok). As a result they don't grow or shrink undesirable as assumed previously. As a result also the AutoPreferredContentSize is not needed.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38795 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
9576365d8f
commit
19ddd4f1cb
|
@ -65,10 +65,6 @@ public:
|
|||
void SetRightInset(int32 right);
|
||||
void SetBottomInset(int32 bottom);
|
||||
|
||||
void SetDefaultBehavior();
|
||||
bool AutoPreferredContentSize() const;
|
||||
void SetAutoPreferredContentSize(bool value);
|
||||
|
||||
operator BString() const;
|
||||
void GetString(BString& string) const;
|
||||
|
||||
|
@ -114,7 +110,6 @@ private:
|
|||
Constraint* fMaxContentWidth;
|
||||
Constraint* fMinContentHeight;
|
||||
Constraint* fMaxContentHeight;
|
||||
bool fAutoPreferredContentSize;
|
||||
Constraint* fPreferredContentWidth;
|
||||
Constraint* fPreferredContentHeight;
|
||||
double fContentAspectRatio;
|
||||
|
|
|
@ -310,8 +310,6 @@ BALMLayout::AddItem(BLayoutItem* item, XTab* left, YTab* top, XTab* right,
|
|||
return NULL;
|
||||
|
||||
area->_Init(&fSolver, left, top, right, bottom);
|
||||
area->SetDefaultBehavior();
|
||||
area->SetAutoPreferredContentSize(false);
|
||||
return area;
|
||||
}
|
||||
|
||||
|
@ -326,8 +324,6 @@ BALMLayout::AddItem(BLayoutItem* item, Row* row, Column* column)
|
|||
return NULL;
|
||||
|
||||
area->_Init(&fSolver, row, column);
|
||||
area->SetDefaultBehavior();
|
||||
area->SetAutoPreferredContentSize(false);
|
||||
return area;
|
||||
}
|
||||
|
||||
|
@ -631,14 +627,6 @@ BALMLayout::_CreateLayoutItem(BView* view)
|
|||
void
|
||||
BALMLayout::_SolveLayout()
|
||||
{
|
||||
// if autoPreferredContentSize is set on an area,
|
||||
// readjust its preferredContentSize and penalties settings
|
||||
for (int32 i = 0; i < CountItems(); i++) {
|
||||
Area* currentArea = _AreaForItem(ItemAt(i));
|
||||
if (currentArea && currentArea->AutoPreferredContentSize())
|
||||
currentArea->SetDefaultBehavior();
|
||||
}
|
||||
|
||||
// Try to solve the layout until the result is OPTIMAL or INFEASIBLE,
|
||||
// maximally 15 tries sometimes the solving algorithm encounters numerical
|
||||
// problems (NUMFAILURE), and repeating the solving often helps to overcome
|
||||
|
|
|
@ -29,30 +29,6 @@ Area::View()
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the auto preferred content size.
|
||||
*
|
||||
* @return the auto preferred content size
|
||||
*/
|
||||
bool
|
||||
Area::AutoPreferredContentSize() const
|
||||
{
|
||||
return fAutoPreferredContentSize;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the auto preferred content size true or false.
|
||||
*
|
||||
* @param value the auto preferred content size
|
||||
*/
|
||||
void
|
||||
Area::SetAutoPreferredContentSize(bool value)
|
||||
{
|
||||
fAutoPreferredContentSize = value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the left tab of the area.
|
||||
*
|
||||
|
@ -407,34 +383,6 @@ Area::SetBottomInset(int32 bottom)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the preferred size according to the content's PreferredSize method,
|
||||
* and the penalties according to heuristics.
|
||||
*/
|
||||
void
|
||||
Area::SetDefaultBehavior()
|
||||
{
|
||||
if (View() == NULL) {
|
||||
SetShrinkPenalties(BSize(0, 0));
|
||||
SetGrowPenalties(BSize(0, 0));
|
||||
return;
|
||||
}
|
||||
|
||||
if (dynamic_cast<BButton*>(View()) != NULL
|
||||
|| dynamic_cast<BRadioButton*>(View()) != NULL
|
||||
|| dynamic_cast<BCheckBox*>(View()) != NULL
|
||||
|| dynamic_cast<BStringView*>(View()) != NULL
|
||||
|| dynamic_cast<BPictureButton*>(View()) != NULL
|
||||
|| dynamic_cast<BStatusBar*>(View()) != NULL) {
|
||||
fShrinkPenalties = BSize(4, 4);
|
||||
fGrowPenalties = BSize(3, 3);
|
||||
} else {
|
||||
fShrinkPenalties = BSize(2, 2);
|
||||
fGrowPenalties = BSize(1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Area::operator BString() const
|
||||
{
|
||||
BString string;
|
||||
|
@ -533,12 +481,17 @@ Area::Area(BLayoutItem* item)
|
|||
fRow(NULL),
|
||||
fColumn(NULL),
|
||||
|
||||
fShrinkPenalties(2, 2),
|
||||
fGrowPenalties(1, 1),
|
||||
|
||||
fMinContentWidth(NULL),
|
||||
fMaxContentWidth(NULL),
|
||||
fMinContentHeight(NULL),
|
||||
fMaxContentHeight(NULL),
|
||||
fPreferredContentWidth(NULL),
|
||||
fPreferredContentHeight(NULL),
|
||||
|
||||
fContentAspectRatio(0),
|
||||
fContentAspectRatioC(NULL)
|
||||
{
|
||||
|
||||
|
@ -551,12 +504,6 @@ Area::Area(BLayoutItem* item)
|
|||
void
|
||||
Area::_Init(LinearSpec* ls, XTab* left, YTab* top, XTab* right, YTab* bottom)
|
||||
{
|
||||
fShrinkPenalties = BSize(2, 2);
|
||||
fGrowPenalties = BSize(1, 1);
|
||||
fContentAspectRatio = 0;
|
||||
|
||||
fAutoPreferredContentSize = false;
|
||||
|
||||
fLS = ls;
|
||||
fLeft = left;
|
||||
fRight = right;
|
||||
|
|
Loading…
Reference in New Issue