17 printItems oneItem useIndex hilightLevel hilightFrameColor |
17 printItems oneItem useIndex hilightLevel hilightFrameColor |
18 ignoreReselect arrowLevel smallArrow keyActionStyle |
18 ignoreReselect arrowLevel smallArrow keyActionStyle |
19 returnKeyActionStyle toggleSelect strikeOut iSearchString items |
19 returnKeyActionStyle toggleSelect strikeOut iSearchString items |
20 doubleClickMsg hilightStyle clickPosition allowDrag |
20 doubleClickMsg hilightStyle clickPosition allowDrag |
21 dragObjectConverter dragIsActive endDragAction dropTarget |
21 dragObjectConverter dragIsActive endDragAction dropTarget |
22 dropSource visualBlock selectedVisualBlock' |
22 dropSource visualBlock selectedVisualBlock |
|
23 selectionChangeConditionBlock' |
23 classVariableNames:'RightArrowShadowForm RightArrowLightForm RightArrowForm |
24 classVariableNames:'RightArrowShadowForm RightArrowLightForm RightArrowForm |
24 SmallRightArrowShadowForm SmallRightArrowLightForm |
25 SmallRightArrowShadowForm SmallRightArrowLightForm |
25 DefaultForegroundColor DefaultBackgroundColor |
26 DefaultForegroundColor DefaultBackgroundColor |
26 DefaultHilightForegroundColor DefaultHilightBackgroundColor |
27 DefaultHilightForegroundColor DefaultHilightBackgroundColor |
27 DefaultHilightFrameColor DefaultHilightLevel |
28 DefaultHilightFrameColor DefaultHilightLevel |
120 hilightFgColor |
121 hilightFgColor |
121 hilightBgColor <Color> how highlighted items are drawn |
122 hilightBgColor <Color> how highlighted items are drawn |
122 |
123 |
123 halfIntensityColor <Color> foreground for disabled items |
124 halfIntensityColor <Color> foreground for disabled items |
124 |
125 |
125 selectConditionBlock <Block> if non-nil, this nlock can decide if selection is ok |
126 selectConditionBlock <Block> if non-nil, this block can decide if selection is ok. |
|
127 its invoked with the itemNr of the |
|
128 'to-be-selected' item. |
|
129 If the block returns true, the item is selected |
|
130 (or added to the selection); if false is returned, |
|
131 no action is taken. |
|
132 selectionChangeConditionBlock |
|
133 <Block> much like above, but invoked without argument, |
|
134 on any change of the selection (i.e. also when items |
|
135 are deselected). |
|
136 Can return false to suppress change. |
126 |
137 |
127 doubleClickActionBlock <Block> action to perform on double-click |
138 doubleClickActionBlock <Block> action to perform on double-click |
128 (1-arg blocks gets selectionIndex or selectionValue |
139 (1-arg blocks gets selectionIndex or selectionValue |
129 as arg - depending upon the useIndex setting) |
140 as arg - depending upon the useIndex setting) |
130 |
141 |
1120 returnKeyActionStyle := aSymbol |
1131 returnKeyActionStyle := aSymbol |
1121 ! |
1132 ! |
1122 |
1133 |
1123 selectConditionBlock:aBlock |
1134 selectConditionBlock:aBlock |
1124 "set the conditionBlock; this block is evaluated before a selection |
1135 "set the conditionBlock; this block is evaluated before a selection |
1125 change is performed; the change will not be done, if the evaluation |
1136 is made or added to the selection (i.e. not on removes); |
1126 returns false. For example, this allows confirmation queries in |
1137 The block gets the 'about-to-be-selected' items itemNr as argument. |
1127 the SystemBrowser" |
1138 The change will not be done, if the evaluation returns false. |
|
1139 For example, this allows confirmation queries in the SystemBrowser" |
1128 |
1140 |
1129 selectConditionBlock := aBlock |
1141 selectConditionBlock := aBlock |
|
1142 ! |
|
1143 |
|
1144 selectionChangeConditionBlock:aBlock |
|
1145 "set the selectionChange-conditionBlock; this block is evaluated before |
|
1146 any selection change is performed. |
|
1147 The change will not be done, if the block returns false. |
|
1148 For example, this allows confirmation queries in the SystemBrowser" |
|
1149 |
|
1150 selectionChangeConditionBlock := aBlock |
1130 ! |
1151 ! |
1131 |
1152 |
1132 useIndex |
1153 useIndex |
1133 "set/clear the useIndex flag. If set, both actionBlock and change-messages |
1154 "set/clear the useIndex flag. If set, both actionBlock and change-messages |
1134 are passed the index(indices) of the selection as argument. |
1155 are passed the index(indices) of the selection as argument. |
1609 "add entry, aNumber to the selection. No scrolling is done. |
1630 "add entry, aNumber to the selection. No scrolling is done. |
1610 *** No model and/or actionBlock notification is done here." |
1631 *** No model and/or actionBlock notification is done here." |
1611 |
1632 |
1612 (self isValidSelection:aNumber) ifFalse:[^ self]. |
1633 (self isValidSelection:aNumber) ifFalse:[^ self]. |
1613 |
1634 |
|
1635 "/ any change allowed at all ? |
|
1636 (selectionChangeConditionBlock notNil |
|
1637 and:[(selectionChangeConditionBlock value) not]) ifTrue:[^ self]. |
|
1638 |
|
1639 "/ this item selectable ? |
1614 (selectConditionBlock notNil |
1640 (selectConditionBlock notNil |
1615 and:[(selectConditionBlock value:aNumber) not]) ifTrue:[^ self]. |
1641 and:[(selectConditionBlock value:aNumber) not]) ifTrue:[^ self]. |
1616 |
1642 |
1617 selection isNil ifTrue:[^ self selectWithoutScroll:aNumber]. |
1643 selection isNil ifTrue:[^ self selectWithoutScroll:aNumber]. |
1618 selection isCollection ifTrue:[ |
1644 selection isCollection ifTrue:[ |
2085 ((button == 1) or:[button == #select]) ifTrue:[ |
2111 ((button == 1) or:[button == #select]) ifTrue:[ |
2086 "/ toggleSelect ifTrue:[ |
2112 "/ toggleSelect ifTrue:[ |
2087 "/ ^ self buttonPress:button x:x y:y |
2113 "/ ^ self buttonPress:button x:x y:y |
2088 "/ ]. |
2114 "/ ]. |
2089 enabled ifTrue:[ |
2115 enabled ifTrue:[ |
|
2116 "/ any change allowed at all ? |
|
2117 (selectionChangeConditionBlock notNil |
|
2118 and:[(selectionChangeConditionBlock value) not]) ifTrue:[^ self]. |
|
2119 |
2090 listLineNr := self visibleLineToListLine:(self visibleLineOfY:y). |
2120 listLineNr := self visibleLineToListLine:(self visibleLineOfY:y). |
2091 listLineNr notNil ifTrue:[ |
2121 listLineNr notNil ifTrue:[ |
2092 (self lineIsEnabled:listLineNr) ifFalse:[^ self]. |
2122 (self lineIsEnabled:listLineNr) ifFalse:[^ self]. |
2093 |
|
2094 (selectConditionBlock notNil |
|
2095 and:[(selectConditionBlock value:listLineNr) not]) ifTrue:[^ self]. |
|
2096 ]. |
2123 ]. |
2097 oldSelection := selection copy. |
2124 oldSelection := selection copy. |
2098 listLineNr notNil ifTrue: [ |
2125 listLineNr notNil ifTrue: [ |
2099 multipleSelectOk ifTrue:[ |
2126 multipleSelectOk ifTrue:[ |
2100 (self isInSelection:listLineNr) ifTrue:[ |
2127 (self isInSelection:listLineNr) ifTrue:[ |
2101 self removeFromSelection:listLineNr |
2128 self removeFromSelection:listLineNr |
2102 ] ifFalse:[ |
2129 ] ifFalse:[ |
2103 self addToSelection:listLineNr |
2130 self addToSelection:listLineNr |
2104 ] |
2131 ] |
2105 ] ifFalse:[ |
2132 ] ifFalse:[ |
|
2133 "/ this item selectable ? |
|
2134 (selectConditionBlock notNil |
|
2135 and:[(selectConditionBlock value:listLineNr) not]) ifTrue:[^ self]. |
|
2136 |
2106 self selectWithoutScroll:listLineNr |
2137 self selectWithoutScroll:listLineNr |
2107 ] |
2138 ] |
2108 ]. |
2139 ]. |
2109 ((ignoreReselect not and:[selection notNil]) |
2140 ((ignoreReselect not and:[selection notNil]) |
2110 or:[selection ~= oldSelection]) ifTrue:[ |
2141 or:[selection ~= oldSelection]) ifTrue:[ |
2303 |
2334 |
2304 enabled ifFalse:[ |
2335 enabled ifFalse:[ |
2305 ^ self |
2336 ^ self |
2306 ]. |
2337 ]. |
2307 |
2338 |
2308 (selectConditionBlock isNil or:[selectConditionBlock value:index]) ifTrue:[ |
2339 "/ any change allowed at all ? |
2309 keyActionStyle notNil ifTrue:[ |
2340 (selectionChangeConditionBlock notNil |
2310 keyActionStyle == #pass ifTrue:[ |
2341 and:[(selectionChangeConditionBlock value) not]) ifTrue:[^ self]. |
2311 ^ super keyPress:key x:x y:y |
2342 |
2312 ]. |
2343 keyActionStyle notNil ifTrue:[ |
2313 oldSelection := selection. |
2344 keyActionStyle == #pass ifTrue:[ |
2314 (multipleSelectOk and:[self sensor shiftDown]) ifTrue:[ |
2345 ^ super keyPress:key x:x y:y |
2315 (self isInSelection:index) ifTrue:[ |
2346 ]. |
2316 self removeFromSelection:index |
2347 oldSelection := selection. |
2317 ] ifFalse:[ |
2348 (multipleSelectOk and:[self sensor shiftDown]) ifTrue:[ |
2318 self addToSelection:index |
2349 (self isInSelection:index) ifTrue:[ |
2319 ] |
2350 self removeFromSelection:index |
2320 ] ifFalse:[ |
2351 ] ifFalse:[ |
2321 self selection:index. |
2352 self addToSelection:index |
2322 |
2353 ] |
2323 keyActionStyle == #selectAndDoubleClick ifTrue:[ |
2354 ] ifFalse:[ |
2324 self doubleClicked |
2355 "/ this item selectable ? |
2325 ] |
2356 (selectConditionBlock notNil |
|
2357 and:[(selectConditionBlock value:index) not]) ifTrue:[^ self]. |
|
2358 |
|
2359 self selection:index. |
|
2360 |
|
2361 keyActionStyle == #selectAndDoubleClick ifTrue:[ |
|
2362 self doubleClicked |
2326 ] |
2363 ] |
2327 ] |
2364 ] |
2328 ]. |
2365 ]. |
2329 |
2366 |
2330 "Modified: / 4.2.2000 / 14:51:25 / cg" |
2367 "Modified: / 4.2.2000 / 14:51:25 / cg" |
2884 ! |
2921 ! |
2885 |
2922 |
2886 selectOrToggleAtX:x y:y |
2923 selectOrToggleAtX:x y:y |
2887 |oldSelection listLineNr| |
2924 |oldSelection listLineNr| |
2888 |
2925 |
|
2926 "/ any change allowed at all ? |
|
2927 (selectionChangeConditionBlock notNil |
|
2928 and:[(selectionChangeConditionBlock value) not]) ifTrue:[^ self]. |
|
2929 |
2889 listLineNr := self visibleLineToListLine:(self visibleLineOfY:y). |
2930 listLineNr := self visibleLineToListLine:(self visibleLineOfY:y). |
2890 listLineNr notNil ifTrue:[ |
2931 listLineNr notNil ifTrue:[ |
2891 (toggleSelect |
2932 (toggleSelect |
2892 and:[self isInSelection:listLineNr]) ifTrue:[ |
2933 and:[self isInSelection:listLineNr]) ifTrue:[ |
2893 oldSelection := selection copy. |
2934 oldSelection := selection copy. |
2894 self removeFromSelection:listLineNr |
2935 self removeFromSelection:listLineNr |
2895 ] ifFalse:[ |
2936 ] ifFalse:[ |
2896 (self lineIsEnabled:listLineNr) ifFalse:[^ self]. |
2937 (self lineIsEnabled:listLineNr) ifFalse:[^ self]. |
2897 |
2938 |
2898 (selectConditionBlock notNil |
2939 oldSelection := selection copy. |
2899 and:[(selectConditionBlock value:listLineNr) not]) ifTrue:[^ self]. |
|
2900 |
|
2901 (toggleSelect and:[multipleSelectOk]) ifTrue:[ |
2940 (toggleSelect and:[multipleSelectOk]) ifTrue:[ |
2902 oldSelection := selection copy. |
|
2903 self addToSelection:listLineNr |
2941 self addToSelection:listLineNr |
2904 ] ifFalse:[ |
2942 ] ifFalse:[ |
2905 oldSelection := selection copy. |
2943 "/ this item selectable ? |
|
2944 (selectConditionBlock notNil |
|
2945 and:[(selectConditionBlock value:listLineNr) not]) ifTrue:[^ self]. |
|
2946 |
2906 self selectWithoutScroll:listLineNr. |
2947 self selectWithoutScroll:listLineNr. |
2907 ]. |
2948 ]. |
2908 ]. |
2949 ]. |
2909 ((ignoreReselect not and:[selection notNil]) |
2950 ((ignoreReselect not and:[selection notNil]) |
2910 or:[selection ~= oldSelection]) ifTrue:[ |
2951 or:[selection ~= oldSelection]) ifTrue:[ |