Implemented invocation on double click.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16799 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-03-14 21:38:11 +00:00
parent f6e3e0a259
commit 04cec2bbbd
+19 -13
View File
@@ -280,14 +280,20 @@ BListView::MouseDown(BPoint point)
} }
BMessage *message = Looper()->CurrentMessage(); BMessage *message = Looper()->CurrentMessage();
int32 index = IndexOf(point);
// If the user double (or more) clicked within the current selection,
// we don't change the selection but invoke the selection.
int32 clicks; int32 clicks;
if (message->FindInt32("clicks", &clicks) == B_OK && clicks > 1
&& index >= fFirstSelected && index <= fLastSelected) {
Invoke();
return;
}
int32 modifiers; int32 modifiers;
message->FindInt32("clicks", &clicks);
message->FindInt32("modifiers", &modifiers); message->FindInt32("modifiers", &modifiers);
int index = IndexOf(point);
fTrack->drag_start = point; fTrack->drag_start = point;
fTrack->item_index = index; fTrack->item_index = index;
fTrack->was_selected = index >= 0 ? ItemAt(index)->IsSelected() : false; fTrack->was_selected = index >= 0 ? ItemAt(index)->IsSelected() : false;
@@ -303,19 +309,17 @@ BListView::MouseDown(BPoint point)
if (modifiers & B_SHIFT_KEY) { if (modifiers & B_SHIFT_KEY) {
// toggle selection state of clicked item (like in Tracker) // toggle selection state of clicked item (like in Tracker)
// toggle selection state of clicked item // toggle selection state of clicked item
if (clicks == 1) { if (ItemAt(index)->IsSelected())
if (ItemAt(index)->IsSelected()) Deselect(index);
Deselect(index); else
else Select(index, true);
Select(index, true);
}
} else { } else {
Select(index); Select(index);
} }
} }
} else { } else {
// toggle selection state of clicked item // toggle selection state of clicked item
if ((modifiers & B_SHIFT_KEY) && ItemAt(index)->IsSelected() && clicks == 1) if ((modifiers & B_SHIFT_KEY) && ItemAt(index)->IsSelected())
Deselect(index); Deselect(index);
else else
Select(index); Select(index);
@@ -828,6 +832,9 @@ BListView::CurrentSelection(int32 index) const
status_t status_t
BListView::Invoke(BMessage *message) BListView::Invoke(BMessage *message)
{ {
// Note, this is more or less a copy of BControl::Invoke() and should
// stay that way (ie. changes done there should be adopted here)
bool notify = false; bool notify = false;
uint32 kind = InvokeKind(&notify); uint32 kind = InvokeKind(&notify);
@@ -861,8 +868,7 @@ BListView::Invoke(BMessage *message)
if (message) if (message)
err = BInvoker::Invoke(&clone); err = BInvoker::Invoke(&clone);
// TODO: assynchronous messaging SendNotices(kind, &clone);
// SendNotices(kind, &clone);
return err; return err;
} }