Give the area an id.

This commit is contained in:
czeidler
2012-05-03 08:44:13 +12:00
committed by Alex Wilson
parent b7630c4c98
commit c3e57dc36d
4 changed files with 41 additions and 0 deletions
+13
View File
@@ -208,6 +208,19 @@ BALMLayout::AddColumn(XTab* _left, XTab* _right)
}
Area*
BALMLayout::AreaFor(int32 id) const
{
int32 areaCount = CountAreas();
for (int32 i = 0; i < areaCount; i++) {
Area* area = AreaAt(i);
if (area->ID() == id)
return area;
}
return NULL;
}
/**
* Finds the area that contains the given control.
*
+23
View File
@@ -522,6 +522,15 @@ Area::~Area()
}
static int32 sAreaID = 0;
static int32
new_area_id()
{
return sAreaID++;
}
/**
* Constructor.
* Uses XTabs and YTabs.
@@ -550,7 +559,21 @@ Area::Area(BLayoutItem* item)
fContentAspectRatio(-1),
fContentAspectRatioC(NULL)
{
fID = new_area_id();
}
int32
Area::ID() const
{
return fID;
}
void
Area::SetID(int32 id)
{
fID = id;
}