added example showing all standard cursors
authorClaus Gittinger <cg@exept.de>
Mon, 28 Sep 1998 14:08:43 +0200
changeset 2372 e84fd06f8d2d
parent 2371 fafba97d401c
child 2373 0ac9abce2387
added example showing all standard cursors
Cursor.st
--- a/Cursor.st	Mon Sep 28 13:51:43 1998 +0200
+++ b/Cursor.st	Mon Sep 28 14:08:43 1998 +0200
@@ -82,204 +82,273 @@
 "
     get a standard cursor:
 
-	Cursor wait
-	Cursor stop
-	Cursor normal
+        Cursor wait
+        Cursor stop
+        Cursor normal
 
     create a custom cursor:
 
-	Cursor extent:16@16 
-	       fromArray:#[ 2r00000000 2r00000000
-			    2r00000000 2r00000000
-			    2r00000000 2r00000000
-			    2r11111111 2r11111111
-			    2r11111111 2r11111111
-			    2r00000000 2r00000000
-			    2r00000000 2r00000000
-			    2r11111111 2r11111111
-			    2r11111111 2r11111111
-			    2r00000000 2r00000000
-			    2r00000000 2r00000000
-			    2r11111111 2r11111111
-			    2r11111111 2r11111111
-			    2r00000000 2r00000000
-			    2r00000000 2r00000000
-			    2r00000000 2r00000000]
-		offset:-8 @ -8   
-
-
+        Cursor extent:16@16 
+               fromArray:#[ 2r00000000 2r00000000
+                            2r00000000 2r00000000
+                            2r00000000 2r00000000
+                            2r11111111 2r11111111
+                            2r11111111 2r11111111
+                            2r00000000 2r00000000
+                            2r00000000 2r00000000
+                            2r11111111 2r11111111
+                            2r11111111 2r11111111
+                            2r00000000 2r00000000
+                            2r00000000 2r00000000
+                            2r11111111 2r11111111
+                            2r11111111 2r11111111
+                            2r00000000 2r00000000
+                            2r00000000 2r00000000
+                            2r00000000 2r00000000]
+                offset:-8 @ -8   
+
+
+
+    some common cursors ...
+                                                                        [exBegin]
+        |v b cursors nextCursorAction|
+
+        cursors := OrderedCollection new.
+        cursors add:#arrow.
+        cursors add:#blank.
+        cursors add:#bottomLeft.
+        cursors add:#bottomRight.
+        cursors add:#caret.
+        cursors add:#corner.
+        cursors add:#cross.
+        cursors add:#crossHair.
+        cursors add:#document.
+        cursors add:#down.
+        cursors add:#downLimitArrow.
+        cursors add:#execute.
+        cursors add:#eye.
+        cursors add:#folder.
+        cursors add:#fourWay.
+        cursors add:#hand.
+        cursors add:#left.
+        cursors add:#leftHand.
+        cursors add:#leftLimitArrow.
+        cursors add:#leftRightArrow.
+        cursors add:#marker.
+        cursors add:#normal.
+        cursors add:#origin.
+        cursors add:#questionMark.
+        cursors add:#read.
+        cursors add:#right.
+        cursors add:#rightLimitArrow.
+        cursors add:#stop.
+        cursors add:#text.
+        cursors add:#thumbsDown.
+        cursors add:#thumbsUp.
+        cursors add:#topLeft.
+        cursors add:#topRight.
+        cursors add:#up.
+        cursors add:#upDownArrow.
+        cursors add:#upLeftArrow.
+        cursors add:#upLimitArrow.
+        cursors add:#upRightArrow.
+        cursors add:#upRightHand.
+        cursors add:#wait.
+        cursors add:#write.
+        cursors add:#xMarker.
+
+        nextCursorAction := [
+            |sel c|
+
+            cursors isEmpty ifTrue:[
+                v close.
+            ] ifFalse:[
+                sel := cursors removeFirst.
+                c := Cursor perform:sel.
+                b label:sel.
+                b cursor:c.
+            ]
+        ].
+
+        v := StandardSystemView extent:100@100.
+        b := Button origin:0.0@0.0 corner:1.0@1.0 in:v.
+        b label:'default'.
+        b action:nextCursorAction.
+        v openAndWait.
+
+                                                                        [exEnd]
 
     define a cursor for a view:
-									[exBegin]
-	|v|
-
-	v := StandardSystemView extent:100@100.
-	v cursor:Cursor stop.
-	v open.
-									[exEnd]
+                                                                        [exBegin]
+        |v|
+
+        v := StandardSystemView extent:100@100.
+        v cursor:Cursor stop.
+        v open.
+                                                                        [exEnd]
 
 
       with above custom cursor:
-									[exBegin]
-	|v|
-
-	v := StandardSystemView extent:100@100.
-	v cursor:(
-	    Cursor extent:16@16 
-	       fromArray:#[ 2r00000000 2r00000000
-			    2r00000000 2r00000000
-			    2r00000000 2r00000000
-			    2r11111111 2r11111111
-			    2r11111111 2r11111111
-			    2r00000000 2r00000000
-			    2r00000000 2r00000000
-			    2r11111111 2r11111111
-			    2r11111111 2r11111111
-			    2r00000000 2r00000000
-			    2r00000000 2r00000000
-			    2r11111111 2r11111111
-			    2r11111111 2r11111111
-			    2r00000000 2r00000000
-			    2r00000000 2r00000000
-			    2r00000000 2r00000000]
-		offset:-8 @ -8).   
-	v open.
-									[exEnd]
+                                                                        [exBegin]
+        |v|
+
+        v := StandardSystemView extent:100@100.
+        v cursor:(
+            Cursor extent:16@16 
+               fromArray:#[ 2r00000000 2r00000000
+                            2r00000000 2r00000000
+                            2r00000000 2r00000000
+                            2r11111111 2r11111111
+                            2r11111111 2r11111111
+                            2r00000000 2r00000000
+                            2r00000000 2r00000000
+                            2r11111111 2r11111111
+                            2r11111111 2r11111111
+                            2r00000000 2r00000000
+                            2r00000000 2r00000000
+                            2r11111111 2r11111111
+                            2r11111111 2r11111111
+                            2r00000000 2r00000000
+                            2r00000000 2r00000000
+                            2r00000000 2r00000000]
+                offset:-8 @ -8).   
+        v open.
+                                                                        [exEnd]
 
 
       a custom cursor with mask:
-									[exBegin]
-	|v|
-
-	v := StandardSystemView extent:100@100.
-	v cursor:(
-	    Cursor 
-	       extent:16@16 
-	       sourceArray:#[ 
-			    2r00000000 2r00000000
-			    2r00000000 2r00000000
-			    2r00000000 2r00000000
-			    2r11111111 2r11111111
-			    2r11111111 2r11111111
-			    2r00000000 2r00000000
-			    2r00000000 2r00000000
-			    2r00000000 2r00000000
-			    2r00000000 2r00000000
-			    2r00000000 2r00000000
-			    2r00000000 2r00000000
-			    2r11111111 2r11111111
-			    2r11111111 2r11111111
-			    2r00000000 2r00000000
-			    2r00000000 2r00000000
-			    2r00000000 2r00000000]
-	       maskArray:#[ 
-			    2r00000000 2r00000000
-			    2r00000000 2r00000000
-			    2r11111111 2r11111111
-			    2r11111111 2r11111111
-			    2r11111111 2r11111111
-			    2r11111111 2r11111111
-			    2r00000000 2r00000000
-			    2r00000000 2r00000000
-			    2r00000000 2r00000000
-			    2r00000000 2r00000000
-			    2r11111111 2r11111111
-			    2r11111111 2r11111111
-			    2r11111111 2r11111111
-			    2r11111111 2r11111111
-			    2r00000000 2r00000000
-			    2r00000000 2r00000000]
-		offset:-8 @ -8).   
-	v open.
-									[exEnd]
+                                                                        [exBegin]
+        |v|
+
+        v := StandardSystemView extent:100@100.
+        v cursor:(
+            Cursor 
+               extent:16@16 
+               sourceArray:#[ 
+                            2r00000000 2r00000000
+                            2r00000000 2r00000000
+                            2r00000000 2r00000000
+                            2r11111111 2r11111111
+                            2r11111111 2r11111111
+                            2r00000000 2r00000000
+                            2r00000000 2r00000000
+                            2r00000000 2r00000000
+                            2r00000000 2r00000000
+                            2r00000000 2r00000000
+                            2r00000000 2r00000000
+                            2r11111111 2r11111111
+                            2r11111111 2r11111111
+                            2r00000000 2r00000000
+                            2r00000000 2r00000000
+                            2r00000000 2r00000000]
+               maskArray:#[ 
+                            2r00000000 2r00000000
+                            2r00000000 2r00000000
+                            2r11111111 2r11111111
+                            2r11111111 2r11111111
+                            2r11111111 2r11111111
+                            2r11111111 2r11111111
+                            2r00000000 2r00000000
+                            2r00000000 2r00000000
+                            2r00000000 2r00000000
+                            2r00000000 2r00000000
+                            2r11111111 2r11111111
+                            2r11111111 2r11111111
+                            2r11111111 2r11111111
+                            2r11111111 2r11111111
+                            2r00000000 2r00000000
+                            2r00000000 2r00000000]
+                offset:-8 @ -8).   
+        v open.
+                                                                        [exEnd]
 
 
       a cursor from an image read from a file:
-									[exBegin]
-	|v img|
-
-	v := StandardSystemView extent:100@100.
-	img := Image fromFile:'bitmaps/xpmBitmaps/cursors/mouse.xpm'.
-	v cursor:(Cursor fromImage:img).
-	v open.
-									[exEnd]
+                                                                        [exBegin]
+        |v img|
+
+        v := StandardSystemView extent:100@100.
+        img := Image fromFile:'bitmaps/xpmBitmaps/cursors/mouse.xpm'.
+        v cursor:(Cursor fromImage:img).
+        v open.
+                                                                        [exEnd]
 
 
       with multiple views:
-									[exBegin]
-	|v1 v2 top|
-
-	top := StandardSystemView new.
-	top extent:300@300.
-	v1 := View origin:0.0@0.0 corner:1.0@0.5 in:top.
-	v1 viewBackground:(Color grey:75).
-	v1 cursor:Cursor thumbsUp.
-	v2 := View origin:0.0@0.5 corner:1.0@1.0 in:top.
-	v2 viewBackground:(Color white).
-	v2 cursor:Cursor wait.
-	top open.
-									[exEnd]
+                                                                        [exBegin]
+        |v1 v2 top|
+
+        top := StandardSystemView new.
+        top extent:300@300.
+        v1 := View origin:0.0@0.0 corner:1.0@0.5 in:top.
+        v1 viewBackground:(Color grey:75).
+        v1 cursor:Cursor thumbsUp.
+        v2 := View origin:0.0@0.5 corner:1.0@1.0 in:top.
+        v2 viewBackground:(Color white).
+        v2 cursor:Cursor wait.
+        top open.
+                                                                        [exEnd]
 
 
     show a cursor (in the active ST/X view) for a while:
-									[exBegin]
-
-	Cursor wait 
-	    showWhile:[
-		Delay waitForSeconds:5
-	    ]
-									[exEnd]
+                                                                        [exBegin]
+
+        Cursor wait 
+            showWhile:[
+                Delay waitForSeconds:5
+            ]
+                                                                        [exEnd]
 
 
     show a cursor in all views belonging to a windowGroup:
     (have to wait until top is visible to access windowGroup)
-									[exBegin]
-	|v1 v2 top|
-
-	top := StandardSystemView new.
-	top extent:300@300.
-	v1 := View origin:0.0@0.0 corner:1.0@0.5 in:top.
-	v1 viewBackground:(Color grey:75).
-	v1 cursor:(Cursor normal).
-
-	v2 := View origin:0.0@0.5 corner:1.0@1.0 in:top.
-	v2 viewBackground:(Color white).
-	v2 cursor:(Cursor crossHair).
-	top openAndWait.
-
-	Delay waitForSeconds:3.
-
-	top windowGroup
-	    withCursor:Cursor wait 
-	    do:[
-		  Delay waitForSeconds:5
-	       ]
-									[exEnd]
+                                                                        [exBegin]
+        |v1 v2 top|
+
+        top := StandardSystemView new.
+        top extent:300@300.
+        v1 := View origin:0.0@0.0 corner:1.0@0.5 in:top.
+        v1 viewBackground:(Color grey:75).
+        v1 cursor:(Cursor normal).
+
+        v2 := View origin:0.0@0.5 corner:1.0@1.0 in:top.
+        v2 viewBackground:(Color white).
+        v2 cursor:(Cursor crossHair).
+        top openAndWait.
+
+        Delay waitForSeconds:3.
+
+        top windowGroup
+            withCursor:Cursor wait 
+            do:[
+                  Delay waitForSeconds:5
+               ]
+                                                                        [exEnd]
 
 
     show a cursor in a single view for a while:
-									[exBegin]
-	|v1 v2 top|
-
-	top := StandardSystemView new.
-	top extent:300@300.
-	v1 := View origin:0.0@0.0 corner:1.0@0.5 in:top.
-	v1 viewBackground:(Color grey:75).
-	v1 cursor:(Cursor normal).
-
-	v2 := View origin:0.0@0.5 corner:1.0@1.0 in:top.
-	v2 viewBackground:(Color white).
-	v2 cursor:(Cursor crossHair).
-
-	top openAndWait.
-
-	Delay waitForSeconds:3.
-
-	v1 withCursor:Cursor wait 
-	   do:[
-		  Delay waitForSeconds:5
-	      ]
-									[exEnd]
+                                                                        [exBegin]
+        |v1 v2 top|
+
+        top := StandardSystemView new.
+        top extent:300@300.
+        v1 := View origin:0.0@0.0 corner:1.0@0.5 in:top.
+        v1 viewBackground:(Color grey:75).
+        v1 cursor:(Cursor normal).
+
+        v2 := View origin:0.0@0.5 corner:1.0@1.0 in:top.
+        v2 viewBackground:(Color white).
+        v2 cursor:(Cursor crossHair).
+
+        top openAndWait.
+
+        Delay waitForSeconds:3.
+
+        v1 withCursor:Cursor wait 
+           do:[
+                  Delay waitForSeconds:5
+              ]
+                                                                        [exEnd]
 "
 ! !
 
@@ -2483,12 +2552,11 @@
     |wg|
 
     (wg := WindowGroup activeGroup) notNil ifTrue:[
-	^ wg withCursor:self do:aBlock
-    ] ifFalse:[
-	aBlock value
-    ]
-
-    "Modified: 13.1.1997 / 20:10:25 / cg"
+        ^ wg withCursor:self do:aBlock
+    ].
+    ^ aBlock value
+
+    "Modified: / 28.9.1998 / 12:56:59 / cg"
 ! !
 
 !Cursor methodsFor:'accessing'!
@@ -2790,6 +2858,6 @@
 !Cursor class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Cursor.st,v 1.61 1998-09-28 09:27:16 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Cursor.st,v 1.62 1998-09-28 12:08:43 cg Exp $'
 ! !
 Cursor initialize!