* Now that the icons are keyboard navigable, we need a different drop target
identifier: note, this reveals a) an incompatibility between R5 and Haiku with regards to drawing rects with a pen size != 1, b) a drawing bug in that same case in non 32-bit modes - if you have time, Stippi... :-) * If the icon view is bound to a file, it will no longer accept that specific file as a drop target. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19294 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
745e7694e5
commit
5e0acbb2fb
@ -28,8 +28,21 @@ DropTargetListView::Draw(BRect updateRect)
|
||||
if (fDropTarget) {
|
||||
// mark this view as a drop target
|
||||
rgb_color color = HighColor();
|
||||
SetHighColor(ui_color(B_KEYBOARD_NAVIGATION_COLOR));
|
||||
StrokeRect(Bounds());
|
||||
|
||||
SetHighColor(0, 0, 0);
|
||||
SetPenSize(2);
|
||||
BRect rect = Bounds();
|
||||
// TODO: this is an incompatibility between R5 and Haiku and should be fixed!
|
||||
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||
rect.left++;
|
||||
rect.top++;
|
||||
#else
|
||||
rect.right--;
|
||||
rect.bottom--;
|
||||
#endif
|
||||
StrokeRect(rect);
|
||||
|
||||
SetPenSize(1);
|
||||
SetHighColor(color);
|
||||
}
|
||||
}
|
||||
@ -62,5 +75,20 @@ DropTargetListView::AcceptsDrag(const BMessage* /*message*/)
|
||||
void
|
||||
DropTargetListView::_InvalidateFrame()
|
||||
{
|
||||
Invalidate();
|
||||
// only update the parts affected by the change to reduce flickering
|
||||
BRect rect = Bounds();
|
||||
rect.right = rect.left + 1;
|
||||
Invalidate(rect);
|
||||
|
||||
rect = Bounds();
|
||||
rect.left = rect.right - 1;
|
||||
Invalidate(rect);
|
||||
|
||||
rect = Bounds();
|
||||
rect.bottom = rect.top + 1;
|
||||
Invalidate(rect);
|
||||
|
||||
rect = Bounds();
|
||||
rect.top = rect.bottom - 1;
|
||||
Invalidate(rect);
|
||||
}
|
||||
|
@ -529,11 +529,19 @@ IconView::_AcceptsDrag(const BMessage* message)
|
||||
|
||||
type_code type;
|
||||
int32 count;
|
||||
if (message->GetInfo("refs", &type, &count) == B_OK && count == 1 && type == B_REF_TYPE
|
||||
if (message->GetInfo("refs", &type, &count) == B_OK && count == 1 && type == B_REF_TYPE) {
|
||||
// if we're bound to an entry, check that no one drops this to us
|
||||
entry_ref ref;
|
||||
if (fHasRef && message->FindRef("refs", &ref) == B_OK && fRef == ref)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message->GetInfo("icon/large", &type) == B_OK && type == B_MESSAGE_TYPE
|
||||
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||
|| message->GetInfo("icon", &type) == B_OK && type == B_VECTOR_ICON_TYPE
|
||||
#endif
|
||||
|| message->GetInfo("icon/large", &type) == B_OK && type == B_MESSAGE_TYPE
|
||||
|| message->GetInfo("icon/mini", &type) == B_OK && type == B_MESSAGE_TYPE)
|
||||
return true;
|
||||
|
||||
@ -564,11 +572,27 @@ IconView::Draw(BRect updateRect)
|
||||
StrokeRect(Bounds());
|
||||
}
|
||||
|
||||
if (IsFocus() || fDropTarget) {
|
||||
// mark this view as a drop target
|
||||
if (IsFocus()) {
|
||||
// mark this view as a having focus
|
||||
SetHighColor(ui_color(B_KEYBOARD_NAVIGATION_COLOR));
|
||||
StrokeRect(_BitmapRect());
|
||||
}
|
||||
if (fDropTarget) {
|
||||
// mark this view as a drop target
|
||||
SetHighColor(0, 0, 0);
|
||||
SetPenSize(2);
|
||||
BRect rect = _BitmapRect();
|
||||
// TODO: this is an incompatibility between R5 and Haiku and should be fixed!
|
||||
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||
rect.left++;
|
||||
rect.top++;
|
||||
#else
|
||||
rect.right--;
|
||||
rect.bottom--;
|
||||
#endif
|
||||
StrokeRect(rect);
|
||||
SetPenSize(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user