MCPcopy Create free account
hub / github.com/SOUI2/soui / OnKeyDown

Method OnKeyDown

SOUI/src/control/SListView.cpp:586–653  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

584 }
585
586 void SListView::OnKeyDown( TCHAR nChar, UINT nRepCnt, UINT nFlags )
587 {
588 if(!m_adapter)
589 {
590 SetMsgHandled(FALSE);
591 return;
592 }
593
594 if(m_iSelItem!=-1 && m_bWantTab)
595 {
596 SItemPanel *pItem = GetItemPanel(m_iSelItem);
597 if(pItem)
598 {
599 pItem->DoFrameEvent(WM_KEYDOWN,nChar, MAKELONG(nFlags, nRepCnt));
600 if(pItem->IsMsgHandled()) return;
601 }
602 }
603
604 int nNewSelItem = -1;
605 SWindow *pOwner = GetOwner();
606 if (pOwner && (nChar == VK_ESCAPE || nChar == VK_RETURN))
607 {
608 pOwner->SSendMessage(WM_KEYDOWN, nChar, MAKELONG(nFlags, nRepCnt));
609 return;
610 }
611
612 if (nChar == VK_DOWN && m_iSelItem < m_adapter->getCount() - 1)
613 nNewSelItem = m_iSelItem+1;
614 else if (nChar == VK_UP && m_iSelItem > 0)
615 nNewSelItem = m_iSelItem-1;
616 else
617 {
618 switch(nChar)
619 {
620 case VK_PRIOR:
621 OnScroll(TRUE,SB_PAGEUP,0);
622 break;
623 case VK_NEXT:
624 OnScroll(TRUE,SB_PAGEDOWN,0);
625 break;
626 case VK_HOME:
627 OnScroll(TRUE,SB_TOP,0);
628 break;
629 case VK_END:
630 OnScroll(TRUE,SB_BOTTOM,0);
631 break;
632 }
633 if(nChar == VK_PRIOR || nChar == VK_HOME)
634 {
635 if(!m_lstItems.IsEmpty())
636 {
637 nNewSelItem = (int)m_lstItems.GetHead().pItem->GetItemIndex();
638 }
639 }else if(nChar == VK_NEXT || nChar == VK_END)
640 {
641 if(!m_lstItems.IsEmpty())
642 {
643 nNewSelItem = (int)m_lstItems.GetTail().pItem->GetItemIndex();

Callers

nothing calls this directly

Calls 7

GetOwnerFunction · 0.85
SSendMessageMethod · 0.80
GetHeadMethod · 0.80
SetMsgHandledFunction · 0.50
DoFrameEventMethod · 0.45
getCountMethod · 0.45
IsEmptyMethod · 0.45

Tested by

no test coverage detected