From 06ab171868144e96d8d7610011f3b4753ecadd5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 28 Mar 2009 19:35:58 +0000 Subject: [PATCH] Make the code work that has the parent draw the background for the little handle (parent draws on top of it's dragger child view). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29761 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Dragger.cpp | 87 ++++++++++++++++++++-------------- 1 file changed, 52 insertions(+), 35 deletions(-) diff --git a/src/kits/interface/Dragger.cpp b/src/kits/interface/Dragger.cpp index 40bbf535c6..5ea06c1509 100644 --- a/src/kits/interface/Dragger.cpp +++ b/src/kits/interface/Dragger.cpp @@ -162,7 +162,16 @@ BDragger::Draw(BRect update) BRect bounds(Bounds()); if (AreDraggersDrawn() && (!fShelf || fShelf->AllowsDragging())) { - BPoint where = bounds.RightBottom() - BPoint(fBitmap->Bounds().Width(), fBitmap->Bounds().Height()); + if (Parent() && (Parent()->Flags() & B_DRAW_ON_CHILDREN) == 0) { + uint32 flags = Parent()->Flags(); + Parent()->SetFlags(flags | B_DRAW_ON_CHILDREN); + Parent()->Draw(Frame() & ConvertToParent(update)); + Parent()->Flush(); + Parent()->SetFlags(flags); + } + + BPoint where = bounds.RightBottom() - BPoint(fBitmap->Bounds().Width(), + fBitmap->Bounds().Height()); SetDrawingMode(B_OP_OVER); DrawBitmap(fBitmap, where); SetDrawingMode(B_OP_COPY); @@ -171,16 +180,14 @@ BDragger::Draw(BRect update) // TODO: should draw it differently ? } } else if (IsVisibilityChanging()) { - -//uint32 flags = Parent()->Flags(); -//Parent()->SetFlags(flags | B_DRAW_ON_CHILDREN); -//Parent()->Draw(Frame()); -//Parent()->SetFlags(flags); - - if (Parent()) - Parent()->Invalidate(Frame()); - - else { + if (Parent()) { + if ((Parent()->Flags() & B_DRAW_ON_CHILDREN) == 0) { + uint32 flags = Parent()->Flags(); + Parent()->SetFlags(flags | B_DRAW_ON_CHILDREN); + Parent()->Invalidate(Frame() & ConvertToParent(update)); + Parent()->SetFlags(flags); + } + } else { SetHighColor(255, 255, 255); FillRect(bounds); } @@ -284,30 +291,40 @@ BDragger::MouseMoved(BPoint point, uint32 code, const BMessage *msg) void BDragger::MessageReceived(BMessage *msg) { - if (msg->what == B_TRASH_TARGET) { - if (fShelf != NULL) - Window()->PostMessage(kDeleteReplicant, fTarget, NULL); - else { - (new BAlert("??", - "Can't delete this replicant from its original application. Life goes on.", - "OK", NULL, NULL, B_WIDTH_FROM_WIDEST, B_WARNING_ALERT))->Go(NULL); - } - } else if (msg->what == _SHOW_DRAG_HANDLES_) { - // this code is used whenever the "are draggers drawn" option is changed - if (fRelation == TARGET_IS_CHILD) { - fTransition = true; - Draw(Bounds()); - Flush(); - fTransition = false; - } else { - if ((fShelf && (fShelf->AllowsDragging() && AreDraggersDrawn())) - || AreDraggersDrawn()) - Show(); - else - Hide(); - } - } else - BView::MessageReceived(msg); + switch (msg->what) { + case B_TRASH_TARGET: + if (fShelf != NULL) + Window()->PostMessage(kDeleteReplicant, fTarget, NULL); + else { + (new BAlert("??", + "Can't delete this replicant from its original " + "application. Life goes on.", + "OK", NULL, NULL, B_WIDTH_FROM_WIDEST, + B_WARNING_ALERT))->Go(NULL); + } + break; + + case _SHOW_DRAG_HANDLES_: + // This code is used whenever the "are draggers drawn" option is + // changed. + if (fRelation == TARGET_IS_CHILD) { + fTransition = true; + Draw(Bounds()); + Flush(); + fTransition = false; + } else { + if ((fShelf && (fShelf->AllowsDragging() && AreDraggersDrawn())) + || AreDraggersDrawn()) + Show(); + else + Hide(); + } + break; + + default: + BView::MessageReceived(msg); + break; + } }