Add a BObjectList<BLayoutItem> to BView::fLayoutData that keeps track of any BLayoutItems that refer to this view that are part of a layout. BLayoutItem does the registering/deregistering of the items, and BView::Private proxies fLayoutData for us. Currently, this is not used anywhere, but there are many places where it will be used soon.

This commit is contained in:
Alex Wilson
2011-10-28 14:16:07 -06:00
parent edb4c8244c
commit bd97b9adba
4 changed files with 47 additions and 2 deletions
+31
View File
@@ -34,6 +34,7 @@
#include <MenuBar.h>
#include <Message.h>
#include <MessageQueue.h>
#include <ObjectList.h>
#include <Picture.h>
#include <Point.h>
#include <Polygon.h>
@@ -335,6 +336,7 @@ struct BView::LayoutData {
fLayoutInvalidationDisabled(0),
fLayout(NULL),
fLayoutContext(NULL),
fLayoutItems(5, false),
fLayoutValid(true), // TODO: Rethink these initial values!
fMinMaxValid(true), //
fLayoutInProgress(false),
@@ -375,6 +377,7 @@ struct BView::LayoutData {
int fLayoutInvalidationDisabled;
BLayout* fLayout;
BLayoutContext* fLayoutContext;
BObjectList<BLayoutItem> fLayoutItems;
bool fLayoutValid;
bool fMinMaxValid;
bool fLayoutInProgress;
@@ -5959,6 +5962,34 @@ BView::_PrintTree()
// #pragma mark -
BLayoutItem*
BView::Private::LayoutItemAt(int32 index)
{
return fView->fLayoutData->fLayoutItems.ItemAt(index);
}
int32
BView::Private::CountLayoutItems()
{
return fView->fLayoutData->fLayoutItems.CountItems();
}
void
BView::Private::RegisterLayoutItem(BLayoutItem* item)
{
fView->fLayoutData->fLayoutItems.AddItem(item);
}
void
BView::Private::DeregisterLayoutItem(BLayoutItem* item)
{
fView->fLayoutData->fLayoutItems.RemoveItem(item);
}
bool
BView::Private::MinMaxValid()
{