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

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

Controlをデリゲートベースにした。DictionaryのContainsKeyとTryGetValueを実装。デリゲートの追加・削除の右辺にNothingを指定可能にした。

File size: 6.4 KB
Line 
1
2Public
3 Sub AddPaintDC(h As PaintDCEventHandler)
4 If IsNothing(paintDC) Then
5 paintDC = h
6 Else
7 paintDC += h
8 End If
9 End Sub
10 Sub RemovePaintDC(h As PaintDCEventHandler)
11 If Not IsNothing(paintDC) Then
12 paintDC -= h
13 End If
14 End Sub
15Private
16 Sub OnPaintDC(e As PaintDCEventArgs)
17 If Not IsNothing(paintDC) Then
18 paintDC(This, e)
19 End If
20 End Sub
21Private
22 paintDC As PaintDCEventHandler
23
24Public
25 Sub AddClick(h As System.EventHandler)
26 If IsNothing(click) Then
27 click = h
28 Else
29 click += h
30 End If
31 End Sub
32 Sub RemoveClick(h As System.EventHandler)
33 If Not IsNothing(click) Then
34 click -= h
35 End If
36 End Sub
37Private
38 Sub OnClick(e As System.EventArgs)
39 If Not IsNothing(click) Then
40 click(This, e)
41 End If
42 End Sub
43Private
44 click As System.EventHandler
45
46Public
47 Sub AddDoubleClick(h As System.EventHandler)
48 If IsNothing(doubleClick) Then
49 doubleClick = h
50 Else
51 doubleClick += h
52 End If
53 End Sub
54 Sub RemoveDoubleClick(h As System.EventHandler)
55 If Not IsNothing(doubleClick) Then
56 doubleClick -= h
57 End If
58 End Sub
59Private
60 Sub OnDoubleClick(e As System.EventArgs)
61 If Not IsNothing(doubleClick) Then
62 doubleClick(This, e)
63 End If
64 End Sub
65Private
66 doubleClick As System.EventHandler
67
68Public
69 Sub AddMouseEnter(h As MouseEventHandler)
70 If IsNothing(mouseEnter) Then
71 mouseEnter = h
72 Else
73 mouseEnter += h
74 End If
75 End Sub
76 Sub RemoveMouseEnter(h As MouseEventHandler)
77 If Not IsNothing(mouseEnter) Then
78 mouseEnter -= h
79 End If
80 End Sub
81Private
82 Sub OnMouseEnter(e As MouseEventArgs)
83 If Not IsNothing(mouseEnter) Then
84 mouseEnter(This, e)
85 End If
86 End Sub
87Private
88 mouseEnter As MouseEventHandler
89
90Public
91 Sub AddMouseMove(h As MouseEventHandler)
92 If IsNothing(mouseMove) Then
93 mouseMove = h
94 Else
95 mouseMove += h
96 End If
97 End Sub
98 Sub RemoveMouseMove(h As MouseEventHandler)
99 If Not IsNothing(mouseMove) Then
100 mouseMove -= h
101 End If
102 End Sub
103Private
104 Sub OnMouseMove(e As MouseEventArgs)
105 If Not IsNothing(mouseMove) Then
106 mouseMove(This, e)
107 End If
108 End Sub
109Private
110 mouseMove As MouseEventHandler
111
112Public
113 Sub AddMouseHover(h As MouseEventHandler)
114 If IsNothing(mouseHover) Then
115 mouseHover = h
116 Else
117 mouseHover += h
118 End If
119 End Sub
120 Sub RemoveMouseHover(h As MouseEventHandler)
121 If Not IsNothing(mouseHover) Then
122 mouseHover -= h
123 End If
124 End Sub
125Private
126 Sub OnMouseHover(e As MouseEventArgs)
127 If Not IsNothing(mouseHover) Then
128 mouseHover(This, e)
129 End If
130 End Sub
131Private
132 mouseHover As MouseEventHandler
133
134Public
135 Sub AddMouseLeave(h As MouseEventHandler)
136 If IsNothing(mouseLeave) Then
137 mouseLeave = h
138 Else
139 mouseLeave += h
140 End If
141 End Sub
142 Sub RemoveMouseLeave(h As MouseEventHandler)
143 If Not IsNothing(mouseLeave) Then
144 mouseLeave -= h
145 End If
146 End Sub
147Private
148 Sub OnMouseLeave(e As MouseEventArgs)
149 If Not IsNothing(mouseLeave) Then
150 mouseLeave(This, e)
151 End If
152 End Sub
153Private
154 mouseLeave As MouseEventHandler
155
156Public
157 Sub AddMouseDown(h As MouseEventHandler)
158 If IsNothing(mouseDown) Then
159 mouseDown = h
160 Else
161 mouseDown += h
162 End If
163 End Sub
164 Sub RemoveMouseDown(h As MouseEventHandler)
165 If Not IsNothing(mouseDown) Then
166 mouseDown -= h
167 End If
168 End Sub
169Private
170 Sub OnMouseDown(e As MouseEventArgs)
171 If Not IsNothing(mouseDown) Then
172 mouseDown(This, e)
173 End If
174 End Sub
175Private
176 mouseDown As MouseEventHandler
177
178Public
179 Sub AddMouseClick(h As MouseEventHandler)
180 If IsNothing(mouseClick) Then
181 mouseClick = h
182 Else
183 mouseClick += h
184 End If
185 End Sub
186 Sub RemoveMouseClick(h As MouseEventHandler)
187 If Not IsNothing(mouseClick) Then
188 mouseClick -= h
189 End If
190 End Sub
191Private
192 Sub OnMouseClick(e As MouseEventArgs)
193 If Not IsNothing(mouseClick) Then
194 mouseClick(This, e)
195 End If
196 End Sub
197Private
198 mouseClick As MouseEventHandler
199
200Public
201 Sub AddMouseDoubleClick(h As MouseEventHandler)
202 If IsNothing(mouseDoubleClick) Then
203 mouseDoubleClick = h
204 Else
205 mouseDoubleClick += h
206 End If
207 End Sub
208 Sub RemoveMouseDoubleClick(h As MouseEventHandler)
209 If Not IsNothing(mouseDoubleClick) Then
210 mouseDoubleClick -= h
211 End If
212 End Sub
213Private
214 Sub OnMouseDoubleClick(e As MouseEventArgs)
215 If Not IsNothing(mouseDoubleClick) Then
216 mouseDoubleClick(This, e)
217 End If
218 End Sub
219Private
220 mouseDoubleClick As MouseEventHandler
221
222Public
223 Sub AddMouseUp(h As MouseEventHandler)
224 If IsNothing(mouseUp) Then
225 mouseUp = h
226 Else
227 mouseUp += h
228 End If
229 End Sub
230 Sub RemoveMouseUp(h As MouseEventHandler)
231 If Not IsNothing(mouseUp) Then
232 mouseUp -= h
233 End If
234 End Sub
235Private
236 Sub OnMouseUp(e As MouseEventArgs)
237 If Not IsNothing(mouseUp) Then
238 mouseUp(This, e)
239 End If
240 End Sub
241Private
242 mouseUp As MouseEventHandler
243
244Public
245 Sub AddKeyDown(h As KeyEventHandler)
246 If IsNothing(keyDown) Then
247 keyDown = h
248 Else
249 keyDown += h
250 End If
251 End Sub
252 Sub RemoveKeyDown(h As KeyEventHandler)
253 If Not IsNothing(keyDown) Then
254 keyDown -= h
255 End If
256 End Sub
257Private
258 Sub OnKeyDown(e As KeyEventArgs)
259 If Not IsNothing(keyDown) Then
260 keyDown(This, e)
261 End If
262 End Sub
263Private
264 keyDown As KeyEventHandler
265
266Public
267 Sub AddKeyUp(h As KeyEventHandler)
268 If IsNothing(keyUp) Then
269 keyUp = h
270 Else
271 keyUp += h
272 End If
273 End Sub
274 Sub RemoveKeyUp(h As KeyEventHandler)
275 If Not IsNothing(keyUp) Then
276 keyUp -= h
277 End If
278 End Sub
279Private
280 Sub OnKeyUp(e As KeyEventArgs)
281 If Not IsNothing(keyUp) Then
282 keyUp(This, e)
283 End If
284 End Sub
285Private
286 keyUp As KeyEventHandler
287/*
288Public
289 Sub AddKeyPress(h As KeyPressEventHandler)
290 If IsNothing(keyPress) Then
291 keyPress = h
292 Else
293 keyPress += h
294 End If
295 End Sub
296 Sub RemoveKeyPress(h As KeyPressEventHandler)
297 If Not IsNothing(keyPress) Then
298 keyPress -= h
299 End If
300 End Sub
301Private
302 Sub OnKeyPress(e As KeyPressEventArgs)
303 If Not IsNothing(keyPress) Then
304 keyPress(This, e)
305 End If
306 End Sub
307Private
308 keyPress As KeyPressEventHandler
309
310Public
311 Sub AddCreate(h As CreateEventHandler)
312 If IsNothing(create) Then
313 create = h
314 Else
315 create += h
316 End If
317 End Sub
318 Sub RemoveCreate(h As CreateEventHandler)
319 If Not IsNothing(create) Then
320 create -= h
321 End If
322 End Sub
323Private
324 Sub OnCreate(e As CreateEventArgs)
325 If Not IsNothing(create) Then
326 create(This, e)
327 End If
328 End Sub
329Private
330 create As CreateEventHandler
331*/
Note: See TracBrowser for help on using the repository browser.