RString InputHandler::GetLocalizedInputString( const DeviceInput &di ) { switch( di.button ) { case KEY_HOME: return HOME.GetValue(); case KEY_END: return END.GetValue(); case KEY_UP: return UP.GetValue(); case KEY_DOWN: return DOWN.GetValue(); case KEY_SPACE: return SPACE.GetValue(); case KEY_LSHIFT: case KEY_RSHIFT: return SHIFT.GetValue(); case KEY_LCTRL: case KEY_RCTRL: return CTRL.GetValue(); case KEY_LALT: case KEY_RALT: return ALT.GetValue(); case KEY_INSERT: return INSERT.GetValue(); case KEY_DEL: return DEL.GetValue(); case KEY_PGUP: return PGUP.GetValue(); case KEY_PGDN: return PGDN.GetValue(); case KEY_BACKSLASH: return BACKSLASH.GetValue(); default: wchar_t c = DeviceButtonToChar( di.button, false ); if( c && c != L' ' ) // Don't show "Key " for space. return Capitalize( WStringToRString(wstring()+c) ); return DeviceButtonToString( di.button ); } }
/* Return a reversible representation of a DeviceInput. This is not affected by * InputDrivers, localization or the keyboard language. */ RString DeviceInput::ToString() const { if( device == InputDevice_Invalid ) return RString(); RString s = InputDeviceToString(device) + "_" + DeviceButtonToString(button); return s; }
CString DeviceInput::toString() { if( device == DEVICE_NONE ) return ""; CString s = InputDeviceToString(device) + "_" + DeviceButtonToString(device,button); return s; }
RString InputHandler::GetDeviceSpecificInputString( const DeviceInput &di ) { if( di.device == InputDevice_Invalid ) return RString(); if( di.device == DEVICE_KEYBOARD ) { wchar_t c = DeviceButtonToChar( di.button, false ); if( c && c != L' ' ) // Don't show "Key " for space. return InputDeviceToString( di.device ) + " " + Capitalize( WStringToRString(wstring()+c) ); } RString s = DeviceButtonToString( di.button ); if( di.device != DEVICE_KEYBOARD ) s = InputDeviceToString( di.device ) + " " + s; return s; }