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

Method onKeyDown

src/eepp/ui/uimenu.cpp:510–554  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

508}
509
510Uint32 UIMenu::onKeyDown( const KeyEvent& event ) {
511 switch ( event.getKeyCode() ) {
512 case KEY_DOWN:
513 nextSel();
514 break;
515 case KEY_UP:
516 prevSel();
517 break;
518 case KEY_RIGHT:
519 if ( nullptr != mItemSelected && mItemSelected->isType( UI_TYPE_MENUSUBMENU ) )
520 mItemSelected->asType<UIMenuSubMenu>()->showSubMenu();
521 else if ( getOwnerNode() && getOwnerNode()->getParent() &&
522 getOwnerNode()->getParent()->isType( UI_TYPE_MENUBAR ) )
523 getOwnerNode()->getParent()->asType<UIMenuBar>()->showNextMenu();
524 break;
525 case KEY_LEFT:
526 if ( getOwnerNode() && getOwnerNode()->getParent() &&
527 getOwnerNode()->getParent()->isType( UI_TYPE_MENUBAR ) )
528 getOwnerNode()->getParent()->asType<UIMenuBar>()->showPrevMenu();
529 else if ( getOwnerNode() && getOwnerNode()->getParent() &&
530 getOwnerNode()->getParent()->isType( UI_TYPE_MENU ) )
531 hide();
532 break;
533 case KEY_ESCAPE:
534 hide();
535 break;
536 case KEY_KP_ENTER:
537 case KEY_RETURN:
538 if ( nullptr != mItemSelected && nullptr != getEventDispatcher() ) {
539 mItemSelected->sendMouseEvent(
540 Event::MouseClick, getEventDispatcher()->getMousePos(), EE_BUTTON_LMASK );
541 if ( mItemSelected ) {
542 NodeMessage msg( mItemSelected, NodeMessage::MouseUp, EE_BUTTON_LMASK );
543 mItemSelected->messagePost( &msg );
544 }
545 if ( mItemSelected ) {
546 mItemSelected->forceKeyDown( event );
547 }
548 }
549 break;
550 default:
551 break;
552 }
553 return UIWidget::onKeyDown( event );
554}
555
556static Drawable* getIconDrawable( const std::string& name, UIIconThemeManager* iconThemeManager ) {
557 Drawable* iconDrawable = nullptr;

Callers

nothing calls this directly

Calls 10

onKeyDownFunction · 0.85
showSubMenuMethod · 0.80
showNextMenuMethod · 0.80
showPrevMenuMethod · 0.80
sendMouseEventMethod · 0.80
messagePostMethod · 0.80
forceKeyDownMethod · 0.80
isTypeMethod · 0.45
getParentMethod · 0.45
getMousePosMethod · 0.45

Tested by

no test coverage detected