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 JXTreeListWidget::HandleMouseDown ( const JPoint& pt, const JXMouseButton button, const JSize clickCount, const JXButtonStates& buttonStates, const JXKeyModifiers& modifiers ) { itsToggleDragIndex = 0; JPoint cell; const JBoolean inCell = GetCell(pt, &cell); if (button == kJXLeftButton && inCell && JIndex(cell.x) == itsToggleOpenColIndex && (itsTreeList->GetNode(cell.y))->IsOpenable()) { itsMouseInToggleFlag = kJTrue; itsToggleDragIndex = cell.y; TableRefreshCell(cell); } else if (button == kJXLeftButton && clickCount == 2 && inCell && JIndex(cell.x) != itsToggleOpenColIndex) { Broadcast(NodeDblClicked(itsTreeList->GetNode(cell.y), cell)); } else { ScrollForWheel(button, modifiers); } }
void GLFitDescriptionList::HandleMouseDown ( const JPoint& pt, const JXMouseButton button, const JSize clickCount, const JXButtonStates& buttonStates, const JXKeyModifiers& modifiers ) { JPoint cell; if (button == kJXLeftButton && GetCell(pt, &cell)) { if (GetTableSelection().IsSelected(cell) && clickCount == 2) { Broadcast(FitInitiated(cell.y)); } else if (!GetTableSelection().IsSelected(cell) && clickCount == 1) { SelectSingleCell(cell); Broadcast(FitSelected(cell.y)); } } else { ScrollForWheel(button, modifiers); } }
void CBCommandTable::HandleMouseDown ( const JPoint& pt, const JXMouseButton button, const JSize clickCount, const JXButtonStates& buttonStates, const JXKeyModifiers& modifiers ) { JPoint cell; if (ScrollForWheel(button, modifiers) || !GetCell(pt, &cell)) { return; } itsStartPt = pt; if (cell.x == kOptionsColumn) { SelectSingleCell(cell); itsOptionsMenu->PopUp(this, pt, buttonStates, modifiers); } else if (button == kJXLeftButton) { SelectSingleCell(cell); if (clickCount == 2) { BeginEditing(cell); } } }
void GMAccountList::HandleMouseDown ( const JPoint& pt, const JXMouseButton button, const JSize clickCount, const JXButtonStates& buttonStates, const JXKeyModifiers& modifiers ) { JPoint cell; if (button == kJXLeftButton && clickCount == 1 && GetCell(pt, &cell)) { JTableSelection& s = GetTableSelection(); if (!s.IsSelected(cell) && itsDialog->OKToSwitchAccounts()) { s.ClearSelection(); s.SelectRow(cell.y); Broadcast(NameSelected(cell.y)); BeginEditing(cell); } else if (s.IsSelected(cell) && !IsEditing()) { BeginEditing(cell); } } else if (button > kJXRightButton) { ScrollForWheel(button, modifiers); } }
void JXTabGroup::HandleDNDScroll ( const JPoint& pt, const JXMouseButton scrollButton, const JXKeyModifiers& modifiers ) { if (scrollButton != 0) { ScrollForWheel(scrollButton, modifiers); } }
void CBSymbolTable::HandleMouseDown ( const JPoint& pt, const JXMouseButton button, const JSize clickCount, const JXButtonStates& buttonStates, const JXKeyModifiers& modifiers ) { itsKeyBuffer.Clear(); JPoint cell; if (ScrollForWheel(button, modifiers)) { return; } else if (!GetCell(pt, &cell)) { (GetTableSelection()).ClearSelection(); } else if (button == kJXLeftButton && clickCount == 2 && !modifiers.shift() && modifiers.meta() && modifiers.control()) { SelectSingleCell(cell, kJFalse); DisplaySelectedSymbols(); (GetWindow())->Close(); return; } else if (clickCount == 2 && modifiers.meta()) { SelectSingleCell(cell, kJFalse); FindSelectedSymbols(button); } else if (button == kJXLeftButton && clickCount == 2 && !modifiers.shift() && !modifiers.control()) { DisplaySelectedSymbols(); } else { BeginSelectionDrag(cell, button, modifiers); } }
void GMFilterNameTable::HandleMouseDown ( const JPoint& pt, const JXMouseButton button, const JSize clickCount, const JXButtonStates& buttonStates, const JXKeyModifiers& modifiers ) { itsIsWaitingForDrag = kJFalse; itsStartPt = pt; itsDNDIsValid = kJFalse; if (button > kJXRightButton) { ScrollForWheel(button, modifiers); return; } JPoint cell; if (!GetCell(pt, &cell)) { return; } itsCurrentCell = cell; JTableSelection& s = GetTableSelection(); JPoint oldCell; JBoolean hasSingleSel = s.GetFirstSelectedCell(&oldCell); if (itsConditionTable->OKToSwitch() && itsActionTable->OKToSwitch() && (!IsEditing() || EndEditing())) { if ((hasSingleSel && cell.y != oldCell.y) || (!hasSingleSel)) { SelectFilter(cell.y); } itsIsWaitingForDrag = kJTrue; } }
void GPMProcessTreeList::HandleMouseDown ( const JPoint& pt, const JXMouseButton button, const JSize clickCount, const JXButtonStates& buttonStates, const JXKeyModifiers& modifiers ) { if (ScrollForWheel(button, modifiers)) { return; } JTableSelection& s = GetTableSelection(); s.ClearSelection(); JPoint cell; if (!GetCell(pt, &cell)) { return; } s.SelectRow(cell.y); if (cell.x == GPMProcessList::kTreeState) { const GPMProcessEntry* entry; const JBoolean ok = GetSelectedProcess(&entry); assert( ok ); GPMProcessTable::ToggleProcessState(*entry); itsList->Update(); } else if (cell.x != GPMProcessList::kTreeOpenClose && button == kJXRightButton) { itsContextMenu->PopUp(this, pt, buttonStates, modifiers); } else { JXNamedTreeListWidget::HandleMouseDown(pt, button, clickCount, buttonStates, modifiers); } }
void CMLineIndexTable::HandleMouseDown ( const JPoint& pt, const JXMouseButton button, const JSize clickCount, const JXButtonStates& buttonStates, const JXKeyModifiers& modifiers ) { if (ScrollForWheel(button, modifiers, NULL, itsVScrollbar)) { return; } JPoint cell; if (!GetCell(pt, &cell)) { return; } itsText->SelectLine(cell.y); const JIndex lineIndex = itsText->VisualLineIndexToCRLineIndex(cell.y); if (button == kJXRightButton) { OpenLineMenu(lineIndex, pt, buttonStates, modifiers, kJFalse); } else if (button == kJXLeftButton && modifiers.GetState(JXMenu::AdjustNMShortcutModifier(kJXMetaKeyIndex)) && !modifiers.shift()) { RunUntil(lineIndex); } else if (button == kJXLeftButton && modifiers.GetState(JXMenu::AdjustNMShortcutModifier(kJXControlKeyIndex))) { SetExecutionPoint(lineIndex); } else if (button == kJXLeftButton) { AdjustBreakpoints(lineIndex, pt, buttonStates, modifiers); } }
void SelectionTable::HandleMouseDown ( const JPoint& pt, const JXMouseButton button, const JSize clickCount, const JXButtonStates& buttonStates, const JXKeyModifiers& modifiers ) { if (button == kJXLeftButton) { // We first need to find out which cell contains this point. JPoint cell; if (GetCell(pt, &cell)) { // We clicked in the table. // Get the selection object that JTable owns. JTableSelection& selection = GetTableSelection(); // Select the cell that the user clicked on. selection.SelectCell(cell); } else { // We clicked the mouse outside of the table. // Get the selection object that JTable owns. JTableSelection& selection = GetTableSelection(); // Clear the selection. selection.ClearSelection(); } } // Let the base class handle the wheel mouse. else { ScrollForWheel(button, modifiers); } }
void CBMacroSetTable::HandleMouseDown ( const JPoint& pt, const JXMouseButton button, const JSize clickCount, const JXButtonStates& buttonStates, const JXKeyModifiers& modifiers ) { JPoint cell; if (button == kJXLeftButton && GetCell(pt, &cell)) { BeginEditing(cell); } else { ScrollForWheel(button, modifiers); } }
void CMArray2DTable::HandleMouseDown ( const JPoint& pt, const JXMouseButton button, const JSize clickCount, const JXButtonStates& buttonStates, const JXKeyModifiers& modifiers ) { JTableSelection& s = GetTableSelection(); JPoint cell; if (ScrollForWheel(button, modifiers)) { // work has been done } else if (!GetCell(pt, &cell)) { s.ClearSelection(); } else if (button == kJXLeftButton && modifiers.meta()) { if (!s.IsSelected(cell)) { SelectSingleCell(cell, kJFalse); } const JString expr = itsArrayDir->GetExpression(cell); itsCmdDir->DisplayExpression(expr); } else if (button == kJXLeftButton && clickCount == 2) { BeginEditing(cell); } else if (button == kJXLeftButton && clickCount == 1) { SelectSingleCell(cell, kJFalse); } }
void JXFSBindingTable::HandleMouseDown ( const JPoint& pt, const JXMouseButton button, const JSize clickCount, const JXButtonStates& buttonStates, const JXKeyModifiers& modifiers ) { JTableSelection& s = GetTableSelection(); s.ClearSelection(); JPoint cell; if (button == kJXLeftButton && GetCell(pt, &cell)) { s.SelectCell(cell); TableScrollToCell(cell); if (cell.x == kPatternColumn || cell.x == kCommandColumn) { BeginEditing(cell); } else if (cell.x == kTypeColumn) { itsTypeMenu->PopUp(this, pt, buttonStates, modifiers); } else if (cell.x == kSingleFileColumn) { itsBindingList->ToggleSingleFile(cell.y); TableRefreshRow(cell.y); Broadcast(DataChanged()); } } else { ScrollForWheel(button, modifiers); } }
void JXExprEditor::HandleMouseDown ( const JPoint& pt, const JXMouseButton button, const JSize clickCount, const JXButtonStates& buttonStates, const JXKeyModifiers& modifiers ) { if (button == kJXMiddleButton) { Paste(); } else if (button == kJXLeftButton || button == kJXRightButton) { EIPHandleMouseDown(BoundsToRenderer(pt), JConvertToBoolean(button == kJXRightButton)); } else { ScrollForWheel(button, modifiers); } }
void GLFitParameterTable::HandleMouseDown ( const JPoint& pt, const JXMouseButton button, const JSize clickCount, const JXButtonStates& buttonStates, const JXKeyModifiers& modifiers ) { JPoint cell; if (button == kJXLeftButton && clickCount == 1 && GetCell(pt, &cell)) { if (itsHasStartValues && cell.x == (JCoordinate)kStartColIndex) { BeginEditing(cell); } } else { ScrollForWheel(button, modifiers); } }
void SVNListBase::HandleMouseDown ( const JPoint& pt, const JXMouseButton button, const JSize clickCount, const JXButtonStates& buttonStates, const JXKeyModifiers& modifiers ) { JTableSelection& s = GetTableSelection(); itsIsDraggingFlag = kJFalse; itsSavedSelection->CleanOut(); JPoint cell; if (button > kJXRightButton) { ScrollForWheel(button, modifiers); } else if (!GetCell(pt, &cell)) { s.ClearSelection(); } else if (button == kJXLeftButton && modifiers.shift()) { itsIsDraggingFlag = s.ExtendSelection(cell); } else if (button == kJXLeftButton && modifiers.control()) { s.InvertCell(cell); if (s.IsSelected(cell)) { s.SetBoat(cell); s.SetAnchor(cell); } else { s.ClearBoat(); s.ClearAnchor(); } } else if (button == kJXLeftButton) { s.ClearSelection(); s.SetBoat(cell); s.SetAnchor(cell); s.SelectCell(cell); itsIsDraggingFlag = kJTrue; if (clickCount == 2) { OpenSelectedItems(); } } else if (button == kJXRightButton && clickCount == 1) { if (CreateContextMenu()) { if (!s.IsSelected(cell)) { s.ClearSelection(); s.SetBoat(cell); s.SetAnchor(cell); s.SelectCell(cell); } itsContextMenu->PopUp(this, pt, buttonStates, modifiers); } } }
void TestStringTable::HandleMouseDown ( const JPoint& pt, const JXMouseButton button, const JSize clickCount, const JXButtonStates& buttonStates, const JXKeyModifiers& modifiers ) { itsIsDraggingFlag = kJFalse; if (button > kJXRightButton) { ScrollForWheel(button, modifiers); return; } JPoint cell; if (!GetCell(pt, &cell)) { return; } JStringTableData* data = GetStringData(); JTableSelection& s = GetTableSelection(); if (button == kJXMiddleButton) { BeginEditing(cell); } else if (itsMouseAction == kSelectCells) { if (button == kJXLeftButton && !modifiers.shift()) { s.ClearSelection(); s.SetBoat(cell); s.SetAnchor(cell); s.SelectCell(cell); itsIsDraggingFlag = kJTrue; } else { itsIsDraggingFlag = s.ExtendSelection(cell); } } else if (itsMouseAction == kSelectRows) { if (button == kJXLeftButton && !modifiers.shift()) { s.ClearSelection(); } s.SetBoat(JPoint(1, cell.y)); s.SetAnchor(JPoint(GetColCount(), cell.y)); s.SelectRow(cell.y); } else if (itsMouseAction == kSelectCols) { if (button == kJXLeftButton && !modifiers.shift()) { s.ClearSelection(); } s.SetBoat(JPoint(cell.x, 1)); s.SetAnchor(JPoint(cell.x, GetRowCount())); s.SelectCol(cell.x); } // row manipulations else if (button == kJXLeftButton && itsMouseAction == kInsertRow) { data->InsertRows(cell.y, 1); } else if (button == kJXRightButton && itsMouseAction == kInsertRow) { data->InsertRows(cell.y+1, 1); } else if (button == kJXLeftButton && itsMouseAction == kDuplicateRow) { data->DuplicateRow(cell.y, cell.y); } else if (button == kJXRightButton && itsMouseAction == kDuplicateRow) { data->DuplicateRow(cell.y, cell.y+1); } else if (button == kJXLeftButton && itsMouseAction == kMoveRow && cell.y > 1) { data->MoveRow(cell.y, cell.y-1); } else if (button == kJXRightButton && itsMouseAction == kMoveRow && ((JIndex) cell.y) < GetRowCount()) { data->MoveRow(cell.y, cell.y+1); } else if (itsMouseAction == kRemoveRow) { data->RemoveRow(cell.y); } // column manipulations else if (button == kJXLeftButton && itsMouseAction == kInsertCol) { data->InsertCols(cell.x, 1); } else if (button == kJXRightButton && itsMouseAction == kInsertCol) { data->InsertCols(cell.x+1, 1); } else if (button == kJXLeftButton && itsMouseAction == kDuplicateCol) { data->DuplicateCol(cell.x, cell.x); } else if (button == kJXRightButton && itsMouseAction == kDuplicateCol) { data->DuplicateCol(cell.x, cell.x+1); } else if (button == kJXLeftButton && itsMouseAction == kMoveCol && cell.x > 1) { data->MoveCol(cell.x, cell.x-1); } else if (button == kJXRightButton && itsMouseAction == kMoveCol && ((JIndex) cell.x) < GetColCount()) { data->MoveCol(cell.x, cell.x+1); } else if (itsMouseAction == kRemoveCol) { data->RemoveCol(cell.x); } }
void TestFloatTable::HandleMouseDown ( const JPoint& pt, const JXMouseButton button, const JSize clickCount, const JXButtonStates& buttonStates, const JXKeyModifiers& modifiers ) { JPoint cell; if (button > kJXRightButton) { ScrollForWheel(button, modifiers); return; } else if (!GetCell(pt, &cell)) { return; } JFloatTableData* data = GetFloatData(); if (button == kJXMiddleButton) { BeginEditing(cell); } // row manipulations else if (button == kJXLeftButton && itsMouseAction == kInsertRow) { data->InsertRows(cell.y, 1); } else if (button == kJXRightButton && itsMouseAction == kInsertRow) { data->InsertRows(cell.y+1, 1); } else if (button == kJXLeftButton && itsMouseAction == kDuplicateRow) { data->DuplicateRow(cell.y, cell.y); } else if (button == kJXRightButton && itsMouseAction == kDuplicateRow) { data->DuplicateRow(cell.y, cell.y+1); } else if (button == kJXLeftButton && itsMouseAction == kMoveRow && cell.y > 1) { data->MoveRow(cell.y, cell.y-1); } else if (button == kJXRightButton && itsMouseAction == kMoveRow && ((JIndex) cell.y) < GetRowCount()) { data->MoveRow(cell.y, cell.y+1); } else if (itsMouseAction == kRemoveRow) { data->RemoveRow(cell.y); } // column manipulations else if (button == kJXLeftButton && itsMouseAction == kInsertCol) { data->InsertCols(cell.x, 1); } else if (button == kJXRightButton && itsMouseAction == kInsertCol) { data->InsertCols(cell.x+1, 1); } else if (button == kJXLeftButton && itsMouseAction == kDuplicateCol) { data->DuplicateCol(cell.x, cell.x); } else if (button == kJXRightButton && itsMouseAction == kDuplicateCol) { data->DuplicateCol(cell.x, cell.x+1); } else if (button == kJXLeftButton && itsMouseAction == kMoveCol && cell.x > 1) { data->MoveCol(cell.x, cell.x-1); } else if (button == kJXRightButton && itsMouseAction == kMoveCol && ((JIndex) cell.x) < GetColCount()) { data->MoveCol(cell.x, cell.x+1); } else if (itsMouseAction == kRemoveCol) { data->RemoveCol(cell.x); } }
void JXTabGroup::HandleMouseDown ( const JPoint& pt, const JXMouseButton button, const JSize clickCount, const JXButtonStates& buttonStates, const JXKeyModifiers& modifiers ) { itsDragAction = kInvalidClick; if (button == kJXLeftButton && itsScrollUpRect.Contains(pt)) { if (itsCanScrollUpFlag && itsFirstDrawIndex > 1) // avoid left click when arrow disabled { itsDragAction = kScrollUp; itsScrollUpPushedFlag = kJTrue; itsFirstDrawIndex--; Refresh(); ScrollWait(kInitialScrollDelay); itsScrollUpPushedFlag = kJFalse; // ignore first HandleMouseDrag() } } else if (button == kJXLeftButton && itsScrollDownRect.Contains(pt)) { if (itsCanScrollDownFlag && itsFirstDrawIndex < GetTabCount()) // avoid left click when arrow disabled { itsDragAction = kScrollDown; itsScrollDownPushedFlag = kJTrue; itsFirstDrawIndex++; Refresh(); ScrollWait(kInitialScrollDelay); itsScrollDownPushedFlag = kJFalse; // ignore first HandleMouseDrag() } } else if (button == kJXLeftButton && itsMouseIndex > 0 && itsCloseRect.Contains(pt)) { itsDragAction = kClose; itsClosePushedFlag = kJTrue; Refresh(); } else if (button == kJXLeftButton) { JIndex i; JRect r; if (FindTab(pt, &i, &r)) { ShowTab(i); } } else if (button == kJXRightButton) { CreateContextMenu(); itsContextMenu->PopUp(this, pt, buttonStates, modifiers); } else { ScrollForWheel(button, modifiers); } }
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; }