Mercurial > projects > dynamin
comparison dynamin/gui/events.d @ 72:8dac206ea523
Add shift/control/altDown to KeyEventArgs.
author | Jordan Miner <jminer7@gmail.com> |
---|---|
date | Tue, 11 Aug 2009 01:45:42 -0500 |
parents | c138461bf845 |
children | 73060bc3f004 |
comparison
equal
deleted
inserted
replaced
71:63ea570c8d7c | 72:8dac206ea523 |
---|---|
117 } | 117 } |
118 /// | 118 /// |
119 class KeyEventArgs : StopEventArgs { | 119 class KeyEventArgs : StopEventArgs { |
120 Key _key; | 120 Key _key; |
121 bool _repeat; | 121 bool _repeat; |
122 public: | 122 bool _shiftDown, _controlDown, _altDown; |
123 this(Key key, bool repeat) { | 123 public: |
124 this(Key key, bool repeat, bool shift, bool ctrl, bool alt) { | |
124 _key = key; | 125 _key = key; |
125 _repeat = repeat; | 126 _repeat = repeat; |
127 _shiftDown = shift; | |
128 _controlDown = ctrl; | |
129 _altDown = alt; | |
126 } | 130 } |
127 /** | 131 /** |
128 * Returns: the key that was typed. | 132 * Returns: the key that was typed. |
129 */ | 133 */ |
130 Key key() { return _key; } | 134 Key key() { return _key; } |
133 * down the key. | 137 * down the key. |
134 * Returns: true if the key was already down before this event, false | 138 * Returns: true if the key was already down before this event, false |
135 * if the key was just pressed | 139 * if the key was just pressed |
136 */ | 140 */ |
137 bool repeat() { return _repeat; } | 141 bool repeat() { return _repeat; } |
142 // Returns true if the shift key is currently down and false otherwise. | |
143 bool shiftDown() { return _shiftDown; } | |
144 // Returns true if the control key is currently down and false otherwise. | |
145 bool controlDown() { return _controlDown; } | |
146 // Returns true if the alt key is currently down and false otherwise. | |
147 bool altDown() { return _altDown; } | |
138 string toString() { | 148 string toString() { |
139 return format("KeyEventArgs [key={}, repeat={}]", _key, _repeat); | 149 return format("KeyEventArgs [key={}, repeat={}]", _key, _repeat); |
140 } | 150 } |
141 } | 151 } |
142 /// | 152 /// |