ProgressIndicator.st
changeset 4511 b1a6da90fdc5
parent 4469 a4d672240503
child 4709 b9e63b8565c1
equal deleted inserted replaced
4510:7e17d110b720 4511:b1a6da90fdc5
  1052 !ProgressIndicator methodsFor:'drawing'!
  1052 !ProgressIndicator methodsFor:'drawing'!
  1053 
  1053 
  1054 redraw
  1054 redraw
  1055     "redraw the percentage bar and optional percentage string"
  1055     "redraw the percentage bar and optional percentage string"
  1056 
  1056 
  1057     |s lx rx sx sy sw m2 m w h doBusy oldClip|
  1057     |s lx rx sx sy sw m2 m w h doBusy oldClip currentDeviceFont|
  1058 
  1058 
  1059     self shown ifFalse:[^self].
  1059     self shown ifFalse:[^self].
  1060 
  1060 
  1061     m := margin + 1.
  1061     m := margin + 1.
  1062     m2 := m*2.
  1062     m2 := m*2.
  1093     self paint:bgColor.
  1093     self paint:bgColor.
  1094     self fillRectangleX:m+rx y:m width:w-rx height:h.
  1094     self fillRectangleX:m+rx y:m width:w-rx height:h.
  1095 
  1095 
  1096     showPercentage ifTrue:[
  1096     showPercentage ifTrue:[
  1097         s := percentage printString , ' %'.
  1097         s := percentage printString , ' %'.
  1098         font := font onDevice:device.
  1098         currentDeviceFont := gc createFontOnDevice.
  1099         sw := font widthOf:s .
  1099         sw := currentDeviceFont widthOf:s .
  1100         sx := (width - sw) // 2.
  1100         sx := (width - sw) // 2.
  1101         sy := height // 2 + font descent + 2.
  1101         sy := height // 2 + currentDeviceFont descent + 2.
  1102 
  1102 
  1103         rx <= (sx+sw) ifTrue:[
  1103         rx <= (sx+sw) ifTrue:[
  1104             self paint:Color black.
  1104             self paint:Color black.
  1105             self displayString:s x:sx y:sy.
  1105             self displayString:s x:sx y:sy.
  1106         ]
  1106         ]
  1155         self level:-1
  1155         self level:-1
  1156     ].
  1156     ].
  1157 
  1157 
  1158     bgColor := styleSheet colorAt:'progressIndicator.viewBackground' default:Color white.
  1158     bgColor := styleSheet colorAt:'progressIndicator.viewBackground' default:Color white.
  1159     fgColor := styleSheet colorAt:'progressIndicator.foregroundColor' default:Color blue.
  1159     fgColor := styleSheet colorAt:'progressIndicator.foregroundColor' default:Color blue.
  1160     fgColor := fgColor onDevice:device.
  1160     fgColor := fgColor onDevice:self graphicsDevice.
  1161 
  1161 
  1162     showPercentage := true.
  1162     showPercentage := true.
  1163 !
  1163 !
  1164 
  1164 
  1165 initialize
  1165 initialize
  1262 
  1262 
  1263     "/ If I have a cached preferredExtent value..
  1263     "/ If I have a cached preferredExtent value..
  1264     preferredExtent notNil ifTrue:[
  1264     preferredExtent notNil ifTrue:[
  1265         ^ preferredExtent
  1265         ^ preferredExtent
  1266     ].
  1266     ].
  1267     ^ 100 @ (font height + font descent + ((margin + 1) * 2))
  1267     ^ 100 @ (gc font height + gc font descent + ((margin + 1) * 2))
  1268 
  1268 
  1269     "Modified: 22.10.1997 / 21:07:17 / cg"
  1269     "Modified: 22.10.1997 / 21:07:17 / cg"
  1270 ! !
  1270 ! !
  1271 
  1271 
  1272 !ProgressIndicator methodsFor:'showing progress'!
  1272 !ProgressIndicator methodsFor:'showing progress'!
  1721 ! !
  1721 ! !
  1722 
  1722 
  1723 !ProgressIndicator class methodsFor:'documentation'!
  1723 !ProgressIndicator class methodsFor:'documentation'!
  1724 
  1724 
  1725 version
  1725 version
  1726     ^ '$Header: /cvs/stx/stx/libwidg2/ProgressIndicator.st,v 1.76 2014-01-23 16:11:43 stefan Exp $'
  1726     ^ '$Header: /cvs/stx/stx/libwidg2/ProgressIndicator.st,v 1.77 2014-02-18 15:06:59 stefan Exp $'
  1727 !
  1727 !
  1728 
  1728 
  1729 version_CVS
  1729 version_CVS
  1730     ^ '$Header: /cvs/stx/stx/libwidg2/ProgressIndicator.st,v 1.76 2014-01-23 16:11:43 stefan Exp $'
  1730     ^ '$Header: /cvs/stx/stx/libwidg2/ProgressIndicator.st,v 1.77 2014-02-18 15:06:59 stefan Exp $'
  1731 ! !
  1731 ! !
  1732 
  1732