| 582 | } |
| 583 | |
| 584 | void UIAbstractTableView::bindNavigationClick( UIWidget* widget ) { |
| 585 | mWidgetsClickCbId[widget].push_back( |
| 586 | widget->on( Event::MouseDoubleClick, [this]( const Event* event ) { |
| 587 | auto mouseEvent = static_cast<const MouseEvent*>( event ); |
| 588 | auto cellIdx = mouseEvent->getNode()->asType<UITableCell>()->getCurIndex(); |
| 589 | auto idx = mouseEvent->getNode()->getParent()->asType<UITableRow>()->getCurIndex(); |
| 590 | if ( isEditable() && ( mEditTriggers & EditTrigger::DoubleClicked ) && getModel() && |
| 591 | getModel()->isEditable( cellIdx ) ) { |
| 592 | beginEditing( cellIdx, mouseEvent->getNode()->asType<UIWidget>() ); |
| 593 | } else if ( ( mouseEvent->getFlags() & EE_BUTTON_LMASK ) && !mSingleClickNavigation ) { |
| 594 | onOpenModelIndex( idx, event ); |
| 595 | } |
| 596 | } ) ); |
| 597 | |
| 598 | mWidgetsClickCbId[widget].push_back( |
| 599 | widget->on( Event::MouseClick, [this]( const Event* event ) { |
| 600 | auto mouseEvent = static_cast<const MouseEvent*>( event ); |
| 601 | auto idx = mouseEvent->getNode()->getParent()->asType<UITableRow>()->getCurIndex(); |
| 602 | if ( mouseEvent->getFlags() & EE_BUTTON_RMASK ) { |
| 603 | onOpenMenuModelIndex( idx, event ); |
| 604 | } else if ( ( mouseEvent->getFlags() & EE_BUTTON_LMASK ) && mSingleClickNavigation ) { |
| 605 | onOpenModelIndex( idx, event ); |
| 606 | } else if ( isCellSelection() && ( mouseEvent->getFlags() & EE_BUTTON_LMASK ) ) { |
| 607 | auto cellIdx = mouseEvent->getNode()->asType<UITableCell>()->getCurIndex(); |
| 608 | if ( getInput()->isControlPressed() ) { |
| 609 | getSelection().remove( cellIdx ); |
| 610 | } else { |
| 611 | getSelection().set( cellIdx ); |
| 612 | } |
| 613 | } |
| 614 | } ) ); |
| 615 | } |
| 616 | |
| 617 | UIWidget* UIAbstractTableView::createCell( UIWidget* rowWidget, const ModelIndex& index ) { |
| 618 | UITableCell* widget = UITableCell::New( mTag + "::cell" ); |
nothing calls this directly
no test coverage detected