Author: czeidler Date: 2011-03-14 01:24:12 +0100 (Mon, 14 Mar 2011) New Revision: 40941 Changeset: http://dev.haiku-os.org/changeset/40941 Added: haiku/trunk/src/libs/alm/RowColumnManager.cpp haiku/trunk/src/libs/alm/RowColumnManager.h Modified: haiku/trunk/headers/libs/alm/ALMLayout.h haiku/trunk/headers/libs/alm/Area.h haiku/trunk/headers/libs/alm/Column.h haiku/trunk/headers/libs/alm/Row.h haiku/trunk/headers/libs/alm/Tab.h haiku/trunk/headers/libs/linprog/Constraint.h haiku/trunk/headers/libs/linprog/LinearSpec.h haiku/trunk/headers/libs/linprog/Variable.h haiku/trunk/src/libs/alm/ALMLayout.cpp haiku/trunk/src/libs/alm/Area.cpp haiku/trunk/src/libs/alm/Column.cpp haiku/trunk/src/libs/alm/Jamfile haiku/trunk/src/libs/alm/Row.cpp haiku/trunk/src/libs/linprog/Constraint.cpp haiku/trunk/src/libs/linprog/LinearSpec.cpp haiku/trunk/src/libs/linprog/Variable.cpp Log: - Areas with same tabs are put in a column/row automtically. Move preferred size constraint from Area to the column/row. This avoids a "spring" effect of the quadratic solver if multiple Areas are in the same column/row. - Replace GetString by ToString. - some clean up Modified: haiku/trunk/headers/libs/alm/ALMLayout.h =================================================================== --- haiku/trunk/headers/libs/alm/ALMLayout.h 2011-03-14 00:17:30 UTC (rev 40940) +++ haiku/trunk/headers/libs/alm/ALMLayout.h 2011-03-14 00:24:12 UTC (rev 40941) @@ -22,6 +22,10 @@ namespace BALM { + +class RowColumnManager; + + /*! * A GUI layout engine using the Auckland Layout Model (ALM). */ @@ -33,9 +37,12 @@ XTab* AddXTab(); YTab* AddYTab(); - Row* AddRow(); + int32 CountXTabs() const; + int32 CountYTabs() const; + XTab* XTabAt(int32 index) const; + YTab* YTabAt(int32 index) const; + Row* AddRow(YTab* top, YTab* bottom); - Column* AddColumn(); Column* AddColumn(XTab* left, XTab* right); XTab* Left() const; @@ -56,10 +63,11 @@ Area* AreaFor(const BView* view) const; Area* AreaFor(const BLayoutItem* item) const; + Area* AreaAt(int32 index) const; Area* CurrentArea() const; - void SetCurrentArea(const Area* area); - void SetCurrentArea(const BView* view); - void SetCurrentArea(const BLayoutItem* item); + bool SetCurrentArea(const Area* area); + bool SetCurrentArea(const BView* view); + bool SetCurrentArea(const BLayoutItem* item); XTab* LeftOf(const BView* view) const; XTab* LeftOf(const BLayoutItem* item) const; @@ -150,10 +158,10 @@ Area* fCurrentArea; -#if USE_SCALE_VARIABLE - Variable* fScaleWidth; - Variable* fScaleHeight; -#endif + XTabList fXTabList; + YTabList fYTabList; + + RowColumnManager* fRowColumnManager; }; } // namespace BALM Modified: haiku/trunk/headers/libs/alm/Area.h =================================================================== --- haiku/trunk/headers/libs/alm/Area.h 2011-03-14 00:17:30 UTC (rev 40940) +++ haiku/trunk/headers/libs/alm/Area.h 2011-03-14 00:24:12 UTC (rev 40941) @@ -20,9 +20,6 @@ #include "Tab.h" -#define USE_SCALE_VARIABLE 0 - - class Constraint; @@ -58,6 +55,9 @@ }; +class RowColumnManager; + + /** * Rectangular area in the GUI, defined by a tab on each side. */ @@ -65,7 +65,7 @@ public: ~Area(); - BView* View(); + BLayoutItem* Item(); XTab* Left() const; XTab* Right() const; @@ -78,8 +78,6 @@ Row* GetRow() const; Column* GetColumn() const; - void SetRow(Row* row); - void SetColumn(Column* column); double ContentAspectRatio() const; void SetContentAspectRatio(double ratio); @@ -98,40 +96,29 @@ void SetRightInset(float right); void SetBottomInset(float bottom); - operator BString() const; - void GetString(BString& string) const; + BString ToString() const; Constraint* SetWidthAs(Area* area, float factor = 1.0f); Constraint* SetHeightAs(Area* area, float factor = 1.0f); void InvalidateSizeConstraints(); + BRect Frame(); + BRect ItemFrame(); + private: Area(BLayoutItem* item); -#if USE_SCALE_VARIABLE void _Init(LinearSpec* ls, XTab* left, YTab* top, XTab* right, YTab* bottom, - Variable* scaleWidth, - Variable* scaleHeight); + RowColumnManager* manager); void _Init(LinearSpec* ls, Row* row, Column* column, - Variable* scaleWidth, - Variable* scaleHeight); -#else - void _Init(LinearSpec* ls, XTab* left, YTab* top, - XTab* right, YTab* bottom); - void _Init(LinearSpec* ls, Row* row, Column* column); -#endif + RowColumnManager* manager); void _DoLayout(); void _UpdateMinSizeConstraint(BSize min); void _UpdateMaxSizeConstraint(BSize max); - void _UpdatePreferredWidthConstraint( - BSize& preferred); - void _UpdatePreferredHeightConstraint( - BSize& preferred); - void _SetupPreferredConstraints(); private: BLayoutItem* fLayoutItem; @@ -151,22 +138,18 @@ BSize fTopLeftInset; BSize fRightBottomInset; - BList fConstraints; + BObjectList<Constraint> fConstraints; Constraint* fMinContentWidth; Constraint* fMaxContentWidth; Constraint* fMinContentHeight; Constraint* fMaxContentHeight; - Constraint* fPreferredContentWidth; - Constraint* fPreferredContentHeight; double fContentAspectRatio; Constraint* fContentAspectRatioC; -#if USE_SCALE_VARIABLE - Variable* fScaleWidth; - Variable* fScaleHeight; -#endif + RowColumnManager* fRowColumnManager; public: - friend class BALMLayout; + friend class BALMLayout; + friend class RowColumnManager; }; Modified: haiku/trunk/headers/libs/alm/Column.h =================================================================== --- haiku/trunk/headers/libs/alm/Column.h 2011-03-14 00:17:30 UTC (rev 40940) +++ haiku/trunk/headers/libs/alm/Column.h 2011-03-14 00:24:12 UTC (rev 40941) @@ -13,8 +13,12 @@ namespace BALM { + +class Area; class BALMLayout; +class RowColumnManager; + /** * Represents a column defined by two x-tabs. */ @@ -24,34 +28,21 @@ XTab* Left() const; XTab* Right() const; - Column* Previous() const; - void SetPrevious(Column* value); - Column* Next() const; - void SetNext(Column* value); - void InsertBefore(Column* column); - void InsertAfter(Column* column); - Constraint* HasSameWidthAs(Column* column); +private: + Column(LinearSpec* ls, XTab* left, XTab* right); - ConstraintList* Constraints() const; - -protected: - Column(BALMLayout* layout); - -protected: LinearSpec* fLS; XTab* fLeft; XTab* fRight; -private: - Column* fPrevious; - Column* fNext; - Constraint* fPreviousGlue; - Constraint* fNextGlue; - ConstraintList fConstraints; + //! managed by RowColumnManager + Constraint* fPrefSizeConstraint; + BObjectList<Area> fAreas; public: - friend class BALMLayout; + friend class BALMLayout; + friend class BALM::RowColumnManager; }; Modified: haiku/trunk/headers/libs/alm/Row.h =================================================================== --- haiku/trunk/headers/libs/alm/Row.h 2011-03-14 00:17:30 UTC (rev 40940) +++ haiku/trunk/headers/libs/alm/Row.h 2011-03-14 00:24:12 UTC (rev 40941) @@ -13,8 +13,12 @@ namespace BALM { + +class Area; class BALMLayout; +class RowColumnManager; + /** * Represents a row defined by two y-tabs. */ @@ -24,32 +28,21 @@ YTab* Top() const; YTab* Bottom() const; - Row* Previous() const; - void SetPrevious(Row* value); - Row* Next() const; - void SetNext(Row* value); - void InsertBefore(Row* row); - void InsertAfter(Row* row); - Constraint* HasSameHeightAs(Row* row); - ConstraintList* Constraints() const; -protected: - Row(BALMLayout* layout); +private: + Row(LinearSpec* ls, YTab* top, YTab* bottom); -protected: LinearSpec* fLS; YTab* fTop; YTab* fBottom; -private: - Row* fPrevious; - Row* fNext; - Constraint* fPreviousGlue; - Constraint* fNextGlue; - ConstraintList fConstraints; + //! managed by RowColumnManager + Constraint* fPrefSizeConstraint; + BObjectList<Area> fAreas; public: - friend class BALMLayout; + friend class BALMLayout; + friend class BALM::RowColumnManager; }; Modified: haiku/trunk/headers/libs/alm/Tab.h =================================================================== --- haiku/trunk/headers/libs/alm/Tab.h 2011-03-14 00:17:30 UTC (rev 40940) +++ haiku/trunk/headers/libs/alm/Tab.h 2011-03-14 00:24:12 UTC (rev 40941) @@ -46,7 +46,12 @@ } // namespace BALM + using BALM::XTab; using BALM::YTab; +typedef BObjectList<XTab> XTabList; +typedef BObjectList<YTab> YTabList; + + #endif // X_TAB_H Modified: haiku/trunk/headers/libs/linprog/Constraint.h =================================================================== --- haiku/trunk/headers/libs/linprog/Constraint.h 2011-03-14 00:17:30 UTC (rev 40940) +++ haiku/trunk/headers/libs/linprog/Constraint.h 2011-03-14 00:24:12 UTC (rev 40941) @@ -64,8 +64,7 @@ bool IsValid(); void Invalidate(); - operator BString() const; - void GetString(BString& string) const; + BString ToString() const; void PrintToStream(); ~Constraint(); Modified: haiku/trunk/headers/libs/linprog/LinearSpec.h =================================================================== --- haiku/trunk/headers/libs/linprog/LinearSpec.h 2011-03-14 00:17:30 UTC (rev 40940) +++ haiku/trunk/headers/libs/linprog/LinearSpec.h 2011-03-14 00:24:12 UTC (rev 40941) @@ -129,8 +129,7 @@ ResultType Result() const; bigtime_t SolvingTime() const; - operator BString() const; - void GetString(BString& string) const; + BString ToString() const; const ConstraintList& Constraints() const; const VariableList& UsedVariables() const; Modified: haiku/trunk/headers/libs/linprog/Variable.h =================================================================== --- haiku/trunk/headers/libs/linprog/Variable.h 2011-03-14 00:17:30 UTC (rev 40940) +++ haiku/trunk/headers/libs/linprog/Variable.h 2011-03-14 00:24:12 UTC (rev 40941) @@ -35,8 +35,7 @@ const char* Label(); void SetLabel(const char* label); - operator BString() const; - void GetString(BString& string) const; + BString ToString() const; Constraint* IsEqual(Variable* var); Constraint* IsSmallerOrEqual(Variable* var); @@ -54,7 +53,7 @@ //! delete it yourself! void Invalidate(); - ~Variable(); + virtual ~Variable(); protected: Variable(LinearSpec* ls); Modified: haiku/trunk/src/libs/alm/ALMLayout.cpp =================================================================== --- haiku/trunk/src/libs/alm/ALMLayout.cpp 2011-03-14 00:17:30 UTC (rev 40940) +++ haiku/trunk/src/libs/alm/ALMLayout.cpp 2011-03-14 00:24:12 UTC (rev 40941) @@ -12,6 +12,7 @@ #include <new> #include <iostream> +#include "RowColumnManager.h" #include "ViewLayoutItem.h" @@ -30,10 +31,11 @@ BALMLayout::BALMLayout(float spacing, BALMLayout* friendLayout) : fInset(0.0f), - fSpacing(spacing), + fSpacing(spacing / 2), fCurrentArea(NULL) { fSolver = friendLayout ? friendLayout->Solver() : &fOwnSolver; + fRowColumnManager = new RowColumnManager(fSolver); fLeft = AddXTab(); fRight = AddXTab(); @@ -52,20 +54,12 @@ fPreferredSize = kUnsetSize; fPerformancePath = NULL; - -#if USE_SCALE_VARIABLE - fScaleWidth = fSolver->AddVariable(); - fScaleHeight = fSolver->AddVariable(); -#endif } BALMLayout::~BALMLayout() { -#if USE_SCALE_VARIABLE - delete fScaleWidth; - delete fScaleHeight; -#endif + delete fRowColumnManager; } @@ -85,6 +79,7 @@ return NULL; } + fXTabList.AddItem(tab); return tab; } @@ -105,22 +100,39 @@ return NULL; } + fYTabList.AddItem(tab); return tab; } -/** - * Adds a new row to the specification. - * - * @return the new row - */ -Row* -BALMLayout::AddRow() +int32 +BALMLayout::CountXTabs() const { - return new(std::nothrow) Row(this); + return fXTabList.CountItems(); } +int32 +BALMLayout::CountYTabs() const +{ + return fYTabList.CountItems(); +} + + +XTab* +BALMLayout::XTabAt(int32 index) const +{ + return fXTabList.ItemAt(index); +} + + +YTab* +BALMLayout::YTabAt(int32 index) const +{ + return fYTabList.ItemAt(index); +} + + /** * Adds a new row to the specification that is glued to the given y-tabs. * @@ -131,28 +143,15 @@ Row* BALMLayout::AddRow(YTab* top, YTab* bottom) { - Row* row = new(std::nothrow) Row(this); - if (top != NULL) - row->Constraints()->AddItem(row->Top()->IsEqual(top)); - if (bottom != NULL) - row->Constraints()->AddItem(row->Bottom()->IsEqual(bottom)); - return row; + if (top == NULL) + top = AddYTab(); + if (bottom == NULL) + bottom = AddYTab(); + return new(std::nothrow) Row(fSolver, top, bottom); } /** - * Adds a new column to the specification. - * - * @return the new column - */ -Column* -BALMLayout::AddColumn() -{ - return new(std::nothrow) Column(this); -} - - -/** * Adds a new column to the specification that is glued to the given x-tabs. * * @param left @@ -162,12 +161,11 @@ Column* BALMLayout::AddColumn(XTab* left, XTab* right) { - Column* column = new(std::nothrow) Column(this); - if (left != NULL) - column->Constraints()->AddItem(column->Left()->IsEqual(left)); - if (right != NULL) - column->Constraints()->AddItem(column->Right()->IsEqual(right)); - return column; + if (left == NULL) + left = AddXTab(); + if (right == NULL) + right = AddXTab(); + return new(std::nothrow) Column(fSolver, left, right); } @@ -194,86 +192,126 @@ Area* +BALMLayout::AreaAt(int32 index) const +{ + return AreaFor(ItemAt(index)); +} + + +Area* BALMLayout::CurrentArea() const { return fCurrentArea; } -void +bool BALMLayout::SetCurrentArea(const Area* area) { fCurrentArea = const_cast<Area*>(area); + return true; } -void +bool BALMLayout::SetCurrentArea(const BView* view) { - fCurrentArea = AreaFor(view); + Area* area = AreaFor(view); + if (!area) + return false; + fCurrentArea = area; + return true; } -void +bool BALMLayout::SetCurrentArea(const BLayoutItem* item) { - fCurrentArea = AreaFor(item); + Area* area = AreaFor(item); + if (!area) + return false; + fCurrentArea = area; + return true; } XTab* BALMLayout::LeftOf(const BView* view) const { - return AreaFor(view)->Left(); + Area* area = AreaFor(view); + if (!area) + return NULL; + return area->Left(); } XTab* BALMLayout::LeftOf(const BLayoutItem* item) const { - return AreaFor(item)->Left(); + Area* area = AreaFor(item); + if (!area) + return NULL; + return area->Left(); } XTab* BALMLayout::RightOf(const BView* view) const { - return AreaFor(view)->Right(); + Area* area = AreaFor(view); + if (!area) + return NULL; + return area->Right(); } XTab* BALMLayout::RightOf(const BLayoutItem* item) const { - return AreaFor(item)->Right(); + Area* area = AreaFor(item); + if (!area) + return NULL; + return area->Right(); } YTab* BALMLayout::TopOf(const BView* view) const { - return AreaFor(view)->Top(); + Area* area = AreaFor(view); + if (!area) + return NULL; + return area->Top(); } YTab* BALMLayout::TopOf(const BLayoutItem* item) const { - return AreaFor(item)->Top(); + Area* area = AreaFor(item); + if (!area) + return NULL; + return area->Top(); } YTab* BALMLayout::BottomOf(const BView* view) const { - return AreaFor(view)->Bottom(); + Area* area = AreaFor(view); + if (!area) + return NULL; + return area->Bottom(); } YTab* BALMLayout::BottomOf(const BLayoutItem* item) const { - return AreaFor(item)->Bottom(); + Area* area = AreaFor(item); + if (!area) + return NULL; + return area->Bottom(); } @@ -480,6 +518,7 @@ if (!bottom) bottom = AddYTab(); + // Area is added int ItemAdded if (!BAbstractLayout::AddItem(-1, item)) return NULL; Area* area = AreaFor(item); @@ -487,11 +526,9 @@ return NULL; fCurrentArea = area; -#if USE_SCALE_VARIABLE - area->_Init(fSolver, left, top, right, bottom, fScaleWidth, fScaleHeight); -#else - area->_Init(fSolver, left, top, right, bottom); -#endif + area->_Init(fSolver, left, top, right, bottom, fRowColumnManager); + + fRowColumnManager->AddArea(area); return area; } @@ -506,11 +543,9 @@ return NULL; fCurrentArea = area; -#if USE_SCALE_VARIABLE - area->_Init(fSolver, row, column, fScaleWidth, fScaleHeight); -#else - area->_Init(fSolver, row, column); -#endif + area->_Init(fSolver, row, column, fRowColumnManager); + + fRowColumnManager->AddArea(area); return area; } @@ -519,6 +554,9 @@ BALMLayout::AddItemToRight(BLayoutItem* item, XTab* right, YTab* top, YTab* bottom) { + if (fCurrentArea == NULL) + return NULL; + XTab* left = fCurrentArea->Right(); if (!right) right = AddXTab(); @@ -535,6 +573,9 @@ BALMLayout::AddItemToLeft(BLayoutItem* item, XTab* left, YTab* top, YTab* bottom) { + if (fCurrentArea == NULL) + return NULL; + if (!left) left = AddXTab(); XTab* right = fCurrentArea->Left(); @@ -550,6 +591,9 @@ Area* BALMLayout::AddItemToTop(BLayoutItem* item, YTab* top, XTab* left, XTab* right) { + if (fCurrentArea == NULL) + return NULL; + if (!left) left = fCurrentArea->Left(); if (!right) @@ -566,6 +610,9 @@ BALMLayout::AddItemToBottom(BLayoutItem* item, YTab* bottom, XTab* left, XTab* right) { + if (fCurrentArea == NULL) + return NULL; + if (!left) left = fCurrentArea->Left(); if (!right) @@ -692,6 +739,7 @@ BALMLayout::ItemRemoved(BLayoutItem* item, int32 fromIndex) { if (Area* area = AreaFor(item)) { + fRowColumnManager->RemoveArea(area); item->SetLayoutData(NULL); delete area; } @@ -779,14 +827,14 @@ void BALMLayout::SetSpacing(float spacing) { - fSpacing = spacing; + fSpacing = spacing / 2; } float BALMLayout::Spacing() const { - return fSpacing; + return fSpacing * 2; } @@ -846,4 +894,5 @@ { for (int i = 0; i < CountItems(); i++) AreaFor(ItemAt(i))->InvalidateSizeConstraints(); + fRowColumnManager->UpdateConstraints(); } Modified: haiku/trunk/src/libs/alm/Area.cpp =================================================================== --- haiku/trunk/src/libs/alm/Area.cpp 2011-03-14 00:17:30 UTC (rev 40940) +++ haiku/trunk/src/libs/alm/Area.cpp 2011-03-14 00:24:12 UTC (rev 40941) @@ -18,6 +18,7 @@ #include <StringView.h> #include "ALMLayout.h" +#include "RowColumnManager.h" using namespace LinearProgramming; @@ -111,10 +112,10 @@ } -BView* -Area::View() +BLayoutItem* +Area::Item() { - return fLayoutItem->View(); + return fLayoutItem; } @@ -175,11 +176,9 @@ fColumn = NULL; fMinContentWidth->SetLeftSide(-1.0, fLeft, 1.0, fRight); - BSize preferredSize = fLayoutItem->PreferredSize(); - _UpdatePreferredWidthConstraint(preferredSize); - if (fMaxContentWidth != NULL) fMaxContentWidth->SetLeftSide(-1.0, fLeft, 1.0, fRight); + fRowColumnManager->TabsChanged(this); fLayoutItem->Layout()->InvalidateLayout(); } @@ -198,10 +197,9 @@ fColumn = NULL; fMinContentWidth->SetLeftSide(-1.0, fLeft, 1.0, fRight); - BSize preferredSize = fLayoutItem->PreferredSize(); - _UpdatePreferredWidthConstraint(preferredSize); if (fMaxContentWidth != NULL) fMaxContentWidth->SetLeftSide(-1.0, fLeft, 1.0, fRight); + fRowColumnManager->TabsChanged(this); fLayoutItem->Layout()->InvalidateLayout(); } @@ -218,10 +216,9 @@ fRow = NULL; fMinContentHeight->SetLeftSide(-1.0, fTop, 1.0, fBottom); - BSize preferredSize = fLayoutItem->PreferredSize(); - _UpdatePreferredHeightConstraint(preferredSize); if (fMaxContentHeight != NULL) fMaxContentHeight->SetLeftSide(-1.0, fTop, 1.0, fBottom); + fRowColumnManager->TabsChanged(this); fLayoutItem->Layout()->InvalidateLayout(); } @@ -238,10 +235,9 @@ fRow = NULL; fMinContentHeight->SetLeftSide(-1.0, fTop, 1.0, fBottom); - BSize preferredSize = fLayoutItem->PreferredSize(); - _UpdatePreferredHeightConstraint(preferredSize); if (fMaxContentHeight != NULL) fMaxContentHeight->SetLeftSide(-1.0, fTop, 1.0, fBottom); + fRowColumnManager->TabsChanged(this); fLayoutItem->Layout()->InvalidateLayout(); } @@ -268,34 +264,6 @@ /** - * Sets the row that defines the top and bottom tabs. - * May be null. - */ -void -Area::SetRow(Row* row) -{ - SetTop(row->Top()); - SetBottom(row->Bottom()); - fRow = row; - fLayoutItem->Layout()->InvalidateLayout(); -} - - -/** - * Sets the column that defines the left and right tabs. - * May be null. - */ -void -Area::SetColumn(Column* column) -{ - SetLeft(column->Left()); - SetRight(column->Right()); - fColumn = column; - fLayoutItem->Layout()->InvalidateLayout(); -} - - -/** * The reluctance with which the area's content shrinks below its preferred size. * The bigger the less likely is such shrinking. */ @@ -317,12 +285,10 @@ } -void Area::SetShrinkPenalties(BSize shrink) { +void +Area::SetShrinkPenalties(BSize shrink) { fShrinkPenalties = shrink; - if (fPreferredContentWidth != NULL) { - fPreferredContentWidth->SetPenaltyNeg(shrink.Width()); - fPreferredContentHeight->SetPenaltyNeg(shrink.Height()); - } + fLayoutItem->Layout()->InvalidateLayout(); } @@ -331,10 +297,7 @@ Area::SetGrowPenalties(BSize grow) { fGrowPenalties = grow; - if (fPreferredContentWidth != NULL) { - fPreferredContentWidth->SetPenaltyPos(grow.Width()); - fPreferredContentHeight->SetPenaltyPos(grow.Height()); - } + fLayoutItem->Layout()->InvalidateLayout(); } @@ -480,26 +443,19 @@ } -Area::operator BString() const +BString +Area::ToString() const { - BString string; - GetString(string); - return string; -} - - -void -Area::GetString(BString& string) const -{ - string << "Area("; - fLeft->GetString(string); + BString string = "Area("; + string += fLeft->ToString(); string << ", "; - fTop->GetString(string); + string += fTop->ToString(); string << ", "; - fRight->GetString(string); + string += fRight->ToString(); string << ", "; - fBottom->GetString(string); + string += fBottom->ToString(); string << ")"; + return string; } @@ -542,15 +498,27 @@ BSize minSize = fLayoutItem->MinSize(); BSize maxSize = fLayoutItem->MaxSize(); - BSize prefSize = fLayoutItem->PreferredSize(); _UpdateMinSizeConstraint(minSize); _UpdateMaxSizeConstraint(maxSize); - _UpdatePreferredWidthConstraint(prefSize); - _UpdatePreferredHeightConstraint(prefSize); } +BRect +Area::Frame() +{ + return BRect(fLeft->Value(), fTop->Value(), fRight->Value(), + fBottom->Value()); +} + + +BRect +Area::ItemFrame() +{ + return fLayoutItem->Frame(); +} + + /** * Destructor. * Removes the area from its specification. @@ -558,7 +526,7 @@ Area::~Area() { for (int32 i = 0; i < fConstraints.CountItems(); i++) - delete (Constraint*)fConstraints.ItemAt(i); + delete fConstraints.ItemAt(i); } @@ -586,8 +554,6 @@ fMaxContentWidth(NULL), fMinContentHeight(NULL), fMaxContentHeight(NULL), - fPreferredContentWidth(NULL), - fPreferredContentHeight(NULL), fContentAspectRatio(-1), fContentAspectRatioC(NULL) @@ -599,24 +565,18 @@ /** * Initialize variables. */ -#if USE_SCALE_VARIABLE [... truncated: 963 lines follow ...]