* 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
+20 -10
View File
@@ -3,9 +3,9 @@
* Distributed under the terms of the MIT license. * Distributed under the terms of the MIT license.
* *
* Authors: * Authors:
I.R. Adema * I.R. Adema
Stefano Ceccherini ([email protected]) * Stefano Ceccherini ([email protected])
Michael Pfeiffer * Michael Pfeiffer
*/ */
// TODO refactor (avoid code duplications, decrease method sizes) // TODO refactor (avoid code duplications, decrease method sizes)
@@ -648,18 +648,15 @@ BPrintJob::PrinterType(void *) const
} }
#if 0
#pragma mark ----- PRIVATE ----- // #pragma mark ----- PRIVATE -----
#endif
void void
BPrintJob::_RecurseView(BView *view, BPoint origin, BPrintJob::_RecurseView(BView *view, BPoint origin, BPicture *picture,
BPicture *picture, BRect rect) BRect rect)
{ {
ASSERT(picture != NULL); 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->AppendToPicture(picture);
view->f_is_printing = true; view->f_is_printing = true;
@@ -672,11 +669,24 @@ BPrintJob::_RecurseView(BView *view, BPoint origin,
BView *child = view->ChildAt(0); BView *child = view->ChildAt(0);
while (child != NULL) { while (child != NULL) {
if ((child->Flags() & B_WILL_DRAW) && !child->IsHidden()) {
// TODO: origin and rect should probably // TODO: origin and rect should probably
// be converted for children views in some way // be converted for children views in some way
_RecurseView(child, origin, picture, rect); _RecurseView(child, origin, picture, rect);
child = child->NextSibling(); 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();
}
} }