2015-05-23 22:55:12 -06:00
|
|
|
// Copyright 2010 Dolphin Emulator Project
|
2015-05-17 17:08:10 -06:00
|
|
|
// Licensed under GPLv2+
|
2013-04-17 21:43:35 -06:00
|
|
|
// Refer to the license.txt file included.
|
2010-06-03 12:05:08 -06:00
|
|
|
|
2014-02-22 15:36:30 -07:00
|
|
|
#include <wx/chartype.h>
|
|
|
|
#include <wx/defs.h>
|
|
|
|
#include <wx/string.h>
|
|
|
|
#include <wx/translation.h>
|
|
|
|
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "DolphinWX/WXInputBase.h"
|
2010-06-03 12:05:08 -06:00
|
|
|
|
2014-10-05 03:31:45 -06:00
|
|
|
namespace WxUtils
|
2010-06-03 12:05:08 -06:00
|
|
|
{
|
|
|
|
|
2010-06-05 13:03:37 -06:00
|
|
|
const wxString WXKeyToString(int keycode)
|
2010-06-03 12:05:08 -06:00
|
|
|
{
|
|
|
|
switch (keycode)
|
|
|
|
{
|
2014-02-16 21:51:41 -07:00
|
|
|
case WXK_BACK: return _("Back");
|
|
|
|
case WXK_TAB: return _("Tab");
|
|
|
|
case WXK_RETURN: return _("Return");
|
|
|
|
case WXK_ESCAPE: return _("Escape");
|
|
|
|
case WXK_SPACE: return _("Space");
|
|
|
|
case WXK_DELETE: return _("Delete");
|
2010-06-05 13:03:37 -06:00
|
|
|
|
2010-06-09 14:03:37 -06:00
|
|
|
// Undocumented wx keycodes
|
2014-02-16 21:51:41 -07:00
|
|
|
case 167: return _("Paragraph");
|
|
|
|
case 177: return _("Plus-Minus");
|
2010-06-09 14:03:37 -06:00
|
|
|
|
2014-02-16 21:51:41 -07:00
|
|
|
case WXK_START: return _("Start");
|
|
|
|
case WXK_LBUTTON: return _("L Button");
|
|
|
|
case WXK_RBUTTON: return _("R Button");
|
|
|
|
case WXK_CANCEL: return _("Cancel");
|
|
|
|
case WXK_MBUTTON: return _("M Button");
|
|
|
|
case WXK_CLEAR: return _("Clear");
|
2014-05-17 11:17:28 -06:00
|
|
|
case WXK_SHIFT: return "Shift";
|
|
|
|
case WXK_ALT: return "Alt";
|
2014-02-16 21:51:41 -07:00
|
|
|
case WXK_RAW_CONTROL: return _("Control");
|
2012-03-18 03:31:19 -06:00
|
|
|
#ifdef __WXOSX__
|
2014-02-16 21:51:41 -07:00
|
|
|
case WXK_COMMAND: return _("Command");
|
2012-03-18 03:31:19 -06:00
|
|
|
#endif
|
2014-02-16 21:51:41 -07:00
|
|
|
case WXK_MENU: return _("Menu");
|
|
|
|
case WXK_PAUSE: return _("Pause");
|
|
|
|
case WXK_CAPITAL: return _("Caps Lock");
|
|
|
|
case WXK_END: return _("End");
|
|
|
|
case WXK_HOME: return _("Home");
|
|
|
|
case WXK_LEFT: return _("Left");
|
|
|
|
case WXK_UP: return _("Up");
|
|
|
|
case WXK_RIGHT: return _("Right");
|
|
|
|
case WXK_DOWN: return _("Down");
|
|
|
|
case WXK_SELECT: return _("Select");
|
|
|
|
case WXK_PRINT: return _("Print");
|
|
|
|
case WXK_EXECUTE: return _("Execute");
|
|
|
|
case WXK_SNAPSHOT: return _("Snapshot");
|
|
|
|
case WXK_INSERT: return _("Insert");
|
|
|
|
case WXK_HELP: return _("Help");
|
2014-05-17 11:17:28 -06:00
|
|
|
case WXK_NUMPAD0: return "NP 0";
|
|
|
|
case WXK_NUMPAD1: return "NP 1";
|
|
|
|
case WXK_NUMPAD2: return "NP 2";
|
|
|
|
case WXK_NUMPAD3: return "NP 3";
|
|
|
|
case WXK_NUMPAD4: return "NP 4";
|
|
|
|
case WXK_NUMPAD5: return "NP 5";
|
|
|
|
case WXK_NUMPAD6: return "NP 6";
|
|
|
|
case WXK_NUMPAD7: return "NP 7";
|
|
|
|
case WXK_NUMPAD8: return "NP 8";
|
|
|
|
case WXK_NUMPAD9: return "NP 9";
|
2014-02-16 21:51:41 -07:00
|
|
|
case WXK_MULTIPLY: return _("Multiply");
|
|
|
|
case WXK_ADD: return _("Add");
|
|
|
|
case WXK_SEPARATOR: return _("Separator");
|
|
|
|
case WXK_SUBTRACT: return _("Subtract");
|
|
|
|
case WXK_DECIMAL: return _("Decimal");
|
|
|
|
case WXK_DIVIDE: return _("Divide");
|
2014-05-17 11:17:28 -06:00
|
|
|
case WXK_F1: return "F1";
|
|
|
|
case WXK_F2: return "F2";
|
|
|
|
case WXK_F3: return "F3";
|
|
|
|
case WXK_F4: return "F4";
|
|
|
|
case WXK_F5: return "F5";
|
|
|
|
case WXK_F6: return "F6";
|
|
|
|
case WXK_F7: return "F7";
|
|
|
|
case WXK_F8: return "F8";
|
|
|
|
case WXK_F9: return "F9";
|
|
|
|
case WXK_F10: return "F10";
|
|
|
|
case WXK_F11: return "F11";
|
|
|
|
case WXK_F12: return "F12";
|
|
|
|
case WXK_F13: return "F13";
|
|
|
|
case WXK_F14: return "F14";
|
|
|
|
case WXK_F15: return "F15";
|
|
|
|
case WXK_F16: return "F16";
|
|
|
|
case WXK_F17: return "F17";
|
|
|
|
case WXK_F18: return "F19";
|
|
|
|
case WXK_F19: return "F20";
|
|
|
|
case WXK_F20: return "F21";
|
|
|
|
case WXK_F21: return "F22";
|
|
|
|
case WXK_F22: return "F23";
|
|
|
|
case WXK_F23: return "F24";
|
|
|
|
case WXK_F24: return "F25";
|
2014-02-16 21:51:41 -07:00
|
|
|
case WXK_NUMLOCK: return _("Num Lock");
|
|
|
|
case WXK_SCROLL: return _("Scroll Lock");
|
|
|
|
case WXK_PAGEUP: return _("Page Up");
|
|
|
|
case WXK_PAGEDOWN: return _("Page Down");
|
|
|
|
case WXK_NUMPAD_SPACE: return _("NP Space");
|
|
|
|
case WXK_NUMPAD_TAB: return _("NP Tab");
|
|
|
|
case WXK_NUMPAD_ENTER: return _("NP Enter");
|
2014-05-17 11:17:28 -06:00
|
|
|
case WXK_NUMPAD_F1: return "NP F1";
|
|
|
|
case WXK_NUMPAD_F2: return "NP F2";
|
|
|
|
case WXK_NUMPAD_F3: return "NP F3";
|
|
|
|
case WXK_NUMPAD_F4: return "NP F4";
|
2014-02-16 21:51:41 -07:00
|
|
|
case WXK_NUMPAD_HOME: return _("NP Home");
|
|
|
|
case WXK_NUMPAD_LEFT: return _("NP Left");
|
|
|
|
case WXK_NUMPAD_UP: return _("NP Up");
|
|
|
|
case WXK_NUMPAD_RIGHT: return _("NP Right");
|
|
|
|
case WXK_NUMPAD_DOWN: return _("NP Down");
|
|
|
|
case WXK_NUMPAD_PAGEUP: return _("NP Page Up");
|
|
|
|
case WXK_NUMPAD_PAGEDOWN: return _("NP Page Down");
|
|
|
|
case WXK_NUMPAD_END: return _("NP End");
|
|
|
|
case WXK_NUMPAD_BEGIN: return _("NP Begin");
|
|
|
|
case WXK_NUMPAD_INSERT: return _("NP Insert");
|
|
|
|
case WXK_NUMPAD_DELETE: return _("NP Delete");
|
|
|
|
case WXK_NUMPAD_EQUAL: return _("NP Equal");
|
|
|
|
case WXK_NUMPAD_MULTIPLY: return _("NP Multiply");
|
|
|
|
case WXK_NUMPAD_ADD: return _("NP Add");
|
|
|
|
case WXK_NUMPAD_SEPARATOR: return _("NP Separator");
|
|
|
|
case WXK_NUMPAD_SUBTRACT: return _("NP Subtract");
|
|
|
|
case WXK_NUMPAD_DECIMAL: return _("NP Decimal");
|
|
|
|
case WXK_NUMPAD_DIVIDE: return _("NP Divide");
|
|
|
|
case WXK_WINDOWS_LEFT: return _("Windows Left");
|
|
|
|
case WXK_WINDOWS_RIGHT: return _("Windows Right");
|
|
|
|
case WXK_WINDOWS_MENU: return _("Windows Menu");
|
2010-06-05 13:03:37 -06:00
|
|
|
}
|
|
|
|
|
2014-02-16 21:51:41 -07:00
|
|
|
if (keycode > WXK_SPACE && keycode < WXK_DELETE)
|
|
|
|
{
|
2010-06-05 13:03:37 -06:00
|
|
|
return wxString((wxChar)keycode, 1);
|
2010-06-03 12:05:08 -06:00
|
|
|
}
|
2010-06-05 13:03:37 -06:00
|
|
|
|
2014-05-17 11:17:28 -06:00
|
|
|
return "";
|
2010-06-03 12:05:08 -06:00
|
|
|
}
|
|
|
|
|
2010-06-05 13:03:37 -06:00
|
|
|
const wxString WXKeymodToString(int modifier)
|
2010-06-03 12:05:08 -06:00
|
|
|
{
|
2011-01-30 07:20:20 -07:00
|
|
|
wxString mods;
|
|
|
|
|
|
|
|
if (modifier & wxMOD_META)
|
|
|
|
#ifdef __APPLE__
|
2014-05-17 11:17:28 -06:00
|
|
|
mods += "Cmd+";
|
2011-01-30 07:20:20 -07:00
|
|
|
#elif defined _WIN32
|
2014-05-17 11:17:28 -06:00
|
|
|
mods += "Win+";
|
2011-01-30 07:20:20 -07:00
|
|
|
#else
|
2014-05-17 11:17:28 -06:00
|
|
|
mods += "Meta+";
|
2011-01-30 07:20:20 -07:00
|
|
|
#endif
|
|
|
|
if (modifier & wxMOD_CONTROL)
|
2014-05-17 11:17:28 -06:00
|
|
|
mods += "Ctrl+";
|
2011-01-30 07:20:20 -07:00
|
|
|
if (modifier & wxMOD_ALT)
|
2014-05-17 11:17:28 -06:00
|
|
|
mods += "Alt+";
|
2011-01-30 07:20:20 -07:00
|
|
|
if (modifier & wxMOD_SHIFT)
|
2014-05-17 11:17:28 -06:00
|
|
|
mods += "Shift+";
|
2011-01-30 07:20:20 -07:00
|
|
|
|
|
|
|
return mods;
|
2010-06-03 12:05:08 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|