MCPcopy Create free account
hub / github.com/SpartanJ/eepp / bindNavigationClick

Method bindNavigationClick

src/eepp/ui/abstract/uiabstracttableview.cpp:584–615  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

582}
583
584void 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
617UIWidget* UIAbstractTableView::createCell( UIWidget* rowWidget, const ModelIndex& index ) {
618 UITableCell* widget = UITableCell::New( mTag + "::cell" );

Callers

nothing calls this directly

Calls 12

isEditableFunction · 0.85
getModelFunction · 0.85
getSelectionFunction · 0.85
push_backMethod · 0.80
getNodeMethod · 0.80
getFlagsMethod · 0.80
isControlPressedMethod · 0.80
onMethod · 0.45
getParentMethod · 0.45
isEditableMethod · 0.45
removeMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected