本文整理汇总了C++中Panel::LookupBoundKeys方法的典型用法代码示例。如果您正苦于以下问题:C++ Panel::LookupBoundKeys方法的具体用法?C++ Panel::LookupBoundKeys怎么用?C++ Panel::LookupBoundKeys使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Panel
的用法示例。
在下文中一共展示了Panel::LookupBoundKeys方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PopulateList
void CKeyBindingHelpDialog::PopulateList()
{
m_pList->DeleteAllItems();
int i, j;
CUtlVector< ListInfo_t > maps;
vgui2::Panel *pPanel = m_hPanel;
while ( pPanel->IsKeyBindingChainToParentAllowed() )
{
PanelKeyBindingMap *map = pPanel->GetKBMap();
while ( map )
{
int k;
int c = maps.Count();
for ( k = 0; k < c; ++k )
{
if ( maps[k].m_pMap == map )
break;
}
if ( k == c )
{
int mapIndex = maps.AddToTail( );
maps[mapIndex].m_pMap = map;
maps[mapIndex].m_pPanel = pPanel;
}
map = map->baseMap;
}
pPanel = pPanel->GetParent();
if ( !pPanel )
break;
}
CUtlRBTree< KeyValues *, int > sorted( 0, 0, BindingLessFunc );
// add header item
int c = maps.Count();
for ( i = 0; i < c; ++i )
{
PanelKeyBindingMap *m = maps[ i ].m_pMap;
Panel *pMapPanel = maps[i].m_pPanel;
Assert( m );
int bindings = m->boundkeys.Count();
for ( j = 0; j < bindings; ++j )
{
BoundKey_t *kbMap = &m->boundkeys[ j ];
Assert( kbMap );
// Create a new: blank item
KeyValues *item = new KeyValues( "Item" );
// Fill in data
char loc[ 128 ];
Q_snprintf( loc, sizeof( loc ), "#%s", kbMap->bindingname );
char ansi[ 256 ];
AnsiText( loc, ansi, sizeof( ansi ) );
item->SetString( "Action", ansi );
item->SetWString( "Binding", Panel::KeyCodeModifiersToDisplayString( (KeyCode)kbMap->keycode, kbMap->modifiers ) );
// Find the binding
KeyBindingMap_t *bindingMap = pMapPanel->LookupBinding( kbMap->bindingname );
if ( bindingMap &&
bindingMap->helpstring )
{
AnsiText( bindingMap->helpstring, ansi, sizeof( ansi ) );
item->SetString( "Description", ansi );
}
item->SetPtr( "Item", kbMap );
sorted.Insert( item );
}
// Now try and find any "unbound" keys...
int mappings = m->entries.Count();
for ( j = 0; j < mappings; ++j )
{
KeyBindingMap_t *kbMap = &m->entries[ j ];
// See if it's bound
CUtlVector< BoundKey_t * > list;
pMapPanel->LookupBoundKeys( kbMap->bindingname, list );
if ( list.Count() > 0 )
continue;
// Not bound, add a placeholder entry
// Create a new: blank item
KeyValues *item = new KeyValues( "Item" );
// fill in data
char loc[ 128 ];
Q_snprintf( loc, sizeof( loc ), "#%s", kbMap->bindingname );
char ansi[ 256 ];
AnsiText( loc, ansi, sizeof( ansi ) );
//.........这里部分代码省略.........