void JXHorizPartition::HandleMouseDown ( const JPoint& pt, const JXMouseButton button, const JSize clickCount, const JXButtonStates& buttonStates, const JXKeyModifiers& modifiers ) { itsDragType = kInvalidDrag; if (button != kJXLeftButton) { return; } if (modifiers.meta()) { itsDragType = kDragAll; PrepareToDragAll(pt.x, &itsMinDragX, &itsMaxDragX); } else { itsDragType = kDragOne; PrepareToDrag(pt.x, &itsMinDragX, &itsMaxDragX); } JPainter* p = CreateDragInsidePainter(); const JRect ap = GetAperture(); p->Line(pt.x, ap.top, pt.x, ap.bottom); itsPrevPt = pt; }
void UndoWidget::HandleMouseDown ( const JPoint& pt, const JXMouseButton button, const JSize clickCount, const JXButtonStates& buttonStates, const JXKeyModifiers& modifiers ) { // Check to see if the left button was pressed if (button == kJXLeftButton) { // Create the drag painter to draw the rubber-band like lines JPainter* p = CreateDragInsidePainter(); // Start the first line p->Line(pt, pt); } // Let the base class handle the wheel mouse. else { ScrollForWheel(button, modifiers); } // Initialize the current points itsStartPt = itsPrevPt = pt; }
void TestWidget::HandleMouseDown ( const JPoint& pt, const JXMouseButton button, const JSize clickCount, const JXButtonStates& buttonStates, const JXKeyModifiers& modifiers ) { if (button == kJXLeftButton && clickCount == 1 && itsHomeRect.Contains(pt)) { JString dir; if (JGetHomeDirectory(&dir)) { JPtrArray<JString> list(JPtrArrayT::kForgetAll); list.Append(&dir); // Normally, you should use the other constructor and then // override JXWidget::GetSelectionData(). JXFileSelection* data = jnew JXFileSelection(GetDisplay(), list); assert( data != NULL ); BeginDND(pt, buttonStates, modifiers, data); } } else if (button == kJXLeftButton && clickCount == 1) { JPainter* p = CreateDragInsidePainter(); p->Rect(JRect(pt, pt)); } else if (button == kJXMiddleButton && clickCount == 1) { itsAnimButton->Place(pt.x, pt.y); } else if (button == kJXRightButton && clickCount == 1 && !modifiers.meta()) { JRect r = itsAnimButton->GetFrame(); if (pt.x > r.left && pt.y > r.top) { itsAnimButton->SetSize(pt.x-r.left, pt.y-r.top); } } else if (button == kJXRightButton && clickCount == 1 && modifiers.meta()) { if (itsSecretMenu->PopUp(this, pt, buttonStates, modifiers)) { return; } else { (JGetUserNotification())->ReportError("Unable to open secret menu!"); } } else if (ScrollForWheel(button, modifiers)) { // work has been done } else if ((clickCount == 2 && its2Rect.Contains(pt)) || (clickCount == 3 && its3Rect.Contains(pt))) { GetNewSize(); } itsStartPt = itsPrevPt = pt; }