Ejemplo n.º 1
0
void
AudioListView::MouseDown(BPoint position)
{
	if (!IsEmpty()) {
		bool onSelection = false;
		BListItem* item = ItemAt(IndexOf(position));

		if (item != NULL && item->IsSelected())
			onSelection = true;

		uint32 buttons = 0;
		if (Window() != NULL && Window()->CurrentMessage() != NULL)
			buttons = Window()->CurrentMessage()->FindInt32("buttons");

		if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0) {

			if (CurrentSelection() < 0 || !onSelection)
				Select(IndexOf(position));

			if (CurrentSelection() >= 0)
				_ShowPopUpMenu(ConvertToScreen(position));
			return;
		}
	}

	BListView::MouseDown(position);
}
Ejemplo n.º 2
0
void
ClipView::MouseDown(BPoint position)
{
	BListView::MouseDown(position);

	BMessage message(SWITCHLIST);
	message.AddInt32("listview", (int32)1);
	Looper()->PostMessage(&message);

	BRect bounds = ItemFrame(CurrentSelection());
	if (bounds.Contains(position)) {
		uint32 buttons = 0;
		if (Window() != NULL && Window()->CurrentMessage() != NULL)
			buttons = Window()->CurrentMessage()->FindInt32("buttons");

		if (buttons == B_SECONDARY_MOUSE_BUTTON)
			_ShowPopUpMenu(ConvertToScreen(position));
	}
}