80 |
80 |
81 examples |
81 examples |
82 " |
82 " |
83 get a standard cursor: |
83 get a standard cursor: |
84 |
84 |
85 Cursor wait |
85 Cursor wait |
86 Cursor stop |
86 Cursor stop |
87 Cursor normal |
87 Cursor normal |
88 |
88 |
89 create a custom cursor: |
89 create a custom cursor: |
90 |
90 |
91 Cursor extent:16@16 |
91 Cursor extent:16@16 |
92 fromArray:#[ 2r00000000 2r00000000 |
92 fromArray:#[ 2r00000000 2r00000000 |
93 2r00000000 2r00000000 |
93 2r00000000 2r00000000 |
94 2r00000000 2r00000000 |
94 2r00000000 2r00000000 |
95 2r11111111 2r11111111 |
95 2r11111111 2r11111111 |
96 2r11111111 2r11111111 |
96 2r11111111 2r11111111 |
97 2r00000000 2r00000000 |
97 2r00000000 2r00000000 |
98 2r00000000 2r00000000 |
98 2r00000000 2r00000000 |
99 2r11111111 2r11111111 |
99 2r11111111 2r11111111 |
100 2r11111111 2r11111111 |
100 2r11111111 2r11111111 |
101 2r00000000 2r00000000 |
101 2r00000000 2r00000000 |
102 2r00000000 2r00000000 |
102 2r00000000 2r00000000 |
103 2r11111111 2r11111111 |
103 2r11111111 2r11111111 |
104 2r11111111 2r11111111 |
104 2r11111111 2r11111111 |
105 2r00000000 2r00000000 |
105 2r00000000 2r00000000 |
106 2r00000000 2r00000000 |
106 2r00000000 2r00000000 |
107 2r00000000 2r00000000] |
107 2r00000000 2r00000000] |
108 offset:-8 @ -8 |
108 offset:-8 @ -8 |
109 |
109 |
110 |
110 |
|
111 |
|
112 some common cursors ... |
|
113 [exBegin] |
|
114 |v b cursors nextCursorAction| |
|
115 |
|
116 cursors := OrderedCollection new. |
|
117 cursors add:#arrow. |
|
118 cursors add:#blank. |
|
119 cursors add:#bottomLeft. |
|
120 cursors add:#bottomRight. |
|
121 cursors add:#caret. |
|
122 cursors add:#corner. |
|
123 cursors add:#cross. |
|
124 cursors add:#crossHair. |
|
125 cursors add:#document. |
|
126 cursors add:#down. |
|
127 cursors add:#downLimitArrow. |
|
128 cursors add:#execute. |
|
129 cursors add:#eye. |
|
130 cursors add:#folder. |
|
131 cursors add:#fourWay. |
|
132 cursors add:#hand. |
|
133 cursors add:#left. |
|
134 cursors add:#leftHand. |
|
135 cursors add:#leftLimitArrow. |
|
136 cursors add:#leftRightArrow. |
|
137 cursors add:#marker. |
|
138 cursors add:#normal. |
|
139 cursors add:#origin. |
|
140 cursors add:#questionMark. |
|
141 cursors add:#read. |
|
142 cursors add:#right. |
|
143 cursors add:#rightLimitArrow. |
|
144 cursors add:#stop. |
|
145 cursors add:#text. |
|
146 cursors add:#thumbsDown. |
|
147 cursors add:#thumbsUp. |
|
148 cursors add:#topLeft. |
|
149 cursors add:#topRight. |
|
150 cursors add:#up. |
|
151 cursors add:#upDownArrow. |
|
152 cursors add:#upLeftArrow. |
|
153 cursors add:#upLimitArrow. |
|
154 cursors add:#upRightArrow. |
|
155 cursors add:#upRightHand. |
|
156 cursors add:#wait. |
|
157 cursors add:#write. |
|
158 cursors add:#xMarker. |
|
159 |
|
160 nextCursorAction := [ |
|
161 |sel c| |
|
162 |
|
163 cursors isEmpty ifTrue:[ |
|
164 v close. |
|
165 ] ifFalse:[ |
|
166 sel := cursors removeFirst. |
|
167 c := Cursor perform:sel. |
|
168 b label:sel. |
|
169 b cursor:c. |
|
170 ] |
|
171 ]. |
|
172 |
|
173 v := StandardSystemView extent:100@100. |
|
174 b := Button origin:0.0@0.0 corner:1.0@1.0 in:v. |
|
175 b label:'default'. |
|
176 b action:nextCursorAction. |
|
177 v openAndWait. |
|
178 |
|
179 [exEnd] |
111 |
180 |
112 define a cursor for a view: |
181 define a cursor for a view: |
113 [exBegin] |
182 [exBegin] |
114 |v| |
183 |v| |
115 |
184 |
116 v := StandardSystemView extent:100@100. |
185 v := StandardSystemView extent:100@100. |
117 v cursor:Cursor stop. |
186 v cursor:Cursor stop. |
118 v open. |
187 v open. |
119 [exEnd] |
188 [exEnd] |
120 |
189 |
121 |
190 |
122 with above custom cursor: |
191 with above custom cursor: |
123 [exBegin] |
192 [exBegin] |
124 |v| |
193 |v| |
125 |
194 |
126 v := StandardSystemView extent:100@100. |
195 v := StandardSystemView extent:100@100. |
127 v cursor:( |
196 v cursor:( |
128 Cursor extent:16@16 |
197 Cursor extent:16@16 |
129 fromArray:#[ 2r00000000 2r00000000 |
198 fromArray:#[ 2r00000000 2r00000000 |
130 2r00000000 2r00000000 |
199 2r00000000 2r00000000 |
131 2r00000000 2r00000000 |
200 2r00000000 2r00000000 |
132 2r11111111 2r11111111 |
201 2r11111111 2r11111111 |
133 2r11111111 2r11111111 |
202 2r11111111 2r11111111 |
134 2r00000000 2r00000000 |
203 2r00000000 2r00000000 |
135 2r00000000 2r00000000 |
204 2r00000000 2r00000000 |
136 2r11111111 2r11111111 |
205 2r11111111 2r11111111 |
137 2r11111111 2r11111111 |
206 2r11111111 2r11111111 |
138 2r00000000 2r00000000 |
207 2r00000000 2r00000000 |
139 2r00000000 2r00000000 |
208 2r00000000 2r00000000 |
140 2r11111111 2r11111111 |
209 2r11111111 2r11111111 |
141 2r11111111 2r11111111 |
210 2r11111111 2r11111111 |
142 2r00000000 2r00000000 |
211 2r00000000 2r00000000 |
143 2r00000000 2r00000000 |
212 2r00000000 2r00000000 |
144 2r00000000 2r00000000] |
213 2r00000000 2r00000000] |
145 offset:-8 @ -8). |
214 offset:-8 @ -8). |
146 v open. |
215 v open. |
147 [exEnd] |
216 [exEnd] |
148 |
217 |
149 |
218 |
150 a custom cursor with mask: |
219 a custom cursor with mask: |
151 [exBegin] |
220 [exBegin] |
152 |v| |
221 |v| |
153 |
222 |
154 v := StandardSystemView extent:100@100. |
223 v := StandardSystemView extent:100@100. |
155 v cursor:( |
224 v cursor:( |
156 Cursor |
225 Cursor |
157 extent:16@16 |
226 extent:16@16 |
158 sourceArray:#[ |
227 sourceArray:#[ |
159 2r00000000 2r00000000 |
228 2r00000000 2r00000000 |
160 2r00000000 2r00000000 |
229 2r00000000 2r00000000 |
161 2r00000000 2r00000000 |
230 2r00000000 2r00000000 |
162 2r11111111 2r11111111 |
231 2r11111111 2r11111111 |
163 2r11111111 2r11111111 |
232 2r11111111 2r11111111 |
164 2r00000000 2r00000000 |
233 2r00000000 2r00000000 |
165 2r00000000 2r00000000 |
234 2r00000000 2r00000000 |
166 2r00000000 2r00000000 |
235 2r00000000 2r00000000 |
167 2r00000000 2r00000000 |
236 2r00000000 2r00000000 |
168 2r00000000 2r00000000 |
237 2r00000000 2r00000000 |
169 2r00000000 2r00000000 |
238 2r00000000 2r00000000 |
170 2r11111111 2r11111111 |
239 2r11111111 2r11111111 |
171 2r11111111 2r11111111 |
240 2r11111111 2r11111111 |
172 2r00000000 2r00000000 |
241 2r00000000 2r00000000 |
173 2r00000000 2r00000000 |
242 2r00000000 2r00000000 |
174 2r00000000 2r00000000] |
243 2r00000000 2r00000000] |
175 maskArray:#[ |
244 maskArray:#[ |
176 2r00000000 2r00000000 |
245 2r00000000 2r00000000 |
177 2r00000000 2r00000000 |
246 2r00000000 2r00000000 |
178 2r11111111 2r11111111 |
247 2r11111111 2r11111111 |
179 2r11111111 2r11111111 |
248 2r11111111 2r11111111 |
180 2r11111111 2r11111111 |
249 2r11111111 2r11111111 |
181 2r11111111 2r11111111 |
250 2r11111111 2r11111111 |
182 2r00000000 2r00000000 |
251 2r00000000 2r00000000 |
183 2r00000000 2r00000000 |
252 2r00000000 2r00000000 |
184 2r00000000 2r00000000 |
253 2r00000000 2r00000000 |
185 2r00000000 2r00000000 |
254 2r00000000 2r00000000 |
186 2r11111111 2r11111111 |
255 2r11111111 2r11111111 |
187 2r11111111 2r11111111 |
256 2r11111111 2r11111111 |
188 2r11111111 2r11111111 |
257 2r11111111 2r11111111 |
189 2r11111111 2r11111111 |
258 2r11111111 2r11111111 |
190 2r00000000 2r00000000 |
259 2r00000000 2r00000000 |
191 2r00000000 2r00000000] |
260 2r00000000 2r00000000] |
192 offset:-8 @ -8). |
261 offset:-8 @ -8). |
193 v open. |
262 v open. |
194 [exEnd] |
263 [exEnd] |
195 |
264 |
196 |
265 |
197 a cursor from an image read from a file: |
266 a cursor from an image read from a file: |
198 [exBegin] |
267 [exBegin] |
199 |v img| |
268 |v img| |
200 |
269 |
201 v := StandardSystemView extent:100@100. |
270 v := StandardSystemView extent:100@100. |
202 img := Image fromFile:'bitmaps/xpmBitmaps/cursors/mouse.xpm'. |
271 img := Image fromFile:'bitmaps/xpmBitmaps/cursors/mouse.xpm'. |
203 v cursor:(Cursor fromImage:img). |
272 v cursor:(Cursor fromImage:img). |
204 v open. |
273 v open. |
205 [exEnd] |
274 [exEnd] |
206 |
275 |
207 |
276 |
208 with multiple views: |
277 with multiple views: |
209 [exBegin] |
278 [exBegin] |
210 |v1 v2 top| |
279 |v1 v2 top| |
211 |
280 |
212 top := StandardSystemView new. |
281 top := StandardSystemView new. |
213 top extent:300@300. |
282 top extent:300@300. |
214 v1 := View origin:0.0@0.0 corner:1.0@0.5 in:top. |
283 v1 := View origin:0.0@0.0 corner:1.0@0.5 in:top. |
215 v1 viewBackground:(Color grey:75). |
284 v1 viewBackground:(Color grey:75). |
216 v1 cursor:Cursor thumbsUp. |
285 v1 cursor:Cursor thumbsUp. |
217 v2 := View origin:0.0@0.5 corner:1.0@1.0 in:top. |
286 v2 := View origin:0.0@0.5 corner:1.0@1.0 in:top. |
218 v2 viewBackground:(Color white). |
287 v2 viewBackground:(Color white). |
219 v2 cursor:Cursor wait. |
288 v2 cursor:Cursor wait. |
220 top open. |
289 top open. |
221 [exEnd] |
290 [exEnd] |
222 |
291 |
223 |
292 |
224 show a cursor (in the active ST/X view) for a while: |
293 show a cursor (in the active ST/X view) for a while: |
225 [exBegin] |
294 [exBegin] |
226 |
295 |
227 Cursor wait |
296 Cursor wait |
228 showWhile:[ |
297 showWhile:[ |
229 Delay waitForSeconds:5 |
298 Delay waitForSeconds:5 |
230 ] |
299 ] |
231 [exEnd] |
300 [exEnd] |
232 |
301 |
233 |
302 |
234 show a cursor in all views belonging to a windowGroup: |
303 show a cursor in all views belonging to a windowGroup: |
235 (have to wait until top is visible to access windowGroup) |
304 (have to wait until top is visible to access windowGroup) |
236 [exBegin] |
305 [exBegin] |
237 |v1 v2 top| |
306 |v1 v2 top| |
238 |
307 |
239 top := StandardSystemView new. |
308 top := StandardSystemView new. |
240 top extent:300@300. |
309 top extent:300@300. |
241 v1 := View origin:0.0@0.0 corner:1.0@0.5 in:top. |
310 v1 := View origin:0.0@0.0 corner:1.0@0.5 in:top. |
242 v1 viewBackground:(Color grey:75). |
311 v1 viewBackground:(Color grey:75). |
243 v1 cursor:(Cursor normal). |
312 v1 cursor:(Cursor normal). |
244 |
313 |
245 v2 := View origin:0.0@0.5 corner:1.0@1.0 in:top. |
314 v2 := View origin:0.0@0.5 corner:1.0@1.0 in:top. |
246 v2 viewBackground:(Color white). |
315 v2 viewBackground:(Color white). |
247 v2 cursor:(Cursor crossHair). |
316 v2 cursor:(Cursor crossHair). |
248 top openAndWait. |
317 top openAndWait. |
249 |
318 |
250 Delay waitForSeconds:3. |
319 Delay waitForSeconds:3. |
251 |
320 |
252 top windowGroup |
321 top windowGroup |
253 withCursor:Cursor wait |
322 withCursor:Cursor wait |
254 do:[ |
323 do:[ |
255 Delay waitForSeconds:5 |
324 Delay waitForSeconds:5 |
256 ] |
325 ] |
257 [exEnd] |
326 [exEnd] |
258 |
327 |
259 |
328 |
260 show a cursor in a single view for a while: |
329 show a cursor in a single view for a while: |
261 [exBegin] |
330 [exBegin] |
262 |v1 v2 top| |
331 |v1 v2 top| |
263 |
332 |
264 top := StandardSystemView new. |
333 top := StandardSystemView new. |
265 top extent:300@300. |
334 top extent:300@300. |
266 v1 := View origin:0.0@0.0 corner:1.0@0.5 in:top. |
335 v1 := View origin:0.0@0.0 corner:1.0@0.5 in:top. |
267 v1 viewBackground:(Color grey:75). |
336 v1 viewBackground:(Color grey:75). |
268 v1 cursor:(Cursor normal). |
337 v1 cursor:(Cursor normal). |
269 |
338 |
270 v2 := View origin:0.0@0.5 corner:1.0@1.0 in:top. |
339 v2 := View origin:0.0@0.5 corner:1.0@1.0 in:top. |
271 v2 viewBackground:(Color white). |
340 v2 viewBackground:(Color white). |
272 v2 cursor:(Cursor crossHair). |
341 v2 cursor:(Cursor crossHair). |
273 |
342 |
274 top openAndWait. |
343 top openAndWait. |
275 |
344 |
276 Delay waitForSeconds:3. |
345 Delay waitForSeconds:3. |
277 |
346 |
278 v1 withCursor:Cursor wait |
347 v1 withCursor:Cursor wait |
279 do:[ |
348 do:[ |
280 Delay waitForSeconds:5 |
349 Delay waitForSeconds:5 |
281 ] |
350 ] |
282 [exEnd] |
351 [exEnd] |
283 " |
352 " |
284 ! ! |
353 ! ! |
285 |
354 |
286 !Cursor class methodsFor:'initialization'! |
355 !Cursor class methodsFor:'initialization'! |
287 |
356 |