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
This commit is contained in:
Stephan Aßmus
2009-03-28 19:35:58 +00:00
parent 339dcf9c81
commit 06ab171868
+52 -35
View File
@@ -162,7 +162,16 @@ BDragger::Draw(BRect update)
BRect bounds(Bounds()); BRect bounds(Bounds());
if (AreDraggersDrawn() && (!fShelf || fShelf->AllowsDragging())) { 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); SetDrawingMode(B_OP_OVER);
DrawBitmap(fBitmap, where); DrawBitmap(fBitmap, where);
SetDrawingMode(B_OP_COPY); SetDrawingMode(B_OP_COPY);
@@ -171,16 +180,14 @@ BDragger::Draw(BRect update)
// TODO: should draw it differently ? // TODO: should draw it differently ?
} }
} else if (IsVisibilityChanging()) { } else if (IsVisibilityChanging()) {
if (Parent()) {
//uint32 flags = Parent()->Flags(); if ((Parent()->Flags() & B_DRAW_ON_CHILDREN) == 0) {
//Parent()->SetFlags(flags | B_DRAW_ON_CHILDREN); uint32 flags = Parent()->Flags();
//Parent()->Draw(Frame()); Parent()->SetFlags(flags | B_DRAW_ON_CHILDREN);
//Parent()->SetFlags(flags); Parent()->Invalidate(Frame() & ConvertToParent(update));
Parent()->SetFlags(flags);
if (Parent()) }
Parent()->Invalidate(Frame()); } else {
else {
SetHighColor(255, 255, 255); SetHighColor(255, 255, 255);
FillRect(bounds); FillRect(bounds);
} }
@@ -284,30 +291,40 @@ BDragger::MouseMoved(BPoint point, uint32 code, const BMessage *msg)
void void
BDragger::MessageReceived(BMessage *msg) BDragger::MessageReceived(BMessage *msg)
{ {
if (msg->what == B_TRASH_TARGET) { switch (msg->what) {
if (fShelf != NULL) case B_TRASH_TARGET:
Window()->PostMessage(kDeleteReplicant, fTarget, NULL); if (fShelf != NULL)
else { Window()->PostMessage(kDeleteReplicant, fTarget, NULL);
(new BAlert("??", else {
"Can't delete this replicant from its original application. Life goes on.", (new BAlert("??",
"OK", NULL, NULL, B_WIDTH_FROM_WIDEST, B_WARNING_ALERT))->Go(NULL); "Can't delete this replicant from its original "
} "application. Life goes on.",
} else if (msg->what == _SHOW_DRAG_HANDLES_) { "OK", NULL, NULL, B_WIDTH_FROM_WIDEST,
// this code is used whenever the "are draggers drawn" option is changed B_WARNING_ALERT))->Go(NULL);
if (fRelation == TARGET_IS_CHILD) { }
fTransition = true; break;
Draw(Bounds());
Flush(); case _SHOW_DRAG_HANDLES_:
fTransition = false; // This code is used whenever the "are draggers drawn" option is
} else { // changed.
if ((fShelf && (fShelf->AllowsDragging() && AreDraggersDrawn())) if (fRelation == TARGET_IS_CHILD) {
|| AreDraggersDrawn()) fTransition = true;
Show(); Draw(Bounds());
else Flush();
Hide(); fTransition = false;
} } else {
} else if ((fShelf && (fShelf->AllowsDragging() && AreDraggersDrawn()))
BView::MessageReceived(msg); || AreDraggersDrawn())
Show();
else
Hide();
}
break;
default:
BView::MessageReceived(msg);
break;
}
} }