* naive implementation for DrawAfterChildren()

* resolved TODO in _RecurseView(), no need to call Draw() on views
  that are hidden or miss the B_WILL_DRAW flag, as there Draw()
  function would never be called according to the BeBook documentation



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24686 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Karsten Heimrich
2008-03-30 18:12:45 +00:00
parent 88499d361f
commit f1c61c2ada
+24 -14
View File
@@ -3,9 +3,9 @@
* Distributed under the terms of the MIT license.
*
* Authors:
I.R. Adema
Stefano Ceccherini ([email protected])
Michael Pfeiffer
* I.R. Adema
* Stefano Ceccherini ([email protected])
* Michael Pfeiffer
*/
// TODO refactor (avoid code duplications, decrease method sizes)
@@ -648,18 +648,15 @@ BPrintJob::PrinterType(void *) const
}
#if 0
#pragma mark ----- PRIVATE -----
#endif
// #pragma mark ----- PRIVATE -----
void
BPrintJob::_RecurseView(BView *view, BPoint origin,
BPicture *picture, BRect rect)
BPrintJob::_RecurseView(BView *view, BPoint origin, BPicture *picture,
BRect rect)
{
ASSERT(picture != NULL);
// TODO: test what happens if views don't have
// the B_WILL_DRAW flag or have B_DRAW_ON_CHILDREN
view->AppendToPicture(picture);
view->f_is_printing = true;
@@ -672,10 +669,23 @@ BPrintJob::_RecurseView(BView *view, BPoint origin,
BView *child = view->ChildAt(0);
while (child != NULL) {
// TODO: origin and rect should probably
// be converted for children views in some way
_RecurseView(child, origin, picture, rect);
child = child->NextSibling();
if ((child->Flags() & B_WILL_DRAW) && !child->IsHidden()) {
// TODO: origin and rect should probably
// be converted for children views in some way
_RecurseView(child, origin, picture, rect);
child = child->NextSibling();
}
}
if (view->Flags() & B_DRAW_ON_CHILDREN) {
view->AppendToPicture(picture);
view->f_is_printing = true;
view->PushState();
view->SetOrigin(origin);
view->DrawAfterChildren(rect);
view->PopState();
view->f_is_printing = false;
view->EndPicture();
}
}