blob: 2ee99809a66c501306e2676d2f0360c928bc55c7 [file] [log] [blame]
/*
* Copyright 2015 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef COBALT_DOM_KEYCODE_H_
#define COBALT_DOM_KEYCODE_H_
namespace cobalt {
namespace dom {
namespace keycode {
// A standard set of key codes is needed to represent each possible input key,
// so for the sake of compatibility, we have to choose to adopt Chrome's
// implementation for the non-standardized platform-dependent
// KeyboardEvent.keyCode WebAPI, which happens to be the Windows virtual key
// codes.
// Windows virtual key codes doc:
// https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731%28v=vs.85%29.aspx
// Order by the value.
enum {
kUnknown = 0,
kCancel = 0x03,
kBack = 0x08,
kTab = 0x09,
kBacktab = 0x0A,
kClear = 0x0C,
kReturn = 0x0D, // Return/Enter key
kShift = 0x10,
kControl = 0x11,
kMenu = 0x12,
kPause = 0x13,
kCapital = 0x14,
kKana = 0x15,
kHangul = 0x15,
kJunja = 0x17,
kFinal = 0x18,
kHanja = 0x19,
kKanji = 0x19,
kEscape = 0x1B,
kConvert = 0x1C,
kNonconvert = 0x1D,
kAccept = 0x1E,
kModechange = 0x1F,
kSpace = 0x20,
kPrior = 0x21,
kNext = 0x22,
kEnd = 0x23,
kHome = 0x24,
kLeft = 0x25,
kUp = 0x26,
kRight = 0x27,
kDown = 0x28,
kSelect = 0x29,
kPrint = 0x2A,
kExecute = 0x2B,
kSnapshot = 0x2C,
kInsert = 0x2D,
kDelete = 0x2E,
kHelp = 0x2F,
k0 = 0x30,
k1 = 0x31,
k2 = 0x32,
k3 = 0x33,
k4 = 0x34,
k5 = 0x35,
k6 = 0x36,
k7 = 0x37,
k8 = 0x38,
k9 = 0x39,
kA = 0x41,
kB = 0x42,
kC = 0x43,
kD = 0x44,
kE = 0x45,
kF = 0x46,
kG = 0x47,
kH = 0x48,
kI = 0x49,
kJ = 0x4A,
kK = 0x4B,
kL = 0x4C,
kM = 0x4D,
kN = 0x4E,
kO = 0x4F,
kP = 0x50,
kQ = 0x51,
kR = 0x52,
kS = 0x53,
kT = 0x54,
kU = 0x55,
kV = 0x56,
kW = 0x57,
kX = 0x58,
kY = 0x59,
kZ = 0x5A,
kLwin = 0x5B,
kCommand = kLwin, // Provide the Mac name for convenience.
kRwin = 0x5C,
kApps = 0x5D,
kSleep = 0x5F,
kNumpad0 = 0x60,
kNumpad1 = 0x61,
kNumpad2 = 0x62,
kNumpad3 = 0x63,
kNumpad4 = 0x64,
kNumpad5 = 0x65,
kNumpad6 = 0x66,
kNumpad7 = 0x67,
kNumpad8 = 0x68,
kNumpad9 = 0x69,
kMultiply = 0x6A,
kAdd = 0x6B,
kSeparator = 0x6C,
kSubtract = 0x6D,
kDecimal = 0x6E,
kDivide = 0x6F,
kF1 = 0x70,
kF2 = 0x71,
kF3 = 0x72,
kF4 = 0x73,
kF5 = 0x74,
kF6 = 0x75,
kF7 = 0x76,
kF8 = 0x77,
kF9 = 0x78,
kF10 = 0x79,
kF11 = 0x7A,
kF12 = 0x7B,
kF13 = 0x7C,
kF14 = 0x7D,
kF15 = 0x7E,
kF16 = 0x7F,
kF17 = 0x80,
kF18 = 0x81,
kF19 = 0x82,
kF20 = 0x83,
kF21 = 0x84,
kF22 = 0x85,
kF23 = 0x86,
kF24 = 0x87,
kNumlock = 0x90,
kScroll = 0x91,
kWlan = 0x97,
kPower = 0x98,
kLshift = 0xA0,
kRshift = 0xA1,
kLcontrol = 0xA2,
kRcontrol = 0xA3,
kLmenu = 0xA4,
kRmenu = 0xA5,
kBrowserBack = 0xA6,
kBrowserForward = 0xA7,
kBrowserRefresh = 0xA8,
kBrowserStop = 0xA9,
kBrowserSearch = 0xAA,
kBrowserFavorites = 0xAB,
kBrowserHome = 0xAC,
kVolumeMute = 0xAD,
kVolumeDown = 0xAE,
kVolumeUp = 0xAF,
kMediaNextTrack = 0xB0,
kMediaPrevTrack = 0xB1,
kMediaStop = 0xB2,
kMediaPlayPause = 0xB3,
kMediaLaunchMail = 0xB4,
kMediaLaunchMediaSelect = 0xB5,
kMediaLaunchApp1 = 0xB6,
kMediaLaunchApp2 = 0xB7,
kOem1 = 0xBA,
kOemPlus = 0xBB,
kOemComma = 0xBC,
kOemMinus = 0xBD,
kOemPeriod = 0xBE,
kOem2 = 0xBF,
kOem3 = 0xC0,
kBrightnessDown = 0xD8,
kBrightnessUp = 0xD9,
kKbdBrightnessDown = 0xDA,
kOem4 = 0xDB,
kOem5 = 0xDC,
kOem6 = 0xDD,
kOem7 = 0xDE,
kOem8 = 0xDF,
kOem102 = 0xE2,
kKbdBrightnessUp = 0xE8,
kDbeSbcschar = 0xF3,
kDbeDbcschar = 0xF4,
kPlay = 0xFA,
// Not present in Windows virtual key codes, but would be used by the client.
kMediaRewind = 0xE3,
kMediaFastForward = 0xE4,
};
} // namespace keycode
} // namespace dom
} // namespace cobalt
#endif // COBALT_DOM_KEYCODE_H_