First step to make the ALM layout engine more compatible with the haiku layout API. Many stuff was/is managed by ALM which could and should be done by the standard layout facilities.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38753 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler
2010-09-21 07:04:40 +00:00
parent 88ff3bdb33
commit 248bbad27c
5 changed files with 151 additions and 247 deletions
+15 -17
View File
@@ -33,6 +33,8 @@ class Area {
public: public:
~Area(); ~Area();
BView* View();
XTab* Left() const; XTab* Left() const;
void SetLeft(XTab* left); void SetLeft(XTab* left);
XTab* Right() const; XTab* Right() const;
@@ -47,13 +49,12 @@ public:
Column* GetColumn() const; Column* GetColumn() const;
void SetColumn(Column* column); void SetColumn(Column* column);
BView* Content() const;
void SetContent(BView* content);
XTab* ContentLeft() const; XTab* ContentLeft() const;
YTab* ContentTop() const; YTab* ContentTop() const;
XTab* ContentRight() const; XTab* ContentRight() const;
YTab* ContentBottom() const; YTab* ContentBottom() const;
BSize MinContentSize() const; BSize MinContentSize() const;
void SetMinContentSize(BSize min); void SetMinContentSize(BSize min);
BSize MaxContentSize() const; BSize MaxContentSize() const;
void SetMaxContentSize(BSize max); void SetMaxContentSize(BSize max);
@@ -62,17 +63,17 @@ public:
double ContentAspectRatio() const; double ContentAspectRatio() const;
void SetContentAspectRatio(double ratio); void SetContentAspectRatio(double ratio);
void SetExplicitAlignment(BAlignment alignment);
void SetHorizontalAlignment(alignment horizontal);
void SetVerticalAlignment(
vertical_alignment vertical);
BSize ShrinkPenalties() const; BSize ShrinkPenalties() const;
void SetShrinkPenalties(BSize shrink); void SetShrinkPenalties(BSize shrink);
BSize GrowPenalties() const; BSize GrowPenalties() const;
void SetGrowPenalties(BSize grow); void SetGrowPenalties(BSize grow);
BAlignment Alignment() const;
void SetAlignment(BAlignment alignment);
void SetHorizontalAlignment(alignment horizontal);
void SetVerticalAlignment(
vertical_alignment vertical);
int32 LeftInset() const; int32 LeftInset() const;
void SetLeftInset(int32 left); void SetLeftInset(int32 left);
int32 TopInset() const; int32 TopInset() const;
@@ -94,23 +95,20 @@ public:
BList* HasSameSizeAs(Area* area); BList* HasSameSizeAs(Area* area);
protected: protected:
Area(BALMLayout* layout, Area(BALMLayout* layout, BLayoutItem* item);
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);
Area(BALMLayout* layout, void Init(LinearSpec* ls, Row* row, Column* column,
LinearSpec* ls, Row* row, Column* column,
BView* content, BSize minContentSize); BView* content, BSize minContentSize);
void DoLayout(); void DoLayout();
private: private:
void InitChildArea(); void InitChildArea();
void UpdateHorizontal(); void UpdateHorizontal();
void UpdateVertical(); void UpdateVertical();
void Init(BALMLayout* layout,
LinearSpec* ls, XTab* left, YTab* top,
XTab* right, YTab* bottom, BView* content,
BSize minContentSize);
public: public:
static BSize kMaxSize; static BSize kMaxSize;
@@ -118,12 +116,12 @@ public:
static BSize kUndefinedSize; static BSize kUndefinedSize;
protected: protected:
BView* fContent;
BList* fConstraints; BList* fConstraints;
private: private:
// TODO remove the layout pointer when making Area a LayoutItem // TODO remove the layout pointer when making Area a LayoutItem
BALMLayout* fALMLayout; BALMLayout* fALMLayout;
BLayoutItem* fLayoutItem;
LinearSpec* fLS; LinearSpec* fLS;
XTab* fLeft; XTab* fLeft;
+18 -22
View File
@@ -30,6 +30,8 @@ namespace BALM {
class BALMLayout : public BAbstractLayout { class BALMLayout : public BAbstractLayout {
public: public:
BALMLayout(); BALMLayout();
virtual ~BALMLayout();
void SolveLayout(); void SolveLayout();
XTab* AddXTab(); XTab* AddXTab();
@@ -39,15 +41,15 @@ public:
Column* AddColumn(); Column* AddColumn();
Column* AddColumn(XTab* left, XTab* right); Column* AddColumn(XTab* left, XTab* right);
Area* AddArea(XTab* left, YTab* top, XTab* right, YTab* bottom, Area* AddArea(XTab* left, YTab* top, XTab* right,
BView* content, BSize minContentSize); YTab* bottom, BView* content, BSize minContentSize);
Area* AddArea(Row* row, Column* column, BView* content, Area* AddArea(Row* row, Column* column,
BSize minContentSize); BView* content, BSize minContentSize);
Area* AddArea(XTab* left, YTab* top, XTab* right, YTab* bottom, Area* AddArea(XTab* left, YTab* top, XTab* right,
BView* content); YTab* bottom, BView* content);
Area* AddArea(Row* row, Column* column, BView* content); Area* AddArea(Row* row, Column* column,
BView* content);
Area* AreaOf(BView* control); Area* AreaOf(BView* control);
BList* Areas() const;
XTab* Left() const; XTab* Left() const;
XTab* Right() const; XTab* Right() const;
@@ -59,23 +61,16 @@ public:
LayoutStyleType LayoutStyle() const; LayoutStyleType LayoutStyle() const;
void SetLayoutStyle(LayoutStyleType style); void SetLayoutStyle(LayoutStyleType style);
BLayoutItem* AddView(BView* child);
BLayoutItem* AddView(int32 index, BView* child);
bool AddItem(BLayoutItem* item);
bool AddItem(int32 index, BLayoutItem* item);
bool RemoveView(BView* child);
bool RemoveItem(BLayoutItem* item);
BLayoutItem* RemoveItem(int32 index);
BSize BaseMinSize(); BSize BaseMinSize();
BSize BaseMaxSize(); BSize BaseMaxSize();
BSize BasePreferredSize(); BSize BasePreferredSize();
BAlignment BaseAlignment(); BAlignment BaseAlignment();
bool HasHeightForWidth();
void GetHeightForWidth(float width, float* min, virtual void InvalidateLayout(bool children = false);
float* max, float* preferred);
void InvalidateLayout(bool children = false); virtual bool ItemAdded(BLayoutItem* item, int32 atIndex);
virtual void DerivedLayoutItems(); virtual void ItemRemoved(BLayoutItem* item, int32 fromIndex);
virtual void DerivedLayoutItems();
char* PerformancePath() const; char* PerformancePath() const;
void SetPerformancePath(char* path); void SetPerformancePath(char* path);
@@ -83,6 +78,8 @@ public:
LinearSpec* Solver(); LinearSpec* Solver();
private: private:
Area* _AreaForItem(BLayoutItem* item) const;
BSize CalculateMinSize(); BSize CalculateMinSize();
BSize CalculateMaxSize(); BSize CalculateMaxSize();
BSize CalculatePreferredSize(); BSize CalculatePreferredSize();
@@ -93,7 +90,6 @@ private:
LinearSpec fSolver; LinearSpec fSolver;
BList* fAreas;
XTab* fLeft; XTab* fLeft;
XTab* fRight; XTab* fRight;
YTab* fTop; YTab* fTop;
+43 -70
View File
@@ -30,6 +30,13 @@ BSize Area::kMinSize(0, 0);
BSize Area::kUndefinedSize(-1, -1); BSize Area::kUndefinedSize(-1, -1);
BView*
Area::View()
{
return fLayoutItem->View();
}
/** /**
* Gets the auto preferred content size. * Gets the auto preferred content size.
* *
@@ -234,28 +241,6 @@ Area::SetColumn(Column* column)
} }
/**
* Gets the control that is the content of the area.
*/
BView*
Area::Content() const
{
return (fChildArea == NULL) ? fContent : fChildArea->Content();
}
/**
* Sets the control that is the content of the area.
*/
void
Area::SetContent(BView* content)
{
if (fChildArea == NULL) fContent = content;
else fChildArea->fContent = content;
fALMLayout->InvalidateLayout();
}
/** /**
* Left tab of the area's content. May be different from the left tab of the area. * Left tab of the area's content. May be different from the left tab of the area.
*/ */
@@ -487,25 +472,16 @@ Area::SetContentAspectRatio(double ratio)
} }
/**
* Gets alignment of the content in its area.
*/
BAlignment
Area::Alignment() const
{
return fAlignment;
}
/** /**
* Sets alignment of the content in its area. * Sets alignment of the content in its area.
*/ */
void void
Area::SetAlignment(BAlignment alignment) Area::SetExplicitAlignment(BAlignment alignment)
{ {
fAlignment = alignment; fAlignment = alignment;
UpdateHorizontal(); UpdateHorizontal();
UpdateVertical(); UpdateVertical();
fALMLayout->InvalidateLayout(); fALMLayout->InvalidateLayout();
} }
@@ -625,24 +601,24 @@ Area::SetBottomInset(int32 bottom)
void void
Area::SetDefaultBehavior() Area::SetDefaultBehavior()
{ {
if (Content() == NULL) { if (View() == NULL) {
SetPreferredContentSize(BSize(0, 0)); SetPreferredContentSize(BSize(0, 0));
SetShrinkPenalties(BSize(0, 0)); SetShrinkPenalties(BSize(0, 0));
SetGrowPenalties(BSize(0, 0)); SetGrowPenalties(BSize(0, 0));
return; return;
} }
if (PreferredContentSize() != Content()->PreferredSize()){ if (PreferredContentSize() != View()->PreferredSize()){
SetPreferredContentSize(Content()->PreferredSize()); SetPreferredContentSize(View()->PreferredSize());
fALMLayout->InvalidateLayout(); fALMLayout->InvalidateLayout();
} }
if (dynamic_cast<BButton*>(Content()) != NULL if (dynamic_cast<BButton*>(View()) != NULL
|| dynamic_cast<BRadioButton*>(Content()) != NULL || dynamic_cast<BRadioButton*>(View()) != NULL
|| dynamic_cast<BCheckBox*>(Content()) != NULL || dynamic_cast<BCheckBox*>(View()) != NULL
|| dynamic_cast<BStringView*>(Content()) != NULL || dynamic_cast<BStringView*>(View()) != NULL
|| dynamic_cast<BPictureButton*>(Content()) != NULL || dynamic_cast<BPictureButton*>(View()) != NULL
|| dynamic_cast<BStatusBar*>(Content()) != NULL) { || dynamic_cast<BStatusBar*>(View()) != NULL) {
fShrinkPenalties = BSize(4, 4); fShrinkPenalties = BSize(4, 4);
fGrowPenalties = BSize(3, 3); fGrowPenalties = BSize(3, 3);
} else { } else {
@@ -727,10 +703,10 @@ Area::HasSameSizeAs(Area* area)
*/ */
Area::~Area() Area::~Area()
{ {
if (fChildArea != NULL) delete fChildArea; if (fChildArea != NULL)
delete fChildArea;
for (int32 i = 0; i < fConstraints->CountItems(); i++) for (int32 i = 0; i < fConstraints->CountItems(); i++)
delete (Constraint*)fConstraints->ItemAt(i); delete (Constraint*)fConstraints->ItemAt(i);
fALMLayout->Areas()->RemoveItem(this);
} }
@@ -738,25 +714,12 @@ Area::~Area()
* Constructor. * Constructor.
* Uses XTabs and YTabs. * Uses XTabs and YTabs.
*/ */
Area::Area(BALMLayout* layout, LinearSpec* ls, XTab* left, YTab* top, Area::Area(BALMLayout* layout, BLayoutItem* item)
XTab* right, YTab* bottom, BView* content, BSize minContentSize) :
{ fALMLayout(layout),
Init(layout, ls, left, top, right, bottom, content, minContentSize); fLayoutItem(item)
}
/**
* Constructor.
* Uses Rows and Columns.
*/
Area::Area(BALMLayout* layout, LinearSpec* ls, Row* row, Column* column,
BView* content, BSize minContentSize)
{ {
Init(layout, ls, column->Left(), row->Top(), column->Right(), row->Bottom(),
content, minContentSize);
fRow = row;
fColumn = column;
} }
@@ -764,11 +727,9 @@ Area::Area(BALMLayout* layout, LinearSpec* ls, Row* row, Column* column,
* Initialize variables. * Initialize variables.
*/ */
void void
Area::Init(BALMLayout* layout, 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)
{ {
fALMLayout = layout;
fConstraints = new BList(2); fConstraints = new BList(2);
fMaxContentSize = kMaxSize; fMaxContentSize = kMaxSize;
@@ -804,7 +765,6 @@ Area::Init(BALMLayout* layout, LinearSpec* ls, XTab* left, YTab* top,
fRight = right; fRight = right;
fTop = top; fTop = top;
fBottom = bottom; fBottom = bottom;
SetContent(content);
fMinContentSize = minContentSize; fMinContentSize = minContentSize;
// adds the two essential constraints of the area that make sure that the left x-tab is // adds the two essential constraints of the area that make sure that the left x-tab is
@@ -819,23 +779,34 @@ Area::Init(BALMLayout* layout, LinearSpec* ls, XTab* left, YTab* top,
} }
void
Area::Init(LinearSpec* ls, Row* row, Column* column,
BView* content, BSize minContentSize)
{
Init(ls, column->Left(), row->Top(), column->Right(), row->Bottom(),
content, minContentSize);
fRow = row;
fColumn = column;
}
/** /**
* Perform layout on the area. * Perform layout on the area.
*/ */
void Area::DoLayout() void Area::DoLayout()
{ {
if (Content() == NULL) if (View() == NULL)
return; // empty areas need no layout return; // empty areas need no layout
// if there is a childArea, then it is the childArea that actually contains the content // if there is a childArea, then it is the childArea that actually contains the content
Area* area = (fChildArea != NULL) ? fChildArea : this; Area* area = (fChildArea != NULL) ? fChildArea : this;
// set content location and size // set content location and size
area->Content()->MoveTo(floor(area->Left()->Value() + 0.5), area->View()->MoveTo(floor(area->Left()->Value() + 0.5),
floor(area->Top()->Value() + 0.5)); floor(area->Top()->Value() + 0.5));
int32 width = (int32)floor(area->Right()->Value() - area->Left()->Value() + 0.5); int32 width = (int32)floor(area->Right()->Value() - area->Left()->Value() + 0.5);
int32 height = (int32)floor(area->Bottom()->Value() - area->Top()->Value() + 0.5); int32 height = (int32)floor(area->Bottom()->Value() - area->Top()->Value() + 0.5);
area->Content()->ResizeTo(width, height); area->View()->ResizeTo(width, height);
} }
@@ -850,8 +821,10 @@ Area::InitChildArea()
// add a child area with new tabs, // add a child area with new tabs,
// and add constraints that set its tabs to be equal to the // and add constraints that set its tabs to be equal to the
// coresponding tabs of this area (for a start) // coresponding tabs of this area (for a start)
fChildArea = new Area(fALMLayout, fLS, new XTab(fLS), new YTab(fLS), fChildArea = new Area(fALMLayout, fLayoutItem);
new XTab(fLS), new YTab(fLS), fContent, BSize(0, 0)); fChildArea->Init(fLS, new XTab(fLS), new YTab(fLS), new XTab(fLS),
new YTab(fLS), View(), BSize(0, 0));
fLeftConstraint = fLeft->IsEqual(fChildArea->Left()); fLeftConstraint = fLeft->IsEqual(fChildArea->Left());
fConstraints->AddItem(fLeftConstraint); fConstraints->AddItem(fLeftConstraint);
fTopConstraint = fTop->IsEqual(fChildArea->Top()); fTopConstraint = fTop->IsEqual(fChildArea->Top());
+73 -138
View File
@@ -5,6 +5,10 @@
*/ */
#include "BALMLayout.h" #include "BALMLayout.h"
#include <math.h> // for floor
#include <new>
#include "Area.h" #include "Area.h"
#include "Column.h" #include "Column.h"
#include "ResultType.h" #include "ResultType.h"
@@ -12,8 +16,6 @@
#include "XTab.h" #include "XTab.h"
#include "YTab.h" #include "YTab.h"
#include <math.h> // for floor
/** /**
* Constructor. * Constructor.
@@ -26,7 +28,6 @@ BALMLayout::BALMLayout()
fLayoutStyle = FIT_TO_SIZE; fLayoutStyle = FIT_TO_SIZE;
fActivated = true; fActivated = true;
fAreas = new BList(1);
fLeft = new XTab(&fSolver); fLeft = new XTab(&fSolver);
fRight = new XTab(&fSolver); fRight = new XTab(&fSolver);
fTop = new YTab(&fSolver); fTop = new YTab(&fSolver);
@@ -46,6 +47,12 @@ BALMLayout::BALMLayout()
} }
BALMLayout::~BALMLayout()
{
}
/** /**
* Solves the layout. * Solves the layout.
*/ */
@@ -54,11 +61,9 @@ BALMLayout::SolveLayout()
{ {
// if autoPreferredContentSize is set on an area, // if autoPreferredContentSize is set on an area,
// readjust its preferredContentSize and penalties settings // readjust its preferredContentSize and penalties settings
int32 sizeAreas = fAreas->CountItems(); for (int32 i = 0; i < CountItems(); i++) {
Area* currentArea; Area* currentArea = _AreaForItem(ItemAt(i));
for (int32 i = 0; i < sizeAreas; i++) { if (currentArea && currentArea->AutoPreferredContentSize())
currentArea = (Area*)fAreas->ItemAt(i);
if (currentArea->AutoPreferredContentSize())
currentArea->SetDefaultBehavior(); currentArea->SetDefaultBehavior();
} }
@@ -167,8 +172,10 @@ Column*
BALMLayout::AddColumn(XTab* left, XTab* right) BALMLayout::AddColumn(XTab* left, XTab* right)
{ {
Column* column = new Column(&fSolver); Column* column = new Column(&fSolver);
if (left != NULL) column->Constraints()->AddItem(column->Left()->IsEqual(left)); if (left != NULL)
if (right != NULL) column->Constraints()->AddItem(column->Right()->IsEqual(right)); column->Constraints()->AddItem(column->Left()->IsEqual(left));
if (right != NULL)
column->Constraints()->AddItem(column->Right()->IsEqual(right));
return column; return column;
} }
@@ -188,12 +195,13 @@ Area*
BALMLayout::AddArea(XTab* left, YTab* top, XTab* right, YTab* bottom, BALMLayout::AddArea(XTab* left, YTab* top, XTab* right, YTab* bottom,
BView* content, BSize minContentSize) BView* content, BSize minContentSize)
{ {
InvalidateLayout(); BLayoutItem* item = AddView(content);
if (content != NULL) Area* area = _AreaForItem(item);
TargetView()->AddChild(content); if (!area)
Area* area = new Area(this, &fSolver, left, top, right, bottom, content, return NULL;
area->Init(&fSolver, left, top, right, bottom, content,
minContentSize); minContentSize);
fAreas->AddItem(area);
return area; return area;
} }
@@ -211,11 +219,12 @@ Area*
BALMLayout::AddArea(Row* row, Column* column, BView* content, BALMLayout::AddArea(Row* row, Column* column, BView* content,
BSize minContentSize) BSize minContentSize)
{ {
InvalidateLayout(); BLayoutItem* item = AddView(content);
if (content != NULL) Area* area = _AreaForItem(item);
TargetView()->AddChild(content); if (!area)
Area* area = new Area(this, &fSolver, row, column, content, minContentSize); return NULL;
fAreas->AddItem(area);
area->Init(&fSolver, row, column, content, minContentSize);
return area; return area;
} }
@@ -234,14 +243,15 @@ Area*
BALMLayout::AddArea(XTab* left, YTab* top, XTab* right, YTab* bottom, BALMLayout::AddArea(XTab* left, YTab* top, XTab* right, YTab* bottom,
BView* content) BView* content)
{ {
InvalidateLayout(); BLayoutItem* item = AddView(content);
if (content != NULL) Area* area = _AreaForItem(item);
TargetView()->AddChild(content); if (!area)
Area* area = new Area(this, &fSolver, left, top, right, bottom, content, return NULL;
area->Init(&fSolver, left, top, right, bottom, content,
BSize(0, 0)); BSize(0, 0));
area->SetDefaultBehavior(); area->SetDefaultBehavior();
area->SetAutoPreferredContentSize(false); area->SetAutoPreferredContentSize(false);
fAreas->AddItem(area);
return area; return area;
} }
@@ -257,13 +267,14 @@ BALMLayout::AddArea(XTab* left, YTab* top, XTab* right, YTab* bottom,
Area* Area*
BALMLayout::AddArea(Row* row, Column* column, BView* content) BALMLayout::AddArea(Row* row, Column* column, BView* content)
{ {
InvalidateLayout(); BLayoutItem* item = AddView(content);
if (content != NULL) Area* area = _AreaForItem(item);
TargetView()->AddChild(content); if (!area)
Area* area = new Area(this, &fSolver, row, column, content, BSize(0, 0)); return NULL;
area->Init(&fSolver, row, column, content, BSize(0, 0));
area->SetDefaultBehavior(); area->SetDefaultBehavior();
area->SetAutoPreferredContentSize(false); area->SetAutoPreferredContentSize(false);
fAreas->AddItem(area);
return area; return area;
} }
@@ -277,25 +288,7 @@ BALMLayout::AddArea(Row* row, Column* column, BView* content)
Area* Area*
BALMLayout::AreaOf(BView* control) BALMLayout::AreaOf(BView* control)
{ {
Area* area; return _AreaForItem(ItemAt(IndexOfView(control)));
for (int32 i = 0; i < fAreas->CountItems(); i++) {
area = (Area*)fAreas->ItemAt(i);
if (area->Content() == control)
return area;
}
return NULL;
}
/**
* Gets the ares.
*
* @return the areas
*/
BList*
BALMLayout::Areas() const
{
return fAreas;
} }
@@ -367,76 +360,6 @@ BALMLayout::SetLayoutStyle(LayoutStyleType style)
} }
/**
* Adds view to layout.
*/
BLayoutItem*
BALMLayout::AddView(BView* child)
{
return NULL;
}
/**
* Adds view to layout.
*/
BLayoutItem*
BALMLayout::AddView(int32 index, BView* child)
{
return NULL;
}
/**
* Adds item to layout.
*/
bool
BALMLayout::AddItem(BLayoutItem* item)
{
return false;
}
/**
* Adds item to layout.
*/
bool
BALMLayout::AddItem(int32 index, BLayoutItem* item)
{
return false;
}
/**
* Removes view from layout.
*/
bool
BALMLayout::RemoveView(BView* child)
{
return false;
}
/**
* Removes item from layout.
*/
bool
BALMLayout::RemoveItem(BLayoutItem* item)
{
return false;
}
/**
* Removes item from layout.
*/
BLayoutItem*
BALMLayout::RemoveItem(int32 index)
{
return NULL;
}
/** /**
* Gets minimum size. * Gets minimum size.
*/ */
@@ -485,23 +408,6 @@ BALMLayout::BaseAlignment()
} }
/**
* Gets whether the height of the layout depends on its width.
*/
bool
BALMLayout::HasHeightForWidth()
{
return false;
}
/**
* Gets height constraints for a given width.
*/
void
BALMLayout::GetHeightForWidth(float width, float* min, float* max, float* preferred) {}
/** /**
* Invalidates the layout. * Invalidates the layout.
* Resets minimum/maximum/preferred size. * Resets minimum/maximum/preferred size.
@@ -516,6 +422,24 @@ BALMLayout::InvalidateLayout(bool children)
} }
bool
BALMLayout::ItemAdded(BLayoutItem* item, int32 atIndex)
{
item->SetLayoutData(new(std::nothrow) Area(this, item));
return item->LayoutData() != NULL;
}
void
BALMLayout::ItemRemoved(BLayoutItem* item, int32 fromIndex)
{
if (Area* area = _AreaForItem(item)) {
item->SetLayoutData(NULL);
delete area;
}
}
/** /**
* Calculate and set the layout. * Calculate and set the layout.
* If no layout specification is given, a specification is reverse engineered automatically. * If no layout specification is given, a specification is reverse engineered automatically.
@@ -533,6 +457,9 @@ BALMLayout::DerivedLayoutItems()
if (Owner() == NULL) if (Owner() == NULL)
return; return;
//TODO
// _UpdateConstraints();
// reverse engineer a layout specification if none was given // reverse engineer a layout specification if none was given
//~ if (this == NULL) RecoverLayout(View()); //~ if (this == NULL) RecoverLayout(View());
@@ -568,8 +495,8 @@ 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 < Areas()->CountItems(); i++) for (int32 i = 0; i < CountItems(); i++)
((Area*)Areas()->ItemAt(i))->DoLayout(); _AreaForItem(ItemAt(i))->DoLayout();
fActivated = true; fActivated = true;
} }
@@ -685,3 +612,11 @@ BALMLayout::CalculatePreferredSize()
Bottom()->Value() - Top()->Value()); Bottom()->Value() - Top()->Value());
} }
Area*
BALMLayout::_AreaForItem(BLayoutItem* item) const
{
if (!item)
return NULL;
return static_cast<Area*>(item->LayoutData());
}
+2
View File
@@ -4,6 +4,8 @@ SetSubDirSupportedPlatformsBeOSCompatible ;
UseLibraryHeaders lp_solve linprog alm ; UseLibraryHeaders lp_solve linprog alm ;
UsePrivateHeaders shared ; UsePrivateHeaders shared ;
UsePrivateHeaders [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) kits interface ] ;
SharedLibrary libalm.so : SharedLibrary libalm.so :
Area.cpp Area.cpp