source: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/ControlEvent.sbp

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

サブクラス化機構(Control.Attach)の整備

File size: 8.4 KB
Line 
1Public
2 Sub AddPaintDC(h As PaintDCHandler)
3 If IsNothing(paintDC) Then
4 paintDC = h
5 Else
6 paintDC += h
7 End If
8 End Sub
9 Sub RemovePaintDC(h As PaintDCHandler)
10 If Not IsNothing(paintDC) Then
11 paintDC -= h
12 End If
13 End Sub
14Protected
15 Function OnPaintDC(e As PaintDCArgs) As Boolean
16 If Not IsNothing(paintDC) Then
17 paintDC(This, e)
18 Return True
19 End If
20 End Function
21Private
22 paintDC As PaintDCHandler
23
24Public
25 Sub AddClick(h As Handler)
26 If IsNothing(click) Then
27 click = h
28 Else
29 click += h
30 End If
31 End Sub
32 Sub RemoveClick(h As Handler)
33 If Not IsNothing(click) Then
34 click -= h
35 End If
36 End Sub
37Protected
38 Function OnClick(e As Args) As Boolean
39 If Not IsNothing(click) Then
40 click(This, e)
41 Return True
42 End If
43 End Function
44Private
45 click As Handler
46
47Public
48 Sub AddDoubleClick(h As Handler)
49 If IsNothing(doubleClick) Then
50 doubleClick = h
51 Else
52 doubleClick += h
53 End If
54 End Sub
55 Sub RemoveDoubleClick(h As Handler)
56 If Not IsNothing(doubleClick) Then
57 doubleClick -= h
58 End If
59 End Sub
60Protected
61 Function OnDoubleClick(e As Args) As Boolean
62 If Not IsNothing(doubleClick) Then
63 doubleClick(This, e)
64 Return True
65 End If
66 End Function
67Private
68 doubleClick As Handler
69
70Public
71 Sub AddMove(h As Handler)
72 If IsNothing(move) Then
73 move = h
74 Else
75 move += h
76 End If
77 End Sub
78 Sub RemoveMove(h As Handler)
79 If Not IsNothing(move) Then
80 move -= h
81 End If
82 End Sub
83Protected
84 Function OnMove(e As Args) As Boolean
85 If Not IsNothing(move) Then
86 move(This, e)
87 Return True
88 End If
89 End Function
90Private
91 move As Handler
92
93Public
94 Sub AddResize(h As ResizeHandler)
95 If IsNothing(resize) Then
96 resize = h
97 Else
98 resize += h
99 End If
100 End Sub
101 Sub RemoveResize(h As ResizeHandler)
102 If Not IsNothing(resize) Then
103 resize -= h
104 End If
105 End Sub
106Protected
107 Function OnResize(e As ResizeArgs) As Boolean
108 If Not IsNothing(resize) Then
109 resize(This, e)
110 Return True
111 End If
112 End Function
113Private
114 resize As ResizeHandler
115
116Public
117 Sub AddMouseEnter(h As MouseHandler)
118 If IsNothing(mouseEnter) Then
119 mouseEnter = h
120 Else
121 mouseEnter += h
122 End If
123 End Sub
124 Sub RemoveMouseEnter(h As MouseHandler)
125 If Not IsNothing(mouseEnter) Then
126 mouseEnter -= h
127 End If
128 End Sub
129Protected
130 Function OnMouseEnter(e As MouseArgs) As Boolean
131 If Not IsNothing(mouseEnter) Then
132 mouseEnter(This, e)
133 Return True
134 End If
135 End Function
136Private
137 mouseEnter As MouseHandler
138
139Public
140 Sub AddMouseMove(h As MouseHandler)
141 If IsNothing(mouseMove) Then
142 mouseMove = h
143 Else
144 mouseMove += h
145 End If
146 End Sub
147 Sub RemoveMouseMove(h As MouseHandler)
148 If Not IsNothing(mouseMove) Then
149 mouseMove -= h
150 End If
151 End Sub
152Protected
153 Function OnMouseMove(e As MouseArgs) As Boolean
154 If Not IsNothing(mouseMove) Then
155 mouseMove(This, e)
156 Return True
157 End If
158 End Function
159Private
160 mouseMove As MouseHandler
161
162Public
163 Sub AddMouseHover(h As MouseHandler)
164 If IsNothing(mouseHover) Then
165 mouseHover = h
166 Else
167 mouseHover += h
168 End If
169 End Sub
170 Sub RemoveMouseHover(h As MouseHandler)
171 If Not IsNothing(mouseHover) Then
172 mouseHover -= h
173 End If
174 End Sub
175Protected
176 Function OnMouseHover(e As MouseArgs) As Boolean
177 If Not IsNothing(mouseHover) Then
178 mouseHover(This, e)
179 Return True
180 End If
181 End Function
182Private
183 mouseHover As MouseHandler
184
185Public
186 Sub AddMouseLeave(h As Handler)
187 If IsNothing(mouseLeave) Then
188 mouseLeave = h
189 Else
190 mouseLeave += h
191 End If
192 End Sub
193 Sub RemoveMouseLeave(h As Handler)
194 If Not IsNothing(mouseLeave) Then
195 mouseLeave -= h
196 End If
197 End Sub
198Protected
199 Function OnMouseLeave(e As Args) As Boolean
200 If Not IsNothing(mouseLeave) Then
201 mouseLeave(This, e)
202 Return True
203 End If
204 End Function
205Private
206 mouseLeave As Handler
207
208Public
209 Sub AddMouseDown(h As MouseHandler)
210 If IsNothing(mouseDown) Then
211 mouseDown = h
212 Else
213 mouseDown += h
214 End If
215 End Sub
216 Sub RemoveMouseDown(h As MouseHandler)
217 If Not IsNothing(mouseDown) Then
218 mouseDown -= h
219 End If
220 End Sub
221Protected
222 Function OnMouseDown(e As MouseArgs) As Boolean
223 If Not IsNothing(mouseDown) Then
224 mouseDown(This, e)
225 Return True
226 End If
227 End Function
228Private
229 mouseDown As MouseHandler
230
231Public
232 Sub AddMouseClick(h As MouseHandler)
233 If IsNothing(mouseClick) Then
234 mouseClick = h
235 Else
236 mouseClick += h
237 End If
238 End Sub
239 Sub RemoveMouseClick(h As MouseHandler)
240 If Not IsNothing(mouseClick) Then
241 mouseClick -= h
242 End If
243 End Sub
244Protected
245 Function OnMouseClick(e As MouseArgs) As Boolean
246 If Not IsNothing(mouseClick) Then
247 mouseClick(This, e)
248 Return True
249 End If
250 End Function
251Private
252 mouseClick As MouseHandler
253
254Public
255 Sub AddMouseDoubleClick(h As MouseHandler)
256 If IsNothing(mouseDoubleClick) Then
257 mouseDoubleClick = h
258 Else
259 mouseDoubleClick += h
260 End If
261 End Sub
262 Sub RemoveMouseDoubleClick(h As MouseHandler)
263 If Not IsNothing(mouseDoubleClick) Then
264 mouseDoubleClick -= h
265 End If
266 End Sub
267Protected
268 Function OnMouseDoubleClick(e As MouseArgs) As Boolean
269 If Not IsNothing(mouseDoubleClick) Then
270 mouseDoubleClick(This, e)
271 Return True
272 End If
273 End Function
274Private
275 mouseDoubleClick As MouseHandler
276
277Public
278 Sub AddMouseUp(h As MouseHandler)
279 If IsNothing(mouseUp) Then
280 mouseUp = h
281 Else
282 mouseUp += h
283 End If
284 End Sub
285 Sub RemoveMouseUp(h As MouseHandler)
286 If Not IsNothing(mouseUp) Then
287 mouseUp -= h
288 End If
289 End Sub
290Protected
291 Function OnMouseUp(e As MouseArgs) As Boolean
292 If Not IsNothing(mouseUp) Then
293 mouseUp(This, e)
294 Return True
295 End If
296 End Function
297Private
298 mouseUp As MouseHandler
299
300Public
301 Sub AddKeyDown(h As KeyHandler)
302 If IsNothing(keyDown) Then
303 keyDown = h
304 Else
305 keyDown += h
306 End If
307 End Sub
308 Sub RemoveKeyDown(h As KeyHandler)
309 If Not IsNothing(keyDown) Then
310 keyDown -= h
311 End If
312 End Sub
313Protected
314 Function OnKeyDown(e As KeyArgs) As Boolean
315 If Not IsNothing(keyDown) Then
316 keyDown(This, e)
317 Return True
318 End If
319 End Function
320Private
321 keyDown As KeyHandler
322
323Public
324 Sub AddKeyUp(h As KeyHandler)
325 If IsNothing(keyUp) Then
326 keyUp = h
327 Else
328 keyUp += h
329 End If
330 End Sub
331 Sub RemoveKeyUp(h As KeyHandler)
332 If Not IsNothing(keyUp) Then
333 keyUp -= h
334 End If
335 End Sub
336Protected
337 Function OnKeyUp(e As KeyArgs) As Boolean
338 If Not IsNothing(keyUp) Then
339 keyUp(This, e)
340 Return True
341 End If
342 End Function
343Private
344 keyUp As KeyHandler
345
346Public
347 Sub AddKeyPress(h As KeyPressHandler)
348 If IsNothing(keyPress) Then
349 keyPress = h
350 Else
351 keyPress += h
352 End If
353 End Sub
354 Sub RemoveKeyPress(h As KeyPressHandler)
355 If Not IsNothing(keyPress) Then
356 keyPress -= h
357 End If
358 End Sub
359Protected
360 Function OnKeyPress(e As KeyPressArgs) As Boolean
361 If Not IsNothing(keyPress) Then
362 keyPress(This, e)
363 Return True
364 End If
365 End Function
366Private
367 keyPress As KeyPressHandler
368
369Public
370 Sub AddCreate(h As CreateHandler)
371 If IsNothing(create) Then
372 create = h
373 Else
374 create += h
375 End If
376 End Sub
377 Sub RemoveCreate(h As CreateHandler)
378 If Not IsNothing(create) Then
379 create -= h
380 End If
381 End Sub
382Protected
383 Function OnCreate(e As CreateArgs) As Boolean
384 If Not IsNothing(create) Then
385 create(This, e)
386 Return True
387 End If
388 End Function
389Private
390 create As CreateHandler
391
392Public
393 Sub AddDestroy(h As Handler)
394 If IsNothing(destroy) Then
395 destroy = h
396 Else
397 destroy += h
398 End If
399 End Sub
400 Sub RemoveDestroy(h As Handler)
401 If Not IsNothing(destroy) Then
402 destroy -= h
403 End If
404 End Sub
405Protected
406 Function OnDestroy(e As Args) As Boolean
407 If Not IsNothing(destroy) Then
408 destroy(This, e)
409 Return True
410 End If
411 End Function
412Private
413 destroy As Handler
414
415Public
416 Sub AddPaintBackground(h As PaintBackgroundHandler)
417 If IsNothing(paintBackground) Then
418 paintBackground = h
419 Else
420 paintBackground += h
421 End If
422 End Sub
423 Sub RemovePaintBackground(h As PaintBackgroundHandler)
424 If Not IsNothing(paintBackground) Then
425 paintBackground -= h
426 End If
427 End Sub
428Protected
429 Function OnPaintBackground(e As PaintBackgroundArgs) As Boolean
430 If Not IsNothing(paintBackground) Then
431 paintBackground(This, e)
432 Return True
433 End If
434 End Function
435Private
436 paintBackground As PaintBackgroundHandler
437
Note: See TracBrowser for help on using the repository browser.