initial checkin
authorClaus Gittinger <cg@exept.de>
Mon, 12 Jan 2015 11:23:17 +0100
changeset 6732 b909c5f3bd5c
parent 6723 8a4be06814d1
child 6733 c65e178185dd
initial checkin
MacButtonBorder.st
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MacButtonBorder.st	Mon Jan 12 11:23:17 2015 +0100
@@ -0,0 +1,289 @@
+"{ Package: 'stx:libview' }"
+
+"{ NameSpace: Smalltalk }"
+
+AbstractBorder subclass:#MacButtonBorder
+	instanceVariableNames:''
+	classVariableNames:'TopLeftEdge TopRightEdge BottomLeftEdge BottomRightEdge'
+	poolDictionaries:''
+	category:'Graphics-Support'
+!
+
+!MacButtonBorder class methodsFor:'documentation'!
+
+documentation
+"
+    an as yet unused and unfinished attempt to provide a mac-osx like
+    button border.
+    To be continued.
+"
+!
+
+examples
+"
+                                                [exBegin]
+     |top v b|
+
+
+     top := StandardSystemView extent:100@100.
+     v := View origin:10@10 corner:90@30 in:top.
+     top openAndWait.
+
+     b := MacButtonBorder new.
+     v border:b.
+                                                [exEnd]
+
+                                                [exBegin]
+     |top v1 v2 b|
+
+     top := StandardSystemView extent:100@200.
+     v1 := View origin:10@10 corner:90@30 in:top.
+     v2 := View origin:10@100 corner:90@150 in:top.
+     top openAndWait.
+
+     b := MacButtonBorder new.
+     v1 border:b.
+     v2 border:b.
+                                                [exEnd]
+"
+! !
+
+!MacButtonBorder class methodsFor:'initialization'!
+
+initialize
+    TopLeftEdge := self topLeftImage2.
+    TopRightEdge := self topRightImage2.
+    BottomLeftEdge := self bottomLeftImage2.
+    BottomRightEdge := self bottomRightImage2.
+! !
+
+!MacButtonBorder class methodsFor:'image specs'!
+
+bottomLeftImage
+    "This resource specification was automatically generated
+     by the ImageEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the ImageEditor may not be able to read the specification."
+
+    "
+     self bottomLeftImage inspect
+     ImageEditor openOnClass:self andSelector:#bottomLeftImage
+     Icon flushCachedIcons
+    "
+
+    <resource: #image>
+
+    ^Icon
+        constantNamed:'MacButtonBorder bottomLeftImage'
+        ifAbsentPut:[(Depth8Image new) width:4; height:4; bits:(ByteArray fromPackedString:'BP A@P@F@PD@APXH@@@DA0@a') ; colorMapFromArray:#[184 184 184 255 255 255 226 226 226 224 224 224 181 181 181 162 162 162 211 211 211 158 158 158 248 248 248 159 159 159]; mask:((Depth1Image new) width:4; height:4; bits:(ByteArray fromPackedString:'<OA0L@@a') ; yourself); yourself]
+!
+
+bottomLeftImage2
+    "This resource specification was automatically generated
+     by the ImageEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the ImageEditor may not be able to read the specification."
+
+    "
+     self bottomLeftImage2 inspect
+     ImageEditor openOnClass:self andSelector:#bottomLeftImage2
+     Icon flushCachedIcons
+    "
+
+    <resource: #image>
+
+    ^Icon
+        constantNamed:'MacButtonBorder bottomLeftImage2'
+        ifAbsentPut:[(Depth8Image new) width:9; height:10; bits:(ByteArray fromPackedString:'E@4VHRD!!HRD!!E0XUHRD!!HRD!!GP0QG"D!!HRD!!H!!@EGBD!!HRD!!IQ,IB!!<!!HRD!!HRLSAP,$HRD!!HRD D@PBFRD!!HRD%HAHH@@LNHRD!!HRHXC0\AHRD!!HRD%HA(T
+') ; colorMapFromArray:#[45 45 45 56 56 56 66 66 66 70 70 70 72 72 72 76 76 76 89 89 89 92 92 92 93 93 93 103 103 103 110 110 110 111 111 111 112 112 112 121 121 121 147 147 147 150 150 150 165 165 165 169 169 169 176 176 176 181 181 181 186 186 186 192 192 192 197 197 197 198 198 198 199 199 199 200 200 200 204 204 204 206 206 206 209 209 209 212 212 212 216 216 216 222 222 222 224 224 224 226 226 226 229 229 229 231 231 231 233 233 233 235 235 235]; mask:((ImageMask new) width:9; height:10; bits:(ByteArray fromPackedString:'8G? _?A?<G?8_71?O''<??0??A?<b') ; yourself); yourself]
+!
+
+bottomRightImage
+    "This resource specification was automatically generated
+     by the ImageEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the ImageEditor may not be able to read the specification."
+
+    "
+     self bottomRightImage inspect
+     ImageEditor openOnClass:self andSelector:#bottomRightImage
+     Icon flushCachedIcons
+    "
+
+    <resource: #image>
+
+    ^Icon
+        constantNamed:'MacButtonBorder bottomRightImage'
+        ifAbsentPut:[(Depth8Image new) width:4; height:4; bits:(ByteArray fromPackedString:'@PDHBPDAA @HA T@A0P@@@@a') ; colorMapFromArray:#[184 184 184 255 255 255 226 226 226 224 224 224 181 181 181 162 162 162 211 211 211 158 158 158 248 248 248 159 159 159]; mask:((Depth1Image new) width:4; height:4; bits:(ByteArray fromPackedString:'<OC 0@@a') ; yourself); yourself]
+!
+
+bottomRightImage2
+    "This resource specification was automatically generated
+     by the ImageEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the ImageEditor may not be able to read the specification."
+
+    "
+     self bottomRightImage2 inspect
+     ImageEditor openOnClass:self andSelector:#bottomRightImage2
+     Icon flushCachedIcons
+    "
+
+    <resource: #image>
+
+    ^Icon
+        constantNamed:'MacButtonBorder bottomRightImage2'
+        ifAbsentPut:[(Depth8Image new) width:9; height:10; bits:(ByteArray fromPackedString:'CP4MCP4 F@4TCP4MCP4!!EP\VCP4MCP4]DP,[CP4MCP4\A!!@!!CP4MCR@KB!!(#CP4MI@0ED2HMCP4Y@ PPG04MC L@BQH^CP4M@P OE2DMCP4MEA$^H04MCP4M
+') ; colorMapFromArray:#[45 45 45 56 56 56 68 68 68 70 70 70 72 72 72 76 76 76 78 78 78 89 89 89 92 92 92 93 93 93 103 103 103 112 112 112 115 115 115 122 122 122 148 148 148 150 150 150 165 165 165 175 175 175 176 176 176 181 181 181 186 186 186 196 196 196 198 198 198 199 199 199 200 200 200 204 204 204 206 206 206 212 212 212 214 214 214 220 220 220 224 224 224 226 226 226 228 228 228 229 229 229 231 231 231 235 235 235 237 237 237]; mask:((ImageMask new) width:9; height:10; bits:(ByteArray fromPackedString:'A?<G?0_?A?<O?1=?O''?<_?!!?<G<b') ; yourself); yourself]
+!
+
+topLeftImage
+    "This resource specification was automatically generated
+     by the ImageEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the ImageEditor may not be able to read the specification."
+
+    "
+     self topLeftImage inspect
+     ImageEditor openOnClass:self andSelector:#topLeftImage
+     Icon flushCachedIcons
+    "
+
+    <resource: #image>
+
+    ^Icon
+        constantNamed:'MacButtonBorder topLeftImage'
+        ifAbsentPut:[(Depth8Image new) width:4; height:4; bits:(ByteArray fromPackedString:'@@@DA0@EA  @A DABP A@P@a') ; colorMapFromArray:#[184 184 184 255 255 255 226 226 226 224 224 224 181 181 181 162 162 162 211 211 211 158 158 158 248 248 248 159 159 159]; mask:((Depth1Image new) width:4; height:4; bits:(ByteArray fromPackedString:'LGC0<@@a') ; yourself); yourself]
+!
+
+topLeftImage2
+    "This resource specification was automatically generated
+     by the ImageEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the ImageEditor may not be able to read the specification."
+
+    "
+     self topLeftImage2 inspect
+     ImageEditor openOnClass:self andSelector:#topLeftImage2
+     Icon flushCachedIcons
+    "
+
+    <resource: #image>
+
+    ^Icon
+        constantNamed:'MacButtonBorder topLeftImage2'
+        ifAbsentPut:[(Depth8Image new) width:9; height:10; bits:(ByteArray fromPackedString:'GQ4]GQ4]GP<BGQ4]GQ4P@@(SGQ4]GPXCGA4]GQ4]B@\^GQ4]GQ4NAQX]GQ4]GQ(AD!!,]GQ4]GP4KFA4]GQ4]G@PQGQ4]GQ4]E0$UGQ4]GQ4]E@0YGQ4]GQ4]
+') ; colorMapFromArray:#[91 91 91 102 102 102 104 104 104 109 109 109 110 110 110 115 115 115 117 117 117 118 118 118 119 119 119 121 121 121 123 123 123 139 139 139 143 143 143 146 146 146 153 153 153 155 155 155 158 158 158 169 169 169 174 174 174 187 187 187 191 191 191 192 192 192 199 199 199 203 203 203 204 204 204 207 207 207 217 217 217 219 219 219 221 221 221 224 224 224 229 229 229]; mask:((ImageMask new) width:9; height:10; bits:(ByteArray fromPackedString:'@_<G?09?GG<8_7!!?\G? _>A?8G<b') ; yourself); yourself]
+!
+
+topRightImage
+    "This resource specification was automatically generated
+     by the ImageEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the ImageEditor may not be able to read the specification."
+
+    "
+     self topRightImage inspect
+     ImageEditor openOnClass:self andSelector:#topRightImage
+     Icon flushCachedIcons
+    "
+
+    <resource: #image>
+
+    ^Icon
+        constantNamed:'MacButtonBorder topRightImage'
+        ifAbsentPut:[(Depth8Image new) width:4; height:4; bits:(ByteArray fromPackedString:'A0P@@@ FAP@A@PX@@PDHBP@a') ; colorMapFromArray:#[184 184 184 255 255 255 226 226 226 224 224 224 181 181 181 162 162 162 211 211 211 158 158 158 248 248 248 159 159 159]; mask:((Depth1Image new) width:4; height:4; bits:(ByteArray fromPackedString:'0NC0<@@a') ; yourself); yourself]
+!
+
+topRightImage2
+    "This resource specification was automatically generated
+     by the ImageEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the ImageEditor may not be able to read the specification."
+
+    "
+     self topRightImage2 inspect
+     ImageEditor openOnClass:self andSelector:#topRightImage2
+     Icon flushCachedIcons
+    "
+
+    <resource: #image>
+
+    ^Icon
+        constantNamed:'MacButtonBorder topRightImage2'
+        ifAbsentPut:[(Depth8Image new) width:9; height:10; bits:(ByteArray fromPackedString:'B!!\@@@@@@@@@IPD[I @@@@@@@@@1B!!L@@@@@@@@@KPTI@@@@@@@@@@XI@@@@@@@@@@0QJBL@@@@@@@@HF"8@@@@@@@@@L08@@@@@@@@@IB$O@@@@@@@@GQ<%
+') ; colorMapFromArray:#[153 153 153 127 127 127 227 227 227 254 254 254 242 243 242 115 115 115 202 202 202 229 229 229 205 205 205 119 119 119 106 106 106 237 237 237 215 215 215 220 220 220 114 114 114 203 203 203 241 241 241 177 177 177 233 233 233 116 116 116 236 236 236 212 212 212 250 250 250 155 155 155 246 246 246 231 231 231 145 145 145 90 90 90 221 221 221 208 208 208 224 224 224 147 147 147 216 216 216 243 243 243 230 230 230 217 217 217 195 195 195 191 191 191 156 156 156 245 245 245 108 108 108 126 126 126 235 235 235 240 240 240 247 247 247 223 223 223 148 148 148 228 228 228 226 225 225 222 222 222 249 249 249 174 174 174]; mask:((ImageMask new) width:9; height:10; bits:(ByteArray fromPackedString:'0G?0_3!!?GG<N_0=?A7<C_0O?@?<b') ; yourself); yourself]
+! !
+
+!MacButtonBorder methodsFor:'displaying'!
+
+displayOn:aGC forDisplayBox:aRectangle
+    "display the borders represented by the receiver in the specified rectangle.
+     The gc is restored after the draw."
+
+    |left right top bottom savedPaint|
+
+    left := aRectangle left.
+    right := aRectangle right.
+    top := aRectangle top.
+    bottom := aRectangle bottom.
+
+    savedPaint := aGC paint.
+
+    TopLeftEdge displayOn:aGC x:left y:top.
+    aGC paint:(Color redByte:104 greenByte:104 blueByte:104).
+    aGC displayLineFromX:left+(TopLeftEdge width) y:top toX:right-(TopRightEdge width) y:top.
+    aGC paint:(Color redByte:186 greenByte:186 blueByte:186).
+    aGC displayLineFromX:left+(TopLeftEdge width) y:top+1 toX:right-(TopRightEdge width) y:top+1.
+
+    TopRightEdge displayOn:aGC x:(right-TopRightEdge width) y:top.
+    aGC paint:(Color redByte:208 greenByte:208 blueByte:208).
+    aGC displayLineFromX:right-3 y:(top+TopRightEdge height) toX:right-3 y:(bottom-BottomRightEdge height).
+    aGC paint:(Color redByte:147 greenByte:147 blueByte:147).
+    aGC displayLineFromX:right-2 y:(top+TopRightEdge height) toX:right-2 y:(bottom-BottomRightEdge height).
+    aGC paint:(Color redByte:191 greenByte:191 blueByte:191).
+    aGC displayLineFromX:right-1 y:(top+TopRightEdge height) toX:right-1 y:(bottom-BottomRightEdge height).
+
+    BottomLeftEdge displayOn:aGC x:left y:(bottom-BottomLeftEdge height).
+    aGC paint:(Color redByte:148 greenByte:148 blueByte:148).
+    aGC displayLineFromX:left+(BottomLeftEdge width) y:bottom-1-2 toX:right-(BottomRightEdge width) y:bottom-1-2.
+    aGC paint:(Color redByte:56 greenByte:56 blueByte:56).
+    aGC displayLineFromX:left+(BottomLeftEdge width) y:bottom-1-1 toX:right-(BottomRightEdge width) y:bottom-1-1.
+    aGC paint:(Color redByte:186 greenByte:186 blueByte:186).
+    aGC displayLineFromX:left+(BottomLeftEdge width) y:bottom-1 toX:right-(BottomRightEdge width) y:bottom-1.
+
+    BottomRightEdge displayOn:aGC x:(right-BottomRightEdge width) y:(bottom-BottomRightEdge height).
+    aGC paint:(Color redByte:186 greenByte:186 blueByte:186).
+    aGC displayLineFromX:left y:(top+TopLeftEdge height) toX:left y:(bottom-BottomLeftEdge height).
+    aGC paint:(Color redByte:121 greenByte:121 blueByte:121).
+    aGC displayLineFromX:left+1 y:(top+TopLeftEdge height) toX:left+1 y:(bottom-BottomLeftEdge height).
+
+    aGC paint:savedPaint.
+! !
+
+!MacButtonBorder methodsFor:'queries'!
+
+margin
+    ^ 4
+! !
+
+!MacButtonBorder class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/libview/MacButtonBorder.st,v 1.1 2015-01-12 10:23:17 cg Exp $'
+!
+
+version_CVS
+    ^ '$Header: /cvs/stx/stx/libview/MacButtonBorder.st,v 1.1 2015-01-12 10:23:17 cg Exp $'
+! !
+
+
+MacButtonBorder initialize!