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:
@@ -65,10 +65,6 @@ public:
|
|||||||
void SetRightInset(int32 right);
|
void SetRightInset(int32 right);
|
||||||
void SetBottomInset(int32 bottom);
|
void SetBottomInset(int32 bottom);
|
||||||
|
|
||||||
void SetDefaultBehavior();
|
|
||||||
bool AutoPreferredContentSize() const;
|
|
||||||
void SetAutoPreferredContentSize(bool value);
|
|
||||||
|
|
||||||
operator BString() const;
|
operator BString() const;
|
||||||
void GetString(BString& string) const;
|
void GetString(BString& string) const;
|
||||||
|
|
||||||
@@ -114,7 +110,6 @@ private:
|
|||||||
Constraint* fMaxContentWidth;
|
Constraint* fMaxContentWidth;
|
||||||
Constraint* fMinContentHeight;
|
Constraint* fMinContentHeight;
|
||||||
Constraint* fMaxContentHeight;
|
Constraint* fMaxContentHeight;
|
||||||
bool fAutoPreferredContentSize;
|
|
||||||
Constraint* fPreferredContentWidth;
|
Constraint* fPreferredContentWidth;
|
||||||
Constraint* fPreferredContentHeight;
|
Constraint* fPreferredContentHeight;
|
||||||
double fContentAspectRatio;
|
double fContentAspectRatio;
|
||||||
|
|||||||
@@ -310,8 +310,6 @@ BALMLayout::AddItem(BLayoutItem* item, XTab* left, YTab* top, XTab* right,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
area->_Init(&fSolver, left, top, right, bottom);
|
area->_Init(&fSolver, left, top, right, bottom);
|
||||||
area->SetDefaultBehavior();
|
|
||||||
area->SetAutoPreferredContentSize(false);
|
|
||||||
return area;
|
return area;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,8 +324,6 @@ BALMLayout::AddItem(BLayoutItem* item, Row* row, Column* column)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
area->_Init(&fSolver, row, column);
|
area->_Init(&fSolver, row, column);
|
||||||
area->SetDefaultBehavior();
|
|
||||||
area->SetAutoPreferredContentSize(false);
|
|
||||||
return area;
|
return area;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -631,14 +627,6 @@ BALMLayout::_CreateLayoutItem(BView* view)
|
|||||||
void
|
void
|
||||||
BALMLayout::_SolveLayout()
|
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,
|
// Try to solve the layout until the result is OPTIMAL or INFEASIBLE,
|
||||||
// maximally 15 tries sometimes the solving algorithm encounters numerical
|
// maximally 15 tries sometimes the solving algorithm encounters numerical
|
||||||
// problems (NUMFAILURE), and repeating the solving often helps to overcome
|
// problems (NUMFAILURE), and repeating the solving often helps to overcome
|
||||||
|
|||||||
+5
-58
@@ -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.
|
* 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
|
Area::operator BString() const
|
||||||
{
|
{
|
||||||
BString string;
|
BString string;
|
||||||
@@ -533,12 +481,17 @@ Area::Area(BLayoutItem* item)
|
|||||||
fRow(NULL),
|
fRow(NULL),
|
||||||
fColumn(NULL),
|
fColumn(NULL),
|
||||||
|
|
||||||
|
fShrinkPenalties(2, 2),
|
||||||
|
fGrowPenalties(1, 1),
|
||||||
|
|
||||||
fMinContentWidth(NULL),
|
fMinContentWidth(NULL),
|
||||||
fMaxContentWidth(NULL),
|
fMaxContentWidth(NULL),
|
||||||
fMinContentHeight(NULL),
|
fMinContentHeight(NULL),
|
||||||
fMaxContentHeight(NULL),
|
fMaxContentHeight(NULL),
|
||||||
fPreferredContentWidth(NULL),
|
fPreferredContentWidth(NULL),
|
||||||
fPreferredContentHeight(NULL),
|
fPreferredContentHeight(NULL),
|
||||||
|
|
||||||
|
fContentAspectRatio(0),
|
||||||
fContentAspectRatioC(NULL)
|
fContentAspectRatioC(NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -551,12 +504,6 @@ Area::Area(BLayoutItem* item)
|
|||||||
void
|
void
|
||||||
Area::_Init(LinearSpec* ls, XTab* left, YTab* top, XTab* right, YTab* bottom)
|
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;
|
fLS = ls;
|
||||||
fLeft = left;
|
fLeft = left;
|
||||||
fRight = right;
|
fRight = right;
|
||||||
|
|||||||
Reference in New Issue
Block a user