void
TestWidget::HandleMouseDrag
	(
	const JPoint&			pt,
	const JXButtonStates&	buttonStates,
	const JXKeyModifiers&	modifiers
	)
{
	const JBoolean scrolled = ScrollForDrag(pt);

	JPainter* p = NULL;
	if (buttonStates.left() && pt != itsPrevPt && GetDragPainter(&p))	// no painter for multiple click
		{
		if (!scrolled)
			{
			p->Rect(JRect(itsStartPt, itsPrevPt));
			}
		p->Rect(JRect(itsStartPt, pt));
		}

	if (buttonStates.middle() && pt != itsPrevPt)
		{
		itsAnimButton->Place(pt.x, pt.y);
		}
	else if (buttonStates.right() && pt != itsPrevPt)
		{
		JRect r = itsAnimButton->GetFrame();
		if (pt.x > r.left && pt.y > r.top)
			{
			itsAnimButton->SetSize(pt.x-r.left, pt.y-r.top);
			}
		}

	itsPrevPt = pt;
}
Beispiel #2
0
void
UndoWidget::HandleMouseDrag
	(
	const JPoint&			pt,
	const JXButtonStates&	buttonStates,
	const JXKeyModifiers&	modifiers
	)
{
	// Check to see if the window was scrolled
	const JBoolean scrolled = ScrollForDrag(pt);

	// Get the drag painter that we created in mouse down
	JPainter* p = NULL;
	const JBoolean ok = GetDragPainter(&p);
	assert( ok );

	// Make sure that the left button is pressed,
	// that we have moved,
	// and that a drag painter exists
	if (buttonStates.left() && pt != itsPrevPt && p != NULL)	// p is NULL for multiple click
		{

		// Draw line depending on whether or not we scrolled
		if (!scrolled)
			{
			p->Line(itsStartPt, itsPrevPt);
			}
		p->Line(itsStartPt, pt);
		}

	// Remember the current point
	itsPrevPt = pt;
}
JBoolean
JXExprEditor::EIPScrollForDrag
	(
	const JPoint& pt
	)
{
	return ScrollForDrag(RendererToBounds(pt));
}
void
JXExprEditor::HandleMouseDrag
	(
	const JPoint&			pt,
	const JXButtonStates&	buttonStates,
	const JXKeyModifiers&	modifiers
	)
{
	ScrollForDrag(pt);
	EIPHandleMouseDrag(BoundsToRenderer(pt));
}
void
TestStringTable::HandleMouseDrag
	(
	const JPoint&			pt,
	const JXButtonStates&	buttonStates,
	const JXKeyModifiers&	modifiers
	)
{
	if (itsIsDraggingFlag)
		{
		ScrollForDrag(pt);

		JPoint cell;
		const JBoolean ok = GetCell(JPinInRect(pt, GetBounds()), &cell);
		assert( ok );
		(GetTableSelection()).ExtendSelection(cell);
		}
}
Beispiel #6
0
void
JXTable::ContinueSelectionDrag
	(
	const JPoint&			pt,
	const JXKeyModifiers&	modifiers	// included to distinguish from JTable function
	)
{
	if (IsDraggingSelection())
		{
		ScrollForDrag(pt);

		JPoint cell;
		const JBoolean ok = GetCell(JPinInRect(pt, GetBounds()), &cell);
		assert( ok );

		JTable::ContinueSelectionDrag(cell);
		}
}