1 /** DGui project file. 2 3 Copyright: Trogu Antonio Davide 2011-2013 4 5 License: $(HTTP boost.org/LICENSE_1_0.txt, Boost License 1.0). 6 7 Authors: Trogu Antonio Davide 8 */ 9 module dgui.core.events.keyeventargs; 10 11 public import dgui.core.events.eventargs; 12 13 enum Keys: uint // docmain 14 { 15 none = 0, /// No keys specified. 16 17 /// 18 shift = 0x10000, /// Modifier keys. 19 control = 0x20000, 20 alt = 0x40000, 21 22 a = 'A', /// Letters. 23 b = 'B', 24 c = 'C', 25 d = 'D', 26 e = 'E', 27 f = 'F', 28 g = 'G', 29 h = 'H', 30 i = 'I', 31 j = 'J', 32 k = 'K', 33 l = 'L', 34 m = 'M', 35 n = 'N', 36 o = 'O', 37 p = 'P', 38 q = 'Q', 39 r = 'R', 40 s = 'S', 41 t = 'T', 42 u = 'U', 43 v = 'V', 44 w = 'W', 45 x = 'X', 46 y = 'Y', 47 z = 'Z', 48 49 d0 = '0', /// Digits. 50 d1 = '1', 51 d2 = '2', 52 d3 = '3', 53 d4 = '4', 54 d5 = '5', 55 d6 = '6', 56 d7 = '7', 57 d8 = '8', 58 d9 = '9', 59 60 f1 = 112, /// F - function keys. 61 f2 = 113, 62 f3 = 114, 63 f4 = 115, 64 f5 = 116, 65 f6 = 117, 66 f7 = 118, 67 f8 = 119, 68 f9 = 120, 69 f10 = 121, 70 f11 = 122, 71 f12 = 123, 72 f13 = 124, 73 f14 = 125, 74 f15 = 126, 75 f16 = 127, 76 f17 = 128, 77 f18 = 129, 78 f19 = 130, 79 f20 = 131, 80 f21 = 132, 81 f22 = 133, 82 f23 = 134, 83 f24 = 135, 84 85 numPad0 = 96, /// Numbers on keypad. 86 numPad1 = 97, 87 numPad2 = 98, 88 numPad3 = 99, 89 numPad4 = 100, 90 numPad5 = 101, 91 numPad6 = 102, 92 numPad7 = 103, 93 numPad8 = 104, 94 numPad9 = 105, 95 96 add = 107, /// 97 apps = 93, /// Application. 98 attn = 246, /// 99 back = 8, /// Backspace. 100 cancel = 3, /// 101 capital = 20, /// 102 capsLock = 20, 103 clear = 12, /// 104 controlKey = 17, /// 105 crSel = 247, /// 106 decimal = 110, /// 107 del = 46, /// 108 delete_ = del, /// 109 period = 190, /// 110 dot = period, 111 divide = 111, /// 112 down = 40, /// Down arrow. 113 end = 35, /// 114 enter = 13, /// 115 eraseEOF = 249, /// 116 escape = 27, /// 117 execute = 43, /// 118 exsel = 248, /// 119 finalMode = 4, /// IME final mode. 120 hangulMode = 21, /// IME Hangul mode. 121 hanguelMode = 21, 122 hanjaMode = 25, /// IME Hanja mode. 123 help = 47, /// 124 home = 36, /// 125 imeAccept = 30, /// 126 imeConvert = 28, /// 127 imeModeChange = 31, /// 128 imeNonConvert = 29, /// 129 insert = 45, /// 130 junjaMode = 23, /// 131 kanaMode = 21, /// 132 kanjiMode = 25, /// 133 leftControl = 162, /// Left Ctrl. 134 left = 37, /// Left arrow. 135 lineFeed = 10, /// 136 leftMenu = 164, /// Left Alt. 137 leftShift = 160, /// 138 leftWin = 91, /// Left Windows logo. 139 menu = 18, /// Alt. 140 multiply = 106, /// 141 next = 34, /// Page down. 142 noName = 252, // Reserved for future use. 143 numLock = 144, /// 144 oem8 = 223, // OEM specific. 145 oemClear = 254, 146 pa1 = 253, 147 pageDown = 34, /// 148 pageUp = 33, /// 149 pause = 19, /// 150 play = 250, /// 151 print = 42, /// 152 printScreen = 44, /// 153 processKey = 229, /// 154 rightControl = 163, /// Right Ctrl. 155 return_ = 13, /// 156 right = 39, /// Right arrow. 157 rightMenu = 165, /// Right Alt. 158 rightShift = 161, /// 159 rightWin = 92, /// Right Windows logo. 160 scroll = 145, /// Scroll lock. 161 select = 41, /// 162 separator = 108, /// 163 shiftKey = 16, /// 164 snapshot = 44, /// Print screen. 165 space = 32, /// 166 spacebar = space, // Extra. 167 subtract = 109, /// 168 tab = 9, /// 169 up = 38, /// Up arrow. 170 zoom = 251, /// 171 172 // Windows 2000+ 173 browserBack = 166, /// 174 browserFavorites = 171, 175 browserForward = 167, 176 browserHome = 172, 177 browserRefresh = 168, 178 browserSearch = 170, 179 browserStop = 169, 180 launchApplication1 = 182, /// 181 launchApplication2 = 183, 182 launchMail = 180, 183 mediaNextTrack = 176, /// 184 mediaPlayPause = 179, 185 mediaPreviousTrack = 177, 186 mediaStop = 178, 187 oemBackslash = 226, // OEM angle bracket or backslash. 188 oemCloseBrackets = 221, 189 oemComma = 188, 190 oemMinus = 189, 191 oemOpenBrackets = 219, 192 oemPeriod = 190, 193 oemPipe = 220, 194 oemPlus = 187, 195 oemQuestion = 191, 196 oemQuotes = 222, 197 oemSemicolon = 186, 198 oemTilde = 192, 199 selectMedia = 181, /// 200 volumeDown = 174, /// 201 volumeMute = 173, 202 volumeUp = 175, 203 204 /// Bit mask to extract key code from key value. 205 keyCode = 0xFFFF, 206 207 /// Bit mask to extract modifiers from key value. 208 modifiers = 0xFFFF0000, 209 } 210 211 class KeyEventArgs: EventArgs 212 { 213 private Keys _keys; 214 private bool _handled = true; 215 216 public this(Keys keys) 217 { 218 this._keys = keys; 219 } 220 221 @property public Keys keyCode() 222 { 223 return this._keys; 224 } 225 226 @property public bool handled() 227 { 228 return this._handled; 229 } 230 231 @property public void handled(bool b) 232 { 233 this._handled = b; 234 } 235 } 236 237 class KeyCharEventArgs: KeyEventArgs 238 { 239 private char _keyChar; 240 241 public this(Keys keys, char keyCh) 242 { 243 super(keys); 244 this._keyChar = keyCh; 245 } 246 247 @property public char keyChar() 248 { 249 return this._keyChar; 250 } 251 }