本文整理汇总了C++中idEditField::KeyDownEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ idEditField::KeyDownEvent方法的具体用法?C++ idEditField::KeyDownEvent怎么用?C++ idEditField::KeyDownEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idEditField
的用法示例。
在下文中一共展示了idEditField::KeyDownEvent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Posix_ConsoleInput
//.........这里部分代码省略.........
assert( hidden );
tty_Show();
return NULL;
}
switch( key )
{
case 49:
{
ret = read( STDIN_FILENO, &key, 1 );
if( ret <= 0 || key != 126 )
{
Sys_Printf( "dropping sequence: '27' '91' '49' '%d' ", key );
tty_FlushIn();
assert( hidden );
tty_Show();
return NULL;
}
// only screen and linux terms
input_field.SetCursor( 0 );
break;
}
case 50:
{
ret = read( STDIN_FILENO, &key, 1 );
if( ret <= 0 || key != 126 )
{
Sys_Printf( "dropping sequence: '27' '91' '50' '%d' ", key );
tty_FlushIn();
assert( hidden );
tty_Show();
return NULL;
}
// all terms
input_field.KeyDownEvent( K_INS );
break;
}
case 52:
{
ret = read( STDIN_FILENO, &key, 1 );
if( ret <= 0 || key != 126 )
{
Sys_Printf( "dropping sequence: '27' '91' '52' '%d' ", key );
tty_FlushIn();
assert( hidden );
tty_Show();
return NULL;
}
// only screen and linux terms
input_field.SetCursor( strlen( input_field.GetBuffer() ) );
break;
}
case 51:
{
ret = read( STDIN_FILENO, &key, 1 );
if( ret <= 0 )
{
Sys_Printf( "dropping sequence: '27' '91' '51' " );
tty_FlushIn();
assert( hidden );
tty_Show();
return NULL;
}
if( key == 126 )
{
input_field.KeyDownEvent( K_DEL );
break;
示例2: KeyDownEvent
/*
====================
KeyDownEvent
Handles history and console scrollback
====================
*/
void idConsoleLocal::KeyDownEvent( int key )
{
// Execute F key bindings
if( key >= K_F1 && key <= K_F12 )
{
idKeyInput::ExecKeyBinding( key );
return;
}
// ctrl-L clears screen
if( key == K_L && ( idKeyInput::IsDown( K_LCTRL ) || idKeyInput::IsDown( K_RCTRL ) ) )
{
Clear();
return;
}
// enter finishes the line
if( key == K_ENTER || key == K_KP_ENTER )
{
common->Printf( "]%s\n", consoleField.GetBuffer() );
cmdSystem->BufferCommandText( CMD_EXEC_APPEND, consoleField.GetBuffer() ); // valid command
cmdSystem->BufferCommandText( CMD_EXEC_APPEND, "\n" );
// copy line to history buffer
if( consoleField.GetBuffer()[ 0 ] != '\n' && consoleField.GetBuffer()[ 0 ] != '\0' )
{
consoleHistory.AddToHistory( consoleField.GetBuffer() );
}
consoleField.Clear();
consoleField.SetWidthInChars( LINE_WIDTH );
const bool captureToImage = false;
common->UpdateScreen( captureToImage );// force an update, because the command
// may take some time
return;
}
// command completion
if( key == K_TAB )
{
consoleField.AutoComplete();
return;
}
// command history (ctrl-p ctrl-n for unix style)
if( ( key == K_UPARROW ) ||
( key == K_P && ( idKeyInput::IsDown( K_LCTRL ) || idKeyInput::IsDown( K_RCTRL ) ) ) )
{
idStr hist = consoleHistory.RetrieveFromHistory( true );
if( !hist.IsEmpty() )
{
consoleField.SetBuffer( hist );
}
return;
}
if( ( key == K_DOWNARROW ) ||
( key == K_N && ( idKeyInput::IsDown( K_LCTRL ) || idKeyInput::IsDown( K_RCTRL ) ) ) )
{
idStr hist = consoleHistory.RetrieveFromHistory( false );
if( !hist.IsEmpty() )
{
consoleField.SetBuffer( hist );
}
else // DG: if no more lines are in the history, show a blank line again
{
consoleField.Clear();
} // DG end
return;
}
// console scrolling
if( key == K_PGUP )
{
PageUp();
lastKeyEvent = eventLoop->Milliseconds();
nextKeyEvent = CONSOLE_FIRSTREPEAT;
return;
}
if( key == K_PGDN )
{
PageDown();
lastKeyEvent = eventLoop->Milliseconds();
nextKeyEvent = CONSOLE_FIRSTREPEAT;
//.........这里部分代码省略.........