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