author | Claus Gittinger <cg@exept.de> |
Mon, 22 Mar 1999 20:37:09 +0100 | |
changeset 1813 | 7f51dc0341a6 |
parent 1796 | c000ddec58f2 |
child 1824 | 03630b3be319 |
permissions | -rw-r--r-- |
0 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
59 | 3 |
All Rights Reserved |
0 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
ListView subclass:#SelectionInListView |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
14 |
instanceVariableNames:'selection actionBlock enabled hilightFgColor hilightBgColor |
128 | 15 |
halfIntensityFgColor doubleClickActionBlock selectConditionBlock |
16 |
listAttributes multipleSelectOk clickLine initialSelectionMsg |
|
17 |
printItems oneItem useIndex hilightLevel hilightFrameColor |
|
18 |
ignoreReselect arrowLevel smallArrow keyActionStyle |
|
19 |
returnKeyActionStyle toggleSelect strikeOut iSearchString items |
|
1473 | 20 |
doubleClickMsg hilightStyle enableChannel clickPosition allowDrag |
21 |
dragObjectConverter dragIsActive endDragAction dropTarget |
|
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
22 |
dropSource visualBlock selectedVisualBlock' |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
23 |
classVariableNames:'RightArrowShadowForm RightArrowLightForm RightArrowForm |
128 | 24 |
SmallRightArrowShadowForm SmallRightArrowLightForm |
25 |
DefaultForegroundColor DefaultBackgroundColor |
|
26 |
DefaultHilightForegroundColor DefaultHilightBackgroundColor |
|
392
81343306d796
eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
27 |
DefaultHilightFrameColor DefaultHilightLevel |
128 | 28 |
DefaultRightArrowStyle DefaultRightArrowLevel |
29 |
DefaultDisabledForegroundColor DefaultShadowColor |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
30 |
DefaultLightColor DefaultHilightStyle' |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
31 |
poolDictionaries:'' |
1771 | 32 |
category:'Views-Lists' |
0 | 33 |
! |
34 |
||
869
4b09e6fe33b6
allow multiSelect modifier to be changed
Claus Gittinger <cg@exept.de>
parents:
838
diff
changeset
|
35 |
!SelectionInListView class methodsFor:'documentation'! |
7 | 36 |
|
38 | 37 |
copyright |
38 |
" |
|
39 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
59 | 40 |
All Rights Reserved |
38 | 41 |
|
42 |
This software is furnished under a license and may be used |
|
43 |
only in accordance with the terms of that license and with the |
|
44 |
inclusion of the above copyright notice. This software may not |
|
45 |
be provided or otherwise made available to, or used by, any |
|
46 |
other person. No title to or ownership of the software is |
|
47 |
hereby transferred. |
|
48 |
" |
|
49 |
! |
|
50 |
||
7 | 51 |
documentation |
52 |
" |
|
31 | 53 |
this one is a ListView with a selected line (which is shown highlighted) |
38 | 54 |
If multipleSelectionsOk is true, it is also allowed to shift-click multiple |
55 |
entries. |
|
63 | 56 |
If toggleSelect is true, clicking toggles (i.e. click on a seleted item |
57 |
will deselect). |
|
31 | 58 |
|
38 | 59 |
Whenever the selection changes, an action-block is evaluated, passing the |
60 |
current selection as argument. |
|
61 |
Currently, the selection can be nil, aNumber or a collection of numbers; |
|
62 |
this will change to be either nil or a collection, making selection handling |
|
70 | 63 |
easier in the future. (this stupid behavior is due to the multiple |
64 |
select feature being added later - the first implementation used to support |
|
65 |
only single selections). |
|
66 |
||
59 | 67 |
The actionBlock is called with the current selection (single number or |
68 |
collection of numbers) as argument. |
|
69 |
||
70 |
Also, to support ST-80 MVC-style use, the model (if nonNil) is notified |
|
155 | 71 |
by the change mechanism (performs changeMsg) and vice versa, the view |
72 |
updates if the model changes (with aspect of either #list or #selectionIndex). |
|
59 | 73 |
|
60 | 74 |
Before actually adding entries to the the selection, a checkBlock (if non-nil) is evaluated |
75 |
passing the number of the entry whch is about to be selected as argument. |
|
76 |
The select change operation is only done if this returns true. This allows |
|
59 | 77 |
interception of select, for example to query the user if he/she wants to save |
60 | 78 |
the old contents before (see uses in SystemBrowser and FileBrowser), or to |
79 |
disable individual entries. |
|
31 | 80 |
|
38 | 81 |
It is also possible to select entries with the keyboard; use the cursor up/ |
82 |
down keys to select prev/next, Home- and End-keys to select first/last. |
|
83 |
Use the return key to apply the double-click-action to the current selection. |
|
84 |
Also, alphabetic keys will select the next entry starting with that key. |
|
85 |
||
86 |
The keyboard behavior can be further controlled with the keyActionStyle |
|
87 |
instance variable (see SelectionInListView>>keyActionStyle:). |
|
88 |
||
59 | 89 |
Finally, ignoreReselect controls if pressing on an already selected item |
90 |
triggers the action or not. For some applications it is useful to allow |
|
91 |
reselects (for example, the SystemBrowsers method-list updates the |
|
92 |
source code in this case). |
|
38 | 93 |
|
60 | 94 |
Currently, some limited form of line attributes are supported. These |
95 |
are kept in the instance variable lineAttributes. |
|
96 |
This may change (using mechanisms similar to MultiColListEntry), so |
|
63 | 97 |
be prepared. (dont use the listAttributes instvar directly; if possible, |
98 |
use MultiColListEntry or subclasses of it. |
|
120 | 99 |
|
63 | 100 |
Although currently based on the listAttributes instVar, the implementation of |
120 | 101 |
text attributes will be changed in the near future (when Text/DisplayText are |
102 |
available). |
|
103 |
However, the protocol will probably be kept for backward compatibility |
|
104 |
(i.e. use #attributeAt: / #attributeAt:put etc. - at least, these are easy to find |
|
105 |
when migrating to the new attributed text handling). |
|
60 | 106 |
|
586 | 107 |
[Instance variables:] |
108 |
selection <misc> the current selection. nil, a number or collection of numbers |
|
109 |
||
110 |
actionBlock <Block> block to be evaluated on selection changes |
|
1745
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
111 |
(1-arg blocks gets selectionIndex or selectionValue |
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
112 |
as arg - depending upon the useIndex setting) |
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
113 |
|
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
114 |
useIndex <Boolean> if true, the index of a selection is passed to |
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
115 |
the actionBlock or stuffed into the selection valueHolder; |
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
116 |
if false, the seelction-value is passed. |
586 | 117 |
|
118 |
enabled <Boolean> true: selection changes allowed; false: ignore clicks |
|
119 |
||
120 |
hilightFgColor |
|
121 |
hilightBgColor <Color> how highlighted items are drawn |
|
122 |
||
123 |
halfIntensityColor <Color> foreground for disabled items |
|
124 |
||
125 |
selectConditionBlock <Block> if non-nil, this nlock can decide if selection is ok |
|
126 |
||
127 |
doubleClickActionBlock <Block> action to perform on double-click |
|
1745
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
128 |
(1-arg blocks gets selectionIndex or selectionValue |
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
129 |
as arg - depending upon the useIndex setting) |
586 | 130 |
|
131 |
listAttributes dont use - will vanish |
|
132 |
||
133 |
hilightLevel <Integer> level to draw selections (i.e. for 3D effect) |
|
134 |
hilightFrameColor <Color> rectangle around highlighted items |
|
135 |
||
136 |
multipleSelectOk <Boolean> if true, multiple selections (with shift) are ok. |
|
137 |
default: false |
|
138 |
||
139 |
ignoreReselect <Boolean> if true, selecting same again does not trigger action; |
|
140 |
if false, every select triggers it. |
|
141 |
default: true |
|
142 |
||
143 |
toggleSelect <Boolean> if true, click toggles; |
|
144 |
if false, click selects. |
|
145 |
default: false |
|
146 |
||
147 |
arrowLevel <Integer> level to draw right-arrows (for submenus etc.) |
|
148 |
smallArrow <Boolean> if true, uses a small arrow bitmap |
|
149 |
||
150 |
listMsg if non-nil, use ST-80 style (model-access) |
|
151 |
initialSelectionMsg |
|
152 |
printItems |
|
153 |
oneItem |
|
154 |
||
155 |
keyActionStyle <Symbol> controls how to respond to keyboard selects |
|
156 |
||
157 |
returnKeyActionStyle <Symbol> controls how to respond to return key |
|
125 | 158 |
|
31 | 159 |
written spring/summer 89 by claus |
160 |
3D Jan 90 by claus |
|
38 | 161 |
multiselect Jun 92 by claus |
162 |
keyboard-select jun 94 by claus |
|
586 | 163 |
|
164 |
[author:] |
|
165 |
Claus Gittinger |
|
7 | 166 |
" |
119 | 167 |
! |
168 |
||
169 |
examples |
|
170 |
" |
|
171 |
SelectionInListView can be used both in the ST/X way, using action blocks |
|
172 |
or in the traditional mvc way. |
|
173 |
with actions: |
|
174 |
||
125 | 175 |
basic interface: |
594 | 176 |
[exBegin] |
401 | 177 |
|top slv| |
178 |
||
179 |
top := StandardSystemView new |
|
180 |
label:'select'; |
|
181 |
minExtent:100@100; |
|
182 |
maxExtent:300@400; |
|
183 |
extent:200@200. |
|
184 |
||
185 |
slv := SelectionInListView new. |
|
186 |
slv list:#('one' 'two' 'three'). |
|
655 | 187 |
slv action:[:index | Transcript showCR:'selected ' , index printString]. |
401 | 188 |
|
189 |
top add:slv in:(0.0@0.0 corner:1.0@1.0). |
|
190 |
top open |
|
594 | 191 |
[exEnd] |
125 | 192 |
|
193 |
||
194 |
get element instead of index: |
|
594 | 195 |
[exBegin] |
401 | 196 |
|top slv| |
197 |
||
198 |
top := StandardSystemView new |
|
199 |
label:'select'; |
|
200 |
minExtent:100@100; |
|
201 |
maxExtent:300@400; |
|
202 |
extent:200@200. |
|
203 |
||
204 |
slv := SelectionInListView new. |
|
205 |
slv list:#('one' 'two' 'three'). |
|
655 | 206 |
slv action:[:element | Transcript showCR:'selected ' , element printString]. |
401 | 207 |
slv useIndex:false. |
208 |
||
209 |
top add:slv in:(0.0@0.0 corner:1.0@1.0). |
|
210 |
top open |
|
594 | 211 |
[exEnd] |
125 | 212 |
|
213 |
||
214 |
concrete example; show filenames: |
|
215 |
(notice: normally, you would use a FileSelectionList) |
|
594 | 216 |
[exBegin] |
401 | 217 |
|top slv| |
218 |
||
219 |
top := StandardSystemView new |
|
220 |
label:'select'; |
|
221 |
minExtent:100@100; |
|
222 |
maxExtent:300@400; |
|
223 |
extent:200@200. |
|
224 |
||
225 |
slv := SelectionInListView new. |
|
226 |
slv list:(Filename currentDirectory directoryContents). |
|
227 |
slv action:[:index | |
|
655 | 228 |
Transcript showCR:'selected ' , index printString. |
229 |
Transcript showCR:' the value is: ', slv selectionValue]. |
|
401 | 230 |
|
231 |
top add:slv in:(0.0@0.0 corner:1.0@1.0). |
|
232 |
top open |
|
594 | 233 |
[exEnd] |
125 | 234 |
|
119 | 235 |
|
124
7abd3a234296
last version before changing to collection in multipleSelect mode
claus
parents:
120
diff
changeset
|
236 |
add a scrollbar: |
594 | 237 |
[exBegin] |
401 | 238 |
|top slv| |
239 |
||
240 |
top := StandardSystemView new |
|
241 |
label:'select'; |
|
242 |
minExtent:100@100; |
|
243 |
maxExtent:300@400; |
|
244 |
extent:200@200. |
|
245 |
||
246 |
slv := SelectionInListView new. |
|
247 |
slv list:(Filename currentDirectory directoryContents). |
|
655 | 248 |
slv action:[:index | Transcript showCR:'selected ' , index printString]. |
401 | 249 |
|
250 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
251 |
top open |
|
594 | 252 |
[exEnd] |
125 | 253 |
|
119 | 254 |
|
628 | 255 |
allow reselect |
256 |
(clicking on already selected entry |
|
257 |
triggers action/changeNotification again): |
|
594 | 258 |
[exBegin] |
401 | 259 |
|top slv| |
260 |
||
261 |
top := StandardSystemView new |
|
262 |
label:'select'; |
|
263 |
minExtent:100@100; |
|
264 |
maxExtent:300@400; |
|
265 |
extent:200@200. |
|
266 |
||
267 |
slv := SelectionInListView new. |
|
268 |
slv list:(Filename currentDirectory directoryContents). |
|
655 | 269 |
slv action:[:index | Transcript showCR:'selected ' , index printString]. |
401 | 270 |
slv ignoreReselect:false. |
271 |
||
272 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
273 |
top open |
|
594 | 274 |
[exEnd] |
125 | 275 |
|
119 | 276 |
|
628 | 277 |
allow multiple selections (shift-select): |
594 | 278 |
[exBegin] |
401 | 279 |
|top slv| |
280 |
||
281 |
top := StandardSystemView new |
|
282 |
label:'select'; |
|
283 |
minExtent:100@100; |
|
284 |
maxExtent:300@400; |
|
285 |
extent:200@200. |
|
286 |
||
287 |
slv := SelectionInListView new. |
|
288 |
slv list:(Filename currentDirectory directoryContents). |
|
655 | 289 |
slv action:[:indexList | Transcript showCR:'selected ' , indexList printString]. |
401 | 290 |
slv multipleSelectOk:true. |
291 |
||
292 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
293 |
top open |
|
594 | 294 |
[exEnd] |
125 | 295 |
|
296 |
same, not using index: |
|
594 | 297 |
[exBegin] |
401 | 298 |
|top slv| |
299 |
||
300 |
top := StandardSystemView new |
|
301 |
label:'select'; |
|
302 |
minExtent:100@100; |
|
303 |
maxExtent:300@400; |
|
304 |
extent:200@200. |
|
305 |
||
306 |
slv := SelectionInListView new. |
|
307 |
slv list:(Filename currentDirectory directoryContents). |
|
655 | 308 |
slv action:[:indexList | Transcript showCR:'selected ' , indexList printString]. |
401 | 309 |
slv multipleSelectOk:true; useIndex:false. |
310 |
||
311 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
312 |
top open |
|
594 | 313 |
[exEnd] |
125 | 314 |
|
119 | 315 |
|
124
7abd3a234296
last version before changing to collection in multipleSelect mode
claus
parents:
120
diff
changeset
|
316 |
strikeout mode (single): |
594 | 317 |
[exBegin] |
401 | 318 |
|top slv| |
319 |
||
320 |
top := StandardSystemView new |
|
321 |
label:'select'; |
|
322 |
minExtent:100@100; |
|
323 |
maxExtent:300@400; |
|
324 |
extent:200@200. |
|
325 |
||
326 |
slv := SelectionInListView new. |
|
327 |
slv list:(Filename currentDirectory directoryContents). |
|
655 | 328 |
slv action:[:index | Transcript showCR:'selected ' , index printString]. |
401 | 329 |
slv strikeOut:true. |
330 |
||
331 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
332 |
top open |
|
594 | 333 |
[exEnd] |
125 | 334 |
|
119 | 335 |
|
124
7abd3a234296
last version before changing to collection in multipleSelect mode
claus
parents:
120
diff
changeset
|
336 |
strikeout mode (multiple): |
594 | 337 |
[exBegin] |
401 | 338 |
|top slv| |
339 |
||
340 |
top := StandardSystemView new |
|
341 |
label:'select'; |
|
342 |
minExtent:100@100; |
|
343 |
maxExtent:300@400; |
|
344 |
extent:200@200. |
|
345 |
||
346 |
slv := SelectionInListView new. |
|
347 |
slv list:(Filename currentDirectory directoryContents). |
|
655 | 348 |
slv action:[:index | Transcript showCR:'selected ' , index printString]. |
401 | 349 |
slv strikeOut:true; multipleSelectOk:true. |
350 |
||
351 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
352 |
top open |
|
594 | 353 |
[exEnd] |
119 | 354 |
|
628 | 355 |
toggleSelect mode (clicking on selected entry deselects it): |
356 |
[exBegin] |
|
357 |
|top slv| |
|
358 |
||
359 |
top := StandardSystemView new |
|
360 |
label:'select'; |
|
361 |
minExtent:100@100; |
|
362 |
maxExtent:300@400; |
|
363 |
extent:200@200. |
|
364 |
||
365 |
slv := SelectionInListView new. |
|
366 |
slv list:(Filename currentDirectory directoryContents). |
|
655 | 367 |
slv action:[:index | Transcript showCR:'selected ' , index printString]. |
628 | 368 |
slv toggleSelect:true. |
369 |
||
370 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
371 |
top open |
|
372 |
[exEnd] |
|
373 |
||
124
7abd3a234296
last version before changing to collection in multipleSelect mode
claus
parents:
120
diff
changeset
|
374 |
define what to do on double-click: |
594 | 375 |
[exBegin] |
401 | 376 |
|top slv| |
377 |
||
378 |
top := StandardSystemView new |
|
379 |
label:'select'; |
|
380 |
minExtent:100@100; |
|
381 |
maxExtent:300@400; |
|
382 |
extent:200@200. |
|
383 |
||
384 |
slv := SelectionInListView new. |
|
385 |
slv list:(Filename currentDirectory directoryContents). |
|
655 | 386 |
slv action:[:index | Transcript showCR:'selected ' , index printString]. |
387 |
slv doubleClickAction:[:index | Transcript showCR:'doubleclick on ' , index printString]. |
|
401 | 388 |
|
389 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
390 |
top open |
|
594 | 391 |
[exEnd] |
124
7abd3a234296
last version before changing to collection in multipleSelect mode
claus
parents:
120
diff
changeset
|
392 |
|
1163
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
393 |
enable / disable: |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
394 |
[exBegin] |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
395 |
|top slv| |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
396 |
|
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
397 |
top := StandardSystemView new |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
398 |
label:'select'; |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
399 |
minExtent:100@100; |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
400 |
maxExtent:300@400; |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
401 |
extent:200@200. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
402 |
|
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
403 |
slv := SelectionInListView new. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
404 |
slv list:(Filename currentDirectory directoryContents). |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
405 |
slv action:[:index | Transcript showCR:'selected ' , index printString]. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
406 |
slv disable. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
407 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
408 |
top open. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
409 |
Delay waitForSeconds:5. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
410 |
slv enable. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
411 |
[exEnd] |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
412 |
|
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
413 |
enable / disable via a channel: |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
414 |
[exBegin] |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
415 |
|top slv enableChannel t| |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
416 |
|
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
417 |
enableChannel := true asValue. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
418 |
t := Toggle label:'enable'. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
419 |
t model:enableChannel. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
420 |
t open. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
421 |
|
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
422 |
top := StandardSystemView new |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
423 |
label:'select'; |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
424 |
minExtent:100@100; |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
425 |
maxExtent:300@400; |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
426 |
extent:200@200. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
427 |
|
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
428 |
slv := SelectionInListView new. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
429 |
slv list:(Filename currentDirectory directoryContents). |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
430 |
slv action:[:index | Transcript showCR:'selected ' , index printString]. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
431 |
slv enableChannel:enableChannel. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
432 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
433 |
top open. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
434 |
[exEnd] |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
435 |
|
119 | 436 |
using a Model: |
594 | 437 |
[exBegin] |
401 | 438 |
|top slv model| |
439 |
||
440 |
model := Plug new. |
|
441 |
model respondTo:#getList with:[#('foo' 'bar' 'baz' 'hello')]. |
|
442 |
model respondTo:#initial with:[1]. |
|
655 | 443 |
model respondTo:#setSelection: with:[:arg | Transcript showCR:'model selected:', arg printString]. |
401 | 444 |
|
445 |
top := StandardSystemView new |
|
446 |
label:'select'; |
|
447 |
minExtent:100@100; |
|
448 |
maxExtent:300@400; |
|
449 |
extent:200@200. |
|
450 |
||
451 |
slv := SelectionInListView |
|
452 |
on:model |
|
453 |
aspect:#someAspect |
|
454 |
change:#setSelection: |
|
455 |
list:#getList |
|
456 |
initialSelection:#initial. |
|
457 |
||
458 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
459 |
top open |
|
594 | 460 |
[exEnd] |
119 | 461 |
|
462 |
notice, that the ST-80 behavaior on reselect is to send a selection change |
|
463 |
with an index of 0. |
|
464 |
||
125 | 465 |
same, with useIndex false: |
594 | 466 |
[exBegin] |
401 | 467 |
|top slv model| |
468 |
||
469 |
model := Plug new. |
|
470 |
model respondTo:#getList with:[#('foo' 'bar' 'baz' 'hello')]. |
|
471 |
model respondTo:#initial with:['bar']. |
|
655 | 472 |
model respondTo:#setSelection: with:[:arg | Transcript showCR:'model selected:', arg printString]. |
401 | 473 |
|
474 |
top := StandardSystemView new |
|
475 |
label:'select'; |
|
476 |
minExtent:100@100; |
|
477 |
maxExtent:300@400; |
|
478 |
extent:200@200. |
|
479 |
||
480 |
slv := SelectionInListView |
|
481 |
on:model |
|
482 |
aspect:#someAspect |
|
483 |
change:#setSelection: |
|
484 |
list:#getList |
|
485 |
initialSelection:#initial. |
|
486 |
slv useIndex:false. |
|
487 |
||
488 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
489 |
top open |
|
594 | 490 |
[exEnd] |
125 | 491 |
|
492 |
||
155 | 493 |
self changing list: |
494 |
(selectionInListView updates itself when button changes initial selection): |
|
594 | 495 |
[exBegin] |
401 | 496 |
|top slv model sel changeButton| |
497 |
||
498 |
sel := 'bar'. |
|
499 |
model := Plug new. |
|
500 |
model respondTo:#getList with:['getList' printNL. #('foo' 'bar' 'baz' 'hello')]. |
|
501 |
model respondTo:#initial with:['initial' printNL. sel]. |
|
502 |
model respondTo:#setSelection: with:[:arg | ('model selected:', arg) printNL. sel := arg]. |
|
503 |
||
504 |
changeButton := Button label:'change selection'. |
|
505 |
changeButton action:[sel := 'foo'. model changed:#initial]. |
|
506 |
changeButton open. |
|
507 |
||
508 |
top := StandardSystemView new |
|
509 |
label:'select'; |
|
510 |
minExtent:100@100; |
|
511 |
maxExtent:300@400; |
|
512 |
extent:200@200. |
|
513 |
||
514 |
slv := SelectionInListView |
|
515 |
on:model |
|
516 |
aspect:#someAspect |
|
517 |
change:#setSelection: |
|
518 |
list:#getList |
|
519 |
initialSelection:#initial. |
|
520 |
slv useIndex:false. |
|
521 |
||
522 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
523 |
top open |
|
594 | 524 |
[exEnd] |
155 | 525 |
|
526 |
||
119 | 527 |
using a SelectionInList-Model: |
528 |
(see how changes in the model (via list:...) are reflected in the view) |
|
594 | 529 |
[exBegin] |
401 | 530 |
|top slv model| |
531 |
||
532 |
model := SelectionInList with:#('foo' 'bar' 'baz' 'hello'). |
|
533 |
model selection:'bar'. |
|
534 |
||
535 |
top := StandardSystemView new |
|
536 |
label:'select'; |
|
537 |
minExtent:100@100; |
|
538 |
maxExtent:300@400; |
|
539 |
extent:200@200. |
|
540 |
||
541 |
slv := SelectionInListView on:model. |
|
542 |
||
543 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
544 |
top open. |
|
545 |
||
449
725c26daf5d8
examples (use new monitoringInspector)
Claus Gittinger <cg@exept.de>
parents:
441
diff
changeset
|
546 |
InspectorView openOn:model monitor:'selectionIndexHolder' |
594 | 547 |
[exEnd] |
125 | 548 |
|
549 |
||
550 |
two selectionInListViews on the same selectionInList model: |
|
594 | 551 |
[exBegin] |
401 | 552 |
|top1 slv1 top2 slv2 model| |
553 |
||
554 |
model := SelectionInList with:#('foo' 'bar' 'baz' 'hello'). |
|
555 |
||
556 |
top1 := StandardSystemView new |
|
557 |
label:'select'; |
|
558 |
minExtent:100@100; |
|
559 |
maxExtent:300@400; |
|
560 |
extent:200@200. |
|
561 |
||
562 |
slv1 := SelectionInListView on:model. |
|
563 |
||
564 |
top1 add:(ScrollableView forView:slv1) in:(0.0@0.0 corner:1.0@1.0). |
|
565 |
top1 open. |
|
566 |
||
567 |
top2 := StandardSystemView new |
|
568 |
label:'select'; |
|
569 |
minExtent:100@100; |
|
570 |
maxExtent:300@400; |
|
571 |
extent:200@200. |
|
572 |
||
573 |
slv2 := SelectionInListView on:model. |
|
574 |
||
575 |
top2 add:(ScrollableView forView:slv2) in:(0.0@0.0 corner:1.0@1.0). |
|
576 |
top2 open. |
|
594 | 577 |
[exEnd] |
166 | 578 |
|
579 |
||
580 |
a MultiSelectionInList model: |
|
594 | 581 |
[exBegin] |
401 | 582 |
|top slv model| |
583 |
||
584 |
model := MultiSelectionInList with:#('foo' 'bar' 'baz' 'hello'). |
|
585 |
model selection:#('foo' 'bar'). |
|
586 |
||
587 |
top := StandardSystemView new |
|
588 |
label:'select'; |
|
589 |
minExtent:100@100; |
|
590 |
maxExtent:300@400; |
|
591 |
extent:200@200. |
|
592 |
||
593 |
slv := SelectionInListView on:model. |
|
594 |
slv multipleSelectOk:true. |
|
595 |
||
596 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
597 |
top open. |
|
598 |
||
449
725c26daf5d8
examples (use new monitoringInspector)
Claus Gittinger <cg@exept.de>
parents:
441
diff
changeset
|
599 |
InspectorView openOn:model monitor:'selectionIndexHolder' |
594 | 600 |
[exEnd] |
166 | 601 |
|
602 |
with strikeOut: |
|
594 | 603 |
[exBegin] |
401 | 604 |
|top slv model| |
605 |
||
606 |
model := MultiSelectionInList with:#('foo' 'bar' 'baz' 'hello'). |
|
607 |
model selection:#('foo' 'bar'). |
|
608 |
||
609 |
top := StandardSystemView new |
|
610 |
label:'select'; |
|
611 |
minExtent:100@100; |
|
612 |
maxExtent:300@400; |
|
613 |
extent:200@200. |
|
614 |
||
615 |
slv := SelectionInListView on:model. |
|
616 |
slv multipleSelectOk:true; toggleSelect:true; strikeOut:true. |
|
617 |
||
618 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
619 |
top open. |
|
620 |
||
449
725c26daf5d8
examples (use new monitoringInspector)
Claus Gittinger <cg@exept.de>
parents:
441
diff
changeset
|
621 |
InspectorView openOn:model monitor:'selectionIndexHolder' |
594 | 622 |
[exEnd] |
401 | 623 |
|
624 |
||
625 |
two listViews on the same list, but separate selections |
|
594 | 626 |
[exBegin] |
401 | 627 |
|top top2 lv1 lv2 selInL1 selInL2 listHolder l1 l2| |
628 |
||
629 |
top := StandardSystemView new extent:300@300. |
|
630 |
||
631 |
lv1 := SelectionInListView origin:0.0@0.0 corner:1.0@0.5 in:top. |
|
632 |
lv1 level:-1. |
|
633 |
lv1 toggleSelect:true. |
|
634 |
||
635 |
lv2 := SelectionInListView origin:0.0@0.5 corner:1.0@1.0 in:top. |
|
636 |
lv2 level:-1. |
|
637 |
lv2 toggleSelect:true. |
|
638 |
||
639 |
selInL1 := SelectionInList new. |
|
640 |
selInL2 := SelectionInList new. |
|
641 |
||
642 |
listHolder := #('foo' 'bar' 'baz') asValue. |
|
643 |
||
644 |
selInL1 listHolder:listHolder. |
|
645 |
selInL2 listHolder:listHolder. |
|
646 |
||
647 |
lv1 model:selInL1. |
|
648 |
lv2 model:selInL2. |
|
649 |
||
650 |
top open. |
|
651 |
||
652 |
top2 := StandardSystemView new extent:100 @ 30. |
|
653 |
l1 := Label origin:0.0@0.0 corner:0.5@1.0 in:top2. |
|
654 |
l2 := Label origin:0.5@0.0 corner:1.0@1.0 in:top2. |
|
655 |
||
656 |
l1 model:(BlockValue with:[:arg | arg value printString] argument:selInL1 selectionIndexHolder). |
|
657 |
l2 model:(BlockValue with:[:arg | arg value printString] argument:selInL2 selectionIndexHolder). |
|
658 |
||
659 |
l1 labelMessage:#value. |
|
660 |
l2 labelMessage:#value. |
|
661 |
||
662 |
top2 open. |
|
663 |
||
664 |
Delay waitForSeconds:2. |
|
665 |
listHolder value:#('1' '2' '3' '4'). |
|
594 | 666 |
[exEnd] |
628 | 667 |
non-string entries (text) |
668 |
[exBegin] |
|
669 |
|top l slv| |
|
670 |
||
671 |
top := StandardSystemView new |
|
672 |
label:'select'; |
|
673 |
minExtent:100@100; |
|
674 |
maxExtent:300@400; |
|
675 |
extent:200@200. |
|
676 |
||
677 |
slv := SelectionInListView new. |
|
678 |
l := OrderedCollection new. |
|
679 |
l add:(Text string:'red' emphasis:(#color->Color red)). |
|
680 |
l add:(Text string:'green' emphasis:(#color->Color green)). |
|
681 |
l add:(Text string:'blue' emphasis:(#color->Color blue)). |
|
682 |
slv list:l. |
|
655 | 683 |
slv action:[:index | Transcript showCR:'selected ' , index printString]. |
628 | 684 |
|
685 |
top add:slv in:(0.0@0.0 corner:1.0@1.0). |
|
686 |
top open |
|
687 |
[exEnd] |
|
838 | 688 |
|
689 |
non string entries |
|
690 |
[exBegin] |
|
691 |
|top slv wrapper l fileImage dirImage m| |
|
692 |
||
693 |
dirImage := Image fromFile:'DirObj.xbm'. |
|
694 |
fileImage := Image fromFile:'FileObj.xbm'. |
|
695 |
||
696 |
||
697 |
l := OrderedCollection new. |
|
698 |
Filename currentDirectory directoryContents do:[:s | |
|
699 |
s asFilename isDirectory ifTrue:[ |
|
700 |
l add:(LabelAndIcon icon:dirImage string:s) |
|
701 |
] ifFalse:[ |
|
702 |
l add:(LabelAndIcon icon:fileImage string:s) |
|
703 |
] |
|
704 |
]. |
|
705 |
||
706 |
m := SelectionInList new. |
|
707 |
m list:l. |
|
708 |
||
709 |
slv := SelectionInListView new. |
|
710 |
slv model:m. |
|
711 |
wrapper := HVScrollableView forView:slv miniScrollerH:true. |
|
712 |
||
713 |
top := StandardSystemView extent:150@200. |
|
714 |
top add:wrapper in:(0.0@0.0 corner:1.0@1.0). |
|
715 |
top open. |
|
716 |
[exEnd] |
|
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
717 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
718 |
[exBegin] |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
719 |
|top slv| |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
720 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
721 |
top := StandardSystemView new |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
722 |
label:'select'; |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
723 |
minExtent:100@100; |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
724 |
maxExtent:300@400; |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
725 |
extent:200@200. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
726 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
727 |
slv := SelectionInListView new. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
728 |
slv list:#('one' 'two' 'three'). |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
729 |
slv action:[:index | Transcript showCR:'selected ' , index printString]. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
730 |
slv multipleSelectOk:true. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
731 |
slv allowDrag:true. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
732 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
733 |
top add:slv in:(0.0@0.0 corner:1.0@1.0). |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
734 |
top open |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
735 |
[exEnd] |
119 | 736 |
" |
166 | 737 |
|
738 |
"Modified: 26.10.1995 / 16:42:02 / cg" |
|
7 | 739 |
! ! |
0 | 740 |
|
869
4b09e6fe33b6
allow multiSelect modifier to be changed
Claus Gittinger <cg@exept.de>
parents:
838
diff
changeset
|
741 |
!SelectionInListView class methodsFor:'instance creation'! |
105 | 742 |
|
125 | 743 |
on:aModel aspect:aspect change:change list:list initialSelection:initial |
744 |
^ self on:aModel |
|
745 |
printItems:true |
|
746 |
oneItem:false |
|
747 |
aspect:aspect |
|
748 |
change:change |
|
749 |
list:list |
|
750 |
menu:nil |
|
751 |
initialSelection:initial |
|
752 |
useIndex:true |
|
753 |
! |
|
754 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
755 |
on:aModel aspect:aspect change:change list:list menu:menu initialSelection:initial |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
756 |
^ self on:aModel |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
757 |
printItems:true |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
758 |
oneItem:false |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
759 |
aspect:aspect |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
760 |
change:change |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
761 |
list:list |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
762 |
menu:menu |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
763 |
initialSelection:initial |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
764 |
useIndex:true |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
765 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
766 |
|
105 | 767 |
on:aModel printItems:print oneItem:one aspect:aspect |
768 |
change:change list:list menu:menu initialSelection:initial |
|
769 |
||
770 |
"for ST-80 compatibility" |
|
771 |
||
119 | 772 |
^ self on:aModel |
105 | 773 |
printItems:print |
774 |
oneItem:one |
|
775 |
aspect:aspect |
|
776 |
change:change |
|
777 |
list:list |
|
778 |
menu:menu |
|
779 |
initialSelection:initial |
|
780 |
useIndex:false |
|
119 | 781 |
! |
782 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
783 |
on:aModel printItems:print oneItem:one aspect:aspect change:change |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
784 |
list:list menu:menu initialSelection:initial useIndex:useIndex |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
785 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
786 |
"for ST-80 compatibility" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
787 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
788 |
^ (self new) on:aModel |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
789 |
printItems:print |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
790 |
oneItem:one |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
791 |
aspect:aspect |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
792 |
change:change |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
793 |
list:list |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
794 |
menu:menu |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
795 |
initialSelection:initial |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
796 |
useIndex:useIndex |
105 | 797 |
! ! |
798 |
||
869
4b09e6fe33b6
allow multiSelect modifier to be changed
Claus Gittinger <cg@exept.de>
parents:
838
diff
changeset
|
799 |
!SelectionInListView class methodsFor:'defaults'! |
22 | 800 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
801 |
defaultAspectMessage |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
802 |
^ nil |
125 | 803 |
! |
804 |
||
805 |
defaultChangeMessage |
|
806 |
^ #selectionIndex: |
|
807 |
! |
|
808 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
809 |
defaultListMessage |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
810 |
^ #list |
125 | 811 |
! |
812 |
||
813 |
defaultSelectionMessage |
|
814 |
^ #selectionIndex |
|
815 |
! |
|
816 |
||
22 | 817 |
rightArrowFormOn:aDevice |
818 |
"return the form used for the right arrow (non 3D)" |
|
819 |
||
1636
6f75bcabf092
oops - resource spec was incompatible with stc.
Claus Gittinger <cg@exept.de>
parents:
1634
diff
changeset
|
820 |
<resource: #style (#'selection.rightArrowForm' #'selection.rightArrowFormFile')> |
1204
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
821 |
|
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
822 |
|f fn bits| |
22 | 823 |
|
824 |
((aDevice == Display) and:[RightArrowForm notNil]) ifTrue:[ |
|
898 | 825 |
^ RightArrowForm |
22 | 826 |
]. |
1204
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
827 |
|
1634 | 828 |
f := StyleSheet at:'selection.rightArrowForm'. |
22 | 829 |
f isNil ifTrue:[ |
1634 | 830 |
fn := StyleSheet at:'selection.rightArrowFormFile' default:'RightArrow.xbm'. |
1204
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
831 |
f := Image fromFile:fn resolution:100 on:aDevice. |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
832 |
f isNil ifTrue:[ |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
833 |
DefaultRightArrowStyle == #solid ifTrue:[ |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
834 |
bits := #[2r00000000 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
835 |
2r00000000 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
836 |
2r00000000 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
837 |
2r00000010 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
838 |
2r00000011 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
839 |
2r00000011 2r10000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
840 |
2r00000011 2r11000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
841 |
2r00000011 2r11100000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
842 |
2r00000011 2r11110000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
843 |
2r00000011 2r11100000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
844 |
2r00000011 2r11000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
845 |
2r00000011 2r10000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
846 |
2r00000011 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
847 |
2r00000010 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
848 |
2r00000000 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
849 |
2r00000000 2r00000000] |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
850 |
] ifFalse:[ |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
851 |
bits := #[2r00000000 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
852 |
2r00000000 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
853 |
2r00000000 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
854 |
2r00000110 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
855 |
2r00000101 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
856 |
2r00000100 2r10000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
857 |
2r00000100 2r01000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
858 |
2r00000100 2r00100000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
859 |
2r00000100 2r00010000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
860 |
2r00000100 2r00100000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
861 |
2r00000100 2r01000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
862 |
2r00000100 2r10000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
863 |
2r00000101 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
864 |
2r00000110 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
865 |
2r00000000 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
866 |
2r00000000 2r00000000] |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
867 |
]. |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
868 |
f := Form width:16 height:16 fromArray:bits on:aDevice |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
869 |
] |
22 | 870 |
]. |
871 |
(aDevice == Display) ifTrue:[ |
|
898 | 872 |
RightArrowForm := f |
22 | 873 |
]. |
874 |
^ f |
|
898 | 875 |
|
1634 | 876 |
"Modified: / 5.8.1998 / 00:04:40 / cg" |
31 | 877 |
! |
878 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
879 |
rightArrowLightFormOn:aDevice |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
880 |
"return the form used for the right arrow light pixels (3D only)" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
881 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
882 |
|f| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
883 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
884 |
((aDevice == Display) and:[RightArrowLightForm notNil]) ifTrue:[ |
898 | 885 |
^ RightArrowLightForm |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
886 |
]. |
898 | 887 |
f := Image fromFile:'bitmaps/RightArrowLight.xbm' resolution:100 on:aDevice. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
888 |
f isNil ifTrue:[ |
898 | 889 |
f := Form width:16 height:16 fromArray:#[2r00000000 2r00000000 |
890 |
2r00000000 2r00000000 |
|
891 |
2r00000000 2r00000000 |
|
892 |
2r00000110 2r00000000 |
|
893 |
2r00000101 2r00000000 |
|
894 |
2r00000100 2r10000000 |
|
895 |
2r00000100 2r01000000 |
|
896 |
2r00000100 2r00100000 |
|
897 |
2r00000100 2r00000000 |
|
898 |
2r00000100 2r00000000 |
|
899 |
2r00000100 2r00000000 |
|
900 |
2r00000100 2r00000000 |
|
901 |
2r00000100 2r00000000 |
|
902 |
2r00000100 2r00000000 |
|
903 |
2r00000000 2r00000000 |
|
904 |
2r00000000 2r00000000] |
|
905 |
on:aDevice |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
906 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
907 |
(aDevice == Display) ifTrue:[ |
898 | 908 |
RightArrowLightForm := f |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
909 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
910 |
^ f |
898 | 911 |
|
912 |
"Modified: 1.1.1970 / 14:10:42 / cg" |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
913 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
914 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
915 |
rightArrowShadowFormOn:aDevice |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
916 |
"return the form used for the right arrow light pixels (3D only)" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
917 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
918 |
|f| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
919 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
920 |
((aDevice == Display) and:[RightArrowShadowForm notNil]) ifTrue:[ |
898 | 921 |
^ RightArrowShadowForm |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
922 |
]. |
898 | 923 |
f := Image fromFile:'bitmaps/RightArrowShadow.xbm' resolution:100 on:aDevice. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
924 |
f isNil ifTrue:[ |
898 | 925 |
f := Form width:16 height:16 fromArray:#[2r00000000 2r00000000 |
926 |
2r00000000 2r00000000 |
|
927 |
2r00000000 2r00000000 |
|
928 |
2r00000000 2r00000000 |
|
929 |
2r00000000 2r00000000 |
|
930 |
2r00000000 2r00000000 |
|
931 |
2r00000000 2r00000000 |
|
932 |
2r00000000 2r00000000 |
|
933 |
2r00000000 2r00010000 |
|
934 |
2r00000000 2r00100000 |
|
935 |
2r00000000 2r01000000 |
|
936 |
2r00000000 2r10000000 |
|
937 |
2r00000001 2r00000000 |
|
938 |
2r00000010 2r00000000 |
|
939 |
2r00000000 2r00000000 |
|
940 |
2r00000000 2r00000000] |
|
941 |
on:aDevice |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
942 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
943 |
(aDevice == Display) ifTrue:[ |
898 | 944 |
RightArrowShadowForm := f |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
945 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
946 |
^ f |
898 | 947 |
|
948 |
"Modified: 1.1.1970 / 01:00:00 / cg" |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
949 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
950 |
|
31 | 951 |
smallRightArrowLightFormOn:aDevice |
952 |
"return the form used for the small right arrow light pixels (3D only)" |
|
953 |
||
954 |
|f| |
|
955 |
||
956 |
((aDevice == Display) and:[SmallRightArrowLightForm notNil]) ifTrue:[ |
|
898 | 957 |
^ SmallRightArrowLightForm |
31 | 958 |
]. |
898 | 959 |
f := Image fromFile:'bitmaps/SmallRightArrowLight.xbm' resolution:100 on:aDevice. |
31 | 960 |
f isNil ifTrue:[ |
898 | 961 |
f := Form width:9 height:9 fromArray:#[2r00000000 2r00000000 |
962 |
2r01100000 2r00000000 |
|
963 |
2r01011000 2r00000000 |
|
964 |
2r01000110 2r00000000 |
|
965 |
2r01000000 2r00000000 |
|
966 |
2r01000000 2r00000000 |
|
967 |
2r01000000 2r00000000 |
|
968 |
2r01000000 2r00000000 |
|
969 |
2r00000000 2r00000000] |
|
970 |
on:aDevice |
|
31 | 971 |
]. |
972 |
(aDevice == Display) ifTrue:[ |
|
898 | 973 |
SmallRightArrowLightForm := f |
31 | 974 |
]. |
975 |
^ f |
|
898 | 976 |
|
977 |
"Modified: 19.12.1996 / 14:10:59 / cg" |
|
31 | 978 |
! |
979 |
||
980 |
smallRightArrowShadowFormOn:aDevice |
|
981 |
"return the form used for the small right arrow light pixels (3D only)" |
|
982 |
||
983 |
|f| |
|
984 |
||
985 |
((aDevice == Display) and:[SmallRightArrowShadowForm notNil]) ifTrue:[ |
|
898 | 986 |
^ SmallRightArrowShadowForm |
31 | 987 |
]. |
898 | 988 |
f := Image fromFile:'bitmaps/SmallRightArrowShadow.xbm' resolution:100 on:aDevice. |
31 | 989 |
f isNil ifTrue:[ |
898 | 990 |
f := Form width:9 height:9 fromArray:#[2r00000000 2r00000000 |
991 |
2r00000000 2r00000000 |
|
992 |
2r00000000 2r00000000 |
|
993 |
2r00000000 2r00000000 |
|
994 |
2r00000001 2r00000000 |
|
995 |
2r00000110 2r00000000 |
|
996 |
2r00011000 2r00000000 |
|
997 |
2r00100000 2r00000000 |
|
998 |
2r00000000 2r00000000] |
|
999 |
on:aDevice |
|
31 | 1000 |
]. |
1001 |
(aDevice == Display) ifTrue:[ |
|
898 | 1002 |
SmallRightArrowShadowForm := f |
31 | 1003 |
]. |
1004 |
^ f |
|
898 | 1005 |
|
1006 |
"Modified: 19.12.1996 / 14:11:10 / cg" |
|
125 | 1007 |
! |
1008 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1009 |
updateStyleCache |
441
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
437
diff
changeset
|
1010 |
"extract values from the styleSheet and cache them in class variables" |
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
437
diff
changeset
|
1011 |
|
1354 | 1012 |
<resource: #style (#'selection.disabledForegroundColor' |
1013 |
#'selection.hilightForegroundColor' #'selection.hilightBackgroundColor' |
|
1014 |
#'selection.hilightFrameColor' #'selection.hilightLevel' |
|
1015 |
#'selection.rightArrowStyle' #'selection.rightArrowLevel' |
|
1016 |
#'selection.foregroundColor' #'selection.backgroundColor' |
|
1017 |
#'selection.shadowColor' #'selection.lightColor' |
|
1018 |
#'selection.font' #'selection.hilightStyle')> |
|
1019 |
||
1020 |
DefaultDisabledForegroundColor := StyleSheet colorAt:'selection.disabledForegroundColor'. |
|
1021 |
DefaultHilightForegroundColor := StyleSheet colorAt:'selection.hilightForegroundColor'. |
|
1022 |
DefaultHilightBackgroundColor := StyleSheet colorAt:'selection.hilightBackgroundColor'. |
|
1023 |
DefaultHilightFrameColor := StyleSheet colorAt:'selection.hilightFrameColor'. |
|
1024 |
DefaultHilightLevel := StyleSheet at:'selection.hilightLevel' default:0. |
|
1025 |
DefaultHilightStyle := StyleSheet at:'selection.hilightStyle' default:(StyleSheet name). |
|
1026 |
DefaultRightArrowStyle := StyleSheet at:'selection.rightArrowStyle'. |
|
1027 |
DefaultRightArrowLevel := StyleSheet at:'selection.rightArrowLevel'. |
|
1028 |
DefaultForegroundColor := StyleSheet colorAt:'selection.foregroundColor'. |
|
1029 |
DefaultBackgroundColor := StyleSheet colorAt:'selection.backgroundColor'. |
|
1030 |
DefaultShadowColor := StyleSheet colorAt:'selection.shadowColor'. |
|
1031 |
DefaultLightColor := StyleSheet colorAt:'selection.lightColor'. |
|
1032 |
DefaultFont := StyleSheet fontAt:'selection.font'. |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1033 |
RightArrowForm := nil. |
125 | 1034 |
|
1035 |
" |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1036 |
self updateStyleCache |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1037 |
" |
441
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
437
diff
changeset
|
1038 |
|
1354 | 1039 |
"Modified: 20.10.1997 / 14:04:26 / cg" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1040 |
! ! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1041 |
|
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1042 |
!SelectionInListView methodsFor:'ST80 compatibility'! |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1043 |
|
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1044 |
sequence |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1045 |
"same as #list - for ST80 compatibility" |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1046 |
|
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1047 |
^ self list |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1048 |
|
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1049 |
"Created: / 21.6.1998 / 02:46:50 / cg" |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1050 |
! ! |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1051 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1052 |
!SelectionInListView methodsFor:'accessing-actions'! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1053 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1054 |
action:aBlock |
1745
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
1055 |
"set the action block to be performed on select. |
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
1056 |
With useIndex==true, the block gets the selectionIndex as arg, |
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
1057 |
otherwise, it gets the selectionValue." |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1058 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1059 |
actionBlock := aBlock |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1060 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1061 |
|
393 | 1062 |
doubleClickAction:aOneArgBlock |
1063 |
"set the double click action block. |
|
1064 |
If non-nil, that one is evaluated on double click, passing the |
|
1745
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
1065 |
selection-line-number (useIndex==true) or selectionValue (useIndex==false) as argument." |
393 | 1066 |
|
1067 |
doubleClickActionBlock := aOneArgBlock |
|
1068 |
||
1069 |
"Modified: 24.2.1996 / 16:07:28 / cg" |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1070 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1071 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1072 |
keyActionStyle:aSymbol |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1073 |
"defines how the view should respond to alpha-keys pressed. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1074 |
Possible values are: |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1075 |
#select -> will select next entry starting with that |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1076 |
character and perform the click-action |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1077 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1078 |
#selectAndDoubleclick -> will select next & perform double-click action |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1079 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1080 |
#pass -> will pass key to superclass (i.e. no special treatment) |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1081 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1082 |
nil -> will ignore key |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1083 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1084 |
the default (set in #initialize) is #select |
125 | 1085 |
" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1086 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1087 |
keyActionStyle := aSymbol |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1088 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1089 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1090 |
returnKeyActionStyle:aSymbol |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1091 |
"defines how the view should respond to a return key pressed. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1092 |
Possible values are: |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1093 |
#doubleClick -> perform double-click action |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1094 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1095 |
#pass -> will pass key to superclass (i.e. no special treatment) |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1096 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1097 |
nil -> will ignore key |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1098 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1099 |
the default (set in #initialize) is #doubleClick |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1100 |
" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1101 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1102 |
returnKeyActionStyle := aSymbol |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1103 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1104 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1105 |
selectConditionBlock:aBlock |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1106 |
"set the conditionBlock; this block is evaluated before a selection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1107 |
change is performed; the change will not be done, if the evaluation |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1108 |
returns false. For example, this allows confirmation queries in |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1109 |
the SystemBrowser" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1110 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1111 |
selectConditionBlock := aBlock |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1112 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1113 |
|
1310 | 1114 |
useIndex |
1115 |
"set/clear the useIndex flag. If set, both actionBlock and change-messages |
|
1116 |
are passed the index(indices) of the selection as argument. |
|
1117 |
If clear, the value(s) (i.e. the selected string) is passed. |
|
1118 |
Default is true." |
|
1119 |
||
1120 |
^ useIndex |
|
1121 |
! |
|
1122 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1123 |
useIndex:aBoolean |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1124 |
"set/clear the useIndex flag. If set, both actionBlock and change-messages |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1125 |
are passed the index(indices) of the selection as argument. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1126 |
If clear, the value(s) (i.e. the selected string) is passed. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1127 |
Default is true." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1128 |
|
1235 | 1129 |
useIndex ~~ aBoolean ifTrue:[ |
1130 |
useIndex := aBoolean. |
|
1131 |
useIndex ifTrue:[ |
|
1132 |
changeMsg == #selection: ifTrue:[ |
|
1133 |
changeMsg := #selectionIndex:. |
|
1134 |
aspectMsg := #selectionIndex. |
|
1135 |
] |
|
1136 |
] ifFalse:[ |
|
1137 |
changeMsg == #selectionIndex: ifTrue:[ |
|
1138 |
changeMsg := #selection:. |
|
1139 |
aspectMsg := #selection. |
|
1140 |
] |
|
1141 |
]. |
|
1142 |
]. |
|
1143 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1144 |
! ! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1145 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1146 |
!SelectionInListView methodsFor:'accessing-attributes'! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1147 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1148 |
attributeAt:index |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1149 |
"return the line attribute of list line index. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1150 |
currently supported are: |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1151 |
#halfIntensity |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1152 |
#disabled |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1153 |
#bold |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1154 |
" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1155 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1156 |
listAttributes isNil ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1157 |
(index > listAttributes size) ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1158 |
^ listAttributes at:index |
125 | 1159 |
] |
1160 |
]. |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1161 |
^ nil |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1162 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1163 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1164 |
attributeAt:index add:aSymbolOrCollectionOfSymbols |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1165 |
"add to a lines attribute(s); |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1166 |
currently supported are: |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1167 |
#halfIntensity |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1168 |
#disabled |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1169 |
#bold |
125 | 1170 |
" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1171 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1172 |
|current| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1173 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1174 |
current := self attributeAt:index. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1175 |
current isNil ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1176 |
current := Set new. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1177 |
] ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1178 |
current isSymbol ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1179 |
current == aSymbolOrCollectionOfSymbols ifTrue:[^ self]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1180 |
current := Set with:current |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1181 |
] |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1182 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1183 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1184 |
aSymbolOrCollectionOfSymbols isSymbol ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1185 |
current := current add:aSymbolOrCollectionOfSymbols |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1186 |
] ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1187 |
(current includes:aSymbolOrCollectionOfSymbols) ifTrue:[^ self]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1188 |
current addAll:aSymbolOrCollectionOfSymbols |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1189 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1190 |
self attributeAt:index put:current |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1191 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1192 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1193 |
attributeAt:index put:aSymbolOrCollectionOfSymbolsOrNil |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1194 |
"set a lines attribute(s); |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1195 |
currently supported are: |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1196 |
#halfIntensity |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1197 |
#disabled |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1198 |
#bold |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1199 |
" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1200 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1201 |
(index > self size) ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1202 |
listAttributes isNil ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1203 |
listAttributes := (OrderedCollection new:index) grow:index |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1204 |
] ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1205 |
(index > listAttributes size) ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1206 |
listAttributes grow:index |
125 | 1207 |
] |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1208 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1209 |
aSymbolOrCollectionOfSymbolsOrNil = (listAttributes at:index) ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1210 |
listAttributes at:index put:aSymbolOrCollectionOfSymbolsOrNil. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1211 |
self redrawLine:index |
125 | 1212 |
] |
1213 |
] |
|
1214 |
||
1215 |
! |
|
1216 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1217 |
attributeAt:index remove:aSymbolOrCollectionOfSymbols |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1218 |
"remove a line attribute; |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1219 |
currently supported are: |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1220 |
#halfIntensity |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1221 |
#disabled |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1222 |
#bold |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1223 |
" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1224 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1225 |
|current| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1226 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1227 |
current := self attributeAt:index. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1228 |
current isNil ifTrue:[^ self]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1229 |
current isSymbol ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1230 |
aSymbolOrCollectionOfSymbols isSymbol ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1231 |
current == aSymbolOrCollectionOfSymbols ifTrue:[current := nil] |
125 | 1232 |
] ifFalse:[ |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1233 |
(aSymbolOrCollectionOfSymbols includes:current) ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1234 |
current := nil |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1235 |
] |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1236 |
] |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1237 |
] ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1238 |
aSymbolOrCollectionOfSymbols isSymbol ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1239 |
current := current remove:aSymbolOrCollectionOfSymbols ifAbsent:[] |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1240 |
] ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1241 |
aSymbolOrCollectionOfSymbols removeAll:aSymbolOrCollectionOfSymbols |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1242 |
] |
125 | 1243 |
]. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1244 |
self attributeAt:index put:current |
125 | 1245 |
! |
1246 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1247 |
line:lineNr hasAttribute:aSymbol |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1248 |
"return true, if line nr has attribute, aSymbol; |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1249 |
currently supported attributes are: |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1250 |
#halfIntensity |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1251 |
#disabled |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1252 |
#bold |
125 | 1253 |
" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1254 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1255 |
|attr| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1256 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1257 |
listAttributes isNil ifTrue:[^ false]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1258 |
(lineNr > listAttributes size) ifTrue:[^ false]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1259 |
attr := listAttributes at:lineNr. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1260 |
attr isNil ifTrue:[^ false]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1261 |
attr isSymbol ifTrue:[^ attr == aSymbol]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1262 |
^ (attr includes:aSymbol) |
125 | 1263 |
! |
1264 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1265 |
setAttributes:aList |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1266 |
"set the attribute list. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1267 |
No redraw is done - the caller should make sure to redraw afterwards |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1268 |
(or use this only before the view is visible)." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1269 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1270 |
listAttributes := aList |
125 | 1271 |
! |
1272 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1273 |
strikeOut:aBoolean |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1274 |
"turn on/off strikeOut mode" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1275 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1276 |
strikeOut := aBoolean. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1277 |
! ! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1278 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1279 |
!SelectionInListView methodsFor:'accessing-behavior'! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1280 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1281 |
disable |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1282 |
"disable the view - no selection changes are allowed" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1283 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1284 |
enabled := false |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1285 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1286 |
|
1181
ad5004cb2969
allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents:
1163
diff
changeset
|
1287 |
dragObjectConverter:aBlock |
ad5004cb2969
allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents:
1163
diff
changeset
|
1288 |
"set an optional dragObject converter; |
ad5004cb2969
allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents:
1163
diff
changeset
|
1289 |
if non-nil, this one will be evaluated on a drag-start, |
1182
b8af34a9be46
allow a dropConverter to return nil (ignore on drop)
Claus Gittinger <cg@exept.de>
parents:
1181
diff
changeset
|
1290 |
for each dropItem as argument, and supposed |
b8af34a9be46
allow a dropConverter to return nil (ignore on drop)
Claus Gittinger <cg@exept.de>
parents:
1181
diff
changeset
|
1291 |
to convert it into a dragObject and return it. |
b8af34a9be46
allow a dropConverter to return nil (ignore on drop)
Claus Gittinger <cg@exept.de>
parents:
1181
diff
changeset
|
1292 |
If it returns nil, the object will not be dropped. |
1181
ad5004cb2969
allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents:
1163
diff
changeset
|
1293 |
Useful, if the receiver view represents fileNames or other |
ad5004cb2969
allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents:
1163
diff
changeset
|
1294 |
names of the actual objects to be dragged." |
ad5004cb2969
allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents:
1163
diff
changeset
|
1295 |
|
ad5004cb2969
allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents:
1163
diff
changeset
|
1296 |
dragObjectConverter := aBlock |
ad5004cb2969
allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents:
1163
diff
changeset
|
1297 |
|
ad5004cb2969
allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents:
1163
diff
changeset
|
1298 |
"Created: 6.4.1997 / 12:16:11 / cg" |
1182
b8af34a9be46
allow a dropConverter to return nil (ignore on drop)
Claus Gittinger <cg@exept.de>
parents:
1181
diff
changeset
|
1299 |
"Modified: 6.4.1997 / 14:12:45 / cg" |
1181
ad5004cb2969
allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents:
1163
diff
changeset
|
1300 |
! |
ad5004cb2969
allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents:
1163
diff
changeset
|
1301 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1302 |
enable |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1303 |
"enable the view - selection changes are allowed" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1304 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1305 |
enabled := true |
125 | 1306 |
! |
1307 |
||
987
611244bb2e1d
Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents:
970
diff
changeset
|
1308 |
enabled |
611244bb2e1d
Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents:
970
diff
changeset
|
1309 |
"return true if selections are possible" |
611244bb2e1d
Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents:
970
diff
changeset
|
1310 |
|
611244bb2e1d
Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents:
970
diff
changeset
|
1311 |
^ enabled. |
611244bb2e1d
Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents:
970
diff
changeset
|
1312 |
|
611244bb2e1d
Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents:
970
diff
changeset
|
1313 |
"Created: 29.1.1997 / 12:40:54 / stefan" |
611244bb2e1d
Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents:
970
diff
changeset
|
1314 |
! |
611244bb2e1d
Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents:
970
diff
changeset
|
1315 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1316 |
ignoreReselect:aBoolean |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1317 |
"set/clear the ignoreReselect flag - |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1318 |
if set, a click on an already selected entry is ignored. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1319 |
Otherwise the notification is done, even if no |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1320 |
change in the selection occurs. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1321 |
(for example, in browser to update a method). |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1322 |
Setting ignoreReselect to false makes sense if data is shown |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1323 |
which may change by itself (i.e. without the user doing anything) |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1324 |
For example, the inspector uses this, and redisplays the value, |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1325 |
if the selection is the same. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1326 |
The default is true, meaning that a click on an already selected |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1327 |
does not lead to a notification via the actionBlock/change mechanism." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1328 |
|
997 | 1329 |
"ca: |
1330 |
multiple selection on: the ignoreReselect will have no influence |
|
1331 |
" |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1332 |
ignoreReselect := aBoolean |
125 | 1333 |
! |
1334 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1335 |
multipleSelectOk:aBoolean |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1336 |
"allow/disallow multiple selections. If enabled, the |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1337 |
user may select multiple entries in the list, and the program |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1338 |
always gets a collection of selected items (indexes if useIndex is true, |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1339 |
values otherwise). The default is false, for single selections." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1340 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1341 |
multipleSelectOk := aBoolean. |
997 | 1342 |
|
125 | 1343 |
! |
1344 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1345 |
toggleSelect:aBoolean |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1346 |
"turn on/off toggle select. If true, clicking on a selected entry |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1347 |
unselects it and vice versa. The default is false, which means |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1348 |
that clicking on an already selected entry does not change its |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1349 |
select status (see also ignoreReselect:)." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1350 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1351 |
toggleSelect := aBoolean. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1352 |
! ! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1353 |
|
1163
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1354 |
!SelectionInListView methodsFor:'accessing-channels'! |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1355 |
|
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1356 |
enableChannel |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1357 |
^ enableChannel |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1358 |
|
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1359 |
"Created: 28.3.1997 / 21:24:00 / cg" |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1360 |
! |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1361 |
|
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1362 |
enableChannel:aValueHolder |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1363 |
"set the valueHolder, which holds the enable boolean value" |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1364 |
|
1379 | 1365 |
|prev| |
1366 |
||
1367 |
prev := enableChannel. |
|
1163
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1368 |
enableChannel := aValueHolder. |
1400 | 1369 |
self setupChannel:aValueHolder for:nil withOld:prev |
1370 |
||
1371 |
"Modified: / 14.11.1997 / 13:51:15 / cg" |
|
1310 | 1372 |
! |
1373 |
||
1374 |
listHolder |
|
1375 |
^ listChannel |
|
1376 |
! |
|
1377 |
||
1378 |
listHolder:aListHolder |
|
1379 |
listChannel notNil ifTrue:[ |
|
1380 |
listChannel removeDependent:self |
|
1381 |
]. |
|
1382 |
(listChannel := aListHolder) notNil ifTrue:[ |
|
1383 |
listChannel addDependent:self |
|
1384 |
]. |
|
1385 |
self getListFromModel |
|
1163
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1386 |
! ! |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1387 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1388 |
!SelectionInListView methodsFor:'accessing-contents'! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1389 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1390 |
add:aValue beforeIndex:index |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1391 |
"must recompute our current selections" |
125 | 1392 |
|
1393 |
selection notNil ifTrue:[ |
|
1394 |
multipleSelectOk ifTrue:[ |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1395 |
selection := selection collect:[ :sel | |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1396 |
sel >= index ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1397 |
sel + 1 |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1398 |
] ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1399 |
sel |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1400 |
] |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1401 |
]. |
125 | 1402 |
] ifFalse:[ |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1403 |
selection >= index ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1404 |
selection := selection + 1. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1405 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1406 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1407 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1408 |
^ super add:aValue beforeIndex:index. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1409 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1410 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1411 |
contents:aCollection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1412 |
"set the list - redefined, since setting the list implies unselecting |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1413 |
and clearing attributes. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1414 |
No redraw is done - the caller should make sure to redraw afterwards |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1415 |
(or use this only before the view is visible)." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1416 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1417 |
selection := nil. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1418 |
listAttributes := nil. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1419 |
super contents:aCollection. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1420 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1421 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1422 |
list:aCollection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1423 |
"set the list - redefined, since setting the list implies unselecting |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1424 |
and clearing attributes." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1425 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1426 |
self list:aCollection keepSelection:false |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1427 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1428 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1429 |
list:aCollection keepSelection:aBoolean |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1430 |
"set the list - redefined, since setting the list implies unselecting |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1431 |
and clearing attributes." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1432 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1433 |
|oldSelection| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1434 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1435 |
"somewhat of a kludge: if selection is first line, |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1436 |
we have to remove the highlight frame by hand here" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1437 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1438 |
(shown and:[hilightLevel ~~ 0]) ifTrue:[ |
686
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1439 |
selection == firstLineShown ifTrue:[ |
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1440 |
self paint:bgColor. |
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1441 |
self fillRectangleX:margin y:margin |
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1442 |
width:(width - (margin * 2)) |
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1443 |
height:(hilightLevel abs). |
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1444 |
]. |
125 | 1445 |
]. |
1446 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1447 |
aBoolean ifTrue:[ |
686
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1448 |
oldSelection := selection. |
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1449 |
selection := nil. |
125 | 1450 |
]. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1451 |
listAttributes := nil. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1452 |
super list:aCollection expandTabs:printItems. |
686
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1453 |
self setSelection:oldSelection. "/ nil if keep is false |
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1454 |
|
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1455 |
"Modified: 25.5.1996 / 16:31:13 / cg" |
31 | 1456 |
! |
1457 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1458 |
printItems:aBoolean |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1459 |
"set/clear the printItems flag. If set, items (as set via #list: or |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1460 |
as returned from the model) are sent #printString to display them. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1461 |
If false, items are assumed to be either strings, or know how to |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1462 |
display themself in a GC (i.e. they are instances of ListEntry). |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1463 |
The default is false. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1464 |
Caveat: printString seems to be too specialized - I'd rather have |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1465 |
a definable printSelector or - better - a printConverter. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1466 |
This may be added in the future." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1467 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1468 |
printItems := aBoolean |
125 | 1469 |
! |
1470 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1471 |
removeIndexWithoutRedraw:lineNr |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1472 |
"delete line - no redraw; |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1473 |
return true, if something was really deleted. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1474 |
Redefined since we have to care for selection" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1475 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1476 |
self checkRemovingSelection:lineNr. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1477 |
^ super removeIndexWithoutRedraw:lineNr |
105 | 1478 |
! |
1479 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1480 |
setContents:aCollection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1481 |
"set the list - redefined, since setting the list implies unselecting |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1482 |
and clearing attributes. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1483 |
No redraw is done - the caller should make sure to redraw afterwards |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1484 |
(or use this only before the view is visible)." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1485 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1486 |
selection := nil. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1487 |
listAttributes := nil. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1488 |
super setContents:aCollection. |
125 | 1489 |
! |
1490 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1491 |
setList:aCollection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1492 |
"set the list - redefined, since setting the list implies unselecting |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1493 |
and clearing attributes. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1494 |
No redraw is done - the caller should make sure to redraw afterwards |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1495 |
(or use this only before the view is visible)." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1496 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1497 |
selection := nil. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1498 |
listAttributes := nil. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1499 |
super setList:aCollection. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1500 |
! ! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1501 |
|
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1502 |
!SelectionInListView methodsFor:'accessing-look'! |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1503 |
|
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1504 |
selectedVisualBlock:aBlock |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1505 |
"ST-80 compatibility - dummy for now" |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1506 |
|
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1507 |
selectedVisualBlock := aBlock |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1508 |
|
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1509 |
"Created: / 27.10.1997 / 19:50:58 / cg" |
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1510 |
"Modified: / 21.6.1998 / 02:40:46 / cg" |
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1511 |
! |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1512 |
|
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1513 |
visualBlock:aBlock |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1514 |
"ST-80 compatibility - dummy for now" |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1515 |
|
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1516 |
visualBlock := aBlock |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1517 |
|
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1518 |
"Modified: / 21.6.1998 / 02:40:57 / cg" |
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1519 |
! ! |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1520 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1521 |
!SelectionInListView methodsFor:'accessing-mvc'! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1522 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1523 |
addModelInterfaceTo:aDictionary |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1524 |
"see comment in View>>modelInterface" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1525 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1526 |
super addModelInterfaceTo:aDictionary. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1527 |
aDictionary at:#doubleClickMessage put:doubleClickMsg. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1528 |
aDictionary at:#initialSelectionMessage put:initialSelectionMsg. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1529 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1530 |
" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1531 |
SelectionInListView new modelInterface |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1532 |
" |
105 | 1533 |
! |
1534 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1535 |
doubleClick:aSymbol |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1536 |
"set the symbol with which the model is informed about double-click. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1537 |
OBSOLETE: please use #doubleClickMessage:" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1538 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1539 |
self obsoleteMethodWarning:'please use #doubleClickMessage:'. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1540 |
doubleClickMsg := aSymbol |
105 | 1541 |
! |
1542 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1543 |
doubleClickMessage |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1544 |
"return the symbol with which the model (if any) is informed about |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1545 |
double-click. If nil (which is the default), it is not informed." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1546 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1547 |
^ doubleClickMsg |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1548 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1549 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1550 |
doubleClickMessage:aSymbol |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1551 |
"set the symbol with which the model (if any) is informed about double-click. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1552 |
If nil (which is the default), it is not informed." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1553 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1554 |
doubleClickMsg := aSymbol |
119 | 1555 |
! |
1556 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1557 |
initialSelectionMessage |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1558 |
"return the symbol by which the model informes me about a changed |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1559 |
selectionIndex. This is used both in change notification and to |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1560 |
actually aquire a new selection value." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1561 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1562 |
^ initialSelectionMsg |
125 | 1563 |
! |
1564 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1565 |
initialSelectionMessage:aSymbol |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1566 |
"set the symbol by which the model informes me about a changed |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1567 |
selectionIndex. This is used both in change notification and to |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1568 |
actually aquire a new selection value." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1569 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1570 |
initialSelectionMsg := aSymbol |
125 | 1571 |
! |
1572 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1573 |
on:aModel printItems:print oneItem:one aspect:aspectSymbol change:changeSymbol |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1574 |
list:listSymbol menu:menuSymbol initialSelection:initialSymbol useIndex:use |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1575 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1576 |
"ST-80 compatibility" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1577 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1578 |
aspectMsg := aspectSymbol. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1579 |
changeMsg := changeSymbol. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1580 |
listMsg := listSymbol. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1581 |
menuMsg := menuSymbol. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1582 |
initialSelectionMsg := initialSymbol. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1583 |
printItems := print. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1584 |
oneItem := one. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1585 |
useIndex := use. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1586 |
ignoreReselect := false. "/ ST80 behavior |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1587 |
self model:aModel. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1588 |
! ! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1589 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1590 |
!SelectionInListView methodsFor:'accessing-selection'! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1591 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1592 |
addElementToSelection:anObject |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1593 |
"add the element with the same printstring as the argument, anObject |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1594 |
to the selection. The entry is searched by comparing printStrings. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1595 |
No scrolling is done. Returns true, if ok, false if no such entry |
886 | 1596 |
was found. |
1597 |
*** No model and/or actionBlock notification is done here." |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1598 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1599 |
|lineNo str| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1600 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1601 |
str := anObject printString. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1602 |
lineNo := list findFirst:[:entry | str = entry printString]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1603 |
lineNo ~~ 0 ifTrue:[ |
886 | 1604 |
self addToSelection:lineNo. |
1605 |
^ true |
|
125 | 1606 |
]. |
1607 |
^ false |
|
886 | 1608 |
|
1609 |
"Modified: 15.11.1996 / 16:59:43 / cg" |
|
125 | 1610 |
! |
1611 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1612 |
addToSelection:aNumber |
886 | 1613 |
"add entry, aNumber to the selection. No scrolling is done. |
1614 |
*** No model and/or actionBlock notification is done here." |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1615 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1616 |
(self isValidSelection:aNumber) ifFalse:[^ self]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1617 |
|
1409 | 1618 |
(selectConditionBlock notNil |
1619 |
and:[(selectConditionBlock value:aNumber) not]) ifTrue:[^ self]. |
|
1620 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1621 |
selection isNil ifTrue:[^ self selectWithoutScroll:aNumber]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1622 |
selection isCollection ifTrue:[ |
886 | 1623 |
(selection includes:aNumber) ifTrue:[^ self]. |
1202 | 1624 |
selection := selection copyWith:aNumber. |
1625 |
"/ selection add:aNumber |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1626 |
] ifFalse:[ |
886 | 1627 |
(aNumber == selection) ifTrue:[^ self]. |
1628 |
selection := OrderedCollection with:selection with:aNumber |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1629 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1630 |
self redrawElement:aNumber |
886 | 1631 |
|
1632 |
"Modified: 15.11.1996 / 16:59:29 / cg" |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1633 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1634 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1635 |
removeFromSelection:aNumber |
886 | 1636 |
"remove entry, aNumber from the selection. |
1637 |
*** No model and/or actionBlock notification is done here." |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1638 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1639 |
selection isNil ifTrue:[^ self]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1640 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1641 |
multipleSelectOk ifTrue:[ |
886 | 1642 |
(selection includes:aNumber) ifFalse:[^ self]. |
1202 | 1643 |
selection := selection copyWithout:aNumber. |
1644 |
"/ selection remove:aNumber. |
|
886 | 1645 |
selection size == 0 ifTrue:[ |
1646 |
selection := nil |
|
1647 |
] |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1648 |
] ifFalse:[ |
886 | 1649 |
(aNumber == selection) ifFalse:[^ self]. |
1650 |
selection := nil |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1651 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1652 |
self redrawElement:aNumber |
886 | 1653 |
|
1654 |
"Modified: 15.11.1996 / 16:59:04 / cg" |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1655 |
! ! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1656 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1657 |
!SelectionInListView methodsFor:'change & update'! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1658 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1659 |
update:something with:aParameter from:changedObject |
1358 | 1660 |
|list start stop size| |
1345 | 1661 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1662 |
changedObject == model ifTrue:[ |
1235 | 1663 |
something == aspectMsg ifTrue:[ |
1358 | 1664 |
listChannel isNil ifTrue:[ |
1665 |
self getListFromModel |
|
1666 |
]. |
|
1235 | 1667 |
self getSelectionFromModel. |
1668 |
^ self |
|
1669 |
]. |
|
1670 |
something == listMsg ifTrue:[ |
|
1671 |
self getListFromModel. |
|
1672 |
^ self |
|
1673 |
]. |
|
1674 |
something == initialSelectionMsg ifTrue:[ |
|
1675 |
self getSelectionFromModel. |
|
1676 |
^ self |
|
1677 |
]. |
|
1678 |
something == #empty ifTrue:[ |
|
1679 |
self list:nil. |
|
1680 |
^ self |
|
1681 |
]. |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1682 |
]. |
1402 | 1683 |
changedObject == enableChannel ifTrue:[ |
1400 | 1684 |
self enableStateChange. |
1685 |
^ self |
|
1686 |
]. |
|
1345 | 1687 |
changedObject == listChannel ifFalse:[ |
1688 |
^ super update:something with:aParameter from:changedObject |
|
1689 |
]. |
|
1690 |
list := listChannel value. |
|
1691 |
||
1692 |
something == #at: ifTrue:[ |
|
1693 |
^ self at:aParameter put:(list at:aParameter). |
|
1694 |
]. |
|
1695 |
||
1696 |
something == #insert: ifTrue:[ |
|
1697 |
^ self add:(list at:aParameter) beforeIndex:aParameter |
|
1698 |
]. |
|
1699 |
||
1700 |
something == #remove: ifTrue:[ |
|
1701 |
^ self removeIndex:aParameter |
|
1702 |
]. |
|
1703 |
||
1704 |
something == #insertCollection: ifTrue:[ |
|
1473 | 1705 |
(size := aParameter last) ~~ 0 ifTrue:[ |
1706 |
self size == 0 ifTrue:[ |
|
1707 |
self getListFromModel |
|
1708 |
] ifFalse:[ |
|
1709 |
start := aParameter first. |
|
1710 |
||
1711 |
size timesRepeat:[ |
|
1712 |
self add:(list at:start) beforeIndex:start. |
|
1713 |
start := start + 1 |
|
1714 |
] |
|
1358 | 1715 |
] |
1345 | 1716 |
]. |
1310 | 1717 |
^ self |
1718 |
]. |
|
1345 | 1719 |
|
1720 |
something == #removeFrom: ifTrue:[ |
|
1721 |
start := aParameter first. |
|
1722 |
stop := aParameter last. |
|
1723 |
||
1724 |
(start == 1 and:[stop == self size]) ifTrue:[ |
|
1473 | 1725 |
self getListFromModel |
1345 | 1726 |
] ifFalse:[ |
1727 |
(stop - start + 1) timesRepeat:[ |
|
1728 |
self removeIndex:start |
|
1729 |
] |
|
1730 |
]. |
|
1731 |
^ self |
|
1732 |
]. |
|
1733 |
||
1734 |
something == #replace: ifTrue:[ |
|
1735 |
start := aParameter first. |
|
1736 |
stop := aParameter last. |
|
1737 |
||
1738 |
start to:stop do:[:anIndex| |
|
1739 |
self at:anIndex put:(list at:anIndex) |
|
1740 |
]. |
|
1741 |
^ self |
|
1742 |
]. |
|
1743 |
||
1744 |
self getListFromModel. |
|
1400 | 1745 |
|
1746 |
"Modified: / 14.11.1997 / 13:51:04 / cg" |
|
125 | 1747 |
! ! |
1748 |
||
1473 | 1749 |
!SelectionInListView methodsFor:'drag & drop - new'! |
1750 |
||
1751 |
canDrag |
|
1752 |
"returns true if dragging is enabled |
|
1753 |
" |
|
1754 |
^ (allowDrag or:[dropSource notNil]) |
|
1755 |
! |
|
1756 |
||
1757 |
dropSource |
|
1758 |
"returns the dropSource or nil |
|
1759 |
" |
|
1760 |
^ dropSource |
|
1761 |
! |
|
1762 |
||
1763 |
dropSource:aDropSourceOrNil |
|
1764 |
"set the dropSource or nil |
|
1765 |
" |
|
1766 |
dropSource := aDropSourceOrNil. |
|
1767 |
||
1768 |
||
1769 |
! |
|
1770 |
||
1771 |
dropTarget |
|
1772 |
"returns the dropTarget or nil |
|
1773 |
" |
|
1774 |
^ dropTarget |
|
1775 |
! |
|
1776 |
||
1777 |
dropTarget:aDropTragetOrNil |
|
1778 |
"set the dropTarget or nil |
|
1779 |
" |
|
1780 |
dropTarget := aDropTragetOrNil. |
|
1781 |
||
1782 |
||
1783 |
! |
|
1784 |
||
1785 |
startDragAt:aPoint |
|
1786 |
||
1787 |
dropSource isNil ifTrue:[ |
|
1788 |
self startDragX:aPoint x y:aPoint y |
|
1789 |
] ifFalse:[ |
|
1790 |
dropSource startDragIn:self at:aPoint |
|
1791 |
] |
|
1792 |
! ! |
|
1793 |
||
1794 |
!SelectionInListView methodsFor:'drag & drop - old'! |
|
1795 |
||
1796 |
allowDrag:aBoolean |
|
1797 |
"enable/disable dragging support" |
|
1798 |
||
1799 |
allowDrag := aBoolean |
|
1800 |
||
1801 |
"Created: 14.11.1996 / 15:12:58 / cg" |
|
1802 |
! |
|
1803 |
||
1804 |
collectionOfDragObjects |
|
1805 |
"returns collection of dragable objects assigned to selection |
|
1806 |
Here, by default, a collection of text-dragObjects is generated; |
|
1807 |
however, if a dragObjectConverter is defined, that one gets a chance |
|
1808 |
to convert as appropriate." |
|
1809 |
||
1810 |
|collection converted| |
|
1811 |
||
1812 |
collection := OrderedCollection new. |
|
1813 |
||
1814 |
self selectionDo:[:aNumber||text| |
|
1815 |
text := self at:aNumber. |
|
1816 |
collection add:(DropObject newText:text) |
|
1817 |
]. |
|
1818 |
dragObjectConverter notNil ifTrue:[ |
|
1819 |
converted := OrderedCollection new. |
|
1820 |
collection do:[:o | |
|
1821 |
|convertedObject| |
|
1822 |
||
1823 |
convertedObject := dragObjectConverter value:o. |
|
1824 |
convertedObject notNil ifTrue:[ |
|
1825 |
converted add:convertedObject |
|
1826 |
] |
|
1827 |
]. |
|
1828 |
collection := converted |
|
1829 |
]. |
|
1830 |
^ collection. |
|
1831 |
||
1832 |
"Modified: 6.4.1997 / 14:14:30 / cg" |
|
1833 |
! |
|
1834 |
||
1835 |
endDragAction:aFourArgBlock |
|
1836 |
"if dragging is enabled, this block will be evaluated |
|
1837 |
at drag end time. |
|
1838 |
It gets 4 args passed (see DragAndDropManager>>endDragAt:): |
|
1839 |
- the targetView (if its a smalltalk view) |
|
1840 |
- the targetViews windowID (useful, if its an alien view) |
|
1841 |
- the dropPosition in screen coordinates |
|
1842 |
- the dropPosition within the target view |
|
1843 |
" |
|
1844 |
||
1845 |
endDragAction := aFourArgBlock |
|
1846 |
||
1847 |
"Created: 14.11.1996 / 15:42:38 / cg" |
|
1848 |
! |
|
1849 |
||
1850 |
showDraggingIn:aView at:p |
|
1697
b2a2f80de0ec
care for empty selection in #showDragging:.
Claus Gittinger <cg@exept.de>
parents:
1676
diff
changeset
|
1851 |
|nItems items offs| |
1473 | 1852 |
|
1853 |
items := self selectionValueAsCollection. |
|
1697
b2a2f80de0ec
care for empty selection in #showDragging:.
Claus Gittinger <cg@exept.de>
parents:
1676
diff
changeset
|
1854 |
(nItems := items size) > 1 ifTrue:[ |
1473 | 1855 |
offs := 0. |
1856 |
items do:[:item | |
|
1857 |
item displayOn:aView at:p + (0@offs). |
|
1858 |
offs := offs + (item heightOn:self) |
|
1859 |
] |
|
1860 |
] ifFalse:[ |
|
1697
b2a2f80de0ec
care for empty selection in #showDragging:.
Claus Gittinger <cg@exept.de>
parents:
1676
diff
changeset
|
1861 |
nItems ~~ 0 ifTrue:[ |
b2a2f80de0ec
care for empty selection in #showDragging:.
Claus Gittinger <cg@exept.de>
parents:
1676
diff
changeset
|
1862 |
items first displayOn:aView at:p. |
b2a2f80de0ec
care for empty selection in #showDragging:.
Claus Gittinger <cg@exept.de>
parents:
1676
diff
changeset
|
1863 |
] |
1473 | 1864 |
] |
1865 |
||
1866 |
"Created: 14.11.1996 / 15:31:31 / cg" |
|
1867 |
"Modified: 14.11.1996 / 16:32:00 / cg" |
|
1868 |
! |
|
1869 |
||
1870 |
startDragX:x y:y |
|
1871 |
|xOffset w h dragAndDropMgr| |
|
1872 |
||
1873 |
dragIsActive := true. |
|
1874 |
xOffset := x. |
|
1875 |
||
1876 |
h := 0. |
|
1877 |
w := 0. |
|
1878 |
||
1879 |
self selectionDo:[:aNumber||e| |
|
1880 |
e := self at:aNumber. |
|
1881 |
h := h + (e heightOn:self). |
|
1882 |
w := w max:(e widthOn:self). |
|
1883 |
]. |
|
1884 |
||
1885 |
DragAndDropManager startDrag:(self collectionOfDragObjects) |
|
1886 |
from:self |
|
1887 |
offset:0 @ 0 |
|
1888 |
atEnd:endDragAction |
|
1889 |
display:(self selectionValue). |
|
1890 |
||
1891 |
"/ dragAndDropMgr := DragAndDropManager new. |
|
1892 |
"/ dragAndDropMgr dropObjects:(self collectionOfDragObjects). |
|
1893 |
"/ |
|
1894 |
"/ dragAndDropMgr |
|
1895 |
"/ startOpaqueDrag:[:aPoint :aView | |
|
1896 |
"/ self |
|
1897 |
"/ showDraggingIn:aView |
|
1898 |
"/ at:aPoint - (xOffset@0) |
|
1899 |
"/ ] |
|
1900 |
"/ offset:(xOffset @ h) |
|
1901 |
"/ extent:(w*5)@(h*2) |
|
1902 |
"/ in:self |
|
1903 |
"/ at:(x@y) |
|
1904 |
"/ atEnd:endDragAction. |
|
1905 |
"/ |
|
1906 |
"/ "Modified: 19.4.1997 / 10:00:16 / cg" |
|
1907 |
"/ |
|
1908 |
"/ |
|
1909 |
"/ |
|
1910 |
! ! |
|
1911 |
||
429
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1912 |
!SelectionInListView methodsFor:'drawing'! |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1913 |
|
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1914 |
drawRightArrowInVisibleLine:visLineNr |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1915 |
"draw a right arrow (for submenus). |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1916 |
This method is not used here, but provided for subclasses such |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1917 |
as menus or file-lists." |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1918 |
|
988 | 1919 |
|y x form form2 topLeftColor botRightColor t itemHeight listLine item| |
429
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1920 |
|
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1921 |
x := width - 16. |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1922 |
y := (self yOfVisibleLine:visLineNr). |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1923 |
|
988 | 1924 |
listLine := self visibleLineToListLine:visLineNr. |
1925 |
item := self at:listLine. |
|
1926 |
item isNil ifTrue:[ |
|
1927 |
itemHeight := fontHeight |
|
1928 |
] ifFalse:[ |
|
1929 |
itemHeight := item heightOn:self. |
|
1930 |
]. |
|
1931 |
||
429
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1932 |
(device depth == 1 or:[arrowLevel == 0]) ifTrue:[ |
988 | 1933 |
form := self class rightArrowFormOn:device. |
1934 |
form notNil ifTrue:[ |
|
1935 |
y := y + ((itemHeight - form height) // 2). |
|
1936 |
(self isInSelection:listLine) ifTrue:[ |
|
1937 |
self foreground:hilightFgColor |
|
1938 |
] ifFalse:[ |
|
1939 |
self foreground:fgColor. |
|
1940 |
]. |
|
1941 |
self displayForm:form x:x y:y. |
|
1942 |
] |
|
429
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1943 |
] ifFalse:[ |
988 | 1944 |
smallArrow ifTrue:[ |
1945 |
form := self class smallRightArrowLightFormOn:device. |
|
1946 |
form2 := self class smallRightArrowShadowFormOn:device. |
|
1947 |
] ifFalse:[ |
|
1948 |
form := self class rightArrowLightFormOn:device. |
|
1949 |
form2 := self class rightArrowShadowFormOn:device. |
|
1950 |
]. |
|
1951 |
(form isNil or:[form2 isNil]) ifTrue:[ |
|
1952 |
"/ very bad conditions |
|
1953 |
^ self |
|
1954 |
]. |
|
1955 |
y := y + ((itemHeight - form height) // 2). |
|
1956 |
||
1957 |
topLeftColor := lightColor. |
|
1958 |
botRightColor := shadowColor. |
|
1959 |
||
1960 |
"openwin arrow stays down" |
|
1961 |
styleSheet name ~~ #openwin ifTrue:[ |
|
1962 |
(self isInSelection:listLine) ifTrue:[ |
|
1963 |
t := topLeftColor. |
|
1964 |
topLeftColor := botRightColor. |
|
1965 |
botRightColor := t. |
|
1966 |
] |
|
1967 |
]. |
|
1968 |
arrowLevel < 0 ifTrue:[ |
|
1969 |
t := topLeftColor. |
|
1970 |
topLeftColor := botRightColor. |
|
1971 |
botRightColor := t. |
|
1972 |
]. |
|
429
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1973 |
|
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1974 |
"/ self foreground:topLeftColor. |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1975 |
self paint:topLeftColor. |
988 | 1976 |
self displayForm:form x:x y:y. |
429
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1977 |
"/ self foreground:botRightColor. |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1978 |
self paint:botRightColor. |
988 | 1979 |
self displayForm:form2 x:x y:y. |
429
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1980 |
] |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1981 |
! |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1982 |
|
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1983 |
drawVisibleLineSelected:visLineNr |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1984 |
"redraw a single line as selected." |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1985 |
|
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1986 |
self drawVisibleLineSelected:visLineNr with:hilightFgColor and:hilightBgColor |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1987 |
|
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1988 |
"Modified: / 31.8.1995 / 19:24:09 / claus" |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1989 |
"Modified: / 21.6.1998 / 03:12:56 / cg" |
429
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1990 |
! |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1991 |
|
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1992 |
drawVisibleLineSelected:visLineNr with:fg and:bg |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1993 |
"redraw a single line as selected." |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1994 |
|
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1995 |
|listLine |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1996 |
y "{ Class: SmallInteger }" |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1997 |
y2 "{ Class: SmallInteger }" |
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1998 |
wEdge dObj| |
429
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1999 |
|
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2000 |
listLine := self visibleLineToListLine:visLineNr. |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2001 |
listLine notNil ifTrue:[ |
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2002 |
selectedVisualBlock notNil ifTrue:[ |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2003 |
dObj := selectedVisualBlock value:self value:listLine. |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2004 |
y := (self yOfVisibleLine:visLineNr) + font ascent. |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2005 |
self paint:bg on:fg. |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2006 |
dObj displayOn:self x:0 y:y opaque:true. |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2007 |
^ self |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2008 |
]. |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2009 |
|
429
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2010 |
strikeOut ifTrue:[ |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2011 |
self drawVisibleLine:visLineNr with:fgColor and:bgColor. |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2012 |
y := self yOfVisibleLine:visLineNr. |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2013 |
|
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2014 |
self paint:fgColor. |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2015 |
y := y + (fontHeight // 2). |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2016 |
self displayLineFromX:0 y:y toX:width y:y. |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2017 |
^ self |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2018 |
]. |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2019 |
|
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2020 |
self drawVisibleLine:visLineNr with:fg and:bg. |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2021 |
y := (self yOfVisibleLine:visLineNr) - (lineSpacing//2). |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2022 |
|
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2023 |
" |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2024 |
a line above and below |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2025 |
" |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2026 |
hilightFrameColor notNil ifTrue:[ |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2027 |
hilightLevel == 0 ifTrue:[ |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2028 |
self paint:hilightFrameColor. |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2029 |
self displayLineFromX:0 y:y toX:width y:y. |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2030 |
y2 := y + fontHeight - 1. |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2031 |
self displayLineFromX:0 y:y2 toX:width y:y2. |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2032 |
^ self |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2033 |
] |
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2034 |
] ifFalse:[ |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2035 |
hilightStyle == #motif ifTrue:[ |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2036 |
self paint:fg. |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2037 |
self displayLineFromX:0 y:y+1 toX:width y:y+1. |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2038 |
y2 := y + fontHeight - 1 - 1. |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2039 |
self displayLineFromX:0 y:y2 toX:width y:y2. |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2040 |
] |
429
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2041 |
]. |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2042 |
|
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2043 |
" |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2044 |
an edge it around |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2045 |
" |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2046 |
(hilightLevel ~~ 0) ifTrue:[ |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2047 |
" |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2048 |
let edge start at left, extending to the full width |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2049 |
XXX: widthOfContents should be cached in ListView |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2050 |
(instead of recomputing all over) |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2051 |
" |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2052 |
wEdge := width-(2 * margin). |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2053 |
includesNonStrings ifFalse:[ |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2054 |
wEdge := wEdge max:(self widthOfContents). |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2055 |
]. |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2056 |
self drawEdgesForX:(margin - leftOffset) y:y |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2057 |
width:wEdge+leftOffset height:fontHeight |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2058 |
level:hilightLevel. |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2059 |
|
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2060 |
|
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2061 |
]. |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2062 |
^ self |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2063 |
]. |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2064 |
^ super drawVisibleLine:visLineNr with:fg and:bg |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2065 |
|
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2066 |
"Modified: / 31.8.1995 / 19:24:09 / claus" |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2067 |
"Created: / 28.2.1996 / 18:40:21 / cg" |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2068 |
"Modified: / 21.6.1998 / 03:51:04 / cg" |
429
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2069 |
! ! |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2070 |
|
125 | 2071 |
!SelectionInListView methodsFor:'event handling'! |
2072 |
||
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2073 |
buttonControlPress:button x:x y:y |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2074 |
"if multipleSelectOk: add to the selection; |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2075 |
otherwise, behave like normal select" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2076 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2077 |
|oldSelection listLineNr| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2078 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2079 |
((button == 1) or:[button == #select]) ifTrue:[ |
1299 | 2080 |
"/ toggleSelect ifTrue:[ |
2081 |
"/ ^ self buttonPress:button x:x y:y |
|
2082 |
"/ ]. |
|
816 | 2083 |
enabled ifTrue:[ |
2084 |
listLineNr := self visibleLineToListLine:(self visibleLineOfY:y). |
|
2085 |
listLineNr notNil ifTrue:[ |
|
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2086 |
(self lineIsEnabled:listLineNr) ifFalse:[^ self]. |
816 | 2087 |
|
2088 |
(selectConditionBlock notNil |
|
2089 |
and:[(selectConditionBlock value:listLineNr) not]) ifTrue:[^ self]. |
|
2090 |
]. |
|
2091 |
oldSelection := selection copy. |
|
2092 |
listLineNr notNil ifTrue: [ |
|
2093 |
multipleSelectOk ifTrue:[ |
|
2094 |
(self isInSelection:listLineNr) ifTrue:[ |
|
2095 |
self removeFromSelection:listLineNr |
|
2096 |
] ifFalse:[ |
|
2097 |
self addToSelection:listLineNr |
|
2098 |
] |
|
2099 |
] ifFalse:[ |
|
2100 |
self selectWithoutScroll:listLineNr |
|
2101 |
] |
|
2102 |
]. |
|
2103 |
((ignoreReselect not and:[selection notNil]) |
|
2104 |
or:[selection ~= oldSelection]) ifTrue:[ |
|
2105 |
self selectionChangedFrom:oldSelection. |
|
2106 |
]. |
|
2107 |
clickLine := listLineNr |
|
2108 |
] |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2109 |
] ifFalse:[ |
816 | 2110 |
super buttonPress:button x:x y:y |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2111 |
] |
816 | 2112 |
|
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2113 |
"Created: / 14.11.1996 / 15:51:41 / cg" |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2114 |
"Modified: / 8.8.1998 / 03:24:03 / cg" |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2115 |
! |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2116 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2117 |
buttonMotion:buttonMask x:x y:y |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2118 |
"mouse-move while button was pressed - handle selection changes" |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2119 |
|
997 | 2120 |
(enabled not or:[dragIsActive]) ifTrue:[ |
987
611244bb2e1d
Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents:
970
diff
changeset
|
2121 |
^ self |
611244bb2e1d
Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents:
970
diff
changeset
|
2122 |
]. |
611244bb2e1d
Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents:
970
diff
changeset
|
2123 |
|
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2124 |
"is it the select or 1-button ?" |
1620
47983c461af0
use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents:
1600
diff
changeset
|
2125 |
self sensor leftButtonPressed ifFalse:[^ self]. |
47983c461af0
use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents:
1600
diff
changeset
|
2126 |
"/ (device buttonMotionMask:buttonMask includesButton:#select) ifFalse:[ |
47983c461af0
use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents:
1600
diff
changeset
|
2127 |
"/ (device buttonMotionMask:buttonMask includesButton:1) ifFalse:[ |
47983c461af0
use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents:
1600
diff
changeset
|
2128 |
"/ ^ self |
47983c461af0
use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents:
1600
diff
changeset
|
2129 |
"/ ]. |
47983c461af0
use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents:
1600
diff
changeset
|
2130 |
"/ ]. |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2131 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2132 |
clickLine isNil ifTrue:[^ self]. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2133 |
|
1473 | 2134 |
(self canDrag and:[clickPosition notNil]) ifTrue:[ "mouse pressed but not released" |
997 | 2135 |
(clickPosition dist:(x@y)) > 5.0 ifTrue:[ |
1473 | 2136 |
^ self startDragAt:clickPosition |
997 | 2137 |
]. |
2138 |
^ self |
|
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2139 |
]. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2140 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2141 |
"if moved outside of view, start autoscroll" |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2142 |
(y < 0) ifTrue:[ |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2143 |
self compressMotionEvents:false. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2144 |
self startAutoScrollUp:y. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2145 |
^ self |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2146 |
]. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2147 |
(y > height) ifTrue:[ |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2148 |
self compressMotionEvents:false. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2149 |
self startAutoScrollDown:(y - height). |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2150 |
^ self |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2151 |
]. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2152 |
|
1473 | 2153 |
(self canDrag and:[x < -5]) ifTrue:[ "visible and left out of view" |
2154 |
^ self startDragAt:(0 @ y) |
|
997 | 2155 |
]. |
2156 |
||
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2157 |
"move inside - stop autoscroll if any" |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2158 |
self stopAutoScroll. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2159 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2160 |
self expandSelectionToX:x y:y. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2161 |
|
1620
47983c461af0
use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents:
1600
diff
changeset
|
2162 |
"Modified: / 29.1.1997 / 12:15:31 / stefan" |
47983c461af0
use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents:
1600
diff
changeset
|
2163 |
"Modified: / 28.7.1998 / 16:06:55 / cg" |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2164 |
! |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2165 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2166 |
buttonMultiPress:button x:x y:y |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2167 |
((button == 1) or:[button == #select]) ifTrue:[ |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2168 |
"/ doubleClickActionBlock isNil ifTrue:[ |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2169 |
"/ self buttonPress:button x:x y:y |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2170 |
"/ ]. |
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2171 |
enabled ifFalse:[ |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2172 |
^ self |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2173 |
]. |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2174 |
self doubleClicked. |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2175 |
] ifFalse:[ |
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2176 |
super buttonMultiPress:button x:x y:y |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2177 |
] |
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2178 |
|
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2179 |
"Modified: / 26.10.1997 / 18:50:58 / cg" |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2180 |
! |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2181 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2182 |
buttonPress:button x:x y:y |
997 | 2183 |
|sensor lineNr| |
2184 |
||
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2185 |
((button == 1) or:[button == #select]) ifFalse:[ |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2186 |
^ super buttonPress:button x:x y:y |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2187 |
]. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2188 |
enabled ifFalse:[ |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2189 |
^ self |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2190 |
]. |
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2191 |
|
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2192 |
dragIsActive := false. |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2193 |
clickPosition := nil. |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2194 |
|
997 | 2195 |
sensor := self sensor. |
1513 | 2196 |
sensor notNil ifTrue:[ |
2197 |
sensor ctrlDown ifTrue:[ |
|
2198 |
^ self buttonControlPress:button x:x y:y |
|
2199 |
]. |
|
2200 |
sensor shiftDown ifTrue:[ |
|
2201 |
^ self expandSelectionToX:x y:y |
|
2202 |
] |
|
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2203 |
]. |
1181
ad5004cb2969
allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents:
1163
diff
changeset
|
2204 |
|
1473 | 2205 |
self canDrag ifTrue:[ |
1181
ad5004cb2969
allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents:
1163
diff
changeset
|
2206 |
"/ clicked into the selection ? |
ad5004cb2969
allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents:
1163
diff
changeset
|
2207 |
|
997 | 2208 |
lineNr := self visibleLineToListLine:(self visibleLineOfY:y). |
2209 |
||
2210 |
(self isInSelection:lineNr) ifTrue:[ |
|
2211 |
"wait for release button |
|
2212 |
" |
|
2213 |
clickPosition := x@y. |
|
2214 |
clickLine := lineNr. |
|
2215 |
^ self |
|
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2216 |
] |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2217 |
]. |
997 | 2218 |
self selectOrToggleAtX:x y:y |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2219 |
|
1513 | 2220 |
"Modified: / 7.5.1998 / 02:02:20 / cg" |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2221 |
! |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2222 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2223 |
buttonRelease:button x:x y:y |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2224 |
"stop any autoscroll" |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2225 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2226 |
self stopAutoScroll. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2227 |
|
997 | 2228 |
dragIsActive ifTrue:[ |
2229 |
dragIsActive := false |
|
2230 |
] ifFalse:[ |
|
2231 |
clickPosition notNil ifTrue:[ |
|
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2232 |
enabled ifFalse:[ |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2233 |
^ self |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2234 |
]. |
997 | 2235 |
self selectOrToggleAtX:(clickPosition x) y:(clickPosition y). |
2236 |
] |
|
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2237 |
]. |
997 | 2238 |
clickPosition := nil. |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2239 |
|
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2240 |
"Modified: / 26.10.1997 / 18:51:14 / cg" |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2241 |
! |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2242 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2243 |
buttonShiftPress:button x:x y:y |
997 | 2244 |
"expand selection |
2245 |
" |
|
1252 | 2246 |
self halt. "/ never called |
997 | 2247 |
|
2248 |
self expandSelectionToX:x y:y |
|
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2249 |
|
1252 | 2250 |
"Modified: 17.6.1997 / 18:03:24 / cg" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2251 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2252 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2253 |
doubleClicked |
1745
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
2254 |
|actionArg| |
1457 | 2255 |
|
2256 |
clickLine := nil. |
|
2257 |
||
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2258 |
enabled ifFalse:[ |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2259 |
^ self |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2260 |
]. |
554 | 2261 |
selection isNil ifTrue:[ |
2262 |
"/ can only happen if claus modifies the selection within |
|
2263 |
"/ the selectAction .... |
|
2264 |
^ self |
|
2265 |
]. |
|
2266 |
||
1745
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
2267 |
actionArg := self argForChangeMessage. |
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
2268 |
|
1010 | 2269 |
"/ |
2270 |
"/ the ST-80 way of notifying the model |
|
2271 |
"/ |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2272 |
(model notNil and:[doubleClickMsg notNil]) ifTrue:[ |
1745
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
2273 |
self sendChangeMessage:doubleClickMsg with:actionArg. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2274 |
]. |
554 | 2275 |
|
1010 | 2276 |
"/ |
2277 |
"/ ST/X action blocks |
|
2278 |
"/ |
|
1744
f7d712e4b79e
support 0, 1 or 2-arg doubleClickActionBlock.
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
2279 |
doubleClickActionBlock notNil ifTrue:[ |
1745
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
2280 |
(doubleClickActionBlock numArgs == 1) ifTrue:[ |
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
2281 |
doubleClickActionBlock value:actionArg |
1744
f7d712e4b79e
support 0, 1 or 2-arg doubleClickActionBlock.
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
2282 |
] ifFalse:[ |
1745
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
2283 |
doubleClickActionBlock value |
1744
f7d712e4b79e
support 0, 1 or 2-arg doubleClickActionBlock.
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
2284 |
] |
f7d712e4b79e
support 0, 1 or 2-arg doubleClickActionBlock.
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
2285 |
]. |
1010 | 2286 |
|
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2287 |
"Modified: / 26.10.1997 / 18:51:39 / cg" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2288 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2289 |
|
1163
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
2290 |
enableStateChange |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
2291 |
enableChannel value ifTrue:[ |
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2292 |
self enable. |
1163
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
2293 |
] ifFalse:[ |
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2294 |
self disable. |
1163
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
2295 |
]. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
2296 |
|
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2297 |
"Created: / 28.3.1997 / 21:25:01 / cg" |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2298 |
"Modified: / 26.10.1997 / 18:48:27 / cg" |
1163
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
2299 |
! |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
2300 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2301 |
key:key select:index x:x y:y |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2302 |
"select an entry by a keyboard action. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2303 |
This is treated like a doubleClick on that entry" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2304 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2305 |
|oldSelection| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2306 |
|
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2307 |
enabled ifFalse:[ |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2308 |
^ self |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2309 |
]. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2310 |
(selectConditionBlock isNil or:[selectConditionBlock value:index]) ifTrue:[ |
885
7a53a92aa4c2
oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
2311 |
keyActionStyle notNil ifTrue:[ |
7a53a92aa4c2
oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
2312 |
keyActionStyle == #pass ifTrue:[ |
7a53a92aa4c2
oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
2313 |
^ super keyPress:key x:x y:y |
7a53a92aa4c2
oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
2314 |
]. |
7a53a92aa4c2
oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
2315 |
oldSelection := selection. |
7a53a92aa4c2
oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
2316 |
self selection:index. |
7a53a92aa4c2
oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
2317 |
"/ |
7a53a92aa4c2
oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
2318 |
"/ cg; 15-nov-1996 |
7a53a92aa4c2
oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
2319 |
"/ notification is already done in #selection: |
7a53a92aa4c2
oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
2320 |
"/ |
7a53a92aa4c2
oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
2321 |
"/ self selectionChangedFrom:oldSelection. |
7a53a92aa4c2
oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
2322 |
"/ |
7a53a92aa4c2
oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
2323 |
|
7a53a92aa4c2
oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
2324 |
keyActionStyle == #selectAndDoubleClick ifTrue:[ |
7a53a92aa4c2
oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
2325 |
self doubleClicked |
7a53a92aa4c2
oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
2326 |
] |
7a53a92aa4c2
oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
2327 |
] |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2328 |
]. |
885
7a53a92aa4c2
oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
2329 |
|
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2330 |
"Modified: / 26.10.1997 / 18:51:57 / cg" |
125 | 2331 |
! |
2332 |
||
2333 |
keyPress:key x:x y:y |
|
2334 |
"handle keyboard input" |
|
2335 |
||
490 | 2336 |
<resource: #keyboard ( #CursorUp #CursorDown #BeginOfText #EndOfText |
1676
a85936a2064c
treat BeginOfLine key like BeginOfText;
Claus Gittinger <cg@exept.de>
parents:
1640
diff
changeset
|
2337 |
#BeginOfLine #EndOfLine |
490 | 2338 |
#Return ) > |
132 | 2339 |
|
210
f7d44c195776
search fixed for lines which start with a separator
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2340 |
|index |
f7d44c195776
search fixed for lines which start with a separator
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2341 |
searchIndex "{Class: SmallInteger}" |
f7d44c195776
search fixed for lines which start with a separator
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2342 |
startSearch "{Class: SmallInteger}" |
1323
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2343 |
backSearch searchPrefix item |
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2344 |
mySize sensor s| |
125 | 2345 |
|
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2346 |
enabled ifFalse:[ |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2347 |
^ self |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2348 |
]. |
125 | 2349 |
(key == #CursorUp) ifTrue:[ |
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2350 |
index := self previousBeforeSelection. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2351 |
self key:key select:index x:x y:y. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2352 |
^ self |
125 | 2353 |
]. |
2354 |
(key == #CursorDown) ifTrue:[ |
|
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2355 |
index := self nextAfterSelection. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2356 |
self key:key select:index x:x y:y. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2357 |
^ self |
125 | 2358 |
]. |
2359 |
"/ |
|
1249 | 2360 |
"/ stupid: Home and End are caught in ScrollableView |
125 | 2361 |
"/ we normally do not get them ... |
2362 |
"/ (need to call handlesKey: from there ... |
|
2363 |
"/ ... and implement it here) |
|
2364 |
"/ |
|
1676
a85936a2064c
treat BeginOfLine key like BeginOfText;
Claus Gittinger <cg@exept.de>
parents:
1640
diff
changeset
|
2365 |
((key == #BeginOfText) or:[key == #BeginOfLine]) ifTrue:[ |
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2366 |
self key:key select:1 x:x y:y. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2367 |
^ self |
125 | 2368 |
]. |
1676
a85936a2064c
treat BeginOfLine key like BeginOfText;
Claus Gittinger <cg@exept.de>
parents:
1640
diff
changeset
|
2369 |
((key == #EndOfText) or:[key == #EndOfLine]) ifTrue:[ |
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2370 |
index := self size. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2371 |
self key:key select:index x:x y:y. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2372 |
^ self |
125 | 2373 |
]. |
2374 |
key == #Return ifTrue:[ |
|
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2375 |
returnKeyActionStyle == #doubleClick ifTrue:[ |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2376 |
selection notNil ifTrue:[ |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2377 |
self doubleClicked |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2378 |
]. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2379 |
^ self |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2380 |
]. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2381 |
returnKeyActionStyle ~~ #pass ifTrue:[ |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2382 |
^ self |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2383 |
]. |
125 | 2384 |
]. |
2385 |
||
1323
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2386 |
mySize := self size. |
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2387 |
|
125 | 2388 |
" |
2389 |
alphabetic keys: search for next entry |
|
2390 |
starting with keys character. If shift is pressed, search backward |
|
2391 |
" |
|
1323
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2392 |
(mySize > 0 |
125 | 2393 |
and:[key isCharacter |
2394 |
and:[key isLetter]]) ifTrue:[ |
|
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2395 |
keyActionStyle isNil ifTrue:[^ self]. |
364 | 2396 |
"/ multipleSelectOk ifTrue:[^ self]. |
1323
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2397 |
|
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2398 |
keyActionStyle == #pass ifFalse:[ |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2399 |
searchPrefix := key asLowercase asString. |
125 | 2400 |
|
2401 |
"/ ... isISearch... ifFalse:[ |
|
2402 |
"/ iSearchString := '' |
|
2403 |
"/ ] ifTrue:[ |
|
2404 |
"/ iSearchString := iSearchString , searchPrefix. |
|
2405 |
"/ searchPrefix := iSearchString |
|
2406 |
"/ ]. |
|
2407 |
||
1513 | 2408 |
backSearch := false. |
2409 |
sensor := self sensor. |
|
2410 |
sensor notNil ifTrue:[ |
|
2411 |
backSearch := sensor shiftDown. |
|
2412 |
]. |
|
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2413 |
backSearch ifTrue:[ |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2414 |
selection notNil ifTrue:[ |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2415 |
selection size > 0 ifTrue:[ |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2416 |
startSearch := selection first - 1 |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2417 |
] ifFalse:[ |
1323
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2418 |
selection isCollection ifTrue:[ |
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2419 |
startSearch := mySize |
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2420 |
] ifFalse:[ |
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2421 |
startSearch := selection - 1 |
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2422 |
] |
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2423 |
] |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2424 |
] ifFalse:[ |
1323
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2425 |
startSearch := mySize |
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2426 |
]. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2427 |
startSearch < 1 ifTrue:[ |
1323
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2428 |
startSearch := mySize. |
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2429 |
]. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2430 |
] ifFalse:[ |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2431 |
selection notNil ifTrue:[ |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2432 |
selection size > 0 ifTrue:[ |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2433 |
startSearch := selection last + 1 |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2434 |
] ifFalse:[ |
1323
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2435 |
selection isCollection ifTrue:[ |
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2436 |
startSearch := 1 |
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2437 |
] ifFalse:[ |
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2438 |
startSearch := selection + 1 |
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2439 |
] |
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2440 |
] |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2441 |
] ifFalse:[ |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2442 |
startSearch := 1 |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2443 |
]. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2444 |
startSearch > self size ifTrue:[ |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2445 |
startSearch := 1. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2446 |
]. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2447 |
]. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2448 |
searchIndex := startSearch. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2449 |
[true] whileTrue:[ |
1256
13ff2ef827e5
care for nil entries when searching via key-click
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2450 |
item := self at:searchIndex. |
13ff2ef827e5
care for nil entries when searching via key-click
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2451 |
item notNil ifTrue:[ |
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2452 |
(Object errorSignal catch:[s := item asString]) |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2453 |
ifTrue:[s := item displayString]. |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2454 |
(s withoutSeparators asLowercase startsWith:searchPrefix) ifTrue:[ |
1256
13ff2ef827e5
care for nil entries when searching via key-click
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2455 |
searchIndex = selection ifTrue:[^ self]. |
13ff2ef827e5
care for nil entries when searching via key-click
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2456 |
^ self key:key select:searchIndex x:x y:y |
13ff2ef827e5
care for nil entries when searching via key-click
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2457 |
]. |
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2458 |
]. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2459 |
backSearch ifTrue:[ |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2460 |
searchIndex := searchIndex - 1. |
1323
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2461 |
searchIndex < 1 ifTrue:[searchIndex := mySize] |
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2462 |
] ifFalse:[ |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2463 |
searchIndex := searchIndex + 1. |
1323
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2464 |
searchIndex > mySize ifTrue:[searchIndex := 1]. |
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2465 |
]. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2466 |
searchIndex == startSearch ifTrue:[ |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2467 |
^ self |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2468 |
] |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2469 |
] |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2470 |
]. |
125 | 2471 |
]. |
2472 |
^ super keyPress:key x:x y:y |
|
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2473 |
|
1676
a85936a2064c
treat BeginOfLine key like BeginOfText;
Claus Gittinger <cg@exept.de>
parents:
1640
diff
changeset
|
2474 |
"Modified: / 15.9.1998 / 18:22:31 / cg" |
125 | 2475 |
! |
2476 |
||
1789 | 2477 |
pointerEnter:state x:x y:y |
2478 |
"mouse pointer moved into my view; |
|
2479 |
Since I process keyboard events (to position on an entry and/or |
|
2480 |
for scrolling), request the focus." |
|
2481 |
||
1796 | 2482 |
(styleSheet at:#'selection.requestFocusOnPointerEnter' default:true) ifTrue:[ |
2483 |
self requestFocus. |
|
2484 |
]. |
|
1789 | 2485 |
super pointerEnter:state x:x y:y |
2486 |
! |
|
2487 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2488 |
sizeChanged:how |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2489 |
"if there is a selection, make certain, its visible |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2490 |
after the sizechange" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2491 |
|
1725
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2492 |
|first wasAtEnd selectionWasWisible| |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2493 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2494 |
wasAtEnd := (firstLineShown + nFullLinesShown) >= self size. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2495 |
|
1725
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2496 |
selectionWasWisible := false. |
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2497 |
selection notNil ifTrue:[ |
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2498 |
multipleSelectOk ifTrue:[ |
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2499 |
first := selection firstIfEmpty:nil |
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2500 |
] ifFalse:[ |
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2501 |
first := selection |
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2502 |
]. |
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2503 |
first notNil ifTrue:[ |
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2504 |
selectionWasWisible := (first between:firstLineShown and:(firstLineShown + nFullLinesShown)). |
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2505 |
] |
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2506 |
]. |
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2507 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2508 |
super sizeChanged:how. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2509 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2510 |
shown ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2511 |
selection notNil ifTrue:[ |
1725
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2512 |
selectionWasWisible ifTrue:[ |
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2513 |
multipleSelectOk ifTrue:[ |
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2514 |
first := selection firstIfEmpty:nil |
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2515 |
] ifFalse:[ |
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2516 |
first := selection |
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2517 |
]. |
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2518 |
first notNil ifTrue:[self makeLineVisible:first] |
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2519 |
] |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2520 |
] ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2521 |
" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2522 |
if we where at the end before, move to the end again. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2523 |
Still to be seen, if this is better in real life ... |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2524 |
" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2525 |
wasAtEnd ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2526 |
"at end" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2527 |
self scrollToBottom |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2528 |
] |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2529 |
] |
125 | 2530 |
] |
2531 |
||
1725
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2532 |
"Modified: / 1.12.1998 / 23:27:27 / cg" |
155 | 2533 |
! ! |
2534 |
||
105 | 2535 |
!SelectionInListView methodsFor:'initialization'! |
2536 |
||
941 | 2537 |
fetchDeviceResources |
2538 |
"fetch device colors, to avoid reallocation at redraw time" |
|
2539 |
||
2540 |
super fetchDeviceResources. |
|
2541 |
||
2542 |
hilightFgColor notNil ifTrue:[hilightFgColor := hilightFgColor on:device]. |
|
2543 |
hilightBgColor notNil ifTrue:[hilightBgColor := hilightBgColor on:device]. |
|
2544 |
halfIntensityFgColor notNil ifTrue:[halfIntensityFgColor := halfIntensityFgColor on:device]. |
|
2545 |
hilightFrameColor notNil ifTrue:[hilightFrameColor := hilightFrameColor on:device]. |
|
2546 |
||
2547 |
"Created: 14.1.1997 / 00:11:13 / cg" |
|
2548 |
! |
|
2549 |
||
105 | 2550 |
initCursor |
2551 |
"set the cursor - a hand" |
|
2552 |
||
2553 |
cursor := Cursor hand |
|
2554 |
! |
|
2555 |
||
2556 |
initStyle |
|
968 | 2557 |
"setup viewStyle specifics" |
2558 |
||
105 | 2559 |
super initStyle. |
2560 |
||
392
81343306d796
eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
2561 |
"/ DefaultFont notNil ifTrue:[font := DefaultFont on:device]. |
105 | 2562 |
|
2563 |
bgColor := viewBackground. |
|
2564 |
hilightFrameColor := nil. |
|
2565 |
hilightLevel := 0. |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2566 |
hilightStyle := DefaultHilightStyle. |
105 | 2567 |
arrowLevel := 1. |
2568 |
smallArrow := false. |
|
2569 |
||
709 | 2570 |
device hasGrayscales ifTrue:[ |
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2571 |
" |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2572 |
must get rid of these hard codings |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2573 |
" |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2574 |
(hilightStyle == #next) ifTrue:[ |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2575 |
hilightFgColor := fgColor. |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2576 |
hilightBgColor := White. |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2577 |
hilightFrameColor := fgColor |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2578 |
] ifFalse:[ |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2579 |
(hilightStyle == #motif) ifTrue:[ |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2580 |
fgColor := White. |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2581 |
bgColor := Grey. |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2582 |
viewBackground := bgColor. |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2583 |
hilightFgColor := bgColor "fgColor" "White". |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2584 |
hilightBgColor := fgColor "bgColor lightened" "darkened". |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2585 |
] ifFalse:[ |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2586 |
(hilightStyle == #openwin) ifTrue:[ |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2587 |
hilightFgColor := fgColor. |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2588 |
hilightBgColor := Color grey. |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2589 |
smallArrow := true. |
1634 | 2590 |
] ifFalse:[ |
2591 |
(hilightStyle == #win95) ifTrue:[ |
|
2592 |
smallArrow := true. |
|
2593 |
] |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2594 |
] |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2595 |
] |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2596 |
] |
105 | 2597 |
]. |
2598 |
||
2599 |
hilightFgColor isNil ifTrue:[ |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2600 |
hilightFgColor := bgColor. |
105 | 2601 |
]. |
2602 |
hilightBgColor isNil ifTrue:[ |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2603 |
hilightBgColor := fgColor. |
105 | 2604 |
]. |
2605 |
DefaultForegroundColor notNil ifTrue:[ |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2606 |
fgColor := DefaultForegroundColor |
105 | 2607 |
]. |
2608 |
DefaultBackgroundColor notNil ifTrue:[ |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2609 |
bgColor := viewBackground := DefaultBackgroundColor |
105 | 2610 |
]. |
2611 |
DefaultHilightForegroundColor notNil ifTrue:[ |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2612 |
hilightFgColor := DefaultHilightForegroundColor |
105 | 2613 |
]. |
2614 |
DefaultHilightBackgroundColor notNil ifTrue:[ |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2615 |
hilightBgColor := DefaultHilightBackgroundColor |
105 | 2616 |
]. |
2617 |
DefaultHilightFrameColor notNil ifTrue:[ |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2618 |
hilightFrameColor := DefaultHilightFrameColor |
105 | 2619 |
]. |
2620 |
DefaultHilightLevel notNil ifTrue:[ |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2621 |
hilightLevel := DefaultHilightLevel |
105 | 2622 |
]. |
2623 |
DefaultRightArrowLevel notNil ifTrue:[ |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2624 |
arrowLevel := DefaultRightArrowLevel |
105 | 2625 |
]. |
2626 |
||
2627 |
DefaultShadowColor notNil ifTrue:[ |
|
941 | 2628 |
shadowColor := DefaultShadowColor |
105 | 2629 |
]. |
2630 |
DefaultLightColor notNil ifTrue:[ |
|
941 | 2631 |
lightColor := DefaultLightColor |
105 | 2632 |
]. |
2633 |
||
2634 |
(hilightLevel abs > 0) ifTrue:[ |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2635 |
lineSpacing := 3 |
105 | 2636 |
] ifFalse:[ |
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2637 |
lineSpacing := 2 |
105 | 2638 |
]. |
2639 |
||
2640 |
hilightFgColor isNil ifTrue:[ |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2641 |
hilightFgColor := bgColor. |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2642 |
hilightBgColor := fgColor |
105 | 2643 |
]. |
2644 |
||
2645 |
DefaultDisabledForegroundColor notNil ifTrue:[ |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2646 |
halfIntensityFgColor := DefaultDisabledForegroundColor |
105 | 2647 |
] ifFalse:[ |
705 | 2648 |
halfIntensityFgColor := Color darkGray. |
105 | 2649 |
]. |
2650 |
||
1634 | 2651 |
"Modified: / 5.8.1998 / 00:00:00 / cg" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2652 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2653 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2654 |
initialize |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2655 |
super initialize. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2656 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2657 |
fontHeight := font height + lineSpacing. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2658 |
enabled := true. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2659 |
ignoreReselect := true. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2660 |
multipleSelectOk := toggleSelect := strikeOut := printItems := false. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2661 |
useIndex := true. |
997 | 2662 |
dragIsActive := allowDrag := false. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2663 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2664 |
keyActionStyle := #select. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2665 |
returnKeyActionStyle := #doubleClick. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2666 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2667 |
listMsg := self class defaultListMessage. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2668 |
initialSelectionMsg := self class defaultSelectionMessage. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2669 |
|
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2670 |
"Modified: 14.11.1996 / 15:12:33 / cg" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2671 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2672 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2673 |
realize |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2674 |
super realize. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2675 |
|
1068 | 2676 |
model notNil ifTrue:[ |
2677 |
self getSelectionFromModel. |
|
2678 |
]. |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2679 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2680 |
selection notNil ifTrue:[ |
1068 | 2681 |
selection isCollection ifTrue:[ |
2682 |
selection notEmpty ifTrue:[ |
|
2683 |
self makeLineVisible:selection first |
|
2684 |
] |
|
2685 |
] ifFalse:[ |
|
2686 |
self makeLineVisible:selection |
|
2687 |
] |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2688 |
]. |
1068 | 2689 |
|
2690 |
"Modified: 27.2.1997 / 14:23:40 / cg" |
|
0 | 2691 |
! ! |
2692 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2693 |
!SelectionInListView methodsFor:'private'! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2694 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2695 |
argForChangeMessage |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2696 |
"return the argument for a selectionChange; |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2697 |
depending on the setting of useIndex, this is either the numeric |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2698 |
index of the selection or the value (i.e. the string)" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2699 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2700 |
useIndex ~~ false ifTrue:[ "/ i.e. everything except false |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2701 |
multipleSelectOk ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2702 |
selection isNil ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2703 |
^ #() |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2704 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2705 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2706 |
^ selection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2707 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2708 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2709 |
printItems ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2710 |
^ self selectionValue |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2711 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2712 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2713 |
items notNil ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2714 |
multipleSelectOk ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2715 |
^ selection collect:[:nr | items at:nr] |
128 | 2716 |
]. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2717 |
^ items at:selection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2718 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2719 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2720 |
^ nil "/ cannot happen |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2721 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2722 |
"Modified: 26.10.1995 / 16:28:13 / cg" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2723 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2724 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2725 |
checkRemovingSelection:lineNr |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2726 |
"when a line is removed, we have to adjust selection" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2727 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2728 |
|newSelection| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2729 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2730 |
selection notNil ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2731 |
multipleSelectOk ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2732 |
newSelection := OrderedCollection new. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2733 |
selection do:[:sel | |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2734 |
sel < lineNr ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2735 |
newSelection add:sel |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2736 |
] ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2737 |
sel > lineNr ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2738 |
newSelection add:(sel - 1) |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2739 |
] |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2740 |
"otherwise remove it from the selection" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2741 |
] |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2742 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2743 |
newSelection size == 0 ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2744 |
selection := nil |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2745 |
] ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2746 |
selection := newSelection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2747 |
] |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2748 |
] ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2749 |
selection == lineNr ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2750 |
selection := nil |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2751 |
] ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2752 |
selection > lineNr ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2753 |
selection := selection - 1 |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2754 |
] |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2755 |
] |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2756 |
] |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2757 |
] |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2758 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2759 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2760 |
getListFromModel |
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2761 |
"if I have a model, get my list from it using the listMessage. |
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2762 |
If listMessage is nil, try aspectMessage for backward compatibilty." |
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2763 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2764 |
|text msg| |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2765 |
|
1310 | 2766 |
listChannel notNil ifTrue:[ |
1345 | 2767 |
items := listChannel value copy |
1310 | 2768 |
] ifFalse:[ |
2769 |
(model isNil or:[(msg := listMsg) isNil and:[(msg := aspectMsg) isNil]]) ifTrue:[ |
|
2770 |
^ self |
|
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2771 |
]. |
1310 | 2772 |
items := model perform:msg. |
2773 |
]. |
|
2774 |
items notNil ifTrue:[ |
|
2775 |
printItems ifTrue:[ |
|
2776 |
text := items collect:[:element | element printString] |
|
2777 |
] ifFalse:[ |
|
2778 |
text := items |
|
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2779 |
]. |
1310 | 2780 |
text notNil ifTrue:[ |
2781 |
text isSequenceable ifFalse:[ |
|
2782 |
text := text asOrderedCollection |
|
2783 |
] |
|
2784 |
] |
|
105 | 2785 |
]. |
1310 | 2786 |
self list:text keepSelection:true. "/ expandTabs:false |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2787 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2788 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2789 |
getSelectionFromModel |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2790 |
"if I have a model and an initialSelectionMsg, get my selection from it" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2791 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2792 |
|sel| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2793 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2794 |
model notNil ifTrue:[ |
1310 | 2795 |
listChannel notNil ifTrue:[ |
2796 |
sel := model value. |
|
1813
7f51dc0341a6
oops - did not unselect if model was changed to nil.
Claus Gittinger <cg@exept.de>
parents:
1796
diff
changeset
|
2797 |
sel isNil ifTrue:[ |
7f51dc0341a6
oops - did not unselect if model was changed to nil.
Claus Gittinger <cg@exept.de>
parents:
1796
diff
changeset
|
2798 |
self deselect. |
7f51dc0341a6
oops - did not unselect if model was changed to nil.
Claus Gittinger <cg@exept.de>
parents:
1796
diff
changeset
|
2799 |
^ self |
7f51dc0341a6
oops - did not unselect if model was changed to nil.
Claus Gittinger <cg@exept.de>
parents:
1796
diff
changeset
|
2800 |
] |
1310 | 2801 |
] ifFalse:[ |
2802 |
initialSelectionMsg isNil ifTrue:[^ self]. |
|
686
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
2803 |
sel := model perform:initialSelectionMsg. |
1310 | 2804 |
]. |
2805 |
(useIndex or:[sel isNumber]) ifTrue:[ |
|
2806 |
self setSelection:sel |
|
2807 |
] ifFalse:[ |
|
2808 |
self setSelectElement:sel. |
|
686
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
2809 |
] |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2810 |
]. |
686
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
2811 |
|
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
2812 |
"Modified: 25.5.1996 / 16:34:54 / cg" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2813 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2814 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2815 |
isValidSelection:aNumberOrCollection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2816 |
"return true, if aNumber is ok as a selection index" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2817 |
|
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2818 |
|sz| |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2819 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2820 |
aNumberOrCollection isNil ifTrue:[^ false]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2821 |
|
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2822 |
sz := self size. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2823 |
(aNumberOrCollection isCollection) ifTrue:[ |
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2824 |
multipleSelectOk ifFalse:[^ false]. |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2825 |
aNumberOrCollection do:[:index | |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2826 |
(index between:1 and:sz) ifFalse:[^ false]. |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2827 |
(self lineIsEnabled:index) ifFalse:[^ false]. |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2828 |
]. |
125 | 2829 |
] ifFalse:[ |
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2830 |
(aNumberOrCollection between:1 and:sz) ifFalse:[^ false]. |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2831 |
(self lineIsEnabled:aNumberOrCollection) ifFalse:[^ false]. |
63 | 2832 |
]. |
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2833 |
^ true. |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2834 |
|
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2835 |
"Modified: / 8.8.1998 / 03:34:27 / cg" |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2836 |
! |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2837 |
|
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2838 |
lineIsEnabled:lineNr |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2839 |
^ (self line:lineNr hasAttribute:#disabled) not |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2840 |
|
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2841 |
"Modified: / 8.8.1998 / 03:22:50 / cg" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2842 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2843 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2844 |
positionToSelectionX:x y:y |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2845 |
"given a click position, return the selection lineNo" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2846 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2847 |
|visibleLine| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2848 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2849 |
(x between:0 and:width) ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2850 |
(y between:0 and:height) ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2851 |
visibleLine := self visibleLineOfY:y. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2852 |
^ self visibleLineToListLine:visibleLine |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2853 |
] |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2854 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2855 |
^ nil |
125 | 2856 |
! |
2857 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2858 |
scrollSelectDown |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2859 |
"auto scroll action; scroll and reinstall timed-block" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2860 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2861 |
self scrollDown. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2862 |
Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2863 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2864 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2865 |
scrollSelectUp |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2866 |
"auto scroll action; scroll and reinstall timed-block" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2867 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2868 |
self scrollUp. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2869 |
Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2870 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2871 |
|
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2872 |
selectOrToggleAtX:x y:y |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2873 |
|oldSelection listLineNr| |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2874 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2875 |
listLineNr := self visibleLineToListLine:(self visibleLineOfY:y). |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2876 |
listLineNr notNil ifTrue:[ |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2877 |
(toggleSelect |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2878 |
and:[self isInSelection:listLineNr]) ifTrue:[ |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2879 |
oldSelection := selection copy. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2880 |
self removeFromSelection:listLineNr |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2881 |
] ifFalse:[ |
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2882 |
(self lineIsEnabled:listLineNr) ifFalse:[^ self]. |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2883 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2884 |
(selectConditionBlock notNil |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2885 |
and:[(selectConditionBlock value:listLineNr) not]) ifTrue:[^ self]. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2886 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2887 |
(toggleSelect and:[multipleSelectOk]) ifTrue:[ |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2888 |
oldSelection := selection copy. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2889 |
self addToSelection:listLineNr |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2890 |
] ifFalse:[ |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2891 |
oldSelection := selection copy. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2892 |
self selectWithoutScroll:listLineNr. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2893 |
]. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2894 |
]. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2895 |
((ignoreReselect not and:[selection notNil]) |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2896 |
or:[selection ~= oldSelection]) ifTrue:[ |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2897 |
self selectionChangedFrom:oldSelection. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2898 |
]. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2899 |
clickLine := listLineNr |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2900 |
] |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2901 |
|
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2902 |
"Created: / 14.11.1996 / 16:27:17 / cg" |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2903 |
"Modified: / 8.8.1998 / 03:22:26 / cg" |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2904 |
! |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2905 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2906 |
visibleLineNeedsSpecialCare:visLineNr |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2907 |
|listLine| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2908 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2909 |
listLine := self visibleLineToListLine:visLineNr. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2910 |
listLine isNil ifTrue:[^ false]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2911 |
(self isInSelection:listLine) ifTrue:[^ true]. |
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2912 |
visualBlock notNil ifTrue:[^true]. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2913 |
listAttributes notNil ifTrue:[ |
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2914 |
(listLine <= listAttributes size) ifTrue:[ |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2915 |
^ (listAttributes at:listLine) notNil |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2916 |
] |
0 | 2917 |
]. |
125 | 2918 |
^ false |
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2919 |
|
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2920 |
"Modified: / 21.6.1998 / 02:43:02 / cg" |
125 | 2921 |
! |
2922 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2923 |
widthForScrollBetween:start and:end |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2924 |
"has to be redefined since WHOLE line is inverted/modified sometimes" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2925 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2926 |
| anySelectionInRange | |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2927 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2928 |
selection notNil ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2929 |
multipleSelectOk ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2930 |
anySelectionInRange := false. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2931 |
selection do:[:s | |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2932 |
(s between:start and:end) ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2933 |
anySelectionInRange := true |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2934 |
] |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2935 |
] |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2936 |
] ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2937 |
anySelectionInRange := selection between:start and:end |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2938 |
] |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2939 |
] ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2940 |
anySelectionInRange := false |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2941 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2942 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2943 |
anySelectionInRange ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2944 |
^ width |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2945 |
" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2946 |
self is3D ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2947 |
^ width |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2948 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2949 |
( #(next openwin) includes:styleSheet name) ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2950 |
^ width |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2951 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2952 |
viewBackground = background ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2953 |
^ width |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2954 |
] |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2955 |
" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2956 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2957 |
^ super widthForScrollBetween:start and:end |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2958 |
! ! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2959 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2960 |
!SelectionInListView methodsFor:'queries'! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2961 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2962 |
specClass |
1379 | 2963 |
"redefined, since the name of my specClass is nonStandard (i.e. not SelectionInListSpec)" |
2964 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2965 |
self class == SelectionInListView ifTrue:[^ SequenceViewSpec]. |
1045 | 2966 |
^ super specClass |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2967 |
|
1379 | 2968 |
"Modified: / 5.9.1995 / 23:05:53 / claus" |
2969 |
"Modified: / 31.10.1997 / 19:48:44 / cg" |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2970 |
! ! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2971 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2972 |
!SelectionInListView methodsFor:'redrawing'! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2973 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2974 |
redrawElement:aNumber |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2975 |
"redraw an individual element" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2976 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2977 |
^ self redrawLine:aNumber |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2978 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2979 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2980 |
redrawFromVisibleLine:startVisLineNr to:endVisLineNr |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2981 |
"redraw a range of lines. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2982 |
Must check, if any is in the selection and handle this case. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2983 |
Otherwise draw it en-bloque using supers method." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2984 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2985 |
|special sel |
393 | 2986 |
l1 "{ Class: SmallInteger }" |
2987 |
l2 "{ Class: SmallInteger }" |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2988 |
selNo "{ Class: SmallInteger }" | |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2989 |
|
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2990 |
((selection isCollection) |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2991 |
or:[listAttributes notNil |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2992 |
or:[visualBlock notNil |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2993 |
or:[selectedVisualBlock notNil]]]) ifTrue:[ |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
2994 |
"/ cannot do bulk-redraw ... |
393 | 2995 |
l1 := startVisLineNr. |
2996 |
l2 := endVisLineNr. |
|
2997 |
l1 to:l2 do:[:visLine | |
|
2998 |
self redrawVisibleLine:visLine |
|
2999 |
]. |
|
3000 |
^ self |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3001 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3002 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3003 |
"XXX only if -1/+1" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3004 |
"/ hilightLevel ~~ 0 ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3005 |
"/ self paint:bgColor. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3006 |
"/ self fillRectangleX:0 y:(self yOfVisibleLine:startVisLineNr)-1 width:width height:1 |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3007 |
"/ ]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3008 |
special := true. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3009 |
selection isNil ifTrue:[ |
393 | 3010 |
special := false |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3011 |
] ifFalse:[ |
393 | 3012 |
sel := self listLineToVisibleLine:selection. |
3013 |
sel isNil ifTrue:[ |
|
3014 |
special := false |
|
3015 |
] ifFalse:[ |
|
3016 |
special := (sel between:startVisLineNr and:endVisLineNr) |
|
3017 |
] |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3018 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3019 |
special ifFalse:[ |
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3020 |
^ super redrawFromVisibleLine:startVisLineNr to:endVisLineNr |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3021 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3022 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3023 |
selNo := sel. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3024 |
selNo > startVisLineNr ifTrue:[ |
393 | 3025 |
super redrawFromVisibleLine:startVisLineNr to:(selNo - 1) |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3026 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3027 |
self redrawVisibleLine:selNo. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3028 |
selNo < endVisLineNr ifTrue:[ |
393 | 3029 |
super redrawFromVisibleLine:(selNo + 1) to:endVisLineNr |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3030 |
] |
393 | 3031 |
|
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3032 |
"Modified: / 21.6.1998 / 02:42:17 / cg" |
125 | 3033 |
! |
3034 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3035 |
redrawVisibleLine:visLineNr |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3036 |
"redraw a single line. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3037 |
Must check, if any is in the selection and handle this case. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3038 |
Otherwise draw using supers method." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3039 |
|
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3040 |
|listLine fg bg newFont oldFont id dObj y| |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3041 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3042 |
fg := fgColor. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3043 |
bg := bgColor. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3044 |
listLine := self visibleLineToListLine:visLineNr. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3045 |
listLine notNil ifTrue:[ |
384
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3046 |
(self isInSelection:listLine) ifTrue:[ |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3047 |
^ self drawVisibleLineSelected:visLineNr |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3048 |
]. |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3049 |
|
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3050 |
visualBlock notNil ifTrue:[ |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3051 |
dObj := visualBlock value:self value:listLine. |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3052 |
y := (self yOfVisibleLine:visLineNr) + font ascent. |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3053 |
self paint:fg on:bg. |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3054 |
dObj displayOn:self x:0 y:y opaque:true. |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3055 |
^ self |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3056 |
]. |
384
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3057 |
listAttributes notNil ifTrue:[ |
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3058 |
((self line:listLine hasAttribute:#halfIntensity) |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3059 |
or:[ (self lineIsEnabled:listLine) not ]) ifTrue:[ |
384
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3060 |
fg := halfIntensityFgColor |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3061 |
]. |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3062 |
(self line:listLine hasAttribute:#bold) ifTrue:[ |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3063 |
newFont := font asBold. |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3064 |
(font bold |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3065 |
or:[id := (newFont on:device) fontId. |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3066 |
id isNil]) |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3067 |
ifTrue:[ |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3068 |
" |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3069 |
mhmh - what can be done, if the font is already bold ? |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3070 |
or no such font is available |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3071 |
" |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3072 |
fgColor brightness > 0.5 ifTrue:[ |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3073 |
fg := fgColor darkened "darkened". |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3074 |
] ifFalse:[ |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3075 |
fg := fgColor lightened "lightened" |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3076 |
]. |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3077 |
(fg brightness - bg brightness) abs < 0.25 ifTrue:[ |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3078 |
bgColor brightness > 0.5 ifTrue:[ |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3079 |
fg := fg darkened. |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3080 |
] ifFalse:[ |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3081 |
fg := fg lightened |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3082 |
]. |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3083 |
] |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3084 |
]. |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3085 |
id notNil ifTrue:[ |
437
b7d544102a9e
oops - did not restore font (when boldifying)
Claus Gittinger <cg@exept.de>
parents:
429
diff
changeset
|
3086 |
oldFont := font. |
384
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3087 |
self basicFont:newFont. |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3088 |
self drawVisibleLine:visLineNr with:fg and:bg. |
437
b7d544102a9e
oops - did not restore font (when boldifying)
Claus Gittinger <cg@exept.de>
parents:
429
diff
changeset
|
3089 |
self basicFont:oldFont. |
384
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3090 |
] ifFalse:[ |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3091 |
self drawVisibleLine:visLineNr with:fg and:bg. |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3092 |
]. |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3093 |
^ self |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3094 |
] |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3095 |
] |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3096 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3097 |
^ self drawVisibleLine:visLineNr with:fg and:bg |
384
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3098 |
|
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3099 |
"Modified: / 8.8.1998 / 03:42:13 / cg" |
125 | 3100 |
! |
3101 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3102 |
redrawVisibleLine:visLineNr col:colNr |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3103 |
"redraw a single character. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3104 |
Must check, if its in the selection and handle this case." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3105 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3106 |
(self visibleLineNeedsSpecialCare:visLineNr) ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3107 |
^ self redrawVisibleLine:visLineNr |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3108 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3109 |
super redrawVisibleLine:visLineNr col:colNr |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3110 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3111 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3112 |
redrawVisibleLine:visLineNr from:startCol |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3113 |
"redraw from a col to the right end. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3114 |
Must check, if its in the selection and handle this case." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3115 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3116 |
(self visibleLineNeedsSpecialCare:visLineNr) ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3117 |
^ self redrawVisibleLine:visLineNr |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3118 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3119 |
super redrawVisibleLine:visLineNr from:startCol |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3120 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3121 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3122 |
redrawVisibleLine:visLineNr from:startCol to:endCol |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3123 |
"redraw from a startCol to endCol. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3124 |
Must check, if its in the selection and handle this case." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3125 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3126 |
(self visibleLineNeedsSpecialCare:visLineNr) ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3127 |
^ self redrawVisibleLine:visLineNr |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3128 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3129 |
super redrawVisibleLine:visLineNr from:startCol to:endCol |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3130 |
! ! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3131 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3132 |
!SelectionInListView methodsFor:'selections'! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3133 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3134 |
deselect |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3135 |
"deselect; Model or actionBlock notifications are made. |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3136 |
To deselect without notifications, use #setSelection:nil." |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3137 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3138 |
self selection:nil |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3139 |
|
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3140 |
"Modified: 25.5.1996 / 13:03:47 / cg" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3141 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3142 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3143 |
deselectWithoutRedraw |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3144 |
"deselect without redraw or notifications. |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3145 |
No model or actionBlock notifications are made." |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3146 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3147 |
selection := nil |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3148 |
|
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3149 |
"Modified: 25.5.1996 / 13:04:14 / cg" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3150 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3151 |
|
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3152 |
expandSelectionToX:x y:y |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3153 |
"used with button-motion and shift-press; |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3154 |
expand the selection to include all items from the clicked one, |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3155 |
up to the one under the mouse pointer" |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3156 |
|
997 | 3157 |
|movedLine delta oldSel| |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3158 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3159 |
clickLine isNil ifTrue:[^ self]. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3160 |
|
997 | 3161 |
movedLine := self visibleLineToAbsoluteLine:(self visibleLineOfY:y). |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3162 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3163 |
multipleSelectOk ifTrue:[ |
997 | 3164 |
movedLine == clickLine ifFalse:[ |
3165 |
delta := (clickLine < movedLine) ifTrue:[1] ifFalse:[-1]. |
|
3166 |
oldSel := selection copy. |
|
3167 |
||
3168 |
(clickLine+delta) to:movedLine by:delta do:[:ln | |
|
3169 |
(self isInSelection:ln) ifTrue:[self removeFromSelection:ln] |
|
3170 |
ifFalse:[self addToSelection:ln] |
|
3171 |
]. |
|
3172 |
self selectionChangedFrom:oldSel |
|
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3173 |
] |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3174 |
]. |
997 | 3175 |
clickLine := movedLine. |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3176 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3177 |
"Created: 14.11.1996 / 15:48:10 / cg" |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3178 |
"Modified: 14.11.1996 / 15:50:03 / cg" |
997 | 3179 |
|
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3180 |
! |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3181 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3182 |
hasSelection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3183 |
"return true, if the view has a selection" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3184 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3185 |
^ selection notNil |
125 | 3186 |
! |
3187 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3188 |
isInSelection:aNumber |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3189 |
"return true, if line, aNumber is in the selection" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3190 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3191 |
selection isNil ifTrue:[^ false]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3192 |
multipleSelectOk ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3193 |
^ (selection includes:aNumber) |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3194 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3195 |
^ (aNumber == selection) |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3196 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3197 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3198 |
makeSelectionVisible |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3199 |
"scroll to make the selection line visible" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3200 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3201 |
|line| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3202 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3203 |
selection notNil ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3204 |
multipleSelectOk ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3205 |
selection isEmpty ifTrue:[^ self]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3206 |
line := selection first. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3207 |
] ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3208 |
line := selection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3209 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3210 |
self makeLineVisible:line |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3211 |
] |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3212 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3213 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3214 |
nextAfterSelection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3215 |
"return the index of the next selectable entry after the selection. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3216 |
Wrap at end." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3217 |
|
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3218 |
|next sz| |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3219 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3220 |
selection isNil ifTrue:[ |
1244 | 3221 |
next := firstLineShown |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3222 |
] ifFalse:[ |
1244 | 3223 |
selection isCollection ifTrue:[ |
3224 |
selection size == 0 ifTrue:[ |
|
3225 |
next := firstLineShown |
|
3226 |
] ifFalse:[ |
|
3227 |
next := selection max + 1 |
|
3228 |
] |
|
3229 |
] ifFalse:[ |
|
3230 |
next := selection + 1 |
|
3231 |
]. |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3232 |
]. |
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3233 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3234 |
(self isValidSelection:next) ifFalse:[ |
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3235 |
sz := self size. |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3236 |
next > sz ifTrue:[ |
1244 | 3237 |
next := 1. |
3238 |
] ifFalse:[ |
|
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3239 |
[next <= sz |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3240 |
and:[(self isValidSelection:next) not ]] whileTrue:[ |
1244 | 3241 |
next := next + 1 |
3242 |
]. |
|
3243 |
]. |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3244 |
]. |
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3245 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3246 |
(self isValidSelection:next) ifFalse:[ |
1244 | 3247 |
next := nil |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3248 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3249 |
^ next |
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3250 |
|
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3251 |
"Modified: / 8.8.1998 / 03:36:55 / cg" |
125 | 3252 |
! |
3253 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3254 |
numberOfSelections |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3255 |
"return the number of selected entries" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3256 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3257 |
|sz| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3258 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3259 |
selection isNil ifTrue:[^ 0]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3260 |
sz := selection size. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3261 |
sz > 0 ifTrue:[^ sz]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3262 |
^ 1 |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3263 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3264 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3265 |
previousBeforeSelection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3266 |
"return the index of the previous selectable entry before the selection. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3267 |
Wrap at beginning." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3268 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3269 |
|prev| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3270 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3271 |
selection isNil ifTrue:[ |
1244 | 3272 |
prev := firstLineShown - 1 |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3273 |
] ifFalse:[ |
1244 | 3274 |
selection isCollection ifTrue:[ |
3275 |
selection size == 0 ifTrue:[ |
|
3276 |
prev := firstLineShown - 1 |
|
3277 |
] ifFalse:[ |
|
3278 |
prev := selection min - 1 |
|
3279 |
] |
|
3280 |
] ifFalse:[ |
|
3281 |
prev := selection - 1 |
|
3282 |
]. |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3283 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3284 |
(self isValidSelection:prev) ifFalse:[ |
1244 | 3285 |
prev < 1 ifTrue:[ |
3286 |
prev := self size. |
|
3287 |
] ifFalse:[ |
|
3288 |
[prev >= 1 |
|
3289 |
and:[(self isValidSelection:prev) not]] whileTrue:[ |
|
3290 |
prev := prev - 1 |
|
3291 |
]. |
|
3292 |
]. |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3293 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3294 |
(self isValidSelection:prev) ifFalse:[ |
1244 | 3295 |
prev := nil |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3296 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3297 |
^ prev |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3298 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3299 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3300 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3301 |
selectAll |
886 | 3302 |
"select all entries. |
3303 |
Model and/or actionBlock notification IS done." |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3304 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3305 |
|oldSelection| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3306 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3307 |
multipleSelectOk ifTrue:[ |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3308 |
oldSelection := selection. |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3309 |
selection := OrderedCollection withAll:(1 to:self size). |
722
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
709
diff
changeset
|
3310 |
self invalidate. |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3311 |
self selectionChangedFrom:oldSelection. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3312 |
] |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3313 |
|
886 | 3314 |
"Modified: 15.11.1996 / 17:00:26 / cg" |
125 | 3315 |
! |
3316 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3317 |
selectElement:anObject |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3318 |
"select the element with same printString as the argument, anObject. |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3319 |
Scroll to make the new selection visible. |
886 | 3320 |
Model and/or actionBlock notification IS done." |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3321 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3322 |
|lineNo| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3323 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3324 |
list notNil ifTrue:[ |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3325 |
items notNil ifTrue:[ |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3326 |
lineNo := items indexOf:anObject ifAbsent:nil |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3327 |
] ifFalse:[ |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3328 |
lineNo := list indexOf:(anObject printString) ifAbsent:nil. |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3329 |
]. |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3330 |
lineNo notNil ifTrue:[self selection:lineNo] |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3331 |
] |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3332 |
|
886 | 3333 |
"Modified: 15.11.1996 / 17:01:05 / cg" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3334 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3335 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3336 |
selectElementWithoutScroll:anObject |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3337 |
"select the element with same printString as the argument, anObject. |
886 | 3338 |
Do not scroll. |
3339 |
*** No model and/or actionBlock notification is done here." |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3340 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3341 |
|lineNo| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3342 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3343 |
list notNil ifTrue:[ |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3344 |
items notNil ifTrue:[ |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3345 |
lineNo := items indexOf:anObject ifAbsent:nil |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3346 |
] ifFalse:[ |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3347 |
lineNo := list indexOf:(anObject printString) ifAbsent:nil. |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3348 |
]. |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3349 |
lineNo notNil ifTrue:[self selectWithoutScroll:lineNo] |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3350 |
] |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3351 |
|
886 | 3352 |
"Modified: 15.11.1996 / 17:01:17 / cg" |
125 | 3353 |
! |
3354 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3355 |
selectNext |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3356 |
"select next line or first visible if there is currrently no selection. |
886 | 3357 |
Wrap at end. |
3358 |
Model and/or actionBlock notification IS done." |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3359 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3360 |
self selection:(self nextAfterSelection) |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3361 |
|
886 | 3362 |
"Modified: 15.11.1996 / 17:01:27 / cg" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3363 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3364 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3365 |
selectPrevious |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3366 |
"select previous line or previous visible if there is currently no selection. |
886 | 3367 |
Wrap at beginning. |
3368 |
Model and/or actionBlock notification IS done." |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3369 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3370 |
self selection:(self previousBeforeSelection). |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3371 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3372 |
"Modified: 26.9.1995 / 09:41:16 / stefan" |
886 | 3373 |
"Modified: 15.11.1996 / 17:01:34 / cg" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3374 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3375 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3376 |
selectWithoutScroll:aNumberOrNilOrCollection |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3377 |
"select line, aNumber or deselect if argument is nil. |
886 | 3378 |
*** No model and/or actionBlock notification is done here." |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3379 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3380 |
|prevSelection newSelection| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3381 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3382 |
newSelection := aNumberOrNilOrCollection. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3383 |
newSelection notNil ifTrue:[ |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3384 |
(self isValidSelection:newSelection) ifFalse:[ |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3385 |
newSelection := nil |
1484 | 3386 |
]. |
3387 |
newSelection == 0 ifTrue:[ |
|
3388 |
newSelection := nil |
|
3389 |
] ifFalse:[ |
|
3390 |
(newSelection isCollection |
|
3391 |
and:[newSelection size == 0]) ifTrue:[ |
|
3392 |
newSelection := nil |
|
3393 |
] |
|
3394 |
]. |
|
3395 |
||
3396 |
newSelection notNil ifTrue:[ |
|
3397 |
multipleSelectOk ifTrue:[ |
|
3398 |
newSelection isCollection ifFalse:[ |
|
3399 |
newSelection := OrderedCollection with:newSelection |
|
3400 |
] |
|
3401 |
] |
|
3402 |
]. |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3403 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3404 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3405 |
(newSelection = selection) ifTrue: [^ self]. |
125 | 3406 |
|
3407 |
" |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3408 |
redraw old selection unhighlighted |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3409 |
" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3410 |
selection notNil ifTrue: [ |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3411 |
prevSelection := selection. |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3412 |
selection := nil. |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3413 |
multipleSelectOk ifTrue:[ |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3414 |
prevSelection do:[:line | |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3415 |
self redrawElement:line |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3416 |
] |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3417 |
] ifFalse:[ |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3418 |
self redrawElement:prevSelection |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3419 |
] |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3420 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3421 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3422 |
selection := newSelection. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3423 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3424 |
" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3425 |
redraw new selection unhighlighted |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3426 |
" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3427 |
newSelection notNil ifTrue:[ |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3428 |
multipleSelectOk ifTrue:[ |
1484 | 3429 |
"/ newSelection isCollection ifFalse:[ |
3430 |
"/ selection := OrderedCollection with:newSelection. |
|
3431 |
"/ ]. |
|
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3432 |
selection do:[:line | |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3433 |
self redrawElement:line |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3434 |
] |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3435 |
] ifFalse:[ |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3436 |
self redrawElement:selection |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3437 |
] |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3438 |
] |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3439 |
|
886 | 3440 |
"Modified: 15.11.1996 / 16:58:46 / cg" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3441 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3442 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3443 |
selection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3444 |
"return the selection index or collection of indices (if multipleSelect is on)" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3445 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3446 |
^ selection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3447 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3448 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3449 |
selection:aNumberOrNil |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3450 |
"select line, aNumber or deselect if argument is nil; |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3451 |
scroll to make the selected line visible. |
886 | 3452 |
The model and/or actionBlock IS notified." |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3453 |
|
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3454 |
|oldSelection| |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3455 |
|
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3456 |
oldSelection := selection. |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3457 |
self setSelection:aNumberOrNil. |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3458 |
selection ~= oldSelection ifTrue:[ |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3459 |
self selectionChangedFrom:oldSelection |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3460 |
] |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3461 |
|
1638 | 3462 |
"Modified: / 7.8.1998 / 13:36:34 / cg" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3463 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3464 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3465 |
selectionAsCollection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3466 |
"return the selection as a collection of line numbers. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3467 |
This allows users of this class to enumerate independent of |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3468 |
the multipleSelect style." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3469 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3470 |
selection isNil ifTrue:[^ #()]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3471 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3472 |
"/ multipleSelectOk ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3473 |
"/ ^ (OrderedCollection new) add:selection; yourself. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3474 |
"/ ]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3475 |
multipleSelectOk ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3476 |
^ (OrderedCollection new) add:selection; yourself. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3477 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3478 |
^ selection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3479 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3480 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3481 |
selectionChangedFrom:oldSelection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3482 |
"selection has changed. Call actionblock and/or send changeMessage if defined" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3483 |
|
1745
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
3484 |
|changeArg actionArg nA| |
970 | 3485 |
|
3486 |
changeArg := actionArg := self argForChangeMessage. |
|
965
ff8e6542eb13
when both model & actionBlocks are present,
Claus Gittinger <cg@exept.de>
parents:
941
diff
changeset
|
3487 |
|
1010 | 3488 |
"/ |
3489 |
"/ the MVC way of doing things - notify model via changeMsg |
|
3490 |
"/ |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3491 |
multipleSelectOk ifFalse:[ |
965
ff8e6542eb13
when both model & actionBlocks are present,
Claus Gittinger <cg@exept.de>
parents:
941
diff
changeset
|
3492 |
"/ ST80 sends 0 as index, if the same selection is reselected ... |
ff8e6542eb13
when both model & actionBlocks are present,
Claus Gittinger <cg@exept.de>
parents:
941
diff
changeset
|
3493 |
selection == oldSelection ifTrue:[ |
970 | 3494 |
changeArg := 0 |
965
ff8e6542eb13
when both model & actionBlocks are present,
Claus Gittinger <cg@exept.de>
parents:
941
diff
changeset
|
3495 |
]. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3496 |
]. |
970 | 3497 |
self sendChangeMessageWith:changeArg. |
965
ff8e6542eb13
when both model & actionBlocks are present,
Claus Gittinger <cg@exept.de>
parents:
941
diff
changeset
|
3498 |
|
1010 | 3499 |
"/ |
3500 |
"/ the ST/X way of doing things - perform the actionBlock |
|
3501 |
"/ |
|
1745
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
3502 |
actionBlock notNil ifTrue:[ |
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
3503 |
(actionBlock numArgs) == 1 ifTrue:[ |
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
3504 |
actionBlock value:actionArg |
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
3505 |
] ifFalse:[ |
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
3506 |
actionBlock value |
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
3507 |
] |
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
3508 |
]. |
965
ff8e6542eb13
when both model & actionBlocks are present,
Claus Gittinger <cg@exept.de>
parents:
941
diff
changeset
|
3509 |
|
1010 | 3510 |
"Modified: 14.2.1997 / 16:49:09 / cg" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3511 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3512 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3513 |
selectionDo:aBlock |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3514 |
"perform aBlock for each nr in the selection. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3515 |
For single selection, it is called once for the items nr. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3516 |
For multiple selections, it is called for each." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3517 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3518 |
selection notNil ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3519 |
multipleSelectOk ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3520 |
selection do:aBlock |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3521 |
] ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3522 |
aBlock value:selection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3523 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3524 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3525 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3526 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3527 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3528 |
selectionValue |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3529 |
"return the selection value i.e. the text in the selected line. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3530 |
For multiple selections a collection containing the entries is returned." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3531 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3532 |
multipleSelectOk ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3533 |
selection isNil ifTrue:[^ #()]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3534 |
^ selection collect:[:nr | self at:nr] |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3535 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3536 |
selection isNil ifTrue:[^ nil]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3537 |
^ self at:selection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3538 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3539 |
|
988 | 3540 |
selectionValueAsCollection |
3541 |
"return the selection values as a collection - allows selectionValues to |
|
3542 |
be enumerated independent of the multiSelect settings" |
|
3543 |
||
3544 |
selection isNil ifTrue:[^ #()]. |
|
3545 |
multipleSelectOk ifTrue:[ |
|
3546 |
^ selection collect:[:nr | self at:nr] |
|
3547 |
]. |
|
3548 |
^ Array with:(self at:selection) |
|
3549 |
! |
|
3550 |
||
686
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
3551 |
setSelectElement:anObject |
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
3552 |
"select the element with same printString as the argument, anObject. |
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
3553 |
Scroll to make the new selection visible. |
886 | 3554 |
*** No model and/or actionBlock notification is done here." |
686
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
3555 |
|
1358 | 3556 |
|size lineNo coll| |
3557 |
||
3558 |
list isNil ifTrue:[ |
|
3559 |
^ self |
|
3560 |
]. |
|
3561 |
||
3562 |
multipleSelectOk ifTrue:[ |
|
3563 |
(size := anObject size) == 0 ifTrue:[ |
|
3564 |
^ self setSelection:nil |
|
686
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
3565 |
]. |
1358 | 3566 |
coll := OrderedCollection new:size. |
3567 |
||
3568 |
anObject do:[:o| |
|
3569 |
items notNil ifTrue:[ |
|
3570 |
lineNo := items indexOf:o ifAbsent:nil. |
|
3571 |
] ifFalse:[ |
|
3572 |
lineNo := list indexOf:(o printString) ifAbsent:nil |
|
3573 |
]. |
|
3574 |
lineNo notNil ifTrue:[ |
|
3575 |
coll add:lineNo |
|
3576 |
] |
|
3577 |
]. |
|
3578 |
^ self setSelection:coll |
|
3579 |
]. |
|
3580 |
||
3581 |
items notNil ifTrue:[ |
|
3582 |
lineNo := items indexOf:anObject ifAbsent:nil |
|
3583 |
] ifFalse:[ |
|
3584 |
lineNo := list indexOf:(anObject printString) ifAbsent:nil. |
|
3585 |
]. |
|
3586 |
lineNo notNil ifTrue:[self setSelection:lineNo]. |
|
686
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
3587 |
! |
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
3588 |
|
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3589 |
setSelection:aNumberOrNil |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3590 |
"select line, aNumber or deselect if argument is nil; |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3591 |
scroll to make the selected line visible. |
886 | 3592 |
*** No model and/or actionBlock notification is done here." |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3593 |
|
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3594 |
self selectWithoutScroll:aNumberOrNil. |
1638 | 3595 |
selection notNil ifTrue:[ |
3596 |
self makeSelectionVisible |
|
3597 |
] |
|
3598 |
||
3599 |
"Created: / 25.5.1996 / 12:23:18 / cg" |
|
3600 |
"Modified: / 7.8.1998 / 13:36:42 / cg" |
|
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3601 |
! |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3602 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3603 |
toggleSelection:aNumber |
886 | 3604 |
"toggle selection-state of entry, aNumber. |
3605 |
*** No model and/or actionBlock notification is done here." |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3606 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3607 |
(self isInSelection:aNumber) ifTrue:[ |
886 | 3608 |
self removeFromSelection:aNumber |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3609 |
] ifFalse:[ |
886 | 3610 |
self addToSelection:aNumber |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3611 |
] |
886 | 3612 |
|
3613 |
"Modified: 15.11.1996 / 17:02:08 / cg" |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3614 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3615 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3616 |
valueIsInSelection:someString |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3617 |
"return true, if someString is in the selection" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3618 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3619 |
|sel| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3620 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3621 |
selection isNil ifTrue:[^ false]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3622 |
sel := self selectionValue. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3623 |
self numberOfSelections > 1 ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3624 |
^ (sel includes:someString) |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3625 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3626 |
^ (someString = sel) |
125 | 3627 |
! ! |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3628 |
|
869
4b09e6fe33b6
allow multiSelect modifier to be changed
Claus Gittinger <cg@exept.de>
parents:
838
diff
changeset
|
3629 |
!SelectionInListView class methodsFor:'documentation'! |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3630 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3631 |
version |
1813
7f51dc0341a6
oops - did not unselect if model was changed to nil.
Claus Gittinger <cg@exept.de>
parents:
1796
diff
changeset
|
3632 |
^ '$Header: /cvs/stx/stx/libwidg/SelectionInListView.st,v 1.142 1999-03-22 19:37:09 cg Exp $' |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3633 |
! ! |