/********************************************************************* * * _AddKey * * Returns: 1 if Key has been consumed * 0 else */ static int _AddKey(LISTBOX_Handle hObj, int Key) { LISTBOX_Obj* pObj; pObj = LISTBOX_H2P(hObj); switch (Key) { case ' ': _ToggleMultiSel(hObj, pObj, pObj->Sel); return 1; /* Key has been consumed */ case GUI_KEY_RIGHT: if (WM_SetScrollValue(&pObj->ScrollStateH, pObj->ScrollStateH.v + pObj->Props.ScrollStepH)) { LISTBOX_UpdateScrollers(hObj); LISTBOX__InvalidateInsideArea(hObj); } return 1; /* Key has been consumed */ case GUI_KEY_LEFT: if (WM_SetScrollValue(&pObj->ScrollStateH, pObj->ScrollStateH.v - pObj->Props.ScrollStepH)) { LISTBOX_UpdateScrollers(hObj); LISTBOX__InvalidateInsideArea(hObj); } return 1; /* Key has been consumed */ case GUI_KEY_DOWN: LISTBOX_IncSel(hObj); return 1; /* Key has been consumed */ case GUI_KEY_UP: LISTBOX_DecSel(hObj); return 1; /* Key has been consumed */ default: if(_IsAlphaNum(Key)) { _SelectByKey(hObj, Key); return 1; /* Key has been consumed */ } } return 0; }
/********************************************************************* * * _AddKey * * Returns: 1 if Key has been consumed * 0 else */ static int _AddKey(LISTVIEW_Handle hObj, LISTVIEW_Obj* pObj, int Key) { switch (Key) { case GUI_KEY_DOWN: LISTVIEW__MoveSel(hObj, pObj, 1); return 1; /* Key has been consumed */ case GUI_KEY_PGDOWN: _OnPage(hObj, pObj, 1); return 1; /* Key has been consumed */ case GUI_KEY_UP: LISTVIEW__MoveSel(hObj, pObj, -1); return 1; /* Key has been consumed */ case GUI_KEY_PGUP: _OnPage(hObj, pObj, -1); return 1; /* Key has been consumed */ case GUI_KEY_HOME: LISTVIEW__SetSel(hObj, pObj, 0); return 1; /* Key has been consumed */ case GUI_KEY_END: LISTVIEW__SetSel(hObj, pObj, LISTVIEW__GetNumRows(pObj) - 1); return 1; /* Key has been consumed */ case GUI_KEY_RIGHT: if (WM_SetScrollValue(&pObj->ScrollStateH, pObj->ScrollStateH.v + pObj->Props.ScrollStepH)) { LISTVIEW__UpdateScrollPos(hObj, pObj); LISTVIEW__InvalidateInsideArea(hObj, pObj); } return 1; /* Key has been consumed */ case GUI_KEY_LEFT: if (WM_SetScrollValue(&pObj->ScrollStateH, pObj->ScrollStateH.v - pObj->Props.ScrollStepH)) { LISTVIEW__UpdateScrollPos(hObj, pObj); LISTVIEW__InvalidateInsideArea(hObj, pObj); } return 1; /* Key has been consumed */ } return 0; /* Key has NOT been consumed */ }