Exemplo n.º 1
0
void DiagramEndPoint::mouseDown(
	BPoint point,
	uint32 buttons,
	uint32 clicks)
{
	D_MOUSE(("DiagramEndPoint::mouseDown()\n"));
	if (clicks == 1)
	{
		if (isSelectable())
		{
			BMessage selectMsg(M_SELECTION_CHANGED);
			if (modifiers() & B_SHIFT_KEY)
			{
				selectMsg.AddBool("replace", false);
			}
			else
			{
				selectMsg.AddBool("replace", true);
			}
			selectMsg.AddPointer("item", reinterpret_cast<void *>(this));
			DiagramView* v = view();
			BMessenger(v).SendMessage(&selectMsg);
		}
		if (isDraggable() && (buttons == B_PRIMARY_MOUSE_BUTTON))
		{
			BMessage dragMsg(M_WIRE_DRAGGED);
			dragMsg.AddPointer("from", static_cast<void *>(this));
			view()->DragMessage(&dragMsg, BRect(0.0, 0.0, -1.0, -1.0), view());
			view()->messageDragged(point, B_INSIDE_VIEW, &dragMsg);
		}
	}
}
Exemplo n.º 2
0
bool CChevPanel::MouseDragMoveMsg(CMouseDragMoveMsg *msg) {
	CChildDragMoveMsg dragMsg(_startPos);
	dragMsg.execute(this, nullptr, MSGFLAG_SCAN);

	setPosition(msg->_mousePos - _startPos);
	return true;
}
Exemplo n.º 3
0
bool CChevPanel::MouseDragStartMsg(CMouseDragStartMsg *msg) {
	if (checkStartDragging(msg)) {
		_startPos = Point(msg->_mousePos.x - _bounds.left,
			msg->_mousePos.y - _bounds.top);
		CChildDragStartMsg dragMsg(_startPos);
		dragMsg.execute(this, nullptr, MSGFLAG_SCAN);
	}

	return true;
}
Exemplo n.º 4
0
bool DormantNodeView::InitiateDrag(
	BPoint point,
	int32 index,
	bool wasSelected) {
	D_HOOK(("DormantNodeView::InitiateDrag()\n"));

	DormantNodeListItem *item = dynamic_cast<DormantNodeListItem *>(ItemAt(CurrentSelection()));
	if (item) {
		BMessage dragMsg(M_INSTANTIATE_NODE);
		dragMsg.AddData("which", B_RAW_TYPE,
						reinterpret_cast<const void *>(&item->info()),
						sizeof(item->info()));
		point -= ItemFrame(index).LeftTop();
		DragMessage(&dragMsg, item->getDragBitmap(), B_OP_ALPHA, point);
		return true;
	}
	return false;
}
Exemplo n.º 5
0
bool
CTrackListView::InitiateDrag(
	BPoint point,
	int32 index,
	bool wasSelected)
{
	D_HOOK(("CTrackListView::InitiateDrag()\n"));

	CTrackListItem *item = dynamic_cast<CTrackListItem *>(ItemAt(index));
	if (item)
	{
		BMessage dragMsg(MeVDragMsg_ID);
		dragMsg.AddInt32("Type", DragTrack_ID);
		dragMsg.AddInt32("TrackID", item->GetTrackID());
		dragMsg.AddInt32("Index", index);
		dragMsg.AddPointer("Document", m_doc);
		point -= ItemFrame(index).LeftTop();
		DragMessage(&dragMsg, item->GetDragBitmap(), B_OP_ALPHA, point);
		return true;
	}
	return false;
}
Exemplo n.º 6
0
void DiagramBox::mouseDown(
	BPoint point,
	uint32 buttons,
	uint32 clicks)
{
	D_MOUSE(("DiagramBox::mouseDown()\n"));
	DiagramItem *item = itemUnder(point);
	if (item)
	{
		item->mouseDown(point, buttons, clicks);
	}
	else if (clicks == 1)
	{
		if (isSelectable())
		{
			BMessage selectMsg(M_SELECTION_CHANGED);
			if (modifiers() & B_SHIFT_KEY)
			{
				selectMsg.AddBool("replace", false);
			}
			else
			{
				selectMsg.AddBool("replace", true);
			}
			selectMsg.AddPointer("item", reinterpret_cast<void *>(this));
			DiagramView* v = view();
			BMessenger(v).SendMessage(&selectMsg);
		}
		if (isDraggable() && (buttons == B_PRIMARY_MOUSE_BUTTON))
		{
			BMessage dragMsg(M_BOX_DRAGGED);
			dragMsg.AddPointer("item", static_cast<void *>(this));
			dragMsg.AddPoint("offset", point - frame().LeftTop());
			view()->DragMessage(&dragMsg, BRect(0.0, 0.0, -1.0, -1.0), view());
		}
	}
}