Update BLayout::ItemAdded() and BLayout::ItemRemoved() to take an int32 index parameter, and ItemAdded() to return a bool indicating success or failure. Update BLayout::AddItem() to take the result of ItemAdded() into account. Also update BLayout::AllUnarchived() to take this into account. In either situation, if ItemAdded() returns false, the item does not get added to the layout. Removed various TODOs about code that could be removed once this change was made. In BSplitLayout, an item's LayoutData was lazy-initialized, but would always be created during ItemAdded(). Now we create the LayoutData explicitly, so that we can catch failed memory allocations. Closes #5524.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37817 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alex Wilson
2010-07-30 02:28:17 +00:00
parent 0265102f8b
commit 6829d4174b
10 changed files with 97 additions and 82 deletions
+2 -2
View File
@@ -36,8 +36,8 @@ public:
static BArchivable* Instantiate(BMessage* from);
protected:
virtual void ItemAdded(BLayoutItem* item);
virtual void ItemRemoved(BLayoutItem* item);
virtual bool ItemAdded(BLayoutItem* item, int32 atIndex);
virtual void ItemRemoved(BLayoutItem* item, int32 fromIndex);
private:
BSize fMin;