source: trunk/Include/Classes/ActiveBasic/Windows/UI/Forms/EventArgs.ab@ 473

Last change on this file since 473 was 473, checked in by イグトランス (egtra), 16 years ago

実験として書いていたControlクラスを追加(せめてコミット前に既存のContorolに混ぜようとしたがコンパイルできなかった)。
ほかForms, Drawing及びGDI+の修正。

File size: 7.2 KB
Line 
1/**
2@file Include/Classes/ActiveBasic/Windows/UI/EventArgs.ab
3@brief イベントハンドラ関連
4*/
5
6Namespace ActiveBasic
7Namespace Windows
8Namespace UI
9Namespace Forms
10
11TypeDef EventArgs = System.EventArgs
12TypeDef EventHandler = System.EventHandler
13
14Class PaintDCEventArgs
15 Inherits EventArgs
16Public
17 Sub PaintDCEventArgs(hdcTarget As HDC, ByRef rect As RECT)
18 hdc = hdcTarget
19 rc = rect
20 End Sub
21
22 Function Handle() As HDC
23 Handle = hdc
24 End Function
25
26 Function ClipRect() As RECT
27 ClipRect = rc
28 End Function
29
30Private
31 hdc As HDC
32 rc As RECT
33End Class
34
35Delegate Sub PaintDCEventHandler(sender As Object, e As PaintDCEventArgs)
36
37Class PaintDCHandledEventArgs
38 Inherits PaintDCEventArgs
39Public
40 Sub PaintDCHandledEventArgs(hdcTarget As HDC, ByRef rect As RECT)
41 PaintDCEventArgs(hdcTarget, rect)
42 End Sub
43
44 Function Handled() As Boolean
45 Handled = h
46 End Function
47
48 Sub Handled(handled As Boolean)
49 h = handled
50 End Sub
51
52Private
53 h As Boolean
54End Class
55
56TypeDef PaintDCBackGroundEventArgs = PaintDCHandledEventArgs
57
58Enum MouseButtons
59 None = 0
60 Left = MK_LBUTTON
61 Right = MK_RBUTTON
62 Middle = MK_MBUTTON
63 XButton1 = MK_XBUTTON1
64 XButton2 = MK_XBUTTON2
65End Enum
66
67Class MouseEventArgs
68 Inherits EventArgs
69Public
70 Sub MouseEventArgs(button As MouseButtons, clicks As Long, x As Long, y As Long, delta As Long)
71 This.button = button
72 This.clicks = clicks
73 This.pt = New System.Drawing.Point(x, y)
74 This.delta = delta
75 End Sub
76
77 Const Function Button() As MouseButtons
78 Button = button
79 End Function
80
81 Const Function Clicks() As Long
82 Clicks = clicks
83 End Function
84
85 Const Function Delta() As Long
86 Delta = delta
87 End Function
88
89 Const Function Locale() As System.Drawing.Point
90 Locale = New System.Drawing.Point(pt.X, pt.Y)
91 End Function
92
93 Const Function X() As Long
94 X = pt.X
95 End Function
96
97 Const Function Y() As Long
98 Y = pt.Y
99 End Function
100
101Private
102 pt As System.Drawing.Point
103 button As MouseButtons
104 clicks As Long
105 delta As Long
106End Class
107
108Delegate Sub MouseEventHandler(sender As Object, e As MouseEventArgs)
109
110Class KeyPressEventArgs
111 Inherits EventArgs
112Public
113 Sub KeyPressEventArgs(keyChar As Char)
114 key = keyChar
115 End Sub
116
117 Sub KeyChar(keyChar As Char)
118 key = keyChar
119 End Sub
120
121 Const Function KeyChar() As Char
122 KeyChar = key
123 End Function
124
125 Sub Handled(handled As Boolean)
126 h = handled
127 End Sub
128
129 Const Function Handled() As Boolean
130 Handled = h
131 End Function
132Private
133 key As Char
134 h As Boolean
135End Class
136
137Delegate Sub KeyPressEventHandler(sender As Object, e As KeyPressEventArgs)
138
139Enum Keys
140 None = 0
141 LButton = VK_LBUTTON
142 RButton = VK_RBUTTON
143 Cancel = VK_CANCEL
144 MButton = VK_MBUTTON
145 XButton1 = VK_XBUTTON1
146 XButton2 = VK_XBUTTON2
147 Back = VK_BACK
148 Tab = VK_TAB
149 LineFeed = &ha
150 Clear = VK_CLEAR
151 Enter = VK_RETURN
152 Return_ = VK_RETURN
153 ShiftKey = VK_SHIFT
154 ControlKey = VK_CONTROL
155 Menu = VK_MENU
156 Pause = VK_PAUSE
157 Capital = VK_CAPITAL
158 KanaMode = VK_KANA
159 HangulMode = VK_HANGUL
160 JunjaMode = VK_JUNJA
161 FinalMode = VK_FINAL
162 KanjiMode = VK_KANJI
163 HanjaMode = VK_HANJA
164 Escape = VK_ESCAPE
165 IMEConvert = VK_CONVERT
166 IMENonconvert = VK_NONCONVERT
167 IMEAccept = VK_ACCEPT
168 IMEModeChange = VK_MODECHANGE
169 Space = VK_SPACE
170 Prior = VK_PRIOR
171 PageUp = VK_PRIOR
172 PageDown = VK_NEXT
173 Next_ = VK_NEXT
174 End_ = VK_END
175 Home = VK_HOME
176 Left = VK_LEFT
177 Up = VK_UP
178 Right = VK_RIGHT
179 Down = VK_DOWN
180 Select_ = VK_SELECT
181 Print = VK_PRINT
182 Execute = VK_EXECUTE
183 Snapshot = VK_SNAPSHOT
184 Insert = VK_INSERT
185 Delete_ = VK_DELETE
186 Help = VK_HELP
187 D0 = &h30
188 D1 = &h31
189 D2 = &h32
190 D3 = &h33
191 D4 = &h34
192 D5 = &h35
193 D6 = &h36
194 D7 = &h37
195 D8 = &h38
196 D9 = &h39
197 A = &h41
198 B = &h42
199 C = &h43
200 D = &h44
201 E = &h45
202 F = &h46
203 G = &h47
204 H = &h48
205 I = &h49
206 J = &h4a
207 K = &h4b
208 L = &h4c
209 M = &h4d
210 N = &h4e
211 O = &h4f
212 P = &h50
213 Q = &h51
214 R = &h52
215 S = &h53
216 T = &h54
217 U = &h55
218 V = &h56
219 W = &h57
220 X = &h58
221 Y = &h59
222 Z = &h5A
223 LWin = VK_LWIN
224 RWin = VK_RWIN
225 Apps = VK_APPS
226 Sleep = VK_SLEEP
227 NumPad0 = VK_NUMPAD0
228 NumPad1 = VK_NUMPAD1
229 NumPad2 = VK_NUMPAD2
230 NumPad3 = VK_NUMPAD3
231 NumPad4 = VK_NUMPAD4
232 NumPad5 = VK_NUMPAD5
233 NumPad6 = VK_NUMPAD6
234 NumPad7 = VK_NUMPAD7
235 NumPad8 = VK_NUMPAD8
236 NumPad9 = VK_NUMPAD9
237 Multiply = VK_MULTIPLY
238 Add = VK_ADD
239 Separator = VK_SEPARATOR
240 Substract = VK_SUBTRACT
241 Decimal = VK_DECIMAL
242 Divide = VK_DIVIDE
243 F1 = VK_F1
244 F2 = VK_F2
245 F3 = VK_F3
246 F4 = VK_F4
247 F5 = VK_F5
248 F6 = VK_F6
249 F7 = VK_F7
250 F8 = VK_F8
251 F9 = VK_F9
252 F10 = VK_F10
253 F11 = VK_F11
254 F12 = VK_F12
255 F13 = VK_F13
256 F14 = VK_F14
257 F15 = VK_F15
258 F16 = VK_F16
259 F17 = VK_F17
260 F18 = VK_F18
261 F19 = VK_F19
262 F20 = VK_F20
263 F21 = VK_F21
264 F22 = VK_F22
265 F23 = VK_F23
266 F24 = VK_F24
267 NumLock = VK_NUMLOCK
268 Scroll = VK_SCROLL
269 LShiftKey = VK_LSHIFT
270 RShiftKey = VK_RSHIFT
271 LControlKey = VK_LCONTROL
272 RControlKey = VK_RCONTROL
273 LMenu = VK_LMENU
274 RMenu = VK_RMENU
275 BrowserBack = VK_BROWSER_BACK
276 BrowserForward = VK_BROWSER_FORWARD
277 BrowserRefresh = VK_BROWSER_REFRESH
278 BrowserStop = VK_BROWSER_STOP
279 BrowserSearch = VK_BROWSER_SEARCH
280 BrowserFavorites = VK_BROWSER_FAVORITES
281 BrowserHome = VK_BROWSER_HOME
282 VolumeMute = VK_VOLUME_MUTE
283 VolumeDown = VK_VOLUME_DOWN
284 VolumeUp = VK_VOLUME_UP
285 MediaNextTrack = VK_MEDIA_NEXT_TRACK
286 MediaPreviousTrack = VK_MEDIA_PREV_TRACK
287 MediaStop = VK_MEDIA_STOP
288 MediaPlayPause = VK_MEDIA_PLAY_PAUSE
289 LaunchMail = VK_LAUNCH_MAIL
290 SelectMedia = VK_LAUNCH_MEDIA_SELECT
291 LaunchApplication1 = VK_LAUNCH_APP1
292 LaunchApplication2 = VK_LAUNCH_APP2
293 Oem1 = VK_OEM_1
294 Oemplus = VK_OEM_PLUS
295 Oemcomma = VK_OEM_COMMA
296 OemMinus = VK_OEM_MINUS
297 OemPeriod = VK_OEM_PERIOD
298 Oem2 = VK_OEM_2
299 OemQuestion = VK_OEM_2
300 Oem3 = VK_OEM_3
301 Oemtilde = VK_OEM_3
302 Oem4 = VK_OEM_4
303 OemOpenBrackets = VK_OEM_4
304 Oem5 = VK_OEM_5
305 OemPipe = VK_OEM_5
306 Oem6 = VK_OEM_6
307 OemCloseBrackets = VK_OEM_6
308 Oem7 = VK_OEM_7
309 OemQuotes = VK_OEM_7
310 Oem8 = VK_OEM_8
311 Oem102 = VK_OEM_102
312 OemBackslash = VK_OEM_102
313 ProcessKey = VK_PROCESSKEY
314 Packet = VK_PACKET
315 Attn = VK_ATTN
316 Crsel = VK_CRSEL
317 Exsel = VK_EXSEL
318 EraseEof = VK_EREOF
319 Play = VK_PLAY
320 NoName = VK_NONAME
321 Zoom = VK_ZOOM
322 Pa1 = VK_PA1
323 OemClear = VK_OEM_CLEAR
324
325 KeyCode = &hffff
326
327 Shift = &h10000
328 Control = &h20000
329 Alt = &h40000
330
331 Modifiers = &hffff
332End Enum
333
334Class KeyEventArgs
335 Inherits EventArgs
336Public
337 Sub KeyEventArgs(keyData As Keys)
338 key = keyData
339 End Sub
340
341 Function Alt() As Boolean
342 Alt = key And Keys.Menu
343 End Function
344
345 Function Control() As Boolean
346 Control = key And Keys.Control
347 End Function
348
349 Function Shift() As Boolean
350 Shift = key And Keys.Shift
351 End Function
352
353 Function KeyCode() As Keys
354 KeyCode = key And Keys.KeyCode
355 End Function
356
357 Function KeyData() As Keys
358 KeyData = key
359 End Function
360
361 Function Modifiers() As Keys
362 Modifiers = key And Keys.Modifiers
363 End Function
364
365 Function KeyValue() As Long
366 KeyValue = key As Long
367 End Function
368
369 Sub Handled(handled As Boolean)
370 h = handled
371 End Sub
372
373 Function Handled() As Boolean
374 Handled = h
375 End Function
376
377Private
378 key As Keys
379 h As Boolean
380End Class
381
382Delegate Sub KeyEventHandler(sender As Object, e As KeyEventArgs)
383
384End Namespace 'Forms
385End Namespace 'UI
386End Namespace 'Widnows
387End Namespace 'ActiveBasic
Note: See TracBrowser for help on using the repository browser.