Scroller.st
changeset 2321 e1fa2ff7d945
parent 2313 c3c2415333bb
child 2333 725d7913a406
equal deleted inserted replaced
2320:158b10553017 2321:e1fa2ff7d945
  1002 ! !
  1002 ! !
  1003 
  1003 
  1004 !Scroller methodsFor:'autoRepeat'!
  1004 !Scroller methodsFor:'autoRepeat'!
  1005 
  1005 
  1006 installRepeat
  1006 installRepeat
  1007     self windowGroup repairDamage.
  1007     repeatBlock notNil ifTrue:[
  1008     Processor addTimedBlock:repeatBlock afterSeconds:repeatDelay
  1008         self windowGroup repairDamage.
       
  1009         Processor addTimedBlock:repeatBlock afterSeconds:repeatDelay
       
  1010     ]
  1009 !
  1011 !
  1010 
  1012 
  1011 repeatPageDown
  1013 repeatPageDown
  1012     self pageDown.
  1014     repeatBlock notNil ifTrue:[
  1013     self installRepeat.
  1015         self pageDown.
       
  1016         self installRepeat.
       
  1017     ]
  1014 !
  1018 !
  1015 
  1019 
  1016 repeatPageUp
  1020 repeatPageUp
  1017     self pageUp.
  1021     repeatBlock notNil ifTrue:[
  1018     self installRepeat.
  1022         self pageUp.
       
  1023         self installRepeat.
       
  1024     ]
  1019 ! !
  1025 ! !
  1020 
  1026 
  1021 !Scroller methodsFor:'drawing'!
  1027 !Scroller methodsFor:'drawing'!
  1022 
  1028 
  1023 drawHandleFormAtX:x y:y
  1029 drawHandleFormAtX:x y:y
  1407      action is now performed"
  1413      action is now performed"
  1408 
  1414 
  1409     |rect mustDrawThumb|
  1415     |rect mustDrawThumb|
  1410 
  1416 
  1411     repeatBlock notNil ifTrue:[
  1417     repeatBlock notNil ifTrue:[
       
  1418         repeatBlock := nil.
  1412         Processor removeTimedBlock:repeatBlock.
  1419         Processor removeTimedBlock:repeatBlock.
  1413         repeatBlock := nil
  1420         repeatBlock := nil
  1414     ].
  1421     ].
  1415 
  1422 
  1416     (button == 1 or:[button == #select or:[DefaultMiddleButtonJump]])
  1423     (button == 1 or:[button == #select or:[DefaultMiddleButtonJump]])
  1916 
  1923 
  1917 initStyle
  1924 initStyle
  1918     "initialize style dep. stuff"
  1925     "initialize style dep. stuff"
  1919 
  1926 
  1920     <resource: #style (#name 
  1927     <resource: #style (#name 
  1921 		       #'scroller.autoRepeat'
  1928                        #'scroller.autoRepeat'
  1922 		       #'scroller.initialRepeatDelay'
  1929                        #'scroller.initialRepeatDelay'
  1923 		       #'scroller.repeatDelay')>
  1930                        #'scroller.repeatDelay')>
  1924 
  1931 
  1925     |nm|
  1932     |nm|
  1926 
  1933 
  1927     super initStyle.
  1934     super initStyle.
  1928 
  1935 
  1929     DefaultViewBackground notNil ifTrue:[
  1936     DefaultViewBackground notNil ifTrue:[
  1930 	viewBackground := DefaultViewBackground onDevice:device.
  1937         viewBackground := DefaultViewBackground onDevice:device.
  1931     ].
  1938     ].
  1932     DefaultShadowColor notNil ifTrue:[
  1939     DefaultShadowColor notNil ifTrue:[
  1933 	shadowColor := DefaultShadowColor onDevice:device.
  1940         shadowColor := DefaultShadowColor onDevice:device.
  1934     ].
  1941     ].
  1935     DefaultLightColor notNil ifTrue:[
  1942     DefaultLightColor notNil ifTrue:[
  1936 	lightColor := DefaultLightColor onDevice:device.
  1943         lightColor := DefaultLightColor onDevice:device.
  1937     ].
  1944     ].
  1938 
  1945 
  1939     tallyMarks := DefaultTallyMarks.
  1946     tallyMarks := DefaultTallyMarks.
  1940     tallyLevel := DefaultTallyLevel.
  1947     tallyLevel := DefaultTallyLevel.
  1941     DefaultLevel ~~ level ifTrue:[
  1948     DefaultLevel ~~ level ifTrue:[
  1942 	self level:DefaultLevel.
  1949         self level:DefaultLevel.
  1943     ].
  1950     ].
  1944     DefaultBorderWidth ~~ borderWidth ifTrue:[
  1951     DefaultBorderWidth ~~ borderWidth ifTrue:[
  1945 	self borderWidth:DefaultBorderWidth.
  1952         self borderWidth:DefaultBorderWidth.
  1946     ].
  1953     ].
  1947     thumbLevel := DefaultThumbLevel.
  1954     thumbLevel := DefaultThumbLevel.
  1948     thumbActiveLevel := DefaultThumbActiveLevel.
  1955     thumbActiveLevel := DefaultThumbActiveLevel.
  1949     inset := DefaultInset.
  1956     inset := DefaultInset.
  1950     fixThumbHeight := DefaultFixThumbHeight.
  1957     fixThumbHeight := DefaultFixThumbHeight.
  1951     thumbEdgeStyle := DefaultEdgeStyle.
  1958     thumbEdgeStyle := DefaultEdgeStyle.
  1952 
  1959 
  1953     DefaultGhostColor notNil ifTrue:[
  1960     DefaultGhostColor notNil ifTrue:[
  1954 	ghostColor := DefaultGhostColor onDevice:device.
  1961         ghostColor := DefaultGhostColor onDevice:device.
  1955     ].
  1962     ].
  1956     DefaultGhostFrameColor notNil ifTrue:[
  1963     DefaultGhostFrameColor notNil ifTrue:[
  1957 	ghostFrameColor := DefaultGhostFrameColor onDevice:device.
  1964         ghostFrameColor := DefaultGhostFrameColor onDevice:device.
  1958     ].
  1965     ].
  1959     ghostLevel := DefaultGhostLevel.
  1966     ghostLevel := DefaultGhostLevel.
  1960 
  1967 
  1961     DefaultThumbFrameColor notNil ifTrue:[
  1968     DefaultThumbFrameColor notNil ifTrue:[
  1962 	thumbFrameColor := DefaultThumbFrameColor onDevice:device.
  1969         thumbFrameColor := DefaultThumbFrameColor onDevice:device.
  1963     ].
  1970     ].
  1964     DefaultThumbShadowColor notNil ifTrue:[
  1971     DefaultThumbShadowColor notNil ifTrue:[
  1965 	thumbShadowColor := DefaultThumbShadowColor
  1972         thumbShadowColor := DefaultThumbShadowColor
  1966     ] ifFalse:[
  1973     ] ifFalse:[
  1967 	thumbShadowColor := shadowColor.
  1974         thumbShadowColor := shadowColor.
  1968     ].
  1975     ].
  1969     DefaultThumbLightColor notNil ifTrue:[
  1976     DefaultThumbLightColor notNil ifTrue:[
  1970 	thumbLightColor := DefaultThumbLightColor
  1977         thumbLightColor := DefaultThumbLightColor
  1971     ] ifFalse:[
  1978     ] ifFalse:[
  1972 	thumbLightColor := lightColor.
  1979         thumbLightColor := lightColor.
  1973     ].
  1980     ].
  1974 
  1981 
  1975     thumbEdgeStyle notNil ifTrue:[
  1982     thumbEdgeStyle notNil ifTrue:[
  1976 	DefaultThumbHalfShadowColor notNil ifTrue:[
  1983         DefaultThumbHalfShadowColor notNil ifTrue:[
  1977 	    thumbHalfShadowColor := DefaultThumbHalfShadowColor
  1984             thumbHalfShadowColor := DefaultThumbHalfShadowColor
  1978 	].
  1985         ].
  1979 
  1986 
  1980 	DefaultThumbHalfLightColor notNil ifTrue:[
  1987         DefaultThumbHalfLightColor notNil ifTrue:[
  1981 	    thumbHalfLightColor := DefaultThumbHalfLightColor
  1988             thumbHalfLightColor := DefaultThumbHalfLightColor
  1982 	].
  1989         ].
  1983     ].
  1990     ].
  1984 
  1991 
  1985     nm := styleSheet name.
  1992     nm := styleSheet name.
  1986 
  1993 
  1987     device hasGrayscales ifFalse:[
  1994     device hasGrayscales ifFalse:[
  1988 	thumbEdgeStyle notNil ifTrue:[
  1995         thumbEdgeStyle notNil ifTrue:[
  1989 	    thumbHalfShadowColor := Color darkGray.
  1996             thumbHalfShadowColor := Color darkGray.
  1990 	    thumbHalfLightColor := White
  1997             thumbHalfLightColor := White
  1991 	].
  1998         ].
  1992 
  1999 
  1993 	thumbShadowColor := Black.
  2000         thumbShadowColor := Black.
  1994 "/        thumbLightColor := White.
  2001 "/        thumbLightColor := White.
  1995 
  2002 
  1996 	nm = #motif ifTrue:[
  2003         nm = #motif ifTrue:[
  1997 	    DefaultThumbColor isNil ifTrue:[
  2004             DefaultThumbColor isNil ifTrue:[
  1998 		thumbColor := White .
  2005                 thumbColor := White .
  1999 	    ].
  2006             ].
  2000 	]
  2007         ]
  2001     ].
  2008     ].
  2002 
  2009 
  2003     DefaultThumbColor notNil ifTrue:[
  2010     DefaultThumbColor notNil ifTrue:[
  2004 	thumbColor := DefaultThumbColor onDevice:device
  2011         thumbColor := DefaultThumbColor onDevice:device
  2005     ] ifFalse:[
  2012     ] ifFalse:[
  2006 	thumbColor := White.
  2013         thumbColor := White.
  2007 	nm ~= #normal ifTrue:[
  2014         nm ~= #normal ifTrue:[
  2008 	    device hasGrayscales ifFalse:[
  2015             device hasGrayscales ifFalse:[
  2009 		thumbColor := Color grey
  2016                 thumbColor := Color grey
  2010 	    ].
  2017             ].
  2011 	].
  2018         ].
  2012     ].
  2019     ].
  2013 
  2020 
  2014     thumbColor := thumbColor onDevice:device.
  2021     thumbColor := thumbColor onDevice:device.
  2015     thumbShadowColor notNil ifTrue:[
  2022     thumbShadowColor notNil ifTrue:[
  2016 	thumbShadowColor := thumbShadowColor onDevice:device.
  2023         thumbShadowColor := thumbShadowColor onDevice:device.
  2017     ].
  2024     ].
  2018     thumbLightColor notNil ifTrue:[
  2025     thumbLightColor notNil ifTrue:[
  2019 	thumbLightColor := thumbLightColor onDevice:device.
  2026         thumbLightColor := thumbLightColor onDevice:device.
  2020     ].
  2027     ].
  2021     thumbHalfShadowColor notNil ifTrue:[
  2028     thumbHalfShadowColor notNil ifTrue:[
  2022 	thumbHalfShadowColor := thumbHalfShadowColor onDevice:device.
  2029         thumbHalfShadowColor := thumbHalfShadowColor onDevice:device.
  2023     ].
  2030     ].
  2024     thumbHalfLightColor notNil ifTrue:[
  2031     thumbHalfLightColor notNil ifTrue:[
  2025 	thumbHalfLightColor := thumbHalfLightColor onDevice:device.
  2032         thumbHalfLightColor := thumbHalfLightColor onDevice:device.
  2026     ].
  2033     ].
  2027     thumbEdgeStyle notNil ifTrue:[
  2034     thumbEdgeStyle notNil ifTrue:[
  2028 	thumbHalfShadowColor isNil ifTrue:[
  2035         thumbHalfShadowColor isNil ifTrue:[
  2029 	    thumbHalfShadowColor := thumbShadowColor lightened onDevice:device
  2036             thumbHalfShadowColor := thumbShadowColor lightened onDevice:device
  2030 	]
  2037         ]
  2031     ].
  2038     ].
  2032 
  2039 
  2033     DefaultThumbEnteredColor notNil ifTrue:[
  2040     DefaultThumbEnteredColor notNil ifTrue:[
  2034 	thumbEnteredColor := DefaultThumbEnteredColor onDevice:device.
  2041         thumbEnteredColor := DefaultThumbEnteredColor onDevice:device.
  2035     ] ifFalse:[
  2042     ] ifFalse:[
  2036 	thumbEnteredColor := thumbColor.
  2043         thumbEnteredColor := thumbColor.
  2037     ].
  2044     ].
  2038 
  2045 
  2039     (DefaultThumbEnteredColor notNil or:[NewCursors]) ifTrue:[
  2046     (DefaultThumbEnteredColor notNil or:[NewCursors]) ifTrue:[
  2040 	self enableMotionEvents.
  2047         self enableMotionEvents.
  2041 	self enableEnterLeaveEvents.
  2048         self enableEnterLeaveEvents.
  2042     ].
  2049     ].
  2043 
  2050 
  2044     DefaultThumbImage notNil ifTrue:[
  2051     DefaultThumbImage notNil ifTrue:[
  2045 	thumbImage := DefaultThumbImage onDevice:device.
  2052         thumbImage := DefaultThumbImage onDevice:device.
  2046 	fixThumbHeight := true.
  2053         fixThumbHeight := true.
  2047     ].
  2054     ].
  2048 
  2055 
  2049     HandleImage notNil ifTrue:[
  2056     HandleImage notNil ifTrue:[
  2050 	shadowForm := HandleImage onDevice:device.
  2057         shadowForm := HandleImage onDevice:device.
  2051     ] ifFalse:[
  2058     ] ifFalse:[
  2052 	nm = #next ifTrue:[
  2059         nm = #next ifTrue:[
  2053 	    shadowForm := self class handleShadowFormOn:device.
  2060             shadowForm := self class handleShadowFormOn:device.
  2054 	    lightForm := self class handleLightFormOn:device
  2061             lightForm := self class handleLightFormOn:device
  2055 	] ifFalse:[
  2062         ] ifFalse:[
  2056 	    shadowForm := lightForm := nil
  2063             shadowForm := lightForm := nil
  2057 	].
  2064         ].
  2058     ].
  2065     ].
  2059     drawableId notNil ifTrue:[
  2066     drawableId notNil ifTrue:[
  2060 	self computeThumbFrame
  2067         self computeThumbFrame
  2061     ].
  2068     ].
  2062 
  2069 
  2063     autoRepeat := styleSheet at:#'scroller.autoRepeat' default:true.
  2070     autoRepeat := styleSheet at:#'scroller.autoRepeat' default:true.
  2064     initialRepeatDelay := styleSheet at:#'scroller.initialRepeatDelay' default:0.2.
  2071     initialRepeatDelay := styleSheet at:#'scroller.initialRepeatDelay' default:0.2.
  2065     repeatDelay := styleSheet at:#'scroller.repeatDelay' default:0.1.
  2072     repeatDelay := styleSheet at:#'scroller.repeatDelay' default:0.15.
  2066 
  2073 
  2067     "Modified: / 5.9.1998 / 20:21:41 / cg"
  2074     "Modified: / 5.9.1998 / 20:21:41 / cg"
  2068 !
  2075 !
  2069 
  2076 
  2070 initialize
  2077 initialize
  2490 ! !
  2497 ! !
  2491 
  2498 
  2492 !Scroller class methodsFor:'documentation'!
  2499 !Scroller class methodsFor:'documentation'!
  2493 
  2500 
  2494 version
  2501 version
  2495     ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.150 2000-11-20 13:51:47 cg Exp $'
  2502     ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.151 2000-11-23 13:21:00 cg Exp $'
  2496 ! !
  2503 ! !