Scroller.st
changeset 6058 e844c95ec8c2
parent 6030 06928de3213b
child 6094 d465941bfe0b
child 6851 897dc3bd77e0
equal deleted inserted replaced
6057:e3929e2b5edf 6058:e844c95ec8c2
  1093     dl := 1.
  1093     dl := 1.
  1094 
  1094 
  1095     self paint:color1.
  1095     self paint:color1.
  1096     x1 = x2 ifTrue:[
  1096     x1 = x2 ifTrue:[
  1097         "/ vertical
  1097         "/ vertical
  1098         self displayLineFromX:x1 y:y1-dl toX:x2 y:y2-dl.
  1098         gc displayLineFromX:x1 y:y1-dl toX:x2 y:y2-dl.
  1099         self paint:color2.
  1099         gc paint:color2.
  1100         x := x1 + 1.
  1100         x := x1 + 1.
  1101         self displayLineFromX:x y:y1 toX:x y:y2.
  1101         gc displayLineFromX:x y:y1 toX:x y:y2.
  1102     ] ifFalse:[
  1102     ] ifFalse:[
  1103         "/ horizontal
  1103         "/ horizontal
  1104         self displayLineFromX:x1-dl y:y1 toX:x2-dl y:y2.
  1104         gc displayLineFromX:x1-dl y:y1 toX:x2-dl y:y2.
  1105         self paint:color2.
  1105         gc paint:color2.
  1106         y := y1 + 1.
  1106         y := y1 + 1.
  1107         self displayLineFromX:x1 y:y toX:x2 y:y.
  1107         gc displayLineFromX:x1 y:y toX:x2 y:y.
  1108     ].
  1108     ].
  1109 !
  1109 !
  1110 
  1110 
  1111 drawHandleFormAtX:x y:y
  1111 drawHandleFormAtX:x y:y
  1112     "styles with a handle in the middle (NeXT) use this"
  1112     "styles with a handle in the middle (NeXT) use this"
  1113 
  1113 
  1114     thumbShadowColor := thumbShadowColor onDevice:device.
  1114     thumbShadowColor := thumbShadowColor onDevice:device.
  1115 
  1115 
  1116     self paint:thumbShadowColor.
  1116     gc paint:thumbShadowColor.
  1117     self displayForm:shadowForm x:x y:y.
  1117     gc displayForm:shadowForm x:x y:y.
  1118     lightForm notNil ifTrue:[
  1118     lightForm notNil ifTrue:[
  1119         thumbLightColor := thumbLightColor onDevice:device.
  1119         thumbLightColor := thumbLightColor onDevice:device.
  1120         self paint:thumbLightColor.
  1120         gc paint:thumbLightColor.
  1121         self displayForm:lightForm x:x y:y.
  1121         gc displayForm:lightForm x:x y:y.
  1122     ].
  1122     ].
  1123 
  1123 
  1124     "Modified: / 19.5.1998 / 16:26:49 / cg"
  1124     "Modified: / 19.5.1998 / 16:26:49 / cg"
  1125 !
  1125 !
  1126 
  1126 
  1292                                 m := 0.8.
  1292                                 m := 0.8.
  1293                             ].
  1293                             ].
  1294                         ].
  1294                         ].
  1295                     ].
  1295                     ].
  1296                 ].
  1296                 ].
  1297                 self paint:(clr2 mixed:m with:clr).
  1297                 gc paint:(clr2 mixed:m with:clr).
  1298                 (orientation == #vertical) ifTrue:[
  1298                 (orientation == #vertical) ifTrue:[
  1299                     self displayLineFromX:(l+i-1) y:t+1 toX:(l+i-1) y:(t+h-2)
  1299                     gc displayLineFromX:(l+i-1) y:t+1 toX:(l+i-1) y:(t+h-2)
  1300                 ] ifFalse:[
  1300                 ] ifFalse:[
  1301                     self displayLineFromX:(l+1) y:(t+i-1) toX:(l+w-2) y:(t+i-1)
  1301                     gc displayLineFromX:(l+1) y:(t+i-1) toX:(l+w-2) y:(t+i-1)
  1302                 ].
  1302                 ].
  1303             ].
  1303             ].
  1304         ] ifFalse:[
  1304         ] ifFalse:[
  1305             self paint:clr.
  1305             gc paint:clr.
  1306             (xpStyle and:[self isMiniScroller not]) ifTrue:[
  1306             (xpStyle and:[self isMiniScroller not]) ifTrue:[
  1307                 "/ hack for xp
  1307                 "/ hack for xp
  1308                 (orientation == #vertical) ifTrue:[
  1308                 (orientation == #vertical) ifTrue:[
  1309                     self fillRectangleX:l y:t+1 width:w-2 height:h-4.
  1309                     gc fillRectangleX:l y:t+1 width:w-2 height:h-4.
  1310                 ] ifFalse:[
  1310                 ] ifFalse:[
  1311                     self fillRectangleX:l+1 y:t width:w-4 height:h-2.
  1311                     gc fillRectangleX:l+1 y:t width:w-4 height:h-2.
  1312                 ]
  1312                 ]
  1313             ] ifFalse:[
  1313             ] ifFalse:[
  1314                 (styleSheet at:#'scroller.roundStyle' default:false) ifTrue:[
  1314                 (styleSheet at:#'scroller.roundStyle' default:false) ifTrue:[
  1315                     "/ hack for osx
  1315                     "/ hack for osx
  1316                     (orientation == #vertical) ifTrue:[
  1316                     (orientation == #vertical) ifTrue:[
  1318                             |yLine left right|
  1318                             |yLine left right|
  1319 
  1319 
  1320                             left := l+i-1.
  1320                             left := l+i-1.
  1321                             right := l+w-i+1.
  1321                             right := l+w-i+1.
  1322                             yLine := t+3-i.
  1322                             yLine := t+3-i.
  1323                             self displayLineFromX:left y:yLine toX:right y:yLine.    
  1323                             gc displayLineFromX:left y:yLine toX:right y:yLine.    
  1324                             yLine := t+h-3-1+i. 
  1324                             yLine := t+h-3-1+i. 
  1325                             self displayLineFromX:left y:yLine toX:right y:yLine.    
  1325                             gc displayLineFromX:left y:yLine toX:right y:yLine.    
  1326                         ].
  1326                         ].
  1327                         self fillRectangleX:l y:t+3 width:w height:h-6.
  1327                         gc fillRectangleX:l y:t+3 width:w height:h-6.
  1328                     ] ifFalse:[
  1328                     ] ifFalse:[
  1329                         1 to:3 do:[:i |
  1329                         1 to:3 do:[:i |
  1330                             |xLine top bot|
  1330                             |xLine top bot|
  1331 
  1331 
  1332                             top := t+i-1.
  1332                             top := t+i-1.
  1333                             bot := t+h-i+1.
  1333                             bot := t+h-i+1.
  1334                             xLine := l+3-i.
  1334                             xLine := l+3-i.
  1335                             self displayLineFromX:xLine y:top toX:xLine y:bot.    
  1335                             gc displayLineFromX:xLine y:top toX:xLine y:bot.    
  1336                             xLine := l+w-3-1+i. 
  1336                             xLine := l+w-3-1+i. 
  1337                             self displayLineFromX:xLine y:top toX:xLine y:bot.    
  1337                             gc displayLineFromX:xLine y:top toX:xLine y:bot.    
  1338                         ].
  1338                         ].
  1339                         self fillRectangleX:l+3 y:t width:w-6 height:h.
  1339                         gc fillRectangleX:l+3 y:t width:w-6 height:h.
  1340                     ].
  1340                     ].
  1341                 ] ifFalse:[
  1341                 ] ifFalse:[
  1342                     self fillRectangleX:l y:t width:w height:h.
  1342                     gc fillRectangleX:l y:t width:w height:h.
  1343                 ].
  1343                 ].
  1344             ].
  1344             ].
  1345         ].
  1345         ].
  1346     ].
  1346     ].
  1347     lvl := thumbLevel.
  1347     lvl := thumbLevel.
  1366     self isMiniScroller ifTrue:[^ self].
  1366     self isMiniScroller ifTrue:[^ self].
  1367 
  1367 
  1368     thumbFrameColor notNil ifTrue:[
  1368     thumbFrameColor notNil ifTrue:[
  1369         clr2 := styleSheet colorAt:#'scroller.thumbFrameColor2'.
  1369         clr2 := styleSheet colorAt:#'scroller.thumbFrameColor2'.
  1370         clr2 notNil ifTrue:[
  1370         clr2 notNil ifTrue:[
  1371             self paint:clr2.
  1371             gc paint:clr2.
  1372             (orientation == #vertical) ifTrue:[
  1372             (orientation == #vertical) ifTrue:[
  1373                 self displayLineFromX:l+w-2 y:t+1 toX:l+w-2 y:t+h-3.
  1373                 gc displayLineFromX:l+w-2 y:t+1 toX:l+w-2 y:t+h-3.
  1374                 self displayLineFromX:l y:t+h-3 toX:l+w-2 y:t+h-3.
  1374                 gc displayLineFromX:l y:t+h-3 toX:l+w-2 y:t+h-3.
  1375             ] ifFalse:[
  1375             ] ifFalse:[
  1376                 self displayLineFromX:l+2 y:t+h-2 toX:l+w-3 y:t+h-2.
  1376                 gc displayLineFromX:l+2 y:t+h-2 toX:l+w-3 y:t+h-2.
  1377                 self displayLineFromX:l+w-3 y:t toX:l+w-3 y:t+h-2. 
  1377                 gc displayLineFromX:l+w-3 y:t toX:l+w-3 y:t+h-2. 
  1378             ].
  1378             ].
  1379         ].
  1379         ].
  1380 
  1380 
  1381         vistaStyle ifTrue:[
  1381         vistaStyle ifTrue:[
  1382             self paint:clr slightlyDarkened.
  1382             gc paint:clr slightlyDarkened.
  1383         ] ifFalse:[
  1383         ] ifFalse:[
  1384             self paint:thumbFrameColor.
  1384             gc paint:thumbFrameColor.
  1385         ].
  1385         ].
  1386         xpStyle ifTrue:[
  1386         xpStyle ifTrue:[
  1387             (orientation == #vertical) ifTrue:[
  1387             (orientation == #vertical) ifTrue:[
  1388                 self displayLineFromX:l+w-1 y:t+1 toX:l+w-1 y:t+h-3.
  1388                 gc displayLineFromX:l+w-1 y:t+1 toX:l+w-1 y:t+h-3.
  1389                 self displayLineFromX:l+1 y:t+h-2 toX:l+w-2 y:t+h-2.
  1389                 gc displayLineFromX:l+1 y:t+h-2 toX:l+w-2 y:t+h-2.
  1390                 self displayLineFromX:l+w-2 y:t+h-3 toX:l+w-2 y:t+h-3.
  1390                 gc displayLineFromX:l+w-2 y:t+h-3 toX:l+w-2 y:t+h-3.
  1391                 "/ self displayLineFromX:l-2 y:t+h-3 toX:l-2 y:t+h-3.
  1391                 "/ self displayLineFromX:l-2 y:t+h-3 toX:l-2 y:t+h-3.
  1392             ] ifFalse:[
  1392             ] ifFalse:[
  1393                 self displayLineFromX:l+2 y:t+h-1 toX:l+w-3 y:t+h-1.
  1393                 gc displayLineFromX:l+2 y:t+h-1 toX:l+w-3 y:t+h-1.
  1394                 self displayLineFromX:l+w-2 y:t+1 toX:l+w-2 y:t+h-2. 
  1394                 gc displayLineFromX:l+w-2 y:t+1 toX:l+w-2 y:t+h-2. 
  1395                 self displayLineFromX:l+w-3 y:t+h-2 toX:l+w-3 y:t+h-2.
  1395                 gc displayLineFromX:l+w-3 y:t+h-2 toX:l+w-3 y:t+h-2.
  1396             ].
  1396             ].
  1397         ] ifFalse:[
  1397         ] ifFalse:[
  1398             h := h - 1.
  1398             h := h - 1.
  1399             self displayRectangleX:l y:t width:w height:h.
  1399             gc displayRectangleX:l y:t width:w height:h.
  1400         ].
  1400         ].
  1401         vistaStyle ifTrue:[
  1401         vistaStyle ifTrue:[
  1402             self paint:clr lightened.
  1402             gc paint:clr lightened.
  1403             self displayPointX:l y:t.
  1403             gc displayPointX:l y:t.
  1404             self displayPointX:l+w-1 y:t.
  1404             gc displayPointX:l+w-1 y:t.
  1405             self displayPointX:l y:t+h-1.
  1405             gc displayPointX:l y:t+h-1.
  1406             self displayPointX:l+w-1 y:t+h-1.
  1406             gc displayPointX:l+w-1 y:t+h-1.
  1407         ].
  1407         ].
  1408     ].
  1408     ].
  1409 
  1409 
  1410     thumbImage notNil ifTrue:[
  1410     thumbImage notNil ifTrue:[
  1411         thumbImage displayOn:self x:l y:t
  1411         thumbImage displayOn:self x:l y:t
  1435     |oldClip gX gY gW gH|
  1435     |oldClip gX gY gW gH|
  1436 
  1436 
  1437     shown ifTrue:[
  1437     shown ifTrue:[
  1438         oldClip := self clippingBoundsOrNil.
  1438         oldClip := self clippingBoundsOrNil.
  1439         self clippingBounds:(Rectangle left:x top:y width:w height:h).
  1439         self clippingBounds:(Rectangle left:x top:y width:w height:h).
  1440         self clearDeviceRectangleX:x y:y width:w height:h.
  1440         gc clearDeviceRectangleX:x y:y width:w height:h.
  1441 
  1441 
  1442         styleSheet name == #winVista ifTrue:[
  1442         styleSheet name == #winVista ifTrue:[
  1443             self paint:(Color greyByte:16rE3).
  1443             gc paint:(Color greyByte:16rE3).
  1444             (orientation == #vertical) ifTrue:[
  1444             (orientation == #vertical) ifTrue:[
  1445                 self displayLineFromX:0 y:0 toX:0 y:height-1.
  1445                 gc displayLineFromX:0 y:0 toX:0 y:height-1.
  1446                 self displayLineFromX:1 y:0 toX:1 y:height-1.
  1446                 gc displayLineFromX:1 y:0 toX:1 y:height-1.
  1447             ] ifFalse:[
  1447             ] ifFalse:[
  1448                 self displayLineFromX:0 y:0 toX:width-1 y:0.
  1448                 gc displayLineFromX:0 y:0 toX:width-1 y:0.
  1449                 self displayLineFromX:0 y:1 toX:width-1 y:1.
  1449                 gc displayLineFromX:0 y:1 toX:width-1 y:1.
  1450             ].
  1450             ].
  1451         ].
  1451         ].
  1452 
  1452 
  1453         frameBeforeMove notNil ifTrue:[
  1453         frameBeforeMove notNil ifTrue:[
  1454             (ghostColor notNil 
  1454             (ghostColor notNil 
  1459                     gY := frameBeforeMove top.
  1459                     gY := frameBeforeMove top.
  1460                     gW := frameBeforeMove width.
  1460                     gW := frameBeforeMove width.
  1461                     gH := frameBeforeMove height.
  1461                     gH := frameBeforeMove height.
  1462                 
  1462                 
  1463                     ghostColor notNil ifTrue:[
  1463                     ghostColor notNil ifTrue:[
  1464                         self paint:ghostColor.
  1464                         gc paint:ghostColor.
  1465                         self fillRectangle:frameBeforeMove.
  1465                         gc fillRectangle:frameBeforeMove.
  1466                     ].
  1466                     ].
  1467                     (ghostLevel ~~ 0) ifTrue:[
  1467                     (ghostLevel ~~ 0) ifTrue:[
  1468                         self drawEdgesForX:gX y:gY width:gW height:gH level:ghostLevel
  1468                         self drawEdgesForX:gX y:gY width:gW height:gH level:ghostLevel
  1469                     ].
  1469                     ].
  1470                     ghostFrameColor notNil ifTrue:[
  1470                     ghostFrameColor notNil ifTrue:[
  1471                         self paint:ghostFrameColor.
  1471                         gc paint:ghostFrameColor.
  1472                         self displayRectangleX:gX y:gY width:gW height:gH
  1472                         gc displayRectangleX:gX y:gY width:gW height:gH
  1473                     ].
  1473                     ].
  1474                 ]
  1474                 ]
  1475             ]
  1475             ]
  1476         ].
  1476         ].
  1477         self clippingBounds:oldClip
  1477         self clippingBounds:oldClip