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

Method OnKeyDown

SOUI/src/control/SMCListView.cpp:875–944  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

873}
874
875void SMCListView::OnKeyDown( TCHAR nChar, UINT nRepCnt, UINT nFlags )
876{
877 if(!m_adapter)
878 {
879 SetMsgHandled(FALSE);
880 return;
881 }
882
883 if(m_iSelItem!=-1 && m_bWantTab)
884 {
885 SItemPanel *pItem = GetItemPanel(m_iSelItem);
886 if(pItem)
887 {
888 pItem->DoFrameEvent(WM_KEYDOWN,nChar, MAKELONG(nFlags, nRepCnt));
889 if(pItem->IsMsgHandled()) return;
890 }
891 }
892
893 int nNewSelItem = -1;
894 SWindow *pOwner = GetOwner();
895 if (pOwner && (nChar == VK_ESCAPE || nChar == VK_RETURN))
896 {
897 pOwner->SSendMessage(WM_KEYDOWN, nChar, MAKELONG(nFlags, nRepCnt));
898 return;
899 }
900
901 if (nChar == VK_DOWN && m_iSelItem < m_adapter->getCount() - 1)
902 nNewSelItem = m_iSelItem+1;
903 else if (nChar == VK_UP && m_iSelItem > 0)
904 nNewSelItem = m_iSelItem-1;
905 else
906 {
907 switch(nChar)
908 {
909 case VK_PRIOR:
910 OnScroll(TRUE,SB_PAGEUP,0);
911 break;
912 case VK_NEXT:
913 OnScroll(TRUE,SB_PAGEDOWN,0);
914 break;
915 case VK_HOME:
916 OnScroll(TRUE,SB_TOP,0);
917 break;
918 case VK_END:
919 OnScroll(TRUE,SB_BOTTOM,0);
920 break;
921 }
922
923 if(nChar == VK_PRIOR || nChar == VK_HOME)
924 {
925 if(!m_lstItems.IsEmpty())
926 {
927 nNewSelItem = (int)m_lstItems.GetHead().pItem->GetItemIndex();
928 }
929 }else if(nChar == VK_NEXT || nChar == VK_END)
930 {
931 if(!m_lstItems.IsEmpty())
932 {

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