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
RevLine 
[473]1Public
[551]2 Sub AddPaintDC(h As PaintDCHandler)
[473]3 If IsNothing(paintDC) Then
[542]4 paintDC = h
5 Else
6 paintDC += h
[473]7 End If
8 End Sub
[551]9 Sub RemovePaintDC(h As PaintDCHandler)
[473]10 If Not IsNothing(paintDC) Then
11 paintDC -= h
12 End If
13 End Sub
[551]14Protected
[615]15 Function OnPaintDC(e As PaintDCArgs) As Boolean
[473]16 If Not IsNothing(paintDC) Then
17 paintDC(This, e)
[615]18 Return True
[473]19 End If
[615]20 End Function
[473]21Private
[551]22 paintDC As PaintDCHandler
[473]23
24Public
[551]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
[615]38 Function OnClick(e As Args) As Boolean
[551]39 If Not IsNothing(click) Then
40 click(This, e)
[615]41 Return True
[551]42 End If
[615]43 End Function
[551]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
[615]61 Function OnDoubleClick(e As Args) As Boolean
[551]62 If Not IsNothing(doubleClick) Then
63 doubleClick(This, e)
[615]64 Return True
[551]65 End If
[615]66 End Function
[551]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
[615]84 Function OnMove(e As Args) As Boolean
[551]85 If Not IsNothing(move) Then
86 move(This, e)
[615]87 Return True
[551]88 End If
[615]89 End Function
[551]90Private
91 move As Handler
92
93Public
[561]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
[615]107 Function OnResize(e As ResizeArgs) As Boolean
[561]108 If Not IsNothing(resize) Then
109 resize(This, e)
[615]110 Return True
[561]111 End If
[615]112 End Function
[561]113Private
114 resize As ResizeHandler
115
116Public
[551]117 Sub AddMouseEnter(h As MouseHandler)
[542]118 If IsNothing(mouseEnter) Then
119 mouseEnter = h
120 Else
121 mouseEnter += h
122 End If
123 End Sub
[551]124 Sub RemoveMouseEnter(h As MouseHandler)
[542]125 If Not IsNothing(mouseEnter) Then
126 mouseEnter -= h
127 End If
128 End Sub
[551]129Protected
[615]130 Function OnMouseEnter(e As MouseArgs) As Boolean
[542]131 If Not IsNothing(mouseEnter) Then
132 mouseEnter(This, e)
[615]133 Return True
[542]134 End If
[615]135 End Function
[542]136Private
[551]137 mouseEnter As MouseHandler
[542]138
139Public
[551]140 Sub AddMouseMove(h As MouseHandler)
[542]141 If IsNothing(mouseMove) Then
142 mouseMove = h
143 Else
144 mouseMove += h
145 End If
146 End Sub
[551]147 Sub RemoveMouseMove(h As MouseHandler)
[542]148 If Not IsNothing(mouseMove) Then
149 mouseMove -= h
150 End If
151 End Sub
[551]152Protected
[615]153 Function OnMouseMove(e As MouseArgs) As Boolean
[542]154 If Not IsNothing(mouseMove) Then
155 mouseMove(This, e)
[615]156 Return True
[542]157 End If
[615]158 End Function
[542]159Private
[551]160 mouseMove As MouseHandler
[542]161
162Public
[551]163 Sub AddMouseHover(h As MouseHandler)
[542]164 If IsNothing(mouseHover) Then
165 mouseHover = h
166 Else
167 mouseHover += h
168 End If
169 End Sub
[551]170 Sub RemoveMouseHover(h As MouseHandler)
[542]171 If Not IsNothing(mouseHover) Then
172 mouseHover -= h
173 End If
174 End Sub
[551]175Protected
[615]176 Function OnMouseHover(e As MouseArgs) As Boolean
[542]177 If Not IsNothing(mouseHover) Then
178 mouseHover(This, e)
[615]179 Return True
[542]180 End If
[615]181 End Function
[542]182Private
[551]183 mouseHover As MouseHandler
[542]184
185Public
[564]186 Sub AddMouseLeave(h As Handler)
[542]187 If IsNothing(mouseLeave) Then
188 mouseLeave = h
189 Else
190 mouseLeave += h
191 End If
192 End Sub
[564]193 Sub RemoveMouseLeave(h As Handler)
[542]194 If Not IsNothing(mouseLeave) Then
195 mouseLeave -= h
196 End If
197 End Sub
[551]198Protected
[615]199 Function OnMouseLeave(e As Args) As Boolean
[542]200 If Not IsNothing(mouseLeave) Then
201 mouseLeave(This, e)
[615]202 Return True
[542]203 End If
[615]204 End Function
[542]205Private
[564]206 mouseLeave As Handler
[542]207
208Public
[551]209 Sub AddMouseDown(h As MouseHandler)
[473]210 If IsNothing(mouseDown) Then
[542]211 mouseDown = h
212 Else
213 mouseDown += h
[473]214 End If
215 End Sub
[551]216 Sub RemoveMouseDown(h As MouseHandler)
[473]217 If Not IsNothing(mouseDown) Then
218 mouseDown -= h
219 End If
220 End Sub
[551]221Protected
[615]222 Function OnMouseDown(e As MouseArgs) As Boolean
[473]223 If Not IsNothing(mouseDown) Then
224 mouseDown(This, e)
[615]225 Return True
[473]226 End If
[615]227 End Function
[473]228Private
[551]229 mouseDown As MouseHandler
[473]230
231Public
[551]232 Sub AddMouseClick(h As MouseHandler)
[542]233 If IsNothing(mouseClick) Then
234 mouseClick = h
235 Else
236 mouseClick += h
237 End If
238 End Sub
[551]239 Sub RemoveMouseClick(h As MouseHandler)
[542]240 If Not IsNothing(mouseClick) Then
241 mouseClick -= h
242 End If
243 End Sub
[551]244Protected
[615]245 Function OnMouseClick(e As MouseArgs) As Boolean
[542]246 If Not IsNothing(mouseClick) Then
247 mouseClick(This, e)
[615]248 Return True
[542]249 End If
[615]250 End Function
[542]251Private
[551]252 mouseClick As MouseHandler
[542]253
254Public
[551]255 Sub AddMouseDoubleClick(h As MouseHandler)
[542]256 If IsNothing(mouseDoubleClick) Then
257 mouseDoubleClick = h
258 Else
259 mouseDoubleClick += h
260 End If
261 End Sub
[551]262 Sub RemoveMouseDoubleClick(h As MouseHandler)
[542]263 If Not IsNothing(mouseDoubleClick) Then
264 mouseDoubleClick -= h
265 End If
266 End Sub
[551]267Protected
[615]268 Function OnMouseDoubleClick(e As MouseArgs) As Boolean
[542]269 If Not IsNothing(mouseDoubleClick) Then
270 mouseDoubleClick(This, e)
[615]271 Return True
[542]272 End If
[615]273 End Function
[542]274Private
[551]275 mouseDoubleClick As MouseHandler
[542]276
277Public
[551]278 Sub AddMouseUp(h As MouseHandler)
[473]279 If IsNothing(mouseUp) Then
[542]280 mouseUp = h
281 Else
282 mouseUp += h
[473]283 End If
284 End Sub
[551]285 Sub RemoveMouseUp(h As MouseHandler)
[473]286 If Not IsNothing(mouseUp) Then
287 mouseUp -= h
288 End If
289 End Sub
[551]290Protected
[615]291 Function OnMouseUp(e As MouseArgs) As Boolean
[473]292 If Not IsNothing(mouseUp) Then
293 mouseUp(This, e)
[615]294 Return True
[473]295 End If
[615]296 End Function
[473]297Private
[551]298 mouseUp As MouseHandler
[473]299
[542]300Public
[551]301 Sub AddKeyDown(h As KeyHandler)
[542]302 If IsNothing(keyDown) Then
303 keyDown = h
304 Else
305 keyDown += h
306 End If
307 End Sub
[551]308 Sub RemoveKeyDown(h As KeyHandler)
[542]309 If Not IsNothing(keyDown) Then
310 keyDown -= h
311 End If
312 End Sub
[551]313Protected
[615]314 Function OnKeyDown(e As KeyArgs) As Boolean
[542]315 If Not IsNothing(keyDown) Then
316 keyDown(This, e)
[615]317 Return True
[542]318 End If
[615]319 End Function
[542]320Private
[551]321 keyDown As KeyHandler
[542]322
323Public
[551]324 Sub AddKeyUp(h As KeyHandler)
[542]325 If IsNothing(keyUp) Then
326 keyUp = h
327 Else
328 keyUp += h
329 End If
330 End Sub
[551]331 Sub RemoveKeyUp(h As KeyHandler)
[542]332 If Not IsNothing(keyUp) Then
333 keyUp -= h
334 End If
335 End Sub
[551]336Protected
[615]337 Function OnKeyUp(e As KeyArgs) As Boolean
[542]338 If Not IsNothing(keyUp) Then
339 keyUp(This, e)
[615]340 Return True
[542]341 End If
[615]342 End Function
[542]343Private
[551]344 keyUp As KeyHandler
[542]345
346Public
[551]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
[615]360 Function OnKeyPress(e As KeyPressArgs) As Boolean
[551]361 If Not IsNothing(keyPress) Then
362 keyPress(This, e)
[615]363 Return True
[551]364 End If
[615]365 End Function
[551]366Private
367 keyPress As KeyPressHandler
[559]368
[551]369Public
370 Sub AddCreate(h As CreateHandler)
[542]371 If IsNothing(create) Then
372 create = h
373 Else
374 create += h
375 End If
376 End Sub
[551]377 Sub RemoveCreate(h As CreateHandler)
[542]378 If Not IsNothing(create) Then
379 create -= h
380 End If
381 End Sub
[551]382Protected
[615]383 Function OnCreate(e As CreateArgs) As Boolean
[542]384 If Not IsNothing(create) Then
385 create(This, e)
[615]386 Return True
[542]387 End If
[615]388 End Function
[542]389Private
[551]390 create As CreateHandler
[544]391
[551]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
[615]406 Function OnDestroy(e As Args) As Boolean
[551]407 If Not IsNothing(destroy) Then
408 destroy(This, e)
[615]409 Return True
[551]410 End If
[615]411 End Function
[551]412Private
413 destroy As Handler
[559]414
[564]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
[615]429 Function OnPaintBackground(e As PaintBackgroundArgs) As Boolean
[564]430 If Not IsNothing(paintBackground) Then
431 paintBackground(This, e)
[615]432 Return True
[564]433 End If
[615]434 End Function
[564]435Private
436 paintBackground As PaintBackgroundHandler
437
Note: See TracBrowser for help on using the repository browser.