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