本文整理汇总了C++中CKeySet::GetKeyByCode方法的典型用法代码示例。如果您正苦于以下问题:C++ CKeySet::GetKeyByCode方法的具体用法?C++ CKeySet::GetKeyByCode怎么用?C++ CKeySet::GetKeyByCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CKeySet
的用法示例。
在下文中一共展示了CKeySet::GetKeyByCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindKeySetById
//------------------------------------------------------------------------------
// Unassign code from any key definition existing in the set
// NOTE: The key is unassigned from the current set only
//------------------------------------------------------------------------------
CKeyDefinition *CKeyMap::UnAssign(int cde,CKeyDefinition *kdf)
{ CKeySet *set = FindKeySetById(kdf->GetSet());
CKeyDefinition *kpv = set->GetKeyByCode(cde);
if (0 == kpv) return 0;
kdf->SetCode(0); // remove code from actual
kpv->SetCode(0); // remove code from previous
set->ClearCode(cde);
return kpv;
}
示例2: FindKeyDefinitionByCode
//------------------------------------------------------------------------------
// Locate a key definition by keyboard code only
//------------------------------------------------------------------------------
CKeyDefinition* CKeyMap::FindKeyDefinitionByCode (int iCode, Tag &setTagOut)
{ setTagOut = 0;
std::map<Tag,CKeySet*>::iterator i;
for (i=kset.begin(); i!=kset.end(); i++)
{ CKeySet *set = i->second;
CKeyDefinition *kdf = set->GetKeyByCode(iCode);
if (0 == kdf) continue;
setTagOut = set->GetTag();
return kdf;
}
return 0;
}
示例3: KeyPress
//------------------------------------------------------------------------------
// Keyboard Key pressed
//------------------------------------------------------------------------------
void CKeyMap::KeyPress (U_INT key, EKeyboardModifiers mod)
{ // Translate key and modifier into keycode
int code = (mod << 16) + key;
bool handled = false;
//--- special detection mode ------------------------------
if(m_bKeyDetect && m_fKeyCallback)
{
/// \todo unbind if this key code is already asigned
if (m_fKeyCallback(m_winID, code)) return;
}
//---Standard key -----------------------------------------
for (U_INT k=0; (k<oset.size()); k++)
{ CKeySet *ks = oset[k];
CKeyDefinition *kdf = ks->GetKeyByCode(code);
if (0 == kdf) continue;
//---Call the redirected group key callback -----------
Tag ngp = kdf->GetSet();
ks = FindKeySetById (ngp);
KeyGroupCB cb = ks->GetCB();
handled = (cb)(kdf,code);
if (handled) return;
}
return;
}