From 0eed276cf7849f3d5027d1fa99183e25ba8e78c0 Mon Sep 17 00:00:00 2001 From: Adi Oanca Date: Tue, 22 Feb 2005 20:08:27 +0000 Subject: [PATCH] 'Attach' hooks are now called after the complete tree of children of the BView to be added is completely known by app_server git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11453 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/View.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp index e482c3daa1..400a924a56 100644 --- a/src/kits/interface/View.cpp +++ b/src/kits/interface/View.cpp @@ -3198,6 +3198,7 @@ BView::AddChild(BView *child, BView *before) child->setOwner(this->owner); attachView(child); + callAttachHooks(child); if (lockedByAddChild) owner->Unlock(); @@ -3733,26 +3734,18 @@ BView::removeSelf() } -bool +void BView::callDetachHooks(BView *aView) { - // check_clock(); - - // call the hook function: aView->DetachedFromWindow(); - // we attach all its children - BView *child = aView->first_child; while (child != NULL) { aView->callDetachHooks(child); child = child->next_sibling; } - // call the hook function: aView->AllDetached(); - - return true; } @@ -3819,6 +3812,19 @@ BView::addToList(BView *aView, BView *before) return true; } +void +BView::callAttachHooks(BView *aView) +{ + aView->AttachedToWindow(); + + BView *child= aView->first_child; + while (child != NULL) { + aView->callAttachHooks(child); + child = child->next_sibling; + } + + aView->AllAttached(); +} bool BView::attachView(BView *aView) @@ -3851,9 +3857,6 @@ BView::attachView(BView *aView) aView->setCachedState(); - // call the hook function: - aView->AttachedToWindow(); - // we attach all its children BView *child= aView->first_child; @@ -3862,8 +3865,6 @@ BView::attachView(BView *aView) child = child->next_sibling; } - // call the hook function: - aView->AllAttached(); owner->fLink->Flush(); return true;