mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-06 23:37:17 +01:00
cocoa: add mackeycodes.inc from carbon
git-svn-id: trunk@34492 -
This commit is contained in:
parent
6c88a7f8fa
commit
c4a6edc657
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -5448,6 +5448,7 @@ lcl/interfaces/cocoa/cocoawsforms.pp svneol=native#text/plain
|
||||
lcl/interfaces/cocoa/cocoawsmenus.pas svneol=native#text/plain
|
||||
lcl/interfaces/cocoa/cocoawsstdctrls.pp svneol=native#text/plain
|
||||
lcl/interfaces/cocoa/interfaces.pas svneol=native#text/plain
|
||||
lcl/interfaces/cocoa/mackeycodes.inc svneol=native#text/pascal
|
||||
lcl/interfaces/customdrawn/Makefile svneol=native#text/plain
|
||||
lcl/interfaces/customdrawn/Makefile.fpc svneol=native#text/plain
|
||||
lcl/interfaces/customdrawn/alllclintfunits.pas svneol=native#text/pascal
|
||||
|
||||
93
lcl/interfaces/cocoa/mackeycodes.inc
Normal file
93
lcl/interfaces/cocoa/mackeycodes.inc
Normal file
@ -0,0 +1,93 @@
|
||||
(*
|
||||
About Mac Key codes:
|
||||
unfortunately, mac key codes are keyboard specific:
|
||||
that is, there is no universal VK_A, but every keyboard has its code for VK_A
|
||||
Key codes depend on physical key position on the keyboard: considering a
|
||||
QWERTY keyboard and an AZERTY one, keycode(Q) of first one = keycode(A) of
|
||||
the second one, and so on.
|
||||
For "printable" keys we can rely on kEventParamKeyMacCharCodes and
|
||||
kEventParamKeyUnicodes event parameters to obtain an ascii/unicode value
|
||||
that we can translate to the appropriate VK_ code
|
||||
For non printable keys (Function, ins, arrow and so on...) we use the raw
|
||||
keycodes, since it looks like they are constant across all keyboards
|
||||
|
||||
So, here are constants for non-printable keys (MK means "Mac Key").
|
||||
These constants were extracted using KeyCodes program by Peter Maurer
|
||||
(http://www.petermaurer.de/nasi.php?section=keycodes)
|
||||
|
||||
Some keys were taken from the ancient "Macintosh Toolbox Essentials", page 87
|
||||
http://developer.apple.com/documentation/mac/pdf/MacintoshToolboxEssentials.pdf
|
||||
*)
|
||||
|
||||
const
|
||||
MK_ENTER = $24;
|
||||
MK_SPACE = $31;
|
||||
MK_ESC = $35;
|
||||
MK_F1 = $7A;
|
||||
MK_F2 = $78;
|
||||
MK_F3 = $63;
|
||||
MK_F4 = $76;
|
||||
MK_F5 = $60;
|
||||
MK_F6 = $61;
|
||||
MK_F7 = $62;
|
||||
MK_F8 = $64;
|
||||
MK_F9 = $65;
|
||||
MK_F10 = $6D;
|
||||
MK_F11 = $67;
|
||||
MK_F12 = $6F;
|
||||
MK_F13 = $69; MK_PRNSCR = MK_F13; //Print screen = F13
|
||||
MK_F14 = $6B; MK_SCRLOCK = MK_F14; //Scroll Lock = F14
|
||||
MK_F15 = $71; MK_PAUSE = MK_F15; //Pause = F15
|
||||
MK_POWER = $7F7F;
|
||||
MK_TAB = $30;
|
||||
MK_INS = $72; MK_HELP = MK_INS; //old macs call this key "help"
|
||||
MK_DEL = $75;
|
||||
MK_HOME = $73;
|
||||
MK_END = $77;
|
||||
MK_PAGUP = $74;
|
||||
MK_PAGDN = $79;
|
||||
MK_UP = $7E;
|
||||
MK_DOWN = $7D;
|
||||
MK_LEFT = $7B;
|
||||
MK_RIGHT = $7C;
|
||||
MK_NUMLOCK = $47;
|
||||
MK_NUMPAD0 = $52;
|
||||
MK_NUMPAD1 = $53;
|
||||
MK_NUMPAD2 = $54;
|
||||
MK_NUMPAD3 = $55;
|
||||
MK_NUMPAD4 = $56;
|
||||
MK_NUMPAD5 = $57;
|
||||
MK_NUMPAD6 = $58;
|
||||
MK_NUMPAD7 = $59;
|
||||
MK_NUMPAD8 = $5b;
|
||||
MK_NUMPAD9 = $5c;
|
||||
MK_PADEQUALS = $51; //only present in old mac keyboards?
|
||||
MK_PADDIV = $4B;
|
||||
MK_PADMULT = $43;
|
||||
MK_PADSUB = $4E;
|
||||
MK_PADADD = $45;
|
||||
MK_PADDEC = $41;
|
||||
MK_PADENTER = $4C; //enter on numeric keypad
|
||||
MK_BACKSPACE = $33;
|
||||
MK_CAPSLOCK = $39;
|
||||
|
||||
|
||||
//Modifiers codes - you'll never get these directly
|
||||
|
||||
MK_SHIFTKEY = $38;
|
||||
MK_CTRL = $3B;
|
||||
MK_ALT = $3A; MK_OPTION = MK_ALT;
|
||||
MK_COMMAND = $37; MK_APPLE = MK_COMMAND;
|
||||
|
||||
MK_TILDE = 50; // `/~ key
|
||||
MK_MINUS = 27; // -/_ key
|
||||
MK_EQUAL = 24; // =/+ key
|
||||
MK_BACKSLASH = 42; // \ | key
|
||||
MK_LEFTBRACKET = 33; // [ { key
|
||||
MK_RIGHTBRACKET = 30; // ] } key
|
||||
MK_SEMICOLON = 41; // ; : key
|
||||
MK_QUOTE = 39; // ' " key
|
||||
MK_COMMA = 43; // , < key
|
||||
MK_PERIOD = 47; // . > key
|
||||
MK_SLASH = 44; // / ? key
|
||||
|
||||
Loading…
Reference in New Issue
Block a user