VariablePanel.st
changeset 2242 1aea02d32c96
parent 2241 d9c7f1486b7a
child 2243 c2a288b3b73e
equal deleted inserted replaced
2241:d9c7f1486b7a 2242:1aea02d32c96
    14 
    14 
    15 SimpleView subclass:#VariablePanel
    15 SimpleView subclass:#VariablePanel
    16 	instanceVariableNames:'barHeight barWidth separatingLine shadowForm lightForm showHandle
    16 	instanceVariableNames:'barHeight barWidth separatingLine shadowForm lightForm showHandle
    17 		handlePosition handleColor handleStyle handleLevel noColor
    17 		handlePosition handleColor handleStyle handleLevel noColor
    18 		trackLine redrawLocked orientation handleLabels knobHeight
    18 		trackLine redrawLocked orientation handleLabels knobHeight
    19 		realRelativeSizes snapAdornment snapHandlePosition'
    19 		realRelativeSizes snapAdornment'
    20 	classVariableNames:'DefaultShowHandle DefaultHandleStyle DefaultHandlePosition
    20 	classVariableNames:'DefaultShowHandle DefaultHandleStyle DefaultHandlePosition
    21 		DefaultTrackingLine DefaultSeparatingLine DefaultHandleColor
    21 		DefaultTrackingLine DefaultSeparatingLine DefaultHandleColor
    22 		DefaultHandleLevel DefaultVCursor DefaultHCursor
    22 		DefaultHandleLevel DefaultVCursor DefaultHCursor
    23 		DefaultHandleImage DefaultSnapIcons DefaultSnapHandlePosition'
    23 		DefaultHandleImage DefaultSnapIcons DefaultSnapHandlePosition'
    24 	poolDictionaries:''
    24 	poolDictionaries:''
   901 handleLevel:aNumber
   901 handleLevel:aNumber
   902     "define the 3D level of the handle (only with some styles).
   902     "define the 3D level of the handle (only with some styles).
   903      Normally, this is defined via styleSheet files, but this entry allows
   903      Normally, this is defined via styleSheet files, but this entry allows
   904      individual views to be manipulated."
   904      individual views to be manipulated."
   905 
   905 
   906     handleLevel := aNumber
   906     handleLevel := aNumber.
       
   907     realized ifTrue:[
       
   908         self invalidate
       
   909     ]
   907 !
   910 !
   908 
   911 
   909 handlePosition
   912 handlePosition
   910     "return the position of the handle"
   913     "return the position of the handle"
   911 
   914 
   915 handlePosition:aSymbol
   918 handlePosition:aSymbol
   916     "define the position of the handle; the argument aSymbol
   919     "define the position of the handle; the argument aSymbol
   917      may be one of #left, #right or #center.
   920      may be one of #left, #right or #center.
   918      If never set by the program, the position is controlled by the styleSheet."
   921      If never set by the program, the position is controlled by the styleSheet."
   919 
   922 
   920     handlePosition := aSymbol
   923     handlePosition := aSymbol.
       
   924     realized ifTrue:[
       
   925         self invalidate
       
   926     ]
   921 !
   927 !
   922 
   928 
   923 handleShadowImage:shadowImage lightImage:lightImage
   929 handleShadowImage:shadowImage lightImage:lightImage
   924     "define the handles image; both shadow and light parts"
   930     "define the handles image; both shadow and light parts"
   925 
   931 
   985 !
   991 !
   986 
   992 
   987 showHandle:aBoolean
   993 showHandle:aBoolean
   988     "enabled/disable the handle-drawing"
   994     "enabled/disable the handle-drawing"
   989 
   995 
   990     showHandle := aBoolean
   996     showHandle := aBoolean.
       
   997     realized ifTrue:[
       
   998         self invalidate
       
   999     ]
   991 !
  1000 !
   992 
  1001 
   993 snapHandlePosition
  1002 snapHandlePosition
   994     "return the position of the snap-handle"
  1003     "return the position of the snap-handle"
   995 
  1004 
   996     ^ snapHandlePosition
  1005     ^ self handlePosition. "/ ^ snapHandlePosition
   997 !
  1006 !
   998 
  1007 
   999 snapHandlePosition:aSymbol
  1008 snapHandlePosition:aSymbol
  1000     "define the position of the snap-handle; the argument aSymbol
  1009     "define the position of the snap-handle; the argument aSymbol
  1001      may be one of #left, #right or #center.
  1010      may be one of #left, #right or #center.
  1002      If never set by the program, the position is controlled by the styleSheet."
  1011      If never set by the program, the position is controlled by the styleSheet."
  1003 
  1012 
  1004     snapHandlePosition := aSymbol
  1013     self handlePosition:aSymbol.
       
  1014 
       
  1015 "/    snapHandlePosition := aSymbol.
       
  1016 "/    realized ifTrue:[
       
  1017 "/        self invalidate
       
  1018 "/    ]
  1005 !
  1019 !
  1006 
  1020 
  1007 snapMode
  1021 snapMode
  1008     "allowed modes are:
  1022     "allowed modes are:
  1009         nil             no snap
  1023         nil             no snap
  1500 
  1514 
  1501 redraw
  1515 redraw
  1502     "redraw all of the handles"
  1516     "redraw all of the handles"
  1503 
  1517 
  1504     redrawLocked ~~ true ifTrue:[
  1518     redrawLocked ~~ true ifTrue:[
       
  1519         self clear.
  1505         self redrawHandlesFrom:1 to:(self subViews size)
  1520         self redrawHandlesFrom:1 to:(self subViews size)
  1506     ]
  1521     ]
  1507 
  1522 
  1508     "Modified: 28.1.1997 / 17:54:15 / cg"
  1523     "Modified: 28.1.1997 / 17:54:15 / cg"
  1509 !
  1524 !
  1658     ].
  1673     ].
  1659 
  1674 
  1660     handleLevel := DefaultHandleLevel.
  1675     handleLevel := DefaultHandleLevel.
  1661     showHandle := DefaultShowHandle.
  1676     showHandle := DefaultShowHandle.
  1662     handlePosition := DefaultHandlePosition.
  1677     handlePosition := DefaultHandlePosition.
  1663     snapHandlePosition := DefaultSnapHandlePosition.
  1678     "/ snapHandlePosition := DefaultSnapHandlePosition.
  1664     trackLine := DefaultTrackingLine.
  1679     trackLine := DefaultTrackingLine.
  1665     separatingLine := DefaultSeparatingLine.
  1680     separatingLine := DefaultSeparatingLine.
  1666 
  1681 
  1667     DefaultHandleImage notNil ifTrue:[
  1682     DefaultHandleImage notNil ifTrue:[
  1668         shadowForm := DefaultHandleImage onDevice:device.
  1683         shadowForm := DefaultHandleImage onDevice:device.
  2089 
  2104 
  2090     v1 := subViews at:anIndex     ifAbsent:[^ nil].
  2105     v1 := subViews at:anIndex     ifAbsent:[^ nil].
  2091     v2 := subViews at:anIndex + 1 ifAbsent:[^ nil].
  2106     v2 := subViews at:anIndex + 1 ifAbsent:[^ nil].
  2092     w  := snapAdornment at:#width ifAbsent:0.
  2107     w  := snapAdornment at:#width ifAbsent:0.
  2093 
  2108 
  2094     snapHandlePosition == #left ifTrue:[
  2109     handlePosition "snapHandlePosition" == #left ifTrue:[
  2095         snapX := snapY := margin. "/ ViewSpacing.
  2110         snapX := snapY := margin. "/ ViewSpacing.
  2096     ] ifFalse:[
  2111     ] ifFalse:[
  2097         snapHandlePosition == #right ifTrue:[
  2112         handlePosition "snapHandlePosition" == #right ifTrue:[
  2098             snapX := width - w.
  2113             snapX := width - w.
  2099             snapY := height - w.
  2114             snapY := height - w.
  2100         ] ifFalse:[
  2115         ] ifFalse:[
  2101             snapX := (width - w) // 2.
  2116             snapX := (width - w) // 2.
  2102             snapY := (height - w) // 2.
  2117             snapY := (height - w) // 2.
  2163 ! !
  2178 ! !
  2164 
  2179 
  2165 !VariablePanel class methodsFor:'documentation'!
  2180 !VariablePanel class methodsFor:'documentation'!
  2166 
  2181 
  2167 version
  2182 version
  2168     ^ '$Header: /cvs/stx/stx/libwidg/VariablePanel.st,v 1.64 2000-08-27 14:49:30 cg Exp $'
  2183     ^ '$Header: /cvs/stx/stx/libwidg/VariablePanel.st,v 1.65 2000-08-29 09:28:06 cg Exp $'
  2169 ! !
  2184 ! !