void JXRowHeaderWidget::HandleMouseDrag ( const JPoint& origPt, const JXButtonStates& buttonStates, const JXKeyModifiers& modifiers ) { if (itsDragType != kInvalidDrag) { JPoint pt = origPt; // keep col width larger than minimum if (pt.y < itsDragCellRect.top + itsMinRowHeight) { pt.y = itsDragCellRect.top + itsMinRowHeight; } // check if we have moved if (pt.y != itsPrevPt.y) { JPainter* p = NULL; const JBoolean ok = GetDragPainter(&p); assert( ok ); const JRect enclApG = (GetEnclosure())->GetApertureGlobal(); JRect enclAp = JXContainer::GlobalToLocal(enclApG); // scroll, if necessary const JPoint ptG = JXContainer::LocalToGlobal(pt); const JPoint ptT = JPinInRect(itsTable->JXContainer::GlobalToLocal(ptG), itsTable->GetBounds()); const JRect tableAp = itsTable->GetAperture(); const JCoordinate x = tableAp.xcenter(); const JRect tableRect(ptT.y-1, x-1, ptT.y+1, x+1); if (itsTable->ScrollToRect(tableRect)) { (GetWindow())->Update(); enclAp = JXContainer::GlobalToLocal(enclApG); // local coords changed } else { // erase the old line p->Line(enclAp.left, itsPrevPt.y, enclAp.right, itsPrevPt.y); } // draw the new line p->Line(enclAp.left, pt.y, enclAp.right, pt.y); // ready for next call itsPrevPt = pt; } } }
void CBCommandTable::HandleDNDHere ( const JPoint& pt, const JXWidget* source ) { JIndex newRowIndex = itsDNDRowIndex; JPoint cell; if (GetCell(JPinInRect(pt, GetBounds()), &cell)) { const JRect r = GetCellRect(cell); if (pt.y <= r.ycenter()) { newRowIndex = cell.y; } else { newRowIndex = cell.y + 1; } } if (newRowIndex != itsDNDRowIndex) { itsDNDRowIndex = newRowIndex; Refresh(); } }
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); } }
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); } }