icon masks
authorClaus Gittinger <cg@exept.de>
Fri, 04 Apr 1997 16:39:17 +0200
changeset 1538 2c9c73a04908
parent 1537 16265a27165d
child 1539 fcd8fc807c0c
icon masks
StandardSystemView.st
StdSysV.st
--- a/StandardSystemView.st	Fri Apr 04 16:37:04 1997 +0200
+++ b/StandardSystemView.st	Fri Apr 04 16:39:17 1997 +0200
@@ -11,8 +11,8 @@
 "
 
 TopView subclass:#StandardSystemView
-	instanceVariableNames:'label icon iconView iconLabel minExtent maxExtent sizeFixed
-		application windowEventsForApplication'
+	instanceVariableNames:'label icon iconMask iconView iconLabel minExtent maxExtent
+		sizeFixed application windowEventsForApplication'
 	classVariableNames:'DefaultIcon TakeFocusWhenMapped IncludeHostNameInLabel'
 	poolDictionaries:''
 	category:'Views-Basic'
@@ -590,22 +590,25 @@
     ^ icon
 !
 
-icon:aForm
-    "define the form (bitmap) used as icon"
+icon:aFormOrImage
+    "define the form or image (bitmap) used as icon"
 
-    |invertedIcon i|
+    |i m|
 
-    icon := aForm.
+    icon := aFormOrImage.
     icon notNil ifTrue:[
         drawableId notNil ifTrue:[
             i := self convertedIcon:icon.
             (i notNil and:[i id notNil]) ifTrue:[
-                device setWindowIcon:i in:drawableId
+                (m := icon mask) notNil ifTrue:[
+                    m := self convertedIconMask:m.
+                ].
+                device setWindowIcon:i mask:m in:drawableId
             ]
         ]
     ]
 
-    "Modified: 10.6.1996 / 20:15:36 / cg"
+    "Modified: 4.4.1997 / 16:20:52 / cg"
 !
 
 iconLabel
@@ -637,12 +640,14 @@
 
     "/ only images possibly have iconMasks
     icon notNil ifTrue:[
-	(mask := icon mask) notNil ifTrue:[
-	    ^ self convertedIconMask:mask
-	]
+        (mask := icon mask) notNil ifTrue:[
+            ^ self convertedIconMask:mask
+        ]
     ].
 
     ^ nil
+
+    "Modified: 4.4.1997 / 16:39:00 / cg"
 !
 
 iconName:aString
@@ -658,7 +663,8 @@
 !
 
 iconView:aView
-    "specify the view to be used as icon"
+    "specify the view to be used as icon.
+     This may not be supported on all display types"
 
     iconView := aView.
     drawableId notNil ifTrue:[
@@ -667,7 +673,7 @@
         aView setRealized:true.
     ]
 
-    "Modified: 24.4.1996 / 10:30:12 / cg"
+    "Modified: 4.4.1997 / 16:21:37 / cg"
 !
 
 label
@@ -1195,7 +1201,7 @@
 physicalCreate
     "common code for create & recreate"
 
-    |l icn|
+    |l icn icnMask|
 
     IncludeHostNameInLabel == true ifTrue:[
         l := OperatingSystem getHostName , ': ' , label.
@@ -1204,9 +1210,12 @@
     ].
 
     icn := self convertedIcon:icon.
+    (icnMask := icon mask) notNil ifTrue:[
+        icnMask := self convertedIconMask:icnMask
+    ].
     drawableId := device 
                       createWindowFor:self 
-		      type:nil
+                      type:nil
                       origin:(left @ top)
                       extent:(width @ height)
                       minExtent:minExtent
@@ -1217,7 +1226,7 @@
                       inputOnly:(self isInputOnly)
                       label:l
                       cursor:cursor
-                      icon:icn iconMask:nil
+                      icon:icn iconMask:icnMask
                       iconView:iconView.
 
     Lobby registerChange:self.
@@ -1251,7 +1260,7 @@
     device setWindowClass:('Stx', self className) name:name in:drawableId.
 
     "Modified: 14.6.1996 / 17:14:25 / stefan"
-    "Modified: 28.2.1997 / 16:50:12 / cg"
+    "Modified: 4.4.1997 / 16:27:50 / cg"
 !
 
 realize
@@ -1283,6 +1292,8 @@
 recreate
     "recreate the view after a snap-in"
 
+    |i m|
+
     super recreate.
 
     iconView notNil ifTrue:[
@@ -1290,8 +1301,14 @@
         device setWindowIconWindow:iconView in:drawableId.
         iconView setRealized:true.
     ] ifFalse:[
-        (icon notNil and:[icon id notNil]) ifTrue:[
-            device setWindowIcon:icon in:drawableId
+        icon notNil ifTrue:[
+            i := self convertedIcon:icon.
+            (i notNil and:[i id notNil]) ifTrue:[
+                (m := icon mask) notNil ifTrue:[
+                    m := self convertedIconMask:m.
+                ].
+                device setWindowIcon:i mask:m in:drawableId
+            ]
         ].
     ].
 
@@ -1299,11 +1316,11 @@
         device setIconName:iconLabel in:drawableId
     ]
 
-    "Modified: 26.2.1997 / 16:45:21 / cg"
+    "Modified: 4.4.1997 / 16:16:40 / cg"
 ! !
 
 !StandardSystemView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/StandardSystemView.st,v 1.71 1997-03-19 22:03:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/StandardSystemView.st,v 1.72 1997-04-04 14:39:17 cg Exp $'
 ! !
--- a/StdSysV.st	Fri Apr 04 16:37:04 1997 +0200
+++ b/StdSysV.st	Fri Apr 04 16:39:17 1997 +0200
@@ -11,8 +11,8 @@
 "
 
 TopView subclass:#StandardSystemView
-	instanceVariableNames:'label icon iconView iconLabel minExtent maxExtent sizeFixed
-		application windowEventsForApplication'
+	instanceVariableNames:'label icon iconMask iconView iconLabel minExtent maxExtent
+		sizeFixed application windowEventsForApplication'
 	classVariableNames:'DefaultIcon TakeFocusWhenMapped IncludeHostNameInLabel'
 	poolDictionaries:''
 	category:'Views-Basic'
@@ -590,22 +590,25 @@
     ^ icon
 !
 
-icon:aForm
-    "define the form (bitmap) used as icon"
+icon:aFormOrImage
+    "define the form or image (bitmap) used as icon"
 
-    |invertedIcon i|
+    |i m|
 
-    icon := aForm.
+    icon := aFormOrImage.
     icon notNil ifTrue:[
         drawableId notNil ifTrue:[
             i := self convertedIcon:icon.
             (i notNil and:[i id notNil]) ifTrue:[
-                device setWindowIcon:i in:drawableId
+                (m := icon mask) notNil ifTrue:[
+                    m := self convertedIconMask:m.
+                ].
+                device setWindowIcon:i mask:m in:drawableId
             ]
         ]
     ]
 
-    "Modified: 10.6.1996 / 20:15:36 / cg"
+    "Modified: 4.4.1997 / 16:20:52 / cg"
 !
 
 iconLabel
@@ -637,12 +640,14 @@
 
     "/ only images possibly have iconMasks
     icon notNil ifTrue:[
-	(mask := icon mask) notNil ifTrue:[
-	    ^ self convertedIconMask:mask
-	]
+        (mask := icon mask) notNil ifTrue:[
+            ^ self convertedIconMask:mask
+        ]
     ].
 
     ^ nil
+
+    "Modified: 4.4.1997 / 16:39:00 / cg"
 !
 
 iconName:aString
@@ -658,7 +663,8 @@
 !
 
 iconView:aView
-    "specify the view to be used as icon"
+    "specify the view to be used as icon.
+     This may not be supported on all display types"
 
     iconView := aView.
     drawableId notNil ifTrue:[
@@ -667,7 +673,7 @@
         aView setRealized:true.
     ]
 
-    "Modified: 24.4.1996 / 10:30:12 / cg"
+    "Modified: 4.4.1997 / 16:21:37 / cg"
 !
 
 label
@@ -1195,7 +1201,7 @@
 physicalCreate
     "common code for create & recreate"
 
-    |l icn|
+    |l icn icnMask|
 
     IncludeHostNameInLabel == true ifTrue:[
         l := OperatingSystem getHostName , ': ' , label.
@@ -1204,9 +1210,12 @@
     ].
 
     icn := self convertedIcon:icon.
+    (icnMask := icon mask) notNil ifTrue:[
+        icnMask := self convertedIconMask:icnMask
+    ].
     drawableId := device 
                       createWindowFor:self 
-		      type:nil
+                      type:nil
                       origin:(left @ top)
                       extent:(width @ height)
                       minExtent:minExtent
@@ -1217,7 +1226,7 @@
                       inputOnly:(self isInputOnly)
                       label:l
                       cursor:cursor
-                      icon:icn iconMask:nil
+                      icon:icn iconMask:icnMask
                       iconView:iconView.
 
     Lobby registerChange:self.
@@ -1251,7 +1260,7 @@
     device setWindowClass:('Stx', self className) name:name in:drawableId.
 
     "Modified: 14.6.1996 / 17:14:25 / stefan"
-    "Modified: 28.2.1997 / 16:50:12 / cg"
+    "Modified: 4.4.1997 / 16:27:50 / cg"
 !
 
 realize
@@ -1283,6 +1292,8 @@
 recreate
     "recreate the view after a snap-in"
 
+    |i m|
+
     super recreate.
 
     iconView notNil ifTrue:[
@@ -1290,8 +1301,14 @@
         device setWindowIconWindow:iconView in:drawableId.
         iconView setRealized:true.
     ] ifFalse:[
-        (icon notNil and:[icon id notNil]) ifTrue:[
-            device setWindowIcon:icon in:drawableId
+        icon notNil ifTrue:[
+            i := self convertedIcon:icon.
+            (i notNil and:[i id notNil]) ifTrue:[
+                (m := icon mask) notNil ifTrue:[
+                    m := self convertedIconMask:m.
+                ].
+                device setWindowIcon:i mask:m in:drawableId
+            ]
         ].
     ].
 
@@ -1299,11 +1316,11 @@
         device setIconName:iconLabel in:drawableId
     ]
 
-    "Modified: 26.2.1997 / 16:45:21 / cg"
+    "Modified: 4.4.1997 / 16:16:40 / cg"
 ! !
 
 !StandardSystemView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Attic/StdSysV.st,v 1.71 1997-03-19 22:03:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Attic/StdSysV.st,v 1.72 1997-04-04 14:39:17 cg Exp $'
 ! !