author | Claus Gittinger <cg@exept.de> |
Thu, 17 Dec 2015 19:33:22 +0100 | |
changeset 5524 | 56e7888d6438 |
parent 5514 | a208d39257ac |
child 5515 | a3d7a1cc269b |
child 5537 | 362ae978ac0c |
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 |
" |
|
2187
b5bfc9d40650
allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents:
2169
diff
changeset
|
12 |
"{ Package: 'stx:libwidg' }" |
b5bfc9d40650
allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents:
2169
diff
changeset
|
13 |
|
5237 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
0 | 16 |
ListView subclass:#SelectionInListView |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
17 |
instanceVariableNames:'selection actionBlock enabled hilightFgColor hilightBgColor |
3423 | 18 |
hilightFgColorNoFocus hilightBgColorNoFocus halfIntensityFgColor |
19 |
doubleClickActionBlock listAttributes multipleSelectOk clickLine |
|
20 |
selectMode selectionAtClickTime initialSelectionMsg printItems |
|
21 |
oneItem useIndex hilightLevel hilightFrameColor ignoreReselect |
|
22 |
arrowLevel smallArrow keyActionStyle returnKeyActionStyle |
|
23 |
toggleSelect strikeOut iSearchString items doubleClickMsg |
|
24 |
hilightStyle clickPosition allowDrag dragObjectConverter |
|
25 |
dragIsActive endDragAction dropSource visualBlock |
|
3466 | 26 |
selectedVisualBlock selectConditionBlock isButtonPressActive' |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
27 |
classVariableNames:'RightArrowShadowForm RightArrowLightForm RightArrowForm |
128 | 28 |
SmallRightArrowShadowForm SmallRightArrowLightForm |
29 |
DefaultForegroundColor DefaultBackgroundColor |
|
30 |
DefaultHilightForegroundColor DefaultHilightBackgroundColor |
|
392
81343306d796
eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
31 |
DefaultHilightFrameColor DefaultHilightLevel |
128 | 32 |
DefaultRightArrowStyle DefaultRightArrowLevel |
33 |
DefaultDisabledForegroundColor DefaultShadowColor |
|
5100 | 34 |
DefaultLightColor DefaultHilightStyle |
35 |
DefaultHilightForegroundColorNoFocus |
|
36 |
DefaultHilightBackgroundColorNoFocus' |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
37 |
poolDictionaries:'' |
1771 | 38 |
category:'Views-Lists' |
0 | 39 |
! |
40 |
||
869
4b09e6fe33b6
allow multiSelect modifier to be changed
Claus Gittinger <cg@exept.de>
parents:
838
diff
changeset
|
41 |
!SelectionInListView class methodsFor:'documentation'! |
7 | 42 |
|
38 | 43 |
copyright |
44 |
" |
|
45 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
59 | 46 |
All Rights Reserved |
38 | 47 |
|
48 |
This software is furnished under a license and may be used |
|
49 |
only in accordance with the terms of that license and with the |
|
50 |
inclusion of the above copyright notice. This software may not |
|
51 |
be provided or otherwise made available to, or used by, any |
|
52 |
other person. No title to or ownership of the software is |
|
53 |
hereby transferred. |
|
54 |
" |
|
55 |
! |
|
56 |
||
7 | 57 |
documentation |
58 |
" |
|
31 | 59 |
this one is a ListView with a selected line (which is shown highlighted) |
38 | 60 |
If multipleSelectionsOk is true, it is also allowed to shift-click multiple |
61 |
entries. |
|
63 | 62 |
If toggleSelect is true, clicking toggles (i.e. click on a seleted item |
63 |
will deselect). |
|
31 | 64 |
|
38 | 65 |
Whenever the selection changes, an action-block is evaluated, passing the |
66 |
current selection as argument. |
|
67 |
Currently, the selection can be nil, aNumber or a collection of numbers; |
|
68 |
this will change to be either nil or a collection, making selection handling |
|
70 | 69 |
easier in the future. (this stupid behavior is due to the multiple |
70 |
select feature being added later - the first implementation used to support |
|
71 |
only single selections). |
|
72 |
||
59 | 73 |
The actionBlock is called with the current selection (single number or |
74 |
collection of numbers) as argument. |
|
75 |
||
76 |
Also, to support ST-80 MVC-style use, the model (if nonNil) is notified |
|
155 | 77 |
by the change mechanism (performs changeMsg) and vice versa, the view |
78 |
updates if the model changes (with aspect of either #list or #selectionIndex). |
|
59 | 79 |
|
60 | 80 |
Before actually adding entries to the the selection, a checkBlock (if non-nil) is evaluated |
81 |
passing the number of the entry whch is about to be selected as argument. |
|
82 |
The select change operation is only done if this returns true. This allows |
|
59 | 83 |
interception of select, for example to query the user if he/she wants to save |
60 | 84 |
the old contents before (see uses in SystemBrowser and FileBrowser), or to |
85 |
disable individual entries. |
|
31 | 86 |
|
38 | 87 |
It is also possible to select entries with the keyboard; use the cursor up/ |
88 |
down keys to select prev/next, Home- and End-keys to select first/last. |
|
89 |
Use the return key to apply the double-click-action to the current selection. |
|
90 |
Also, alphabetic keys will select the next entry starting with that key. |
|
91 |
||
92 |
The keyboard behavior can be further controlled with the keyActionStyle |
|
93 |
instance variable (see SelectionInListView>>keyActionStyle:). |
|
94 |
||
59 | 95 |
Finally, ignoreReselect controls if pressing on an already selected item |
96 |
triggers the action or not. For some applications it is useful to allow |
|
97 |
reselects (for example, the SystemBrowsers method-list updates the |
|
98 |
source code in this case). |
|
38 | 99 |
|
60 | 100 |
Currently, some limited form of line attributes are supported. These |
101 |
are kept in the instance variable lineAttributes. |
|
102 |
This may change (using mechanisms similar to MultiColListEntry), so |
|
63 | 103 |
be prepared. (dont use the listAttributes instvar directly; if possible, |
104 |
use MultiColListEntry or subclasses of it. |
|
120 | 105 |
|
63 | 106 |
Although currently based on the listAttributes instVar, the implementation of |
120 | 107 |
text attributes will be changed in the near future (when Text/DisplayText are |
108 |
available). |
|
109 |
However, the protocol will probably be kept for backward compatibility |
|
110 |
(i.e. use #attributeAt: / #attributeAt:put etc. - at least, these are easy to find |
|
111 |
when migrating to the new attributed text handling). |
|
60 | 112 |
|
586 | 113 |
[Instance variables:] |
114 |
selection <misc> the current selection. nil, a number or collection of numbers |
|
115 |
||
116 |
actionBlock <Block> block to be evaluated on selection changes |
|
1745
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
117 |
(1-arg blocks gets selectionIndex or selectionValue |
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
118 |
as arg - depending upon the useIndex setting) |
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
119 |
|
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
120 |
useIndex <Boolean> if true, the index of a selection is passed to |
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
121 |
the actionBlock or stuffed into the selection valueHolder; |
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
122 |
if false, the seelction-value is passed. |
586 | 123 |
|
124 |
enabled <Boolean> true: selection changes allowed; false: ignore clicks |
|
125 |
||
126 |
hilightFgColor |
|
127 |
hilightBgColor <Color> how highlighted items are drawn |
|
128 |
||
129 |
halfIntensityColor <Color> foreground for disabled items |
|
130 |
||
2139 | 131 |
selectCondition <Block> if non-nil, this block can decide if selection is ok. |
132 |
or its invoked with the itemNr of the |
|
133 |
<ValueHolder> 'to-be-selected' item. |
|
2138
a634610a37de
added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents:
2136
diff
changeset
|
134 |
If the block returns true, the item is selected |
a634610a37de
added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents:
2136
diff
changeset
|
135 |
(or added to the selection); if false is returned, |
a634610a37de
added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents:
2136
diff
changeset
|
136 |
no action is taken. |
2139 | 137 |
selectionChangeCondition |
2138
a634610a37de
added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents:
2136
diff
changeset
|
138 |
<Block> much like above, but invoked without argument, |
2139 | 139 |
or on any change of the selection (i.e. also when items |
140 |
<ValueHolder> are deselected). |
|
2138
a634610a37de
added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents:
2136
diff
changeset
|
141 |
Can return false to suppress change. |
586 | 142 |
|
143 |
doubleClickActionBlock <Block> action to perform on double-click |
|
1745
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
144 |
(1-arg blocks gets selectionIndex or selectionValue |
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
145 |
as arg - depending upon the useIndex setting) |
586 | 146 |
|
147 |
listAttributes dont use - will vanish |
|
148 |
||
149 |
hilightLevel <Integer> level to draw selections (i.e. for 3D effect) |
|
150 |
hilightFrameColor <Color> rectangle around highlighted items |
|
151 |
||
152 |
multipleSelectOk <Boolean> if true, multiple selections (with shift) are ok. |
|
153 |
default: false |
|
154 |
||
155 |
ignoreReselect <Boolean> if true, selecting same again does not trigger action; |
|
156 |
if false, every select triggers it. |
|
157 |
default: true |
|
158 |
||
159 |
toggleSelect <Boolean> if true, click toggles; |
|
160 |
if false, click selects. |
|
161 |
default: false |
|
162 |
||
163 |
arrowLevel <Integer> level to draw right-arrows (for submenus etc.) |
|
164 |
smallArrow <Boolean> if true, uses a small arrow bitmap |
|
165 |
||
166 |
listMsg if non-nil, use ST-80 style (model-access) |
|
167 |
initialSelectionMsg |
|
168 |
printItems |
|
169 |
oneItem |
|
170 |
||
171 |
keyActionStyle <Symbol> controls how to respond to keyboard selects |
|
172 |
||
173 |
returnKeyActionStyle <Symbol> controls how to respond to return key |
|
125 | 174 |
|
31 | 175 |
written spring/summer 89 by claus |
176 |
3D Jan 90 by claus |
|
38 | 177 |
multiselect Jun 92 by claus |
178 |
keyboard-select jun 94 by claus |
|
586 | 179 |
|
180 |
[author:] |
|
181 |
Claus Gittinger |
|
7 | 182 |
" |
119 | 183 |
! |
184 |
||
185 |
examples |
|
186 |
" |
|
187 |
SelectionInListView can be used both in the ST/X way, using action blocks |
|
188 |
or in the traditional mvc way. |
|
189 |
with actions: |
|
190 |
||
125 | 191 |
basic interface: |
594 | 192 |
[exBegin] |
401 | 193 |
|top slv| |
194 |
||
195 |
top := StandardSystemView new |
|
196 |
label:'select'; |
|
197 |
minExtent:100@100; |
|
198 |
maxExtent:300@400; |
|
199 |
extent:200@200. |
|
200 |
||
201 |
slv := SelectionInListView new. |
|
202 |
slv list:#('one' 'two' 'three'). |
|
655 | 203 |
slv action:[:index | Transcript showCR:'selected ' , index printString]. |
401 | 204 |
|
205 |
top add:slv in:(0.0@0.0 corner:1.0@1.0). |
|
206 |
top open |
|
594 | 207 |
[exEnd] |
125 | 208 |
|
209 |
||
210 |
get element instead of index: |
|
594 | 211 |
[exBegin] |
401 | 212 |
|top slv| |
213 |
||
214 |
top := StandardSystemView new |
|
215 |
label:'select'; |
|
216 |
minExtent:100@100; |
|
217 |
maxExtent:300@400; |
|
218 |
extent:200@200. |
|
219 |
||
220 |
slv := SelectionInListView new. |
|
221 |
slv list:#('one' 'two' 'three'). |
|
655 | 222 |
slv action:[:element | Transcript showCR:'selected ' , element printString]. |
401 | 223 |
slv useIndex:false. |
224 |
||
225 |
top add:slv in:(0.0@0.0 corner:1.0@1.0). |
|
226 |
top open |
|
594 | 227 |
[exEnd] |
125 | 228 |
|
229 |
||
230 |
concrete example; show filenames: |
|
231 |
(notice: normally, you would use a FileSelectionList) |
|
594 | 232 |
[exBegin] |
401 | 233 |
|top slv| |
234 |
||
235 |
top := StandardSystemView new |
|
236 |
label:'select'; |
|
237 |
minExtent:100@100; |
|
238 |
maxExtent:300@400; |
|
239 |
extent:200@200. |
|
240 |
||
241 |
slv := SelectionInListView new. |
|
242 |
slv list:(Filename currentDirectory directoryContents). |
|
243 |
slv action:[:index | |
|
655 | 244 |
Transcript showCR:'selected ' , index printString. |
245 |
Transcript showCR:' the value is: ', slv selectionValue]. |
|
401 | 246 |
|
247 |
top add:slv in:(0.0@0.0 corner:1.0@1.0). |
|
248 |
top open |
|
594 | 249 |
[exEnd] |
125 | 250 |
|
119 | 251 |
|
124
7abd3a234296
last version before changing to collection in multipleSelect mode
claus
parents:
120
diff
changeset
|
252 |
add a scrollbar: |
594 | 253 |
[exBegin] |
401 | 254 |
|top slv| |
255 |
||
256 |
top := StandardSystemView new |
|
257 |
label:'select'; |
|
258 |
minExtent:100@100; |
|
259 |
maxExtent:300@400; |
|
260 |
extent:200@200. |
|
261 |
||
262 |
slv := SelectionInListView new. |
|
263 |
slv list:(Filename currentDirectory directoryContents). |
|
655 | 264 |
slv action:[:index | Transcript showCR:'selected ' , index printString]. |
401 | 265 |
|
266 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
267 |
top open |
|
594 | 268 |
[exEnd] |
125 | 269 |
|
119 | 270 |
|
628 | 271 |
allow reselect |
272 |
(clicking on already selected entry |
|
273 |
triggers action/changeNotification again): |
|
594 | 274 |
[exBegin] |
401 | 275 |
|top slv| |
276 |
||
277 |
top := StandardSystemView new |
|
278 |
label:'select'; |
|
279 |
minExtent:100@100; |
|
280 |
maxExtent:300@400; |
|
281 |
extent:200@200. |
|
282 |
||
283 |
slv := SelectionInListView new. |
|
284 |
slv list:(Filename currentDirectory directoryContents). |
|
655 | 285 |
slv action:[:index | Transcript showCR:'selected ' , index printString]. |
401 | 286 |
slv ignoreReselect:false. |
287 |
||
288 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
289 |
top open |
|
594 | 290 |
[exEnd] |
125 | 291 |
|
119 | 292 |
|
628 | 293 |
allow multiple selections (shift-select): |
594 | 294 |
[exBegin] |
401 | 295 |
|top slv| |
296 |
||
297 |
top := StandardSystemView new |
|
298 |
label:'select'; |
|
299 |
minExtent:100@100; |
|
300 |
maxExtent:300@400; |
|
301 |
extent:200@200. |
|
302 |
||
303 |
slv := SelectionInListView new. |
|
304 |
slv list:(Filename currentDirectory directoryContents). |
|
655 | 305 |
slv action:[:indexList | Transcript showCR:'selected ' , indexList printString]. |
401 | 306 |
slv multipleSelectOk:true. |
307 |
||
308 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
309 |
top open |
|
594 | 310 |
[exEnd] |
125 | 311 |
|
312 |
same, not using index: |
|
594 | 313 |
[exBegin] |
401 | 314 |
|top slv| |
315 |
||
316 |
top := StandardSystemView new |
|
317 |
label:'select'; |
|
318 |
minExtent:100@100; |
|
319 |
maxExtent:300@400; |
|
320 |
extent:200@200. |
|
321 |
||
322 |
slv := SelectionInListView new. |
|
323 |
slv list:(Filename currentDirectory directoryContents). |
|
655 | 324 |
slv action:[:indexList | Transcript showCR:'selected ' , indexList printString]. |
401 | 325 |
slv multipleSelectOk:true; useIndex:false. |
326 |
||
327 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
328 |
top open |
|
594 | 329 |
[exEnd] |
125 | 330 |
|
119 | 331 |
|
124
7abd3a234296
last version before changing to collection in multipleSelect mode
claus
parents:
120
diff
changeset
|
332 |
strikeout mode (single): |
594 | 333 |
[exBegin] |
401 | 334 |
|top slv| |
335 |
||
336 |
top := StandardSystemView new |
|
337 |
label:'select'; |
|
338 |
minExtent:100@100; |
|
339 |
maxExtent:300@400; |
|
340 |
extent:200@200. |
|
341 |
||
342 |
slv := SelectionInListView new. |
|
343 |
slv list:(Filename currentDirectory directoryContents). |
|
655 | 344 |
slv action:[:index | Transcript showCR:'selected ' , index printString]. |
401 | 345 |
slv strikeOut:true. |
346 |
||
347 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
348 |
top open |
|
594 | 349 |
[exEnd] |
125 | 350 |
|
119 | 351 |
|
124
7abd3a234296
last version before changing to collection in multipleSelect mode
claus
parents:
120
diff
changeset
|
352 |
strikeout mode (multiple): |
594 | 353 |
[exBegin] |
401 | 354 |
|top slv| |
355 |
||
356 |
top := StandardSystemView new |
|
357 |
label:'select'; |
|
358 |
minExtent:100@100; |
|
359 |
maxExtent:300@400; |
|
360 |
extent:200@200. |
|
361 |
||
362 |
slv := SelectionInListView new. |
|
363 |
slv list:(Filename currentDirectory directoryContents). |
|
655 | 364 |
slv action:[:index | Transcript showCR:'selected ' , index printString]. |
401 | 365 |
slv strikeOut:true; multipleSelectOk:true. |
366 |
||
367 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
368 |
top open |
|
594 | 369 |
[exEnd] |
119 | 370 |
|
628 | 371 |
toggleSelect mode (clicking on selected entry deselects it): |
372 |
[exBegin] |
|
373 |
|top slv| |
|
374 |
||
375 |
top := StandardSystemView new |
|
376 |
label:'select'; |
|
377 |
minExtent:100@100; |
|
378 |
maxExtent:300@400; |
|
379 |
extent:200@200. |
|
380 |
||
381 |
slv := SelectionInListView new. |
|
382 |
slv list:(Filename currentDirectory directoryContents). |
|
655 | 383 |
slv action:[:index | Transcript showCR:'selected ' , index printString]. |
628 | 384 |
slv toggleSelect:true. |
385 |
||
386 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
387 |
top open |
|
388 |
[exEnd] |
|
389 |
||
124
7abd3a234296
last version before changing to collection in multipleSelect mode
claus
parents:
120
diff
changeset
|
390 |
define what to do on double-click: |
594 | 391 |
[exBegin] |
401 | 392 |
|top slv| |
393 |
||
394 |
top := StandardSystemView new |
|
395 |
label:'select'; |
|
396 |
minExtent:100@100; |
|
397 |
maxExtent:300@400; |
|
398 |
extent:200@200. |
|
399 |
||
400 |
slv := SelectionInListView new. |
|
401 |
slv list:(Filename currentDirectory directoryContents). |
|
655 | 402 |
slv action:[:index | Transcript showCR:'selected ' , index printString]. |
403 |
slv doubleClickAction:[:index | Transcript showCR:'doubleclick on ' , index printString]. |
|
401 | 404 |
|
405 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
406 |
top open |
|
594 | 407 |
[exEnd] |
124
7abd3a234296
last version before changing to collection in multipleSelect mode
claus
parents:
120
diff
changeset
|
408 |
|
1163
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
409 |
enable / disable: |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
410 |
[exBegin] |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
411 |
|top slv| |
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 disable. |
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 |
Delay waitForSeconds:5. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
426 |
slv enable. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
427 |
[exEnd] |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
428 |
|
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
429 |
enable / disable via a channel: |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
430 |
[exBegin] |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
431 |
|top slv enableChannel t| |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
432 |
|
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
433 |
enableChannel := true asValue. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
434 |
t := Toggle label:'enable'. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
435 |
t model:enableChannel. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
436 |
t open. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
437 |
|
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
438 |
top := StandardSystemView new |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
439 |
label:'select'; |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
440 |
minExtent:100@100; |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
441 |
maxExtent:300@400; |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
442 |
extent:200@200. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
443 |
|
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
444 |
slv := SelectionInListView new. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
445 |
slv list:(Filename currentDirectory directoryContents). |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
446 |
slv action:[:index | Transcript showCR:'selected ' , index printString]. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
447 |
slv enableChannel:enableChannel. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
448 |
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
|
449 |
top open. |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
450 |
[exEnd] |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
451 |
|
119 | 452 |
using a Model: |
594 | 453 |
[exBegin] |
401 | 454 |
|top slv model| |
455 |
||
456 |
model := Plug new. |
|
457 |
model respondTo:#getList with:[#('foo' 'bar' 'baz' 'hello')]. |
|
458 |
model respondTo:#initial with:[1]. |
|
655 | 459 |
model respondTo:#setSelection: with:[:arg | Transcript showCR:'model selected:', arg printString]. |
401 | 460 |
|
461 |
top := StandardSystemView new |
|
462 |
label:'select'; |
|
463 |
minExtent:100@100; |
|
464 |
maxExtent:300@400; |
|
465 |
extent:200@200. |
|
466 |
||
467 |
slv := SelectionInListView |
|
468 |
on:model |
|
469 |
aspect:#someAspect |
|
470 |
change:#setSelection: |
|
471 |
list:#getList |
|
472 |
initialSelection:#initial. |
|
473 |
||
474 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
475 |
top open |
|
594 | 476 |
[exEnd] |
119 | 477 |
|
478 |
notice, that the ST-80 behavaior on reselect is to send a selection change |
|
479 |
with an index of 0. |
|
480 |
||
125 | 481 |
same, with useIndex false: |
594 | 482 |
[exBegin] |
401 | 483 |
|top slv model| |
484 |
||
485 |
model := Plug new. |
|
486 |
model respondTo:#getList with:[#('foo' 'bar' 'baz' 'hello')]. |
|
487 |
model respondTo:#initial with:['bar']. |
|
655 | 488 |
model respondTo:#setSelection: with:[:arg | Transcript showCR:'model selected:', arg printString]. |
401 | 489 |
|
490 |
top := StandardSystemView new |
|
491 |
label:'select'; |
|
492 |
minExtent:100@100; |
|
493 |
maxExtent:300@400; |
|
494 |
extent:200@200. |
|
495 |
||
496 |
slv := SelectionInListView |
|
497 |
on:model |
|
498 |
aspect:#someAspect |
|
499 |
change:#setSelection: |
|
500 |
list:#getList |
|
501 |
initialSelection:#initial. |
|
502 |
slv useIndex:false. |
|
503 |
||
504 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
505 |
top open |
|
594 | 506 |
[exEnd] |
125 | 507 |
|
508 |
||
155 | 509 |
self changing list: |
510 |
(selectionInListView updates itself when button changes initial selection): |
|
594 | 511 |
[exBegin] |
401 | 512 |
|top slv model sel changeButton| |
513 |
||
514 |
sel := 'bar'. |
|
515 |
model := Plug new. |
|
516 |
model respondTo:#getList with:['getList' printNL. #('foo' 'bar' 'baz' 'hello')]. |
|
517 |
model respondTo:#initial with:['initial' printNL. sel]. |
|
518 |
model respondTo:#setSelection: with:[:arg | ('model selected:', arg) printNL. sel := arg]. |
|
519 |
||
520 |
changeButton := Button label:'change selection'. |
|
521 |
changeButton action:[sel := 'foo'. model changed:#initial]. |
|
522 |
changeButton open. |
|
523 |
||
524 |
top := StandardSystemView new |
|
525 |
label:'select'; |
|
526 |
minExtent:100@100; |
|
527 |
maxExtent:300@400; |
|
528 |
extent:200@200. |
|
529 |
||
530 |
slv := SelectionInListView |
|
531 |
on:model |
|
532 |
aspect:#someAspect |
|
533 |
change:#setSelection: |
|
534 |
list:#getList |
|
535 |
initialSelection:#initial. |
|
536 |
slv useIndex:false. |
|
537 |
||
538 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
539 |
top open |
|
594 | 540 |
[exEnd] |
155 | 541 |
|
542 |
||
119 | 543 |
using a SelectionInList-Model: |
544 |
(see how changes in the model (via list:...) are reflected in the view) |
|
594 | 545 |
[exBegin] |
401 | 546 |
|top slv model| |
547 |
||
548 |
model := SelectionInList with:#('foo' 'bar' 'baz' 'hello'). |
|
549 |
model selection:'bar'. |
|
550 |
||
551 |
top := StandardSystemView new |
|
552 |
label:'select'; |
|
553 |
minExtent:100@100; |
|
554 |
maxExtent:300@400; |
|
555 |
extent:200@200. |
|
556 |
||
557 |
slv := SelectionInListView on:model. |
|
558 |
||
559 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
560 |
top open. |
|
561 |
||
449
725c26daf5d8
examples (use new monitoringInspector)
Claus Gittinger <cg@exept.de>
parents:
441
diff
changeset
|
562 |
InspectorView openOn:model monitor:'selectionIndexHolder' |
594 | 563 |
[exEnd] |
125 | 564 |
|
565 |
||
566 |
two selectionInListViews on the same selectionInList model: |
|
594 | 567 |
[exBegin] |
401 | 568 |
|top1 slv1 top2 slv2 model| |
569 |
||
570 |
model := SelectionInList with:#('foo' 'bar' 'baz' 'hello'). |
|
571 |
||
572 |
top1 := StandardSystemView new |
|
573 |
label:'select'; |
|
574 |
minExtent:100@100; |
|
575 |
maxExtent:300@400; |
|
576 |
extent:200@200. |
|
577 |
||
578 |
slv1 := SelectionInListView on:model. |
|
579 |
||
580 |
top1 add:(ScrollableView forView:slv1) in:(0.0@0.0 corner:1.0@1.0). |
|
581 |
top1 open. |
|
582 |
||
583 |
top2 := StandardSystemView new |
|
584 |
label:'select'; |
|
585 |
minExtent:100@100; |
|
586 |
maxExtent:300@400; |
|
587 |
extent:200@200. |
|
588 |
||
589 |
slv2 := SelectionInListView on:model. |
|
590 |
||
591 |
top2 add:(ScrollableView forView:slv2) in:(0.0@0.0 corner:1.0@1.0). |
|
592 |
top2 open. |
|
594 | 593 |
[exEnd] |
166 | 594 |
|
595 |
||
596 |
a MultiSelectionInList model: |
|
594 | 597 |
[exBegin] |
401 | 598 |
|top slv model| |
599 |
||
600 |
model := MultiSelectionInList with:#('foo' 'bar' 'baz' 'hello'). |
|
601 |
model selection:#('foo' 'bar'). |
|
602 |
||
603 |
top := StandardSystemView new |
|
604 |
label:'select'; |
|
605 |
minExtent:100@100; |
|
606 |
maxExtent:300@400; |
|
607 |
extent:200@200. |
|
608 |
||
609 |
slv := SelectionInListView on:model. |
|
610 |
slv multipleSelectOk:true. |
|
611 |
||
612 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
613 |
top open. |
|
614 |
||
449
725c26daf5d8
examples (use new monitoringInspector)
Claus Gittinger <cg@exept.de>
parents:
441
diff
changeset
|
615 |
InspectorView openOn:model monitor:'selectionIndexHolder' |
594 | 616 |
[exEnd] |
166 | 617 |
|
618 |
with strikeOut: |
|
594 | 619 |
[exBegin] |
401 | 620 |
|top slv model| |
621 |
||
622 |
model := MultiSelectionInList with:#('foo' 'bar' 'baz' 'hello'). |
|
623 |
model selection:#('foo' 'bar'). |
|
624 |
||
625 |
top := StandardSystemView new |
|
626 |
label:'select'; |
|
627 |
minExtent:100@100; |
|
628 |
maxExtent:300@400; |
|
629 |
extent:200@200. |
|
630 |
||
631 |
slv := SelectionInListView on:model. |
|
632 |
slv multipleSelectOk:true; toggleSelect:true; strikeOut:true. |
|
633 |
||
634 |
top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0). |
|
635 |
top open. |
|
636 |
||
449
725c26daf5d8
examples (use new monitoringInspector)
Claus Gittinger <cg@exept.de>
parents:
441
diff
changeset
|
637 |
InspectorView openOn:model monitor:'selectionIndexHolder' |
594 | 638 |
[exEnd] |
401 | 639 |
|
640 |
||
641 |
two listViews on the same list, but separate selections |
|
594 | 642 |
[exBegin] |
401 | 643 |
|top top2 lv1 lv2 selInL1 selInL2 listHolder l1 l2| |
644 |
||
645 |
top := StandardSystemView new extent:300@300. |
|
646 |
||
647 |
lv1 := SelectionInListView origin:0.0@0.0 corner:1.0@0.5 in:top. |
|
648 |
lv1 level:-1. |
|
649 |
lv1 toggleSelect:true. |
|
650 |
||
651 |
lv2 := SelectionInListView origin:0.0@0.5 corner:1.0@1.0 in:top. |
|
652 |
lv2 level:-1. |
|
653 |
lv2 toggleSelect:true. |
|
654 |
||
655 |
selInL1 := SelectionInList new. |
|
656 |
selInL2 := SelectionInList new. |
|
657 |
||
658 |
listHolder := #('foo' 'bar' 'baz') asValue. |
|
659 |
||
660 |
selInL1 listHolder:listHolder. |
|
661 |
selInL2 listHolder:listHolder. |
|
662 |
||
663 |
lv1 model:selInL1. |
|
664 |
lv2 model:selInL2. |
|
665 |
||
666 |
top open. |
|
667 |
||
668 |
top2 := StandardSystemView new extent:100 @ 30. |
|
669 |
l1 := Label origin:0.0@0.0 corner:0.5@1.0 in:top2. |
|
670 |
l2 := Label origin:0.5@0.0 corner:1.0@1.0 in:top2. |
|
671 |
||
672 |
l1 model:(BlockValue with:[:arg | arg value printString] argument:selInL1 selectionIndexHolder). |
|
673 |
l2 model:(BlockValue with:[:arg | arg value printString] argument:selInL2 selectionIndexHolder). |
|
674 |
||
675 |
l1 labelMessage:#value. |
|
676 |
l2 labelMessage:#value. |
|
677 |
||
678 |
top2 open. |
|
679 |
||
680 |
Delay waitForSeconds:2. |
|
681 |
listHolder value:#('1' '2' '3' '4'). |
|
594 | 682 |
[exEnd] |
628 | 683 |
non-string entries (text) |
684 |
[exBegin] |
|
685 |
|top l slv| |
|
686 |
||
687 |
top := StandardSystemView new |
|
688 |
label:'select'; |
|
689 |
minExtent:100@100; |
|
690 |
maxExtent:300@400; |
|
691 |
extent:200@200. |
|
692 |
||
693 |
slv := SelectionInListView new. |
|
694 |
l := OrderedCollection new. |
|
695 |
l add:(Text string:'red' emphasis:(#color->Color red)). |
|
696 |
l add:(Text string:'green' emphasis:(#color->Color green)). |
|
697 |
l add:(Text string:'blue' emphasis:(#color->Color blue)). |
|
698 |
slv list:l. |
|
655 | 699 |
slv action:[:index | Transcript showCR:'selected ' , index printString]. |
628 | 700 |
|
701 |
top add:slv in:(0.0@0.0 corner:1.0@1.0). |
|
702 |
top open |
|
703 |
[exEnd] |
|
838 | 704 |
|
705 |
non string entries |
|
706 |
[exBegin] |
|
707 |
|top slv wrapper l fileImage dirImage m| |
|
708 |
||
709 |
dirImage := Image fromFile:'DirObj.xbm'. |
|
710 |
fileImage := Image fromFile:'FileObj.xbm'. |
|
711 |
||
712 |
||
713 |
l := OrderedCollection new. |
|
714 |
Filename currentDirectory directoryContents do:[:s | |
|
715 |
s asFilename isDirectory ifTrue:[ |
|
716 |
l add:(LabelAndIcon icon:dirImage string:s) |
|
717 |
] ifFalse:[ |
|
718 |
l add:(LabelAndIcon icon:fileImage string:s) |
|
719 |
] |
|
720 |
]. |
|
721 |
||
722 |
m := SelectionInList new. |
|
723 |
m list:l. |
|
724 |
||
725 |
slv := SelectionInListView new. |
|
726 |
slv model:m. |
|
727 |
wrapper := HVScrollableView forView:slv miniScrollerH:true. |
|
728 |
||
729 |
top := StandardSystemView extent:150@200. |
|
730 |
top add:wrapper in:(0.0@0.0 corner:1.0@1.0). |
|
731 |
top open. |
|
732 |
[exEnd] |
|
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
733 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
734 |
[exBegin] |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
735 |
|top slv| |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
736 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
737 |
top := StandardSystemView new |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
738 |
label:'select'; |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
739 |
minExtent:100@100; |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
740 |
maxExtent:300@400; |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
741 |
extent:200@200. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
742 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
743 |
slv := SelectionInListView new. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
744 |
slv list:#('one' 'two' 'three'). |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
745 |
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
|
746 |
slv multipleSelectOk:true. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
747 |
slv allowDrag:true. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
748 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
749 |
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
|
750 |
top open |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
751 |
[exEnd] |
119 | 752 |
" |
166 | 753 |
|
754 |
"Modified: 26.10.1995 / 16:42:02 / cg" |
|
7 | 755 |
! ! |
0 | 756 |
|
869
4b09e6fe33b6
allow multiSelect modifier to be changed
Claus Gittinger <cg@exept.de>
parents:
838
diff
changeset
|
757 |
!SelectionInListView class methodsFor:'instance creation'! |
105 | 758 |
|
125 | 759 |
on:aModel aspect:aspect change:change list:list initialSelection:initial |
760 |
^ self on:aModel |
|
761 |
printItems:true |
|
762 |
oneItem:false |
|
763 |
aspect:aspect |
|
764 |
change:change |
|
765 |
list:list |
|
766 |
menu:nil |
|
767 |
initialSelection:initial |
|
768 |
useIndex:true |
|
769 |
! |
|
770 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
771 |
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
|
772 |
^ self on:aModel |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
773 |
printItems:true |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
774 |
oneItem:false |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
775 |
aspect:aspect |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
776 |
change:change |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
777 |
list:list |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
778 |
menu:menu |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
779 |
initialSelection:initial |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
780 |
useIndex:true |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
781 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
782 |
|
105 | 783 |
on:aModel printItems:print oneItem:one aspect:aspect |
784 |
change:change list:list menu:menu initialSelection:initial |
|
785 |
||
786 |
"for ST-80 compatibility" |
|
787 |
||
119 | 788 |
^ self on:aModel |
105 | 789 |
printItems:print |
790 |
oneItem:one |
|
791 |
aspect:aspect |
|
792 |
change:change |
|
793 |
list:list |
|
794 |
menu:menu |
|
795 |
initialSelection:initial |
|
796 |
useIndex:false |
|
119 | 797 |
! |
798 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
799 |
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
|
800 |
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
|
801 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
802 |
"for ST-80 compatibility" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
803 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
804 |
^ (self new) on:aModel |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
805 |
printItems:print |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
806 |
oneItem:one |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
807 |
aspect:aspect |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
808 |
change:change |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
809 |
list:list |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
810 |
menu:menu |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
811 |
initialSelection:initial |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
812 |
useIndex:useIndex |
105 | 813 |
! ! |
814 |
||
869
4b09e6fe33b6
allow multiSelect modifier to be changed
Claus Gittinger <cg@exept.de>
parents:
838
diff
changeset
|
815 |
!SelectionInListView class methodsFor:'defaults'! |
22 | 816 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
817 |
defaultAspectMessage |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
818 |
^ nil |
125 | 819 |
! |
820 |
||
4050
b9916b17ff56
added: #defaultBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
4014
diff
changeset
|
821 |
defaultBackgroundColor |
b9916b17ff56
added: #defaultBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
4014
diff
changeset
|
822 |
^ DefaultBackgroundColor |
b9916b17ff56
added: #defaultBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
4014
diff
changeset
|
823 |
! |
b9916b17ff56
added: #defaultBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
4014
diff
changeset
|
824 |
|
125 | 825 |
defaultChangeMessage |
826 |
^ #selectionIndex: |
|
827 |
! |
|
828 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
829 |
defaultListMessage |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
830 |
^ #list |
125 | 831 |
! |
832 |
||
833 |
defaultSelectionMessage |
|
834 |
^ #selectionIndex |
|
835 |
! |
|
836 |
||
22 | 837 |
rightArrowFormOn:aDevice |
838 |
"return the form used for the right arrow (non 3D)" |
|
839 |
||
1636
6f75bcabf092
oops - resource spec was incompatible with stc.
Claus Gittinger <cg@exept.de>
parents:
1634
diff
changeset
|
840 |
<resource: #style (#'selection.rightArrowForm' #'selection.rightArrowFormFile')> |
1204
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
841 |
|
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
842 |
|f fn bits| |
22 | 843 |
|
844 |
((aDevice == Display) and:[RightArrowForm notNil]) ifTrue:[ |
|
898 | 845 |
^ RightArrowForm |
22 | 846 |
]. |
1204
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
847 |
|
2785 | 848 |
f := self styleSheet at:#'selection.rightArrowForm'. |
22 | 849 |
f isNil ifTrue:[ |
1870 | 850 |
fn := StyleSheet at:#'selection.rightArrowFormFile' default:'RightArrow.xbm'. |
2075 | 851 |
f := Smalltalk imageFromFileNamed:fn forClass:self. |
2062
1af54949ac53
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
852 |
f notNil ifTrue:[ |
1af54949ac53
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
853 |
f := f onDevice:aDevice. |
1af54949ac53
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
854 |
] ifFalse:[ |
1204
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
855 |
DefaultRightArrowStyle == #solid ifTrue:[ |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
856 |
bits := #[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 |
2r00000000 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
859 |
2r00000010 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
860 |
2r00000011 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
861 |
2r00000011 2r10000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
862 |
2r00000011 2r11000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
863 |
2r00000011 2r11100000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
864 |
2r00000011 2r11110000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
865 |
2r00000011 2r11100000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
866 |
2r00000011 2r11000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
867 |
2r00000011 2r10000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
868 |
2r00000011 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
869 |
2r00000010 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
870 |
2r00000000 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
871 |
2r00000000 2r00000000] |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
872 |
] ifFalse:[ |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
873 |
bits := #[2r00000000 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
874 |
2r00000000 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
875 |
2r00000000 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
876 |
2r00000110 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
877 |
2r00000101 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
878 |
2r00000100 2r10000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
879 |
2r00000100 2r01000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
880 |
2r00000100 2r00100000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
881 |
2r00000100 2r00010000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
882 |
2r00000100 2r00100000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
883 |
2r00000100 2r01000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
884 |
2r00000100 2r10000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
885 |
2r00000101 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
886 |
2r00000110 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
887 |
2r00000000 2r00000000 |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
888 |
2r00000000 2r00000000] |
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
889 |
]. |
3487
3af04d90ebe9
Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents:
3466
diff
changeset
|
890 |
f := Form width:16 height:16 fromArray:bits onDevice:aDevice |
1204
8cbd65c6ddac
allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents:
1202
diff
changeset
|
891 |
] |
22 | 892 |
]. |
893 |
(aDevice == Display) ifTrue:[ |
|
898 | 894 |
RightArrowForm := f |
22 | 895 |
]. |
896 |
^ f |
|
898 | 897 |
|
1634 | 898 |
"Modified: / 5.8.1998 / 00:04:40 / cg" |
31 | 899 |
! |
900 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
901 |
rightArrowLightFormOn:aDevice |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
902 |
"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
|
903 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
904 |
|f| |
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 |
((aDevice == Display) and:[RightArrowLightForm notNil]) ifTrue:[ |
898 | 907 |
^ RightArrowLightForm |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
908 |
]. |
2075 | 909 |
f := Smalltalk imageFromFileNamed:'RightArrowLight.xbm' forClass:self. |
2062
1af54949ac53
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
910 |
f notNil ifTrue:[ |
1af54949ac53
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
911 |
f := f onDevice:aDevice. |
1af54949ac53
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
912 |
] ifFalse:[ |
898 | 913 |
f := Form width:16 height:16 fromArray:#[2r00000000 2r00000000 |
914 |
2r00000000 2r00000000 |
|
915 |
2r00000000 2r00000000 |
|
916 |
2r00000110 2r00000000 |
|
917 |
2r00000101 2r00000000 |
|
918 |
2r00000100 2r10000000 |
|
919 |
2r00000100 2r01000000 |
|
920 |
2r00000100 2r00100000 |
|
921 |
2r00000100 2r00000000 |
|
922 |
2r00000100 2r00000000 |
|
923 |
2r00000100 2r00000000 |
|
924 |
2r00000100 2r00000000 |
|
925 |
2r00000100 2r00000000 |
|
926 |
2r00000100 2r00000000 |
|
927 |
2r00000000 2r00000000 |
|
928 |
2r00000000 2r00000000] |
|
3487
3af04d90ebe9
Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents:
3466
diff
changeset
|
929 |
onDevice:aDevice |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
930 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
931 |
(aDevice == Display) ifTrue:[ |
898 | 932 |
RightArrowLightForm := f |
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 |
^ f |
898 | 935 |
|
936 |
"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
|
937 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
938 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
939 |
rightArrowShadowFormOn:aDevice |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
940 |
"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
|
941 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
942 |
|f| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
943 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
944 |
((aDevice == Display) and:[RightArrowShadowForm notNil]) ifTrue:[ |
898 | 945 |
^ RightArrowShadowForm |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
946 |
]. |
2075 | 947 |
f := Smalltalk imageFromFileNamed:'RightArrowShadow.xbm' forClass:self. |
2062
1af54949ac53
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
948 |
f notNil ifTrue:[ |
1af54949ac53
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
949 |
f := f onDevice:aDevice. |
1af54949ac53
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
950 |
] ifFalse:[ |
898 | 951 |
f := Form width:16 height:16 fromArray:#[2r00000000 2r00000000 |
952 |
2r00000000 2r00000000 |
|
953 |
2r00000000 2r00000000 |
|
954 |
2r00000000 2r00000000 |
|
955 |
2r00000000 2r00000000 |
|
956 |
2r00000000 2r00000000 |
|
957 |
2r00000000 2r00000000 |
|
958 |
2r00000000 2r00000000 |
|
959 |
2r00000000 2r00010000 |
|
960 |
2r00000000 2r00100000 |
|
961 |
2r00000000 2r01000000 |
|
962 |
2r00000000 2r10000000 |
|
963 |
2r00000001 2r00000000 |
|
964 |
2r00000010 2r00000000 |
|
965 |
2r00000000 2r00000000 |
|
966 |
2r00000000 2r00000000] |
|
3487
3af04d90ebe9
Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents:
3466
diff
changeset
|
967 |
onDevice:aDevice |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
968 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
969 |
(aDevice == Display) ifTrue:[ |
898 | 970 |
RightArrowShadowForm := f |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
971 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
972 |
^ f |
898 | 973 |
|
974 |
"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
|
975 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
976 |
|
31 | 977 |
smallRightArrowLightFormOn:aDevice |
978 |
"return the form used for the small right arrow light pixels (3D only)" |
|
979 |
||
980 |
|f| |
|
981 |
||
982 |
((aDevice == Display) and:[SmallRightArrowLightForm notNil]) ifTrue:[ |
|
898 | 983 |
^ SmallRightArrowLightForm |
31 | 984 |
]. |
2075 | 985 |
f := Smalltalk imageFromFileNamed:'SmallRightArrowLight.xbm' forClass:self. |
2062
1af54949ac53
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
986 |
f notNil ifTrue:[ |
1af54949ac53
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
987 |
f := f onDevice:aDevice. |
1af54949ac53
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
988 |
] ifFalse:[ |
898 | 989 |
f := Form width:9 height:9 fromArray:#[2r00000000 2r00000000 |
990 |
2r01100000 2r00000000 |
|
991 |
2r01011000 2r00000000 |
|
992 |
2r01000110 2r00000000 |
|
993 |
2r01000000 2r00000000 |
|
994 |
2r01000000 2r00000000 |
|
995 |
2r01000000 2r00000000 |
|
996 |
2r01000000 2r00000000 |
|
997 |
2r00000000 2r00000000] |
|
3487
3af04d90ebe9
Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents:
3466
diff
changeset
|
998 |
onDevice:aDevice |
31 | 999 |
]. |
1000 |
(aDevice == Display) ifTrue:[ |
|
898 | 1001 |
SmallRightArrowLightForm := f |
31 | 1002 |
]. |
1003 |
^ f |
|
898 | 1004 |
|
1005 |
"Modified: 19.12.1996 / 14:10:59 / cg" |
|
31 | 1006 |
! |
1007 |
||
1008 |
smallRightArrowShadowFormOn:aDevice |
|
1009 |
"return the form used for the small right arrow light pixels (3D only)" |
|
1010 |
||
1011 |
|f| |
|
1012 |
||
1013 |
((aDevice == Display) and:[SmallRightArrowShadowForm notNil]) ifTrue:[ |
|
898 | 1014 |
^ SmallRightArrowShadowForm |
31 | 1015 |
]. |
2075 | 1016 |
f := Smalltalk imageFromFileNamed:'SmallRightArrowShadow.xbm' forClass:self. |
2062
1af54949ac53
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1017 |
f notNil ifTrue:[ |
1af54949ac53
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1018 |
f := f onDevice:aDevice. |
1af54949ac53
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1019 |
] ifFalse:[ |
898 | 1020 |
f := Form width:9 height:9 fromArray:#[2r00000000 2r00000000 |
1021 |
2r00000000 2r00000000 |
|
1022 |
2r00000000 2r00000000 |
|
1023 |
2r00000000 2r00000000 |
|
1024 |
2r00000001 2r00000000 |
|
1025 |
2r00000110 2r00000000 |
|
1026 |
2r00011000 2r00000000 |
|
1027 |
2r00100000 2r00000000 |
|
1028 |
2r00000000 2r00000000] |
|
3487
3af04d90ebe9
Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents:
3466
diff
changeset
|
1029 |
onDevice:aDevice |
31 | 1030 |
]. |
1031 |
(aDevice == Display) ifTrue:[ |
|
898 | 1032 |
SmallRightArrowShadowForm := f |
31 | 1033 |
]. |
1034 |
^ f |
|
898 | 1035 |
|
1036 |
"Modified: 19.12.1996 / 14:11:10 / cg" |
|
125 | 1037 |
! |
1038 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1039 |
updateStyleCache |
441
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
437
diff
changeset
|
1040 |
"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
|
1041 |
|
1354 | 1042 |
<resource: #style (#'selection.disabledForegroundColor' |
1043 |
#'selection.hilightForegroundColor' #'selection.hilightBackgroundColor' |
|
5100 | 1044 |
#'selection.hilightForegroundColorNoFocus' #'selection.hilightBackgroundColorNoFocus' |
1354 | 1045 |
#'selection.hilightFrameColor' #'selection.hilightLevel' |
1046 |
#'selection.rightArrowStyle' #'selection.rightArrowLevel' |
|
1047 |
#'selection.foregroundColor' #'selection.backgroundColor' |
|
1048 |
#'selection.shadowColor' #'selection.lightColor' |
|
1049 |
#'selection.font' #'selection.hilightStyle')> |
|
1050 |
||
1870 | 1051 |
DefaultDisabledForegroundColor := StyleSheet colorAt:#'selection.disabledForegroundColor'. |
1052 |
DefaultHilightForegroundColor := StyleSheet colorAt:#'selection.hilightForegroundColor'. |
|
1053 |
DefaultHilightBackgroundColor := StyleSheet colorAt:#'selection.hilightBackgroundColor'. |
|
5100 | 1054 |
DefaultHilightForegroundColorNoFocus := StyleSheet colorAt:#'selection.hilightForegroundColorNoFocus'. |
1055 |
DefaultHilightBackgroundColorNoFocus := StyleSheet colorAt:#'selection.hilightBackgroundColorNoFocus'. |
|
1870 | 1056 |
DefaultHilightFrameColor := StyleSheet colorAt:#'selection.hilightFrameColor'. |
1057 |
DefaultHilightLevel := StyleSheet at:#'selection.hilightLevel' default:0. |
|
1058 |
DefaultHilightStyle := StyleSheet at:#'selection.hilightStyle' default:(StyleSheet name). |
|
1059 |
DefaultRightArrowStyle := StyleSheet at:#'selection.rightArrowStyle'. |
|
1060 |
DefaultRightArrowLevel := StyleSheet at:#'selection.rightArrowLevel'. |
|
1061 |
DefaultForegroundColor := StyleSheet colorAt:#'selection.foregroundColor'. |
|
1062 |
DefaultBackgroundColor := StyleSheet colorAt:#'selection.backgroundColor'. |
|
1063 |
DefaultShadowColor := StyleSheet colorAt:#'selection.shadowColor'. |
|
1064 |
DefaultLightColor := StyleSheet colorAt:#'selection.lightColor'. |
|
1065 |
DefaultFont := StyleSheet fontAt:#'selection.font'. |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1066 |
RightArrowForm := nil. |
125 | 1067 |
|
1068 |
" |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1069 |
self updateStyleCache |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1070 |
" |
441
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
437
diff
changeset
|
1071 |
|
1354 | 1072 |
"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
|
1073 |
! ! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1074 |
|
2744 | 1075 |
!SelectionInListView methodsFor:'Compatibility-ST80'! |
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1076 |
|
2597
feebf7ba0771
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
1077 |
isSingleSelect:aBool |
feebf7ba0771
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
1078 |
self multipleSelectOk:aBool not |
feebf7ba0771
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
1079 |
! |
feebf7ba0771
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
1080 |
|
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1081 |
sequence |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1082 |
"same as #list - for ST80 compatibility" |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1083 |
|
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1084 |
^ self list |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1085 |
|
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1086 |
"Created: / 21.6.1998 / 02:46:50 / cg" |
2115
c994e244b8cf
with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents:
2102
diff
changeset
|
1087 |
! |
c994e244b8cf
with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents:
2102
diff
changeset
|
1088 |
|
c994e244b8cf
with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents:
2102
diff
changeset
|
1089 |
setValidTargetIndex:index |
c994e244b8cf
with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents:
2102
diff
changeset
|
1090 |
"ignored for now - for ST80 compatibility" |
c994e244b8cf
with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents:
2102
diff
changeset
|
1091 |
|
c994e244b8cf
with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents:
2102
diff
changeset
|
1092 |
^ self |
c994e244b8cf
with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents:
2102
diff
changeset
|
1093 |
|
c994e244b8cf
with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents:
2102
diff
changeset
|
1094 |
"Created: / 4.2.2000 / 00:07:14 / cg" |
2401
296ed4051b86
VW compatibility: #targetIndex:
Claus Gittinger <cg@exept.de>
parents:
2369
diff
changeset
|
1095 |
! |
296ed4051b86
VW compatibility: #targetIndex:
Claus Gittinger <cg@exept.de>
parents:
2369
diff
changeset
|
1096 |
|
296ed4051b86
VW compatibility: #targetIndex:
Claus Gittinger <cg@exept.de>
parents:
2369
diff
changeset
|
1097 |
targetIndex:index |
296ed4051b86
VW compatibility: #targetIndex:
Claus Gittinger <cg@exept.de>
parents:
2369
diff
changeset
|
1098 |
self selection:index |
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1099 |
! ! |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1100 |
|
2227 | 1101 |
!SelectionInListView methodsFor:'accessing-actions'! |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1102 |
|
2334
94cdb9b2d1f9
avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1103 |
action |
94cdb9b2d1f9
avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1104 |
"return the action block to be performed on select. |
94cdb9b2d1f9
avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1105 |
With useIndex==true, the block gets the selectionIndex as arg, |
94cdb9b2d1f9
avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1106 |
otherwise, it gets the selectionValue." |
94cdb9b2d1f9
avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1107 |
|
94cdb9b2d1f9
avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1108 |
^ actionBlock |
94cdb9b2d1f9
avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1109 |
! |
94cdb9b2d1f9
avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1110 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1111 |
action:aBlock |
1745
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
1112 |
"set the action block to be performed on select. |
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
1113 |
With useIndex==true, the block gets the selectionIndex as arg, |
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
1114 |
otherwise, it gets the selectionValue." |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1115 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1116 |
actionBlock := aBlock |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1117 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1118 |
|
393 | 1119 |
doubleClickAction:aOneArgBlock |
1120 |
"set the double click action block. |
|
1121 |
If non-nil, that one is evaluated on double click, passing the |
|
1745
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
1122 |
selection-line-number (useIndex==true) or selectionValue (useIndex==false) as argument." |
393 | 1123 |
|
1124 |
doubleClickActionBlock := aOneArgBlock |
|
1125 |
||
1126 |
"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
|
1127 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1128 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1129 |
keyActionStyle:aSymbol |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1130 |
"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
|
1131 |
Possible values are: |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1132 |
#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
|
1133 |
character and perform the click-action |
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 |
#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
|
1136 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1137 |
#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
|
1138 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1139 |
nil -> will ignore key |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1140 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1141 |
the default (set in #initialize) is #select |
125 | 1142 |
" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1143 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1144 |
keyActionStyle := aSymbol |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1145 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1146 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1147 |
returnKeyActionStyle:aSymbol |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1148 |
"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
|
1149 |
Possible values are: |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1150 |
#doubleClick -> perform double-click action |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1151 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1152 |
#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
|
1153 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1154 |
nil -> will ignore key |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1155 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1156 |
the default (set in #initialize) is #doubleClick |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1157 |
" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1158 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1159 |
returnKeyActionStyle := aSymbol |
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 |
|
4296
ded54b6d30a1
added: #selectConditionBlock
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4153
diff
changeset
|
1162 |
selectConditionBlock |
ded54b6d30a1
added: #selectConditionBlock
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4153
diff
changeset
|
1163 |
"get the select-conditionBlock; this block is evaluated before |
ded54b6d30a1
added: #selectConditionBlock
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4153
diff
changeset
|
1164 |
any selection change is performed (passing the to-be-changed item index as arg). |
ded54b6d30a1
added: #selectConditionBlock
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4153
diff
changeset
|
1165 |
The change will not be done, if the block returns false. |
ded54b6d30a1
added: #selectConditionBlock
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4153
diff
changeset
|
1166 |
For example, this allows confirmation queries in the SystemBrowser" |
ded54b6d30a1
added: #selectConditionBlock
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4153
diff
changeset
|
1167 |
|
ded54b6d30a1
added: #selectConditionBlock
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4153
diff
changeset
|
1168 |
^ selectConditionBlock |
ded54b6d30a1
added: #selectConditionBlock
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4153
diff
changeset
|
1169 |
|
ded54b6d30a1
added: #selectConditionBlock
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4153
diff
changeset
|
1170 |
"Created: / 29-07-2011 / 13:16:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
ded54b6d30a1
added: #selectConditionBlock
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4153
diff
changeset
|
1171 |
! |
ded54b6d30a1
added: #selectConditionBlock
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4153
diff
changeset
|
1172 |
|
2139 | 1173 |
selectConditionBlock:aBlock |
2141
a9f9956168b8
undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
1174 |
"set the select-conditionBlock; this block is evaluated before |
a9f9956168b8
undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
1175 |
any selection change is performed (passing the to-be-changed item index as arg). |
2138
a634610a37de
added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents:
2136
diff
changeset
|
1176 |
The change will not be done, if the block returns false. |
a634610a37de
added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents:
2136
diff
changeset
|
1177 |
For example, this allows confirmation queries in the SystemBrowser" |
a634610a37de
added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents:
2136
diff
changeset
|
1178 |
|
2141
a9f9956168b8
undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
1179 |
selectConditionBlock := aBlock |
2138
a634610a37de
added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents:
2136
diff
changeset
|
1180 |
! |
a634610a37de
added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents:
2136
diff
changeset
|
1181 |
|
1310 | 1182 |
useIndex |
1183 |
"set/clear the useIndex flag. If set, both actionBlock and change-messages |
|
1184 |
are passed the index(indices) of the selection as argument. |
|
1185 |
If clear, the value(s) (i.e. the selected string) is passed. |
|
1186 |
Default is true." |
|
1187 |
||
1188 |
^ useIndex |
|
1189 |
! |
|
1190 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1191 |
useIndex:aBoolean |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1192 |
"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
|
1193 |
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
|
1194 |
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
|
1195 |
Default is true." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1196 |
|
1235 | 1197 |
useIndex ~~ aBoolean ifTrue:[ |
1198 |
useIndex := aBoolean. |
|
1199 |
useIndex ifTrue:[ |
|
1200 |
changeMsg == #selection: ifTrue:[ |
|
1201 |
changeMsg := #selectionIndex:. |
|
1202 |
aspectMsg := #selectionIndex. |
|
1203 |
] |
|
1204 |
] ifFalse:[ |
|
1205 |
changeMsg == #selectionIndex: ifTrue:[ |
|
1206 |
changeMsg := #selection:. |
|
1207 |
aspectMsg := #selection. |
|
1208 |
] |
|
1209 |
]. |
|
1210 |
]. |
|
1211 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1212 |
! ! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1213 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1214 |
!SelectionInListView methodsFor:'accessing-attributes'! |
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 |
attributeAt:index |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1217 |
"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
|
1218 |
currently supported are: |
4622 | 1219 |
#halfIntensity |
1220 |
#disabled |
|
1221 |
#bold |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1222 |
" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1223 |
|
4622 | 1224 |
listAttributes notNil ifTrue:[ |
1225 |
(index > listAttributes size) ifFalse:[ |
|
1226 |
^ listAttributes at:index |
|
1227 |
] |
|
125 | 1228 |
]. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1229 |
^ nil |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1230 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1231 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1232 |
attributeAt:index add:aSymbolOrCollectionOfSymbols |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1233 |
"add to a lines attribute(s); |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1234 |
currently supported are: |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1235 |
#halfIntensity |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1236 |
#disabled |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1237 |
#bold |
125 | 1238 |
" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1239 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1240 |
|current| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1241 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1242 |
current := self attributeAt:index. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1243 |
current isNil ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1244 |
current := Set new. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1245 |
] ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1246 |
current isSymbol ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1247 |
current == aSymbolOrCollectionOfSymbols ifTrue:[^ self]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1248 |
current := Set with:current |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1249 |
] |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1250 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1251 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1252 |
aSymbolOrCollectionOfSymbols isSymbol ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1253 |
current := current add:aSymbolOrCollectionOfSymbols |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1254 |
] ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1255 |
(current includes:aSymbolOrCollectionOfSymbols) ifTrue:[^ self]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1256 |
current addAll:aSymbolOrCollectionOfSymbols |
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 |
self attributeAt:index put:current |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1259 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1260 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1261 |
attributeAt:index put:aSymbolOrCollectionOfSymbolsOrNil |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1262 |
"set a lines attribute(s); |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1263 |
currently supported are: |
3259 | 1264 |
#halfIntensity |
1265 |
#disabled |
|
1266 |
#bold |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1267 |
" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1268 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1269 |
(index > self size) ifFalse:[ |
3259 | 1270 |
listAttributes isNil ifTrue:[ |
5108 | 1271 |
listAttributes := OrderedCollection newWithSize:index |
3259 | 1272 |
] ifFalse:[ |
5354 | 1273 |
listAttributes ensureSizeAtLeast:index. |
3259 | 1274 |
]. |
1275 |
aSymbolOrCollectionOfSymbolsOrNil = (listAttributes at:index) ifFalse:[ |
|
1276 |
listAttributes at:index put:aSymbolOrCollectionOfSymbolsOrNil. |
|
1277 |
self redrawLine:index |
|
1278 |
] |
|
125 | 1279 |
] |
1280 |
! |
|
1281 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1282 |
attributeAt:index remove:aSymbolOrCollectionOfSymbols |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1283 |
"remove a line attribute; |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1284 |
currently supported are: |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1285 |
#halfIntensity |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1286 |
#disabled |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1287 |
#bold |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1288 |
" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1289 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1290 |
|current| |
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 |
current := self attributeAt:index. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1293 |
current isNil ifTrue:[^ self]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1294 |
current isSymbol ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1295 |
aSymbolOrCollectionOfSymbols isSymbol ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1296 |
current == aSymbolOrCollectionOfSymbols ifTrue:[current := nil] |
125 | 1297 |
] ifFalse:[ |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1298 |
(aSymbolOrCollectionOfSymbols includes:current) ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1299 |
current := nil |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1300 |
] |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1301 |
] |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1302 |
] ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1303 |
aSymbolOrCollectionOfSymbols isSymbol ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1304 |
current := current remove:aSymbolOrCollectionOfSymbols ifAbsent:[] |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1305 |
] ifFalse:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1306 |
aSymbolOrCollectionOfSymbols removeAll:aSymbolOrCollectionOfSymbols |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1307 |
] |
125 | 1308 |
]. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1309 |
self attributeAt:index put:current |
125 | 1310 |
! |
1311 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1312 |
line:lineNr hasAttribute:aSymbol |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1313 |
"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
|
1314 |
currently supported attributes are: |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1315 |
#halfIntensity |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1316 |
#disabled |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1317 |
#bold |
125 | 1318 |
" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1319 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1320 |
|attr| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1321 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1322 |
listAttributes isNil ifTrue:[^ false]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1323 |
(lineNr > listAttributes size) ifTrue:[^ false]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1324 |
attr := listAttributes at:lineNr. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1325 |
attr isNil ifTrue:[^ false]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1326 |
attr isSymbol ifTrue:[^ attr == aSymbol]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1327 |
^ (attr includes:aSymbol) |
125 | 1328 |
! |
1329 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1330 |
setAttributes:aList |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1331 |
"set the attribute list. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1332 |
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
|
1333 |
(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
|
1334 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1335 |
listAttributes := aList |
125 | 1336 |
! |
1337 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1338 |
strikeOut:aBoolean |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1339 |
"turn on/off strikeOut mode" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1340 |
|
2977 | 1341 |
<resource:#obsolete> |
2516 | 1342 |
self obsoleteMethodWarning:'use #strikeout:'. |
1343 |
strikeOut := aBoolean. |
|
1344 |
! |
|
1345 |
||
1346 |
strikeout:aBoolean |
|
1347 |
"turn on/off strikeOut mode" |
|
1348 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1349 |
strikeOut := aBoolean. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1350 |
! ! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1351 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1352 |
!SelectionInListView methodsFor:'accessing-behavior'! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1353 |
|
1181
ad5004cb2969
allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents:
1163
diff
changeset
|
1354 |
dragObjectConverter:aBlock |
ad5004cb2969
allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents:
1163
diff
changeset
|
1355 |
"set an optional dragObject converter; |
ad5004cb2969
allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents:
1163
diff
changeset
|
1356 |
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
|
1357 |
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
|
1358 |
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
|
1359 |
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
|
1360 |
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
|
1361 |
names of the actual objects to be dragged." |
ad5004cb2969
allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents:
1163
diff
changeset
|
1362 |
|
ad5004cb2969
allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents:
1163
diff
changeset
|
1363 |
dragObjectConverter := aBlock |
ad5004cb2969
allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents:
1163
diff
changeset
|
1364 |
|
ad5004cb2969
allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents:
1163
diff
changeset
|
1365 |
"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
|
1366 |
"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
|
1367 |
! |
ad5004cb2969
allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents:
1163
diff
changeset
|
1368 |
|
987
611244bb2e1d
Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents:
970
diff
changeset
|
1369 |
enabled |
611244bb2e1d
Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents:
970
diff
changeset
|
1370 |
"return true if selections are possible" |
611244bb2e1d
Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents:
970
diff
changeset
|
1371 |
|
611244bb2e1d
Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents:
970
diff
changeset
|
1372 |
^ enabled. |
611244bb2e1d
Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents:
970
diff
changeset
|
1373 |
|
611244bb2e1d
Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents:
970
diff
changeset
|
1374 |
"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
|
1375 |
! |
611244bb2e1d
Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents:
970
diff
changeset
|
1376 |
|
1831 | 1377 |
enabled:aBoolean |
1378 |
"enable/disable the view - selection changes are allowed/disallowed" |
|
1379 |
||
1380 |
enabled := aBoolean |
|
1381 |
||
1382 |
"Modified: / 30.3.1999 / 15:26:10 / stefan" |
|
1383 |
! |
|
1384 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1385 |
ignoreReselect:aBoolean |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1386 |
"set/clear the ignoreReselect flag - |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1387 |
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
|
1388 |
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
|
1389 |
change in the selection occurs. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1390 |
(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
|
1391 |
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
|
1392 |
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
|
1393 |
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
|
1394 |
if the selection is the same. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1395 |
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
|
1396 |
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
|
1397 |
|
997 | 1398 |
"ca: |
1399 |
multiple selection on: the ignoreReselect will have no influence |
|
1400 |
" |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1401 |
ignoreReselect := aBoolean |
125 | 1402 |
! |
1403 |
||
2329 | 1404 |
multipleSelectOk |
1405 |
^ multipleSelectOk |
|
1406 |
! |
|
1407 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1408 |
multipleSelectOk:aBoolean |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1409 |
"allow/disallow multiple selections. If enabled, the |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1410 |
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
|
1411 |
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
|
1412 |
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
|
1413 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1414 |
multipleSelectOk := aBoolean. |
997 | 1415 |
|
125 | 1416 |
! |
1417 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1418 |
toggleSelect:aBoolean |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1419 |
"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
|
1420 |
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
|
1421 |
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
|
1422 |
select status (see also ignoreReselect:)." |
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 |
toggleSelect := aBoolean. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1425 |
! ! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1426 |
|
1163
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1427 |
!SelectionInListView methodsFor:'accessing-channels'! |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1428 |
|
1310 | 1429 |
listHolder |
1430 |
^ listChannel |
|
1431 |
! |
|
1432 |
||
1433 |
listHolder:aListHolder |
|
1434 |
listChannel notNil ifTrue:[ |
|
1435 |
listChannel removeDependent:self |
|
1436 |
]. |
|
1437 |
(listChannel := aListHolder) notNil ifTrue:[ |
|
1438 |
listChannel addDependent:self |
|
1439 |
]. |
|
1440 |
self getListFromModel |
|
1163
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1441 |
! ! |
05ec30ba9b17
added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1442 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1443 |
!SelectionInListView methodsFor:'accessing-contents'! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1444 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1445 |
add:aValue beforeIndex:index |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1446 |
"must recompute our current selections" |
125 | 1447 |
|
1448 |
selection notNil ifTrue:[ |
|
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
1449 |
self multipleSelectOk ifTrue:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
1450 |
selection := selection collect:[ :sel | |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
1451 |
sel >= index ifTrue:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
1452 |
sel + 1 |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
1453 |
] ifFalse:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
1454 |
sel |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
1455 |
] |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
1456 |
]. |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
1457 |
] ifFalse:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
1458 |
selection >= index ifTrue:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
1459 |
selection := selection + 1. |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
1460 |
]. |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
1461 |
]. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1462 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1463 |
^ super add:aValue beforeIndex:index. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1464 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1465 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1466 |
contents:aCollection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1467 |
"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
|
1468 |
and clearing attributes. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1469 |
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
|
1470 |
(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
|
1471 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1472 |
selection := nil. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1473 |
listAttributes := nil. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1474 |
super contents:aCollection. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1475 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1476 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1477 |
list:aCollection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1478 |
"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
|
1479 |
and clearing attributes." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1480 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1481 |
self list:aCollection keepSelection:false |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1482 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1483 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1484 |
list:aCollection keepSelection:aBoolean |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1485 |
"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
|
1486 |
and clearing attributes." |
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 |
|oldSelection| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1489 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1490 |
"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
|
1491 |
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
|
1492 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1493 |
(shown and:[hilightLevel ~~ 0]) ifTrue:[ |
686
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1494 |
selection == firstLineShown ifTrue:[ |
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1495 |
self paint:bgColor. |
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1496 |
self fillRectangleX:margin y:margin |
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1497 |
width:(width - (margin * 2)) |
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1498 |
height:(hilightLevel abs). |
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1499 |
]. |
125 | 1500 |
]. |
1501 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1502 |
aBoolean ifTrue:[ |
686
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1503 |
oldSelection := selection. |
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1504 |
selection := nil. |
125 | 1505 |
]. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1506 |
listAttributes := nil. |
3823
1525064c99d2
changed #list:keepSelection:
Claus Gittinger <cg@exept.de>
parents:
3711
diff
changeset
|
1507 |
self list:aCollection expandTabs:printItems. |
2948 | 1508 |
shown ifTrue:[self invalidate]. |
1509 |
||
4467
746be61eb7f2
changed: #list:keepSelection:
Claus Gittinger <cg@exept.de>
parents:
4324
diff
changeset
|
1510 |
useIndex == true ifTrue:[ |
746be61eb7f2
changed: #list:keepSelection:
Claus Gittinger <cg@exept.de>
parents:
4324
diff
changeset
|
1511 |
scrollWhenUpdating == #keep ifTrue:[ |
746be61eb7f2
changed: #list:keepSelection:
Claus Gittinger <cg@exept.de>
parents:
4324
diff
changeset
|
1512 |
self selectWithoutScroll:oldSelection |
746be61eb7f2
changed: #list:keepSelection:
Claus Gittinger <cg@exept.de>
parents:
4324
diff
changeset
|
1513 |
] ifFalse:[ |
746be61eb7f2
changed: #list:keepSelection:
Claus Gittinger <cg@exept.de>
parents:
4324
diff
changeset
|
1514 |
self setSelection:oldSelection. "/ nil if keep is false |
746be61eb7f2
changed: #list:keepSelection:
Claus Gittinger <cg@exept.de>
parents:
4324
diff
changeset
|
1515 |
]. |
3432
1db93a93342d
care for \"do-not-scroll-when-updating\" flag.
Claus Gittinger <cg@exept.de>
parents:
3424
diff
changeset
|
1516 |
] ifFalse:[ |
4467
746be61eb7f2
changed: #list:keepSelection:
Claus Gittinger <cg@exept.de>
parents:
4324
diff
changeset
|
1517 |
self getSelectionFromModel. |
3432
1db93a93342d
care for \"do-not-scroll-when-updating\" flag.
Claus Gittinger <cg@exept.de>
parents:
3424
diff
changeset
|
1518 |
]. |
1db93a93342d
care for \"do-not-scroll-when-updating\" flag.
Claus Gittinger <cg@exept.de>
parents:
3424
diff
changeset
|
1519 |
|
2232
b65df4a6af2d
when the selection is lost (due to a changed list),
Claus Gittinger <cg@exept.de>
parents:
2229
diff
changeset
|
1520 |
selection ~= oldSelection ifTrue:[ |
b65df4a6af2d
when the selection is lost (due to a changed list),
Claus Gittinger <cg@exept.de>
parents:
2229
diff
changeset
|
1521 |
"/ cannot keep the selection (items removed) |
b65df4a6af2d
when the selection is lost (due to a changed list),
Claus Gittinger <cg@exept.de>
parents:
2229
diff
changeset
|
1522 |
"/ must tell the model if there is one .... |
b65df4a6af2d
when the selection is lost (due to a changed list),
Claus Gittinger <cg@exept.de>
parents:
2229
diff
changeset
|
1523 |
self selectionChangedFrom:oldSelection |
b65df4a6af2d
when the selection is lost (due to a changed list),
Claus Gittinger <cg@exept.de>
parents:
2229
diff
changeset
|
1524 |
]. |
686
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1525 |
|
3432
1db93a93342d
care for \"do-not-scroll-when-updating\" flag.
Claus Gittinger <cg@exept.de>
parents:
3424
diff
changeset
|
1526 |
"Modified: / 10-01-2007 / 18:21:31 / cg" |
31 | 1527 |
! |
1528 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1529 |
printItems:aBoolean |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1530 |
"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
|
1531 |
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
|
1532 |
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
|
1533 |
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
|
1534 |
The default is false. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1535 |
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
|
1536 |
a definable printSelector or - better - a printConverter. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1537 |
This may be added in the future." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1538 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1539 |
printItems := aBoolean |
125 | 1540 |
! |
1541 |
||
2255
0bd7f58945b7
oops - must care for selection when doing bulk-removes
Claus Gittinger <cg@exept.de>
parents:
2247
diff
changeset
|
1542 |
removeFromIndex:startLineNr toIndex:endLineNr |
0bd7f58945b7
oops - must care for selection when doing bulk-removes
Claus Gittinger <cg@exept.de>
parents:
2247
diff
changeset
|
1543 |
"must recompute our current selections" |
0bd7f58945b7
oops - must care for selection when doing bulk-removes
Claus Gittinger <cg@exept.de>
parents:
2247
diff
changeset
|
1544 |
|
2256 | 1545 |
|oldSelection| |
1546 |
||
2255
0bd7f58945b7
oops - must care for selection when doing bulk-removes
Claus Gittinger <cg@exept.de>
parents:
2247
diff
changeset
|
1547 |
selection notNil ifTrue:[ |
2256 | 1548 |
oldSelection := selection copy. |
1549 |
||
1550 |
"/ a kludge - if the first line is in the selection, |
|
1551 |
"/ and the selection is drawn with an extra inverted area around, |
|
1552 |
"/ we must invalidate the line before as well. |
|
2633
96d7e5d626ae
redraw bug fix (highlightFrame leftover when deleting lines)
Claus Gittinger <cg@exept.de>
parents:
2597
diff
changeset
|
1553 |
(hilightFrameColor notNil or:[hilightStyle == #motif]) ifTrue:[ |
2256 | 1554 |
(self isInSelection:startLineNr) ifTrue:[ |
1555 |
startLineNr > 1 ifTrue:[ |
|
1556 |
self invalidateLine:(startLineNr - 1) |
|
1557 |
] |
|
1558 |
]. |
|
1559 |
]. |
|
1560 |
||
4478 | 1561 |
self checkRemovingSelectionFrom:startLineNr to:endLineNr. |
2256 | 1562 |
oldSelection ~= selection ifTrue:[ |
1563 |
"/ cannot keep the selection (items removed) |
|
1564 |
"/ must tell the model if there is one .... |
|
2334
94cdb9b2d1f9
avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1565 |
model notNil ifTrue:[model removeDependent:self]. |
94cdb9b2d1f9
avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1566 |
[ |
94cdb9b2d1f9
avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1567 |
self selectionChangedFrom:oldSelection |
2519
a088ad3bb1e5
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
2516
diff
changeset
|
1568 |
] ensure:[ |
2334
94cdb9b2d1f9
avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1569 |
model notNil ifTrue:[model addDependent:self]. |
94cdb9b2d1f9
avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1570 |
]. |
94cdb9b2d1f9
avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1571 |
]. |
2255
0bd7f58945b7
oops - must care for selection when doing bulk-removes
Claus Gittinger <cg@exept.de>
parents:
2247
diff
changeset
|
1572 |
]. |
0bd7f58945b7
oops - must care for selection when doing bulk-removes
Claus Gittinger <cg@exept.de>
parents:
2247
diff
changeset
|
1573 |
super removeFromIndex:startLineNr toIndex:endLineNr. |
0bd7f58945b7
oops - must care for selection when doing bulk-removes
Claus Gittinger <cg@exept.de>
parents:
2247
diff
changeset
|
1574 |
! |
0bd7f58945b7
oops - must care for selection when doing bulk-removes
Claus Gittinger <cg@exept.de>
parents:
2247
diff
changeset
|
1575 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1576 |
removeIndexWithoutRedraw:lineNr |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1577 |
"delete line - no redraw; |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1578 |
return true, if something was really deleted. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1579 |
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
|
1580 |
|
2256 | 1581 |
|oldSelection| |
1582 |
||
1583 |
selection notNil ifTrue:[ |
|
1584 |
oldSelection := selection copy. |
|
1585 |
self checkRemovingSelection:lineNr. |
|
1586 |
oldSelection ~= selection ifTrue:[ |
|
1587 |
"/ cannot keep the selection (items removed) |
|
1588 |
"/ must tell the model if there is one .... |
|
1589 |
self selectionChangedFrom:oldSelection |
|
1590 |
] |
|
1591 |
]. |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1592 |
^ super removeIndexWithoutRedraw:lineNr |
105 | 1593 |
! |
1594 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1595 |
setContents:aCollection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1596 |
"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
|
1597 |
and clearing attributes. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1598 |
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
|
1599 |
(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
|
1600 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1601 |
selection := nil. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1602 |
listAttributes := nil. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1603 |
super setContents:aCollection. |
125 | 1604 |
! |
1605 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1606 |
setList:aCollection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1607 |
"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
|
1608 |
and clearing attributes. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1609 |
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
|
1610 |
(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
|
1611 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1612 |
selection := nil. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1613 |
listAttributes := nil. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1614 |
super setList:aCollection. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1615 |
! ! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1616 |
|
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1617 |
!SelectionInListView methodsFor:'accessing-look'! |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1618 |
|
3711
e8d1ab008312
#noHighlighting to switch off highlighting of selected lines
Stefan Vogel <sv@exept.de>
parents:
3699
diff
changeset
|
1619 |
noHighlighting |
e8d1ab008312
#noHighlighting to switch off highlighting of selected lines
Stefan Vogel <sv@exept.de>
parents:
3699
diff
changeset
|
1620 |
"switch off higlighting of selected lines" |
e8d1ab008312
#noHighlighting to switch off highlighting of selected lines
Stefan Vogel <sv@exept.de>
parents:
3699
diff
changeset
|
1621 |
|
e8d1ab008312
#noHighlighting to switch off highlighting of selected lines
Stefan Vogel <sv@exept.de>
parents:
3699
diff
changeset
|
1622 |
hilightFgColor := fgColor. |
e8d1ab008312
#noHighlighting to switch off highlighting of selected lines
Stefan Vogel <sv@exept.de>
parents:
3699
diff
changeset
|
1623 |
hilightBgColor := bgColor. |
e8d1ab008312
#noHighlighting to switch off highlighting of selected lines
Stefan Vogel <sv@exept.de>
parents:
3699
diff
changeset
|
1624 |
hilightFrameColor := nil. |
e8d1ab008312
#noHighlighting to switch off highlighting of selected lines
Stefan Vogel <sv@exept.de>
parents:
3699
diff
changeset
|
1625 |
hilightFgColorNoFocus := fgColor. |
e8d1ab008312
#noHighlighting to switch off highlighting of selected lines
Stefan Vogel <sv@exept.de>
parents:
3699
diff
changeset
|
1626 |
hilightBgColorNoFocus := bgColor. |
e8d1ab008312
#noHighlighting to switch off highlighting of selected lines
Stefan Vogel <sv@exept.de>
parents:
3699
diff
changeset
|
1627 |
! |
e8d1ab008312
#noHighlighting to switch off highlighting of selected lines
Stefan Vogel <sv@exept.de>
parents:
3699
diff
changeset
|
1628 |
|
4971
c67f7d22e6d8
class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4913
diff
changeset
|
1629 |
selectedVisualBlock |
c67f7d22e6d8
class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4913
diff
changeset
|
1630 |
^ selectedVisualBlock |
c67f7d22e6d8
class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4913
diff
changeset
|
1631 |
! |
c67f7d22e6d8
class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4913
diff
changeset
|
1632 |
|
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1633 |
selectedVisualBlock:aBlock |
2290
1c602645fc3a
visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents:
2264
diff
changeset
|
1634 |
"ST-80 compatibility: provide a block, which returns a displayObject to be drawn for |
1c602645fc3a
visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents:
2264
diff
changeset
|
1635 |
selected items." |
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1636 |
|
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1637 |
selectedVisualBlock := aBlock |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1638 |
|
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1639 |
"Created: / 27.10.1997 / 19:50:58 / cg" |
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1640 |
"Modified: / 21.6.1998 / 02:40:46 / cg" |
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1641 |
! |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1642 |
|
4971
c67f7d22e6d8
class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4913
diff
changeset
|
1643 |
visualBlock |
c67f7d22e6d8
class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4913
diff
changeset
|
1644 |
^ visualBlock |
c67f7d22e6d8
class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4913
diff
changeset
|
1645 |
! |
c67f7d22e6d8
class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4913
diff
changeset
|
1646 |
|
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1647 |
visualBlock:aBlock |
2290
1c602645fc3a
visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents:
2264
diff
changeset
|
1648 |
"ST-80 compatibility: provide a block, which returns a displayObject to be drawn for |
1c602645fc3a
visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents:
2264
diff
changeset
|
1649 |
unselected items." |
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1650 |
|
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1651 |
visualBlock := aBlock |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1652 |
|
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
1653 |
"Modified: / 21.6.1998 / 02:40:57 / cg" |
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1654 |
! ! |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1655 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1656 |
!SelectionInListView methodsFor:'accessing-mvc'! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1657 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1658 |
addModelInterfaceTo:aDictionary |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1659 |
"see comment in View>>modelInterface" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1660 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1661 |
super addModelInterfaceTo:aDictionary. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1662 |
aDictionary at:#doubleClickMessage put:doubleClickMsg. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1663 |
aDictionary at:#initialSelectionMessage put:initialSelectionMsg. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1664 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1665 |
" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1666 |
SelectionInListView new modelInterface |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1667 |
" |
105 | 1668 |
! |
1669 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1670 |
doubleClick:aSymbol |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1671 |
"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
|
1672 |
OBSOLETE: please use #doubleClickMessage:" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1673 |
|
2369 | 1674 |
<resource:#obsolete> |
1675 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1676 |
self obsoleteMethodWarning:'please use #doubleClickMessage:'. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1677 |
doubleClickMsg := aSymbol |
105 | 1678 |
! |
1679 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1680 |
doubleClickMessage |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1681 |
"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
|
1682 |
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
|
1683 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1684 |
^ doubleClickMsg |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1685 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1686 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1687 |
doubleClickMessage:aSymbol |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1688 |
"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
|
1689 |
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
|
1690 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1691 |
doubleClickMsg := aSymbol |
119 | 1692 |
! |
1693 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1694 |
initialSelectionMessage |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1695 |
"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
|
1696 |
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
|
1697 |
actually aquire a new selection value." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1698 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1699 |
^ initialSelectionMsg |
125 | 1700 |
! |
1701 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1702 |
initialSelectionMessage:aSymbol |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1703 |
"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
|
1704 |
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
|
1705 |
actually aquire a new selection value." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1706 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1707 |
initialSelectionMsg := aSymbol |
125 | 1708 |
! |
1709 |
||
4014 | 1710 |
on:aModel aspect:aspectSymbol change:changeSymbol list:listSymbol menu:menuSymbol |
1711 |
||
1712 |
"ST-80 compatibility" |
|
1713 |
||
1714 |
super on:aModel aspect:aspectSymbol change:changeSymbol list:listSymbol menu:menuSymbol. |
|
1715 |
initialSelectionMsg := aspectMsg. |
|
1716 |
! |
|
1717 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1718 |
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
|
1719 |
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
|
1720 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1721 |
"ST-80 compatibility" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1722 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1723 |
aspectMsg := aspectSymbol. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1724 |
changeMsg := changeSymbol. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1725 |
listMsg := listSymbol. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1726 |
menuMsg := menuSymbol. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1727 |
initialSelectionMsg := initialSymbol. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1728 |
printItems := print. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1729 |
oneItem := one. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1730 |
useIndex := use. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1731 |
ignoreReselect := false. "/ ST80 behavior |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1732 |
self model:aModel. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1733 |
! ! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1734 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1735 |
!SelectionInListView methodsFor:'accessing-selection'! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1736 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1737 |
addElementToSelection:anObject |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1738 |
"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
|
1739 |
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
|
1740 |
No scrolling is done. Returns true, if ok, false if no such entry |
886 | 1741 |
was found. |
1742 |
*** 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
|
1743 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1744 |
|lineNo str| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1745 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1746 |
str := anObject printString. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1747 |
lineNo := list findFirst:[:entry | str = entry printString]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1748 |
lineNo ~~ 0 ifTrue:[ |
886 | 1749 |
self addToSelection:lineNo. |
1750 |
^ true |
|
125 | 1751 |
]. |
1752 |
^ false |
|
886 | 1753 |
|
1754 |
"Modified: 15.11.1996 / 16:59:43 / cg" |
|
125 | 1755 |
! |
1756 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1757 |
addToSelection:aNumber |
886 | 1758 |
"add entry, aNumber to the selection. No scrolling is done. |
1759 |
*** 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
|
1760 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1761 |
(self isValidSelection:aNumber) ifFalse:[^ self]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1762 |
|
2138
a634610a37de
added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents:
2136
diff
changeset
|
1763 |
"/ this item selectable ? |
2141
a9f9956168b8
undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
1764 |
(selectConditionBlock notNil |
a9f9956168b8
undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
1765 |
and:[(selectConditionBlock value:aNumber) not]) ifTrue:[^ self]. |
1409 | 1766 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1767 |
selection isNil ifTrue:[^ self selectWithoutScroll:aNumber]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1768 |
selection isCollection ifTrue:[ |
886 | 1769 |
(selection includes:aNumber) ifTrue:[^ self]. |
2136
eb816448daec
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
2125
diff
changeset
|
1770 |
|
eb816448daec
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
2125
diff
changeset
|
1771 |
"/ to enforce the change-message (value is identical to oldValue) |
eb816448daec
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
2125
diff
changeset
|
1772 |
selection isList ifTrue:[ |
eb816448daec
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
2125
diff
changeset
|
1773 |
selection add:aNumber |
eb816448daec
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
2125
diff
changeset
|
1774 |
] ifFalse:[ |
eb816448daec
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
2125
diff
changeset
|
1775 |
selection := selection asOrderedCollection. |
2684
91ac286733ac
when adding to a selection, make sure that a new collection is
Claus Gittinger <cg@exept.de>
parents:
2670
diff
changeset
|
1776 |
selection := selection copyWith:aNumber. |
2136
eb816448daec
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
2125
diff
changeset
|
1777 |
] |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1778 |
] ifFalse:[ |
886 | 1779 |
(aNumber == selection) ifTrue:[^ self]. |
1780 |
selection := OrderedCollection with:selection with:aNumber |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1781 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1782 |
self redrawElement:aNumber |
886 | 1783 |
|
2136
eb816448daec
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
2125
diff
changeset
|
1784 |
"Modified: / 11.2.2000 / 01:38:45 / cg" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1785 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1786 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1787 |
removeFromSelection:aNumber |
886 | 1788 |
"remove entry, aNumber from the selection. |
1789 |
*** 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
|
1790 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1791 |
selection isNil ifTrue:[^ self]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1792 |
|
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
1793 |
self multipleSelectOk ifTrue:[ |
886 | 1794 |
(selection includes:aNumber) ifFalse:[^ self]. |
2136
eb816448daec
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
2125
diff
changeset
|
1795 |
|
eb816448daec
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
2125
diff
changeset
|
1796 |
selection isList ifTrue:[ |
eb816448daec
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
2125
diff
changeset
|
1797 |
selection remove:aNumber ifAbsent:nil |
eb816448daec
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
2125
diff
changeset
|
1798 |
] ifFalse:[ |
eb816448daec
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
2125
diff
changeset
|
1799 |
"/ to enforce the change-message (value is identical to oldValue) |
eb816448daec
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
2125
diff
changeset
|
1800 |
selection := selection asOrderedCollection. |
eb816448daec
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
2125
diff
changeset
|
1801 |
selection := selection copyWithout:aNumber |
eb816448daec
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
2125
diff
changeset
|
1802 |
]. |
886 | 1803 |
selection size == 0 ifTrue:[ |
2136
eb816448daec
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
2125
diff
changeset
|
1804 |
selection := #() |
886 | 1805 |
] |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1806 |
] ifFalse:[ |
886 | 1807 |
(aNumber == selection) ifFalse:[^ self]. |
1808 |
selection := nil |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1809 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1810 |
self redrawElement:aNumber |
886 | 1811 |
|
2136
eb816448daec
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
2125
diff
changeset
|
1812 |
"Modified: / 11.2.2000 / 01:41:24 / cg" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1813 |
! ! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1814 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1815 |
!SelectionInListView methodsFor:'change & update'! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1816 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1817 |
update:something with:aParameter from:changedObject |
2246 | 1818 |
|listValue start stop size idx| |
1345 | 1819 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1820 |
changedObject == model ifTrue:[ |
1235 | 1821 |
something == aspectMsg ifTrue:[ |
1358 | 1822 |
listChannel isNil ifTrue:[ |
1823 |
self getListFromModel |
|
1824 |
]. |
|
1235 | 1825 |
self getSelectionFromModel. |
1826 |
^ self |
|
1827 |
]. |
|
1828 |
something == listMsg ifTrue:[ |
|
1829 |
self getListFromModel. |
|
1830 |
^ self |
|
1831 |
]. |
|
1832 |
something == initialSelectionMsg ifTrue:[ |
|
1833 |
self getSelectionFromModel. |
|
1834 |
^ self |
|
1835 |
]. |
|
1836 |
something == #empty ifTrue:[ |
|
1837 |
self list:nil. |
|
1838 |
^ self |
|
1839 |
]. |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
1840 |
]. |
1345 | 1841 |
changedObject == listChannel ifFalse:[ |
1842 |
^ super update:something with:aParameter from:changedObject |
|
1843 |
]. |
|
3424
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1844 |
|
3451
a21361ac90d2
care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents:
3432
diff
changeset
|
1845 |
something == #remove: ifTrue:[ |
a21361ac90d2
care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents:
3432
diff
changeset
|
1846 |
self removeIndex:aParameter. |
a21361ac90d2
care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents:
3432
diff
changeset
|
1847 |
^ self |
a21361ac90d2
care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents:
3432
diff
changeset
|
1848 |
]. |
a21361ac90d2
care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents:
3432
diff
changeset
|
1849 |
something == #removeFrom: ifTrue:[ |
a21361ac90d2
care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents:
3432
diff
changeset
|
1850 |
start := aParameter first. |
a21361ac90d2
care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents:
3432
diff
changeset
|
1851 |
stop := aParameter last. |
a21361ac90d2
care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents:
3432
diff
changeset
|
1852 |
|
a21361ac90d2
care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents:
3432
diff
changeset
|
1853 |
(start == 1 and:[stop == self size]) ifTrue:[ |
a21361ac90d2
care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents:
3432
diff
changeset
|
1854 |
self getListFromModel |
a21361ac90d2
care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents:
3432
diff
changeset
|
1855 |
] ifFalse:[ |
a21361ac90d2
care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents:
3432
diff
changeset
|
1856 |
self removeFromIndex:start toIndex:stop. |
a21361ac90d2
care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents:
3432
diff
changeset
|
1857 |
]. |
a21361ac90d2
care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents:
3432
diff
changeset
|
1858 |
^ self |
a21361ac90d2
care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents:
3432
diff
changeset
|
1859 |
]. |
a21361ac90d2
care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents:
3432
diff
changeset
|
1860 |
|
3424
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1861 |
"/ ca's "optimizations" are only correct if we do not have items |
4135 | 1862 |
(items isNil or:[printItems not]) ifTrue:[ |
3424
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1863 |
listValue := listChannel value. |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1864 |
|
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1865 |
something == #at: ifTrue:[ |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1866 |
idx := aParameter isCollection ifTrue:[aParameter at:1] |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1867 |
ifFalse:[aParameter]. |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1868 |
self at:aParameter put:(listValue at:idx). |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1869 |
^ self |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1870 |
]. |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1871 |
|
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1872 |
something == #insert: ifTrue:[ |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1873 |
listValue == list ifTrue:[self halt:'should not happen']. |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1874 |
self add:(listValue at:aParameter) beforeIndex:aParameter. |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1875 |
^ self |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1876 |
]. |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1877 |
|
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1878 |
something == #insertCollection: ifTrue:[ |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1879 |
(size := aParameter last) ~~ 0 ifTrue:[ |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1880 |
(self size == 0 or:[size > 50]) ifTrue:[ |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1881 |
self getListFromModel |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1882 |
] ifFalse:[ |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1883 |
listValue == list ifTrue:[self halt:'should not happen']. |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1884 |
start := aParameter first. |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1885 |
"/ self addAll:(listValue copyFrom:start to:start+size-1) beforeIndex:start. |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1886 |
size timesRepeat:[ |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1887 |
self add:(listValue at:start) beforeIndex:start. |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1888 |
start := start + 1 |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1889 |
] |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1890 |
] |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1891 |
]. |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1892 |
^ self |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1893 |
]. |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1894 |
|
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1895 |
something == #replace: ifTrue:[ |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1896 |
start := aParameter first. |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1897 |
stop := aParameter last. |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1898 |
|
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1899 |
list size = listValue size ifTrue:[ |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1900 |
self replaceFrom:start to:stop with:listValue startingAt:start. |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1901 |
^ self |
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1902 |
]. |
2334
94cdb9b2d1f9
avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1903 |
]. |
1345 | 1904 |
]. |
1905 |
||
1906 |
self getListFromModel. |
|
1400 | 1907 |
|
3424
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
1908 |
"Modified: / 30-03-1999 / 14:27:42 / stefan" |
3451
a21361ac90d2
care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents:
3432
diff
changeset
|
1909 |
"Modified: / 21-02-2007 / 15:20:44 / cg" |
125 | 1910 |
! ! |
1911 |
||
2563
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
1912 |
!SelectionInListView methodsFor:'drag & drop'! |
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
1913 |
|
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
1914 |
allowDrag:aBoolean |
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
1915 |
"enable/disable dragging support" |
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
1916 |
|
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
1917 |
allowDrag := aBoolean |
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
1918 |
|
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
1919 |
"Created: 14.11.1996 / 15:12:58 / cg" |
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
1920 |
! |
1473 | 1921 |
|
1922 |
canDrag |
|
3246 | 1923 |
"returns true if dragging is enabled" |
1924 |
||
1473 | 1925 |
^ (allowDrag or:[dropSource notNil]) |
1926 |
! |
|
1927 |
||
3527
da7213ab94dc
dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents:
3487
diff
changeset
|
1928 |
dragAutoScroll:aDropContext |
2820 | 1929 |
"called by the DragAndDropManager to scroll during a drag/drop operation |
3246 | 1930 |
if required (decided by the widget itself); |
1931 |
If a scroll is done, return true otherwise false (used to restore the background)" |
|
1932 |
||
3527
da7213ab94dc
dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents:
3487
diff
changeset
|
1933 |
|point y dist visLnNr absLnNr nLines scrollUp| |
da7213ab94dc
dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents:
3487
diff
changeset
|
1934 |
|
da7213ab94dc
dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents:
3487
diff
changeset
|
1935 |
point := aDropContext targetPoint. |
da7213ab94dc
dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents:
3487
diff
changeset
|
1936 |
y := point y. |
da7213ab94dc
dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents:
3487
diff
changeset
|
1937 |
visLnNr := self visibleLineOfY:y. |
2820 | 1938 |
absLnNr := self visibleLineToAbsoluteLine: visLnNr. |
1939 |
||
1940 |
visLnNr == 1 ifTrue:[ |
|
3527
da7213ab94dc
dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents:
3487
diff
changeset
|
1941 |
scrollUp := true. |
2820 | 1942 |
absLnNr == 1 ifTrue:[ ^ false ]. |
3527
da7213ab94dc
dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents:
3487
diff
changeset
|
1943 |
dist := y. |
2820 | 1944 |
] ifFalse:[ |
3527
da7213ab94dc
dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents:
3487
diff
changeset
|
1945 |
scrollUp := false. |
2820 | 1946 |
absLnNr < self size ifFalse:[ ^ false ]. |
1947 |
(self lineIsFullyVisible: absLnNr + 1) ifTrue:[ ^ false ]. |
|
3527
da7213ab94dc
dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents:
3487
diff
changeset
|
1948 |
dist := height-y. |
2820 | 1949 |
]. |
3527
da7213ab94dc
dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents:
3487
diff
changeset
|
1950 |
aDropContext contentsWillChange. |
da7213ab94dc
dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents:
3487
diff
changeset
|
1951 |
|
da7213ab94dc
dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents:
3487
diff
changeset
|
1952 |
nLines := 1. |
da7213ab94dc
dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents:
3487
diff
changeset
|
1953 |
|
da7213ab94dc
dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents:
3487
diff
changeset
|
1954 |
#(2 4 8) do:[:fraction | |
da7213ab94dc
dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents:
3487
diff
changeset
|
1955 |
dist <= (fontHeight / fraction) ifTrue:[ |
da7213ab94dc
dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents:
3487
diff
changeset
|
1956 |
nLines := fraction. |
da7213ab94dc
dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents:
3487
diff
changeset
|
1957 |
] |
da7213ab94dc
dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents:
3487
diff
changeset
|
1958 |
]. |
da7213ab94dc
dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents:
3487
diff
changeset
|
1959 |
|
da7213ab94dc
dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents:
3487
diff
changeset
|
1960 |
scrollUp ifTrue:[ |
da7213ab94dc
dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents:
3487
diff
changeset
|
1961 |
self scrollUp:nLines |
da7213ab94dc
dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents:
3487
diff
changeset
|
1962 |
] ifFalse:[ |
da7213ab94dc
dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents:
3487
diff
changeset
|
1963 |
self scrollDown:nLines |
da7213ab94dc
dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents:
3487
diff
changeset
|
1964 |
]. |
2820 | 1965 |
|
1966 |
^ true |
|
1967 |
! |
|
1968 |
||
1473 | 1969 |
dropSource |
3246 | 1970 |
"returns the dropSource or nil" |
1971 |
||
1473 | 1972 |
^ dropSource |
1973 |
! |
|
1974 |
||
1975 |
dropSource:aDropSourceOrNil |
|
3246 | 1976 |
"set the dropSource or nil" |
1977 |
||
1473 | 1978 |
dropSource := aDropSourceOrNil. |
1979 |
! |
|
1980 |
||
3246 | 1981 |
startDragAt:aPoint |
1473 | 1982 |
dropSource isNil ifTrue:[ |
2563
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
1983 |
dragIsActive := true. |
3246 | 1984 |
DragAndDropManager |
1985 |
startDrag:(self collectionOfDragObjects) |
|
1986 |
from:self |
|
1987 |
offset:0 @ 0 |
|
1988 |
atEnd:endDragAction |
|
1989 |
display:(self selectionValue). |
|
1473 | 1990 |
] ifFalse:[ |
1991 |
dropSource startDragIn:self at:aPoint |
|
1992 |
] |
|
1993 |
! ! |
|
1994 |
||
429
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1995 |
!SelectionInListView methodsFor:'drawing'! |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1996 |
|
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1997 |
drawRightArrowInVisibleLine:visLineNr |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1998 |
"draw a right arrow (for submenus). |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
1999 |
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
|
2000 |
as menus or file-lists." |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2001 |
|
988 | 2002 |
|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
|
2003 |
|
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2004 |
x := width - 16. |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2005 |
y := (self yOfVisibleLine:visLineNr). |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2006 |
|
988 | 2007 |
listLine := self visibleLineToListLine:visLineNr. |
2008 |
item := self at:listLine. |
|
2009 |
item isNil ifTrue:[ |
|
2010 |
itemHeight := fontHeight |
|
2011 |
] ifFalse:[ |
|
2012 |
itemHeight := item heightOn:self. |
|
2013 |
]. |
|
2014 |
||
4913 | 2015 |
(self graphicsDevice depth == 1 or:[arrowLevel == 0]) ifTrue:[ |
2016 |
form := self class rightArrowFormOn:self graphicsDevice. |
|
988 | 2017 |
form notNil ifTrue:[ |
2018 |
y := y + ((itemHeight - form height) // 2). |
|
2037 | 2019 |
self foreground:( |
2020 |
(self isInSelection:listLine) |
|
2021 |
ifTrue:[hilightFgColor] |
|
2022 |
ifFalse:[fgColor]). |
|
988 | 2023 |
self displayForm:form x:x y:y. |
2024 |
] |
|
429
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2025 |
] ifFalse:[ |
988 | 2026 |
smallArrow ifTrue:[ |
4913 | 2027 |
form := self class smallRightArrowLightFormOn:self graphicsDevice. |
2028 |
form2 := self class smallRightArrowShadowFormOn:self graphicsDevice. |
|
988 | 2029 |
] ifFalse:[ |
4913 | 2030 |
form := self class rightArrowLightFormOn:self graphicsDevice. |
2031 |
form2 := self class rightArrowShadowFormOn:self graphicsDevice. |
|
988 | 2032 |
]. |
2033 |
(form isNil or:[form2 isNil]) ifTrue:[ |
|
2034 |
"/ very bad conditions |
|
2035 |
^ self |
|
2036 |
]. |
|
2037 |
y := y + ((itemHeight - form height) // 2). |
|
2038 |
||
2039 |
topLeftColor := lightColor. |
|
2040 |
botRightColor := shadowColor. |
|
2041 |
||
2042 |
"openwin arrow stays down" |
|
2043 |
styleSheet name ~~ #openwin ifTrue:[ |
|
2044 |
(self isInSelection:listLine) ifTrue:[ |
|
2045 |
t := topLeftColor. |
|
2046 |
topLeftColor := botRightColor. |
|
2047 |
botRightColor := t. |
|
2048 |
] |
|
2049 |
]. |
|
2050 |
arrowLevel < 0 ifTrue:[ |
|
2051 |
t := topLeftColor. |
|
2052 |
topLeftColor := botRightColor. |
|
2053 |
botRightColor := t. |
|
2054 |
]. |
|
429
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2055 |
|
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2056 |
"/ self foreground:topLeftColor. |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2057 |
self paint:topLeftColor. |
988 | 2058 |
self displayForm:form x:x y:y. |
429
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2059 |
"/ self foreground:botRightColor. |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2060 |
self paint:botRightColor. |
988 | 2061 |
self displayForm:form2 x:x y:y. |
429
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2062 |
] |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2063 |
! |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2064 |
|
5207 | 2065 |
drawSelectionHighlightFrameForItemAtY:yLine with:fg |
2066 |
|wEdge y y2| |
|
2067 |
||
2068 |
y := yLine - (lineSpacing//2). |
|
5199 | 2069 |
hilightFrameColor notNil ifTrue:[ |
2070 |
hilightLevel == 0 ifTrue:[ |
|
2071 |
" |
|
2072 |
a line above and below |
|
2073 |
" |
|
2074 |
self paint:hilightFrameColor. |
|
2075 |
self displayLineFromX:0 y:y toX:width y:y. |
|
2076 |
y2 := y + fontHeight - 1. |
|
2077 |
self displayLineFromX:0 y:y2 toX:width y:y2. |
|
2078 |
^ self |
|
2079 |
] |
|
2080 |
] ifFalse:[ |
|
2081 |
hilightStyle == #motif ifTrue:[ |
|
2082 |
"/ an additional line, inset by one pixel |
|
2083 |
self paint:fg. |
|
2084 |
self displayLineFromX:0 y:y+1 toX:width y:y+1. |
|
2085 |
y2 := y + fontHeight - 1 - 1. |
|
2086 |
self displayLineFromX:0 y:y2 toX:width y:y2. |
|
2087 |
] ifFalse:[ |
|
2088 |
hilightStyle == #macosx ifTrue:[ |
|
2089 |
"/ an additional line, at the bottom |
|
2090 |
self paint:viewBackground. |
|
429
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2091 |
y2 := y + fontHeight - 1. |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2092 |
self displayLineFromX:0 y:y2 toX:width y:y2. |
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2093 |
] |
429
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2094 |
]. |
5199 | 2095 |
]. |
2096 |
||
2097 |
" |
|
2098 |
an edge it around |
|
2099 |
" |
|
2100 |
(hilightLevel ~~ 0) ifTrue:[ |
|
429
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2101 |
" |
5199 | 2102 |
let edge start at left, extending to the full width |
2103 |
XXX: widthOfContents should be cached in ListView |
|
2104 |
(instead of recomputing all over) |
|
2105 |
" |
|
2106 |
wEdge := width-(2 * margin). |
|
2107 |
includesNonStrings ifFalse:[ |
|
2108 |
wEdge := wEdge max:(self widthOfContents). |
|
429
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2109 |
]. |
5199 | 2110 |
self drawEdgesForX:(margin - viewOrigin x) y:y |
2111 |
width:wEdge+viewOrigin x height:fontHeight |
|
2112 |
level:hilightLevel. |
|
429
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2113 |
]. |
5207 | 2114 |
! |
2115 |
||
2116 |
drawVisibleLineSelected:visLineNr |
|
2117 |
"redraw a single line as selected." |
|
2118 |
||
2119 |
|fg bg| |
|
2120 |
||
2121 |
self hasFocus ifTrue:[ |
|
2122 |
fg := hilightFgColor. |
|
2123 |
bg := hilightBgColor. |
|
2124 |
] ifFalse:[ |
|
2125 |
fg := hilightFgColorNoFocus. |
|
2126 |
bg := hilightBgColorNoFocus. |
|
2127 |
]. |
|
2128 |
self drawVisibleLineSelected:visLineNr with:fg and:bg |
|
2129 |
||
2130 |
"Modified: / 31.8.1995 / 19:24:09 / claus" |
|
2131 |
"Modified: / 21.6.1998 / 03:12:56 / cg" |
|
2132 |
! |
|
2133 |
||
2134 |
drawVisibleLineSelected:visLineNr with:fg and:bg |
|
2135 |
"redraw a single line as selected." |
|
2136 |
||
2137 |
|listLine |
|
2138 |
y "{ Class: SmallInteger }" |
|
5208 | 2139 |
dObj item t| |
5207 | 2140 |
|
2141 |
listLine := self visibleLineToListLine:visLineNr. |
|
2142 |
listLine isNil ifTrue:[ |
|
2143 |
super drawVisibleLine:visLineNr with:fg and:bg. |
|
2144 |
^ self. |
|
2145 |
]. |
|
2146 |
||
2147 |
y := self yOfVisibleLine:visLineNr. |
|
2148 |
||
2149 |
"/ if an explicit drawing block has been defined - let it do it. |
|
2150 |
selectedVisualBlock notNil ifTrue:[ |
|
2151 |
backgroundAlreadyClearedColor == bg ifFalse:[ |
|
2152 |
self paint:bg. |
|
2153 |
self fillRectangleX:margin y:y - (lineSpacing//2) |
|
2154 |
width:(width - (2 * margin)) |
|
2155 |
height:fontHeight. |
|
2156 |
]. |
|
2157 |
||
2158 |
dObj := selectedVisualBlock value:self value:listLine. |
|
2159 |
self paint:fg on:bg. |
|
2160 |
dObj displayOn:self x:(textStartLeft-viewOrigin x) y:y + gc font ascent opaque:true. |
|
2161 |
||
2162 |
self drawSelectionHighlightFrameForItemAtY:y with:fg. |
|
2163 |
^ self. |
|
2164 |
]. |
|
2165 |
||
2166 |
strikeOut ifTrue:[ |
|
2167 |
self drawVisibleLine:visLineNr with:fgColor and:bgColor. |
|
2168 |
||
2169 |
self paint:fgColor. |
|
2170 |
y := y + (fontHeight // 2). |
|
2171 |
self displayLineFromX:0 y:y toX:width y:y. |
|
2172 |
^ self |
|
2173 |
]. |
|
2174 |
||
2175 |
"/ kludge: |
|
2176 |
"/ care for text objects with a color |
|
2177 |
"/ if the contrast between the fg-color and the selection-bg is too small, |
|
2178 |
"/ the item is not readable anymore ... |
|
2179 |
item := list at:listLine. |
|
2180 |
(item isText and:[item hasChangeOfEmphasis]) ifTrue:[ |
|
2181 |
t := Text string:item string emphasisCollection:item emphasis asArray. |
|
2182 |
t emphasisAllRemove:#color. |
|
2183 |
self |
|
2184 |
drawLine:t |
|
2185 |
atX:(textStartLeft - viewOrigin x) |
|
2186 |
inVisible:visLineNr |
|
2187 |
with:fg and:bg |
|
2188 |
] ifFalse:[ |
|
2189 |
(item class == LabelAndIcon |
|
2190 |
and:[(t := item string) notNil |
|
2191 |
and:[(t isText and:[t hasChangeOfEmphasis])]]) ifTrue:[ |
|
2192 |
t := Text string:t string emphasisCollection:t emphasis asArray. |
|
2193 |
t emphasisAllRemove:#color. |
|
2194 |
t := LabelAndIcon icon:item icon string:t. |
|
2195 |
t image:(item image). |
|
2196 |
t gap:(item gap). |
|
2197 |
t offset: (item offset). |
|
2198 |
self |
|
2199 |
drawLine:t |
|
2200 |
atX:(textStartLeft - viewOrigin x) |
|
2201 |
inVisible:visLineNr |
|
2202 |
with:fg and:bg |
|
2203 |
] ifFalse:[ |
|
2204 |
self drawVisibleLine:visLineNr with:fg and:bg. |
|
2205 |
] |
|
2206 |
]. |
|
2207 |
||
2208 |
self drawSelectionHighlightFrameForItemAtY:y with:fg. |
|
3423 | 2209 |
! |
2210 |
||
2211 |
invalidateLine:aLineNr |
|
2212 |
|visibleLine y| |
|
2213 |
||
2214 |
visibleLine := self listLineToVisibleLine:aLineNr. |
|
2215 |
visibleLine notNil ifTrue:[ |
|
2216 |
y := self yOfVisibleLine:visibleLine. |
|
5199 | 2217 |
self invalidate:(Rectangle origin:(0@y-(lineSpacing//2)) extent:(width@fontHeight+lineSpacing)) |
3423 | 2218 |
]. |
2219 |
! |
|
2220 |
||
2221 |
invalidateSelection |
|
2222 |
shown ifTrue:[ |
|
2223 |
self selectionDo:[:lineNr| self invalidateLine:lineNr ]. |
|
2224 |
]. |
|
429
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2225 |
! ! |
678f8d820c0f
fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
2226 |
|
125 | 2227 |
!SelectionInListView methodsFor:'event handling'! |
2228 |
||
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2229 |
buttonControlPress:button x:x y:y |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2230 |
"if multipleSelectOk: add to the selection; |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2231 |
otherwise, behave like normal select" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2232 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2233 |
|oldSelection listLineNr| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2234 |
|
3912
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
2235 |
(button == 1) ifTrue:[ |
1299 | 2236 |
"/ toggleSelect ifTrue:[ |
2237 |
"/ ^ self buttonPress:button x:x y:y |
|
2238 |
"/ ]. |
|
2318
d4bea07df2cd
fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents:
2314
diff
changeset
|
2239 |
selectionAtClickTime := nil. |
d4bea07df2cd
fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents:
2314
diff
changeset
|
2240 |
|
816 | 2241 |
enabled ifTrue:[ |
2413 | 2242 |
listLineNr := self lineAtY:y. "/ self visibleLineToListLine:(self visibleLineOfY:y). |
816 | 2243 |
listLineNr notNil ifTrue:[ |
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2244 |
(self lineIsEnabled:listLineNr) ifFalse:[^ self]. |
816 | 2245 |
]. |
2246 |
oldSelection := selection copy. |
|
2247 |
listLineNr notNil ifTrue: [ |
|
2141
a9f9956168b8
undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
2248 |
"/ this item selectable ? |
a9f9956168b8
undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
2249 |
(selectConditionBlock notNil |
a9f9956168b8
undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
2250 |
and:[(selectConditionBlock value:listLineNr) not]) ifTrue:[^ self]. |
a9f9956168b8
undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
2251 |
|
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2252 |
self multipleSelectOk ifTrue:[ |
816 | 2253 |
(self isInSelection:listLineNr) ifTrue:[ |
2318
d4bea07df2cd
fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents:
2314
diff
changeset
|
2254 |
self removeFromSelection:listLineNr. |
d4bea07df2cd
fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents:
2314
diff
changeset
|
2255 |
selectMode := false. |
816 | 2256 |
] ifFalse:[ |
2318
d4bea07df2cd
fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents:
2314
diff
changeset
|
2257 |
self addToSelection:listLineNr. |
d4bea07df2cd
fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents:
2314
diff
changeset
|
2258 |
selectMode := true. |
816 | 2259 |
] |
2260 |
] ifFalse:[ |
|
2261 |
self selectWithoutScroll:listLineNr |
|
2262 |
] |
|
2263 |
]. |
|
2264 |
((ignoreReselect not and:[selection notNil]) |
|
2265 |
or:[selection ~= oldSelection]) ifTrue:[ |
|
2266 |
self selectionChangedFrom:oldSelection. |
|
2267 |
]. |
|
2318
d4bea07df2cd
fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents:
2314
diff
changeset
|
2268 |
clickLine := listLineNr. |
816 | 2269 |
] |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2270 |
] ifFalse:[ |
816 | 2271 |
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
|
2272 |
] |
816 | 2273 |
|
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2274 |
"Created: / 14.11.1996 / 15:51:41 / cg" |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
2275 |
"Modified: / 8.8.1998 / 03:24:03 / cg" |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2276 |
! |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2277 |
|
3040
f5e9092f3312
buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents:
2998
diff
changeset
|
2278 |
buttonMotion:buttonState x:x y:y |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2279 |
"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
|
2280 |
|
997 | 2281 |
(enabled not or:[dragIsActive]) ifTrue:[ |
987
611244bb2e1d
Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents:
970
diff
changeset
|
2282 |
^ self |
611244bb2e1d
Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents:
970
diff
changeset
|
2283 |
]. |
611244bb2e1d
Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents:
970
diff
changeset
|
2284 |
|
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2285 |
"is it the select or 1-button ?" |
3040
f5e9092f3312
buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents:
2998
diff
changeset
|
2286 |
buttonState == 0 ifTrue:[^ self]. |
1620
47983c461af0
use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents:
1600
diff
changeset
|
2287 |
self sensor leftButtonPressed ifFalse:[^ self]. |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2288 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2289 |
clickLine isNil ifTrue:[^ self]. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2290 |
|
3565
7471c37e703e
expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents:
3527
diff
changeset
|
2291 |
self canDrag ifTrue:[ |
7471c37e703e
expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents:
3527
diff
changeset
|
2292 |
"/ UserPreferences current expandSelectionOnMouseMoveWithButtonPressed not ifTrue:[ |
7471c37e703e
expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents:
3527
diff
changeset
|
2293 |
"/ clickPosition isNil ifTrue:[ |
7471c37e703e
expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents:
3527
diff
changeset
|
2294 |
"/ clickPosition := x@y |
7471c37e703e
expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents:
3527
diff
changeset
|
2295 |
"/ ] |
7471c37e703e
expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents:
3527
diff
changeset
|
2296 |
"/ ]. |
7471c37e703e
expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents:
3527
diff
changeset
|
2297 |
|
7471c37e703e
expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents:
3527
diff
changeset
|
2298 |
(clickPosition notNil) ifTrue:[ "mouse pressed but not released" |
7471c37e703e
expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents:
3527
diff
changeset
|
2299 |
(clickPosition dist:(x@y)) > (UserPreferences current motionDistanceToStartDrag) ifTrue:[ |
7471c37e703e
expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents:
3527
diff
changeset
|
2300 |
^ self startDragAt:clickPosition |
7471c37e703e
expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents:
3527
diff
changeset
|
2301 |
]. |
7471c37e703e
expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents:
3527
diff
changeset
|
2302 |
^ self |
7471c37e703e
expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents:
3527
diff
changeset
|
2303 |
] |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2304 |
]. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2305 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2306 |
"if moved outside of view, start autoscroll" |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2307 |
(y < 0) ifTrue:[ |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2308 |
self compressMotionEvents:false. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2309 |
self startAutoScrollUp:y. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2310 |
^ self |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2311 |
]. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2312 |
(y > height) ifTrue:[ |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2313 |
self compressMotionEvents:false. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2314 |
self startAutoScrollDown:(y - height). |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2315 |
^ self |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2316 |
]. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2317 |
|
3132
7cbaaa576f28
selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents:
3124
diff
changeset
|
2318 |
(self canDrag |
7cbaaa576f28
selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents:
3124
diff
changeset
|
2319 |
and:[x < -5 or:[x > (width+5)]]) ifTrue:[ "visible and out of view" |
1473 | 2320 |
^ self startDragAt:(0 @ y) |
997 | 2321 |
]. |
2322 |
||
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2323 |
"move inside - stop autoscroll if any" |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2324 |
self stopAutoScroll. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2325 |
|
3565
7471c37e703e
expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents:
3527
diff
changeset
|
2326 |
UserPreferences current expandSelectionOnMouseMoveWithButtonPressed ifTrue:[ |
7471c37e703e
expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents:
3527
diff
changeset
|
2327 |
(self sensor hasButtonMotionEventFor:self) ifFalse:[ |
7471c37e703e
expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents:
3527
diff
changeset
|
2328 |
self expandSelectionToX:x y:y. |
7471c37e703e
expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents:
3527
diff
changeset
|
2329 |
]. |
2161 | 2330 |
]. |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2331 |
|
1620
47983c461af0
use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents:
1600
diff
changeset
|
2332 |
"Modified: / 29.1.1997 / 12:15:31 / stefan" |
2161 | 2333 |
"Modified: / 23.2.2000 / 12:03:35 / cg" |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2334 |
! |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2335 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2336 |
buttonMultiPress:button x:x y:y |
3912
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
2337 |
(button == 1) ifTrue:[ |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2338 |
"/ doubleClickActionBlock isNil ifTrue:[ |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2339 |
"/ self buttonPress:button x:x y:y |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2340 |
"/ ]. |
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2341 |
enabled ifFalse:[ |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2342 |
^ self |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2343 |
]. |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2344 |
self doubleClicked. |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2345 |
] ifFalse:[ |
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2346 |
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
|
2347 |
] |
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2348 |
|
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2349 |
"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
|
2350 |
! |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2351 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2352 |
buttonPress:button x:x y:y |
997 | 2353 |
|sensor lineNr| |
2354 |
||
3912
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
2355 |
(button == 1) ifFalse:[ |
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
2356 |
(button == 2) ifTrue:[ |
3838 | 2357 |
UserPreferences current selectOnRightClick ifTrue:[ |
3912
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
2358 |
self selectOrToggleAtX:x y:y forRightClickMenu:true. |
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
2359 |
UserPreferences current showRightButtonMenuOnRelease ifFalse:[ |
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
2360 |
self pushEvent:#activateMenu. |
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
2361 |
]. |
3838 | 2362 |
^ self. |
2363 |
]. |
|
2998
6f1925bccf54
selectOnRightClick as in win32 - experimental
Claus Gittinger <cg@exept.de>
parents:
2977
diff
changeset
|
2364 |
]. |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2365 |
^ super buttonPress:button x:x y:y |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2366 |
]. |
2318
d4bea07df2cd
fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents:
2314
diff
changeset
|
2367 |
|
d4bea07df2cd
fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents:
2314
diff
changeset
|
2368 |
selectionAtClickTime := nil. |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2369 |
enabled ifFalse:[ |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2370 |
^ self |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2371 |
]. |
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2372 |
|
3466 | 2373 |
dragIsActive := false. |
2374 |
clickPosition := nil. |
|
2375 |
isButtonPressActive := true. |
|
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2376 |
|
997 | 2377 |
sensor := self sensor. |
2730
61a2f1981ac6
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2702
diff
changeset
|
2378 |
sensor ctrlDown ifTrue:[ |
61a2f1981ac6
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2702
diff
changeset
|
2379 |
^ self buttonControlPress:button x:x y:y |
61a2f1981ac6
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2702
diff
changeset
|
2380 |
]. |
61a2f1981ac6
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2702
diff
changeset
|
2381 |
sensor shiftDown ifTrue:[ |
61a2f1981ac6
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2702
diff
changeset
|
2382 |
^ self expandSelectionToX:x y:y |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2383 |
]. |
1181
ad5004cb2969
allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents:
1163
diff
changeset
|
2384 |
|
1473 | 2385 |
self canDrag ifTrue:[ |
1181
ad5004cb2969
allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents:
1163
diff
changeset
|
2386 |
"/ clicked into the selection ? |
ad5004cb2969
allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents:
1163
diff
changeset
|
2387 |
|
2413 | 2388 |
lineNr := self lineAtY:y. "/ self visibleLineToListLine:(self visibleLineOfY:y). |
997 | 2389 |
|
2390 |
(self isInSelection:lineNr) ifTrue:[ |
|
2391 |
"wait for release button |
|
2392 |
" |
|
2393 |
clickPosition := x@y. |
|
2394 |
clickLine := lineNr. |
|
3124 | 2395 |
^ self |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2396 |
] |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2397 |
]. |
997 | 2398 |
self selectOrToggleAtX:x y:y |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2399 |
|
1513 | 2400 |
"Modified: / 7.5.1998 / 02:02:20 / cg" |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2401 |
! |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2402 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2403 |
buttonRelease:button x:x y:y |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2404 |
"stop any autoscroll" |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2405 |
|
2318
d4bea07df2cd
fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents:
2314
diff
changeset
|
2406 |
selectionAtClickTime := nil. |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2407 |
self stopAutoScroll. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2408 |
|
3912
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
2409 |
button == 2 ifTrue:[ |
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
2410 |
super buttonRelease:button x:x y:y. |
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
2411 |
^ self. |
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
2412 |
]. |
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
2413 |
|
997 | 2414 |
dragIsActive ifTrue:[ |
2415 |
dragIsActive := false |
|
2416 |
] ifFalse:[ |
|
2417 |
clickPosition notNil ifTrue:[ |
|
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2418 |
enabled ifFalse:[ |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2419 |
^ self |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2420 |
]. |
997 | 2421 |
self selectOrToggleAtX:(clickPosition x) y:(clickPosition y). |
2422 |
] |
|
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2423 |
]. |
997 | 2424 |
clickPosition := nil. |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2425 |
|
3466 | 2426 |
isButtonPressActive ifTrue:[ |
2427 |
isButtonPressActive := false. |
|
2428 |
self hasSelection ifTrue:[ |
|
2429 |
self makeSelectionVisible. |
|
2430 |
]. |
|
2431 |
]. |
|
2432 |
||
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2433 |
"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
|
2434 |
! |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2435 |
|
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2436 |
buttonShiftPress:button x:x y:y |
997 | 2437 |
"expand selection |
2438 |
" |
|
2264
f5cd15f186f8
care for nil selectable-index in cursorUp/down
Claus Gittinger <cg@exept.de>
parents:
2256
diff
changeset
|
2439 |
self halt:'obsolete method called'. "/ never called |
997 | 2440 |
|
2441 |
self expandSelectionToX:x y:y |
|
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2442 |
|
1252 | 2443 |
"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
|
2444 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2445 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2446 |
doubleClicked |
1745
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
2447 |
|actionArg| |
1457 | 2448 |
|
2449 |
clickLine := nil. |
|
2318
d4bea07df2cd
fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents:
2314
diff
changeset
|
2450 |
selectionAtClickTime := nil. |
1457 | 2451 |
|
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2452 |
enabled ifFalse:[ |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2453 |
^ self |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2454 |
]. |
554 | 2455 |
selection isNil ifTrue:[ |
2456 |
"/ can only happen if claus modifies the selection within |
|
2457 |
"/ the selectAction .... |
|
2458 |
^ self |
|
2459 |
]. |
|
2460 |
||
1745
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
2461 |
actionArg := self argForChangeMessage. |
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
2462 |
|
1010 | 2463 |
"/ |
2464 |
"/ the ST-80 way of notifying the model |
|
2465 |
"/ |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2466 |
(model notNil and:[doubleClickMsg notNil]) ifTrue:[ |
1745
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
2467 |
self sendChangeMessage:doubleClickMsg with:actionArg. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2468 |
]. |
554 | 2469 |
|
1010 | 2470 |
"/ |
2471 |
"/ ST/X action blocks |
|
2472 |
"/ |
|
1744
f7d712e4b79e
support 0, 1 or 2-arg doubleClickActionBlock.
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
2473 |
doubleClickActionBlock notNil ifTrue:[ |
2503
05307dff92f1
use new #valueWithOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2481
diff
changeset
|
2474 |
doubleClickActionBlock valueWithOptionalArgument:actionArg |
1744
f7d712e4b79e
support 0, 1 or 2-arg doubleClickActionBlock.
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
2475 |
]. |
1010 | 2476 |
|
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2477 |
"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
|
2478 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2479 |
|
2204
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2480 |
key:key select:index x:x y:y shifted:shifted |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2481 |
"select an entry by a keyboard action. |
2115
c994e244b8cf
with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents:
2102
diff
changeset
|
2482 |
This is treated like a doubleClick on that entry, |
c994e244b8cf
with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents:
2102
diff
changeset
|
2483 |
except if shift is down, and multiple selections are |
c994e244b8cf
with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents:
2102
diff
changeset
|
2484 |
allowed, this adds/removes the new item to the selection." |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2485 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2486 |
|oldSelection| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2487 |
|
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2488 |
enabled ifFalse:[ |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2489 |
^ self |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2490 |
]. |
2115
c994e244b8cf
with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents:
2102
diff
changeset
|
2491 |
|
2138
a634610a37de
added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents:
2136
diff
changeset
|
2492 |
keyActionStyle notNil ifTrue:[ |
2141
a9f9956168b8
undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
2493 |
"/ this item selectable ? |
a9f9956168b8
undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
2494 |
(selectConditionBlock notNil |
a9f9956168b8
undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
2495 |
and:[(selectConditionBlock value:index) not]) ifTrue:[^ self]. |
a9f9956168b8
undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
2496 |
|
2138
a634610a37de
added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents:
2136
diff
changeset
|
2497 |
keyActionStyle == #pass ifTrue:[ |
a634610a37de
added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents:
2136
diff
changeset
|
2498 |
^ super keyPress:key x:x y:y |
a634610a37de
added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents:
2136
diff
changeset
|
2499 |
]. |
2156
77515ef62950
selectionChange notification, if expanded via shift-click,
Claus Gittinger <cg@exept.de>
parents:
2148
diff
changeset
|
2500 |
|
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2501 |
(self multipleSelectOk and:[shifted]) ifTrue:[ |
2156
77515ef62950
selectionChange notification, if expanded via shift-click,
Claus Gittinger <cg@exept.de>
parents:
2148
diff
changeset
|
2502 |
oldSelection := selection copy. |
2138
a634610a37de
added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents:
2136
diff
changeset
|
2503 |
(self isInSelection:index) ifTrue:[ |
a634610a37de
added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents:
2136
diff
changeset
|
2504 |
self removeFromSelection:index |
2115
c994e244b8cf
with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents:
2102
diff
changeset
|
2505 |
] ifFalse:[ |
3699
8c15f21207e1
make new line visible after an add-to-selection via shift-cursor-up/down
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
2506 |
self addToSelection:index. |
8c15f21207e1
make new line visible after an add-to-selection via shift-cursor-up/down
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
2507 |
self makeLineVisible:index. |
2156
77515ef62950
selectionChange notification, if expanded via shift-click,
Claus Gittinger <cg@exept.de>
parents:
2148
diff
changeset
|
2508 |
]. |
77515ef62950
selectionChange notification, if expanded via shift-click,
Claus Gittinger <cg@exept.de>
parents:
2148
diff
changeset
|
2509 |
(selection ~= oldSelection) ifTrue:[ |
77515ef62950
selectionChange notification, if expanded via shift-click,
Claus Gittinger <cg@exept.de>
parents:
2148
diff
changeset
|
2510 |
self selectionChangedFrom:oldSelection. |
77515ef62950
selectionChange notification, if expanded via shift-click,
Claus Gittinger <cg@exept.de>
parents:
2148
diff
changeset
|
2511 |
]. |
2138
a634610a37de
added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents:
2136
diff
changeset
|
2512 |
] ifFalse:[ |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2513 |
self multipleSelectOk ifTrue:[ |
2235
b51a9d465386
selection should be a colletion if multiSelect is on (keyPress)
Claus Gittinger <cg@exept.de>
parents:
2234
diff
changeset
|
2514 |
self selection:(OrderedCollection with:index) |
b51a9d465386
selection should be a colletion if multiSelect is on (keyPress)
Claus Gittinger <cg@exept.de>
parents:
2234
diff
changeset
|
2515 |
] ifFalse:[ |
b51a9d465386
selection should be a colletion if multiSelect is on (keyPress)
Claus Gittinger <cg@exept.de>
parents:
2234
diff
changeset
|
2516 |
self selection:index. |
b51a9d465386
selection should be a colletion if multiSelect is on (keyPress)
Claus Gittinger <cg@exept.de>
parents:
2234
diff
changeset
|
2517 |
]. |
2138
a634610a37de
added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents:
2136
diff
changeset
|
2518 |
keyActionStyle == #selectAndDoubleClick ifTrue:[ |
a634610a37de
added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents:
2136
diff
changeset
|
2519 |
self doubleClicked |
885
7a53a92aa4c2
oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
2520 |
] |
7a53a92aa4c2
oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
2521 |
] |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2522 |
]. |
885
7a53a92aa4c2
oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
2523 |
|
2115
c994e244b8cf
with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents:
2102
diff
changeset
|
2524 |
"Modified: / 4.2.2000 / 14:51:25 / cg" |
125 | 2525 |
! |
2526 |
||
2527 |
keyPress:key x:x y:y |
|
2528 |
"handle keyboard input" |
|
2529 |
||
490 | 2530 |
<resource: #keyboard ( #CursorUp #CursorDown #BeginOfText #EndOfText |
1676
a85936a2064c
treat BeginOfLine key like BeginOfText;
Claus Gittinger <cg@exept.de>
parents:
1640
diff
changeset
|
2531 |
#BeginOfLine #EndOfLine |
490 | 2532 |
#Return ) > |
132 | 2533 |
|
210
f7d44c195776
search fixed for lines which start with a separator
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2534 |
|index |
f7d44c195776
search fixed for lines which start with a separator
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2535 |
searchIndex "{Class: SmallInteger}" |
f7d44c195776
search fixed for lines which start with a separator
Claus Gittinger <cg@exept.de>
parents:
191
diff
changeset
|
2536 |
startSearch "{Class: SmallInteger}" |
4601 | 2537 |
backSearch searchPrefix shifted |
2194
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
2538 |
mySize sensor s index0 stillSearching| |
125 | 2539 |
|
1361
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2540 |
enabled ifFalse:[ |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2541 |
^ self |
139f8063319c
added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2542 |
]. |
2204
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2543 |
sensor := self sensor. |
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2544 |
shifted := sensor notNil and:[sensor shiftDown]. |
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2545 |
|
125 | 2546 |
(key == #CursorUp) ifTrue:[ |
2194
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
2547 |
index0 := self firstInSelection. |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
2548 |
index := self previousSelectableBefore:selection. |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
2549 |
stillSearching := true. |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
2550 |
[stillSearching |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
2551 |
and:[selectConditionBlock notNil |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
2552 |
and:[(selectConditionBlock value:index) not]]] whileTrue:[ |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
2553 |
index := self previousSelectableBefore:index. |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
2554 |
stillSearching := index0 notNil and:[index ~= index0] |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
2555 |
]. |
3879 | 2556 |
(index0 notNil and:[index isNil or:[index > index0]]) ifTrue:[ |
2557 |
UserPreferences current beepInEditor ifTrue:[ |
|
2558 |
self beep "/ wrapped |
|
2559 |
]. |
|
2560 |
]. |
|
2204
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2561 |
self key:key select:index x:x y:y shifted:shifted. |
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2562 |
^ self |
125 | 2563 |
]. |
2564 |
(key == #CursorDown) ifTrue:[ |
|
2194
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
2565 |
index0 := self lastInSelection. |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
2566 |
index := self nextSelectableAfter:selection. |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
2567 |
stillSearching := true. |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
2568 |
[stillSearching |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
2569 |
and:[selectConditionBlock notNil |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
2570 |
and:[(selectConditionBlock value:index) not]]] whileTrue:[ |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
2571 |
index := self nextSelectableAfter:index. |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
2572 |
stillSearching := index0 notNil and:[index ~= index0] |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
2573 |
]. |
3879 | 2574 |
(index0 notNil and:[index isNil or:[index < index0]]) ifTrue:[ |
2575 |
UserPreferences current beepInEditor ifTrue:[ |
|
2576 |
self beep "/ wrapped |
|
2577 |
]. |
|
2578 |
]. |
|
2204
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2579 |
self key:key select:index x:x y:y shifted:shifted. |
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2580 |
^ self |
125 | 2581 |
]. |
2582 |
"/ |
|
1249 | 2583 |
"/ stupid: Home and End are caught in ScrollableView |
125 | 2584 |
"/ we normally do not get them ... |
2585 |
"/ (need to call handlesKey: from there ... |
|
2586 |
"/ ... and implement it here) |
|
2587 |
"/ |
|
1676
a85936a2064c
treat BeginOfLine key like BeginOfText;
Claus Gittinger <cg@exept.de>
parents:
1640
diff
changeset
|
2588 |
((key == #BeginOfText) or:[key == #BeginOfLine]) ifTrue:[ |
2204
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2589 |
self key:key select:1 x:x y:y shifted:shifted. |
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2590 |
^ self |
125 | 2591 |
]. |
1676
a85936a2064c
treat BeginOfLine key like BeginOfText;
Claus Gittinger <cg@exept.de>
parents:
1640
diff
changeset
|
2592 |
((key == #EndOfText) or:[key == #EndOfLine]) ifTrue:[ |
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2593 |
index := self size. |
2204
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2594 |
self key:key select:index x:x y:y shifted:shifted. |
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2595 |
^ self |
125 | 2596 |
]. |
2597 |
key == #Return ifTrue:[ |
|
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2598 |
returnKeyActionStyle == #doubleClick ifTrue:[ |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2599 |
selection notNil ifTrue:[ |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2600 |
self doubleClicked |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2601 |
]. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2602 |
^ self |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2603 |
]. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2604 |
returnKeyActionStyle ~~ #pass ifTrue:[ |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2605 |
^ self |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2606 |
]. |
125 | 2607 |
]. |
2142
2015adfc6096
selectAll shortKey (shift-Cmd-A)
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2608 |
(key == #SelectAll) ifTrue:[ |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2609 |
self multipleSelectOk ifTrue:[ |
2142
2015adfc6096
selectAll shortKey (shift-Cmd-A)
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2610 |
self selectAll. |
2015adfc6096
selectAll shortKey (shift-Cmd-A)
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2611 |
]. |
2015adfc6096
selectAll shortKey (shift-Cmd-A)
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2612 |
^ self |
2015adfc6096
selectAll shortKey (shift-Cmd-A)
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2613 |
]. |
125 | 2614 |
|
1323
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2615 |
mySize := self size. |
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2616 |
|
125 | 2617 |
" |
2618 |
alphabetic keys: search for next entry |
|
5416 | 2619 |
starting with key's character. If shift is pressed, search backward |
125 | 2620 |
" |
1323
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2621 |
(mySize > 0 |
125 | 2622 |
and:[key isCharacter |
2623 |
and:[key isLetter]]) ifTrue:[ |
|
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2624 |
keyActionStyle isNil ifTrue:[^ self]. |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2625 |
"/ self multipleSelectOk ifTrue:[^ self]. |
1323
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2626 |
|
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2627 |
keyActionStyle == #pass ifFalse:[ |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2628 |
searchPrefix := key asLowercase asString. |
125 | 2629 |
|
2630 |
"/ ... isISearch... ifFalse:[ |
|
2631 |
"/ iSearchString := '' |
|
2632 |
"/ ] ifTrue:[ |
|
2633 |
"/ iSearchString := iSearchString , searchPrefix. |
|
2634 |
"/ searchPrefix := iSearchString |
|
2635 |
"/ ]. |
|
2636 |
||
2204
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2637 |
backSearch := shifted. |
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2638 |
backSearch ifTrue:[ |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2639 |
selection notNil ifTrue:[ |
2204
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2640 |
startSearch := self firstInSelection - 1. |
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2641 |
"/ selection size > 0 ifTrue:[ |
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2642 |
"/ startSearch := selection first - 1 |
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2643 |
"/ ] ifFalse:[ |
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2644 |
"/ selection isCollection ifTrue:[ |
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2645 |
"/ startSearch := mySize |
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2646 |
"/ ] ifFalse:[ |
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2647 |
"/ startSearch := selection - 1 |
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2648 |
"/ ] |
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2649 |
"/ ] |
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2650 |
] ifFalse:[ |
1323
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2651 |
startSearch := mySize |
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2652 |
]. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2653 |
startSearch < 1 ifTrue:[ |
1323
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2654 |
startSearch := mySize. |
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2655 |
]. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2656 |
] ifFalse:[ |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2657 |
selection notNil ifTrue:[ |
2204
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2658 |
startSearch := self lastInSelection + 1. |
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2659 |
"/ selection size > 0 ifTrue:[ |
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2660 |
"/ startSearch := selection last + 1 |
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2661 |
"/ ] ifFalse:[ |
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2662 |
"/ selection isCollection ifTrue:[ |
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2663 |
"/ startSearch := 1 |
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2664 |
"/ ] ifFalse:[ |
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2665 |
"/ startSearch := selection + 1 |
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2666 |
"/ ] |
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2667 |
"/ ] |
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2668 |
] ifFalse:[ |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2669 |
startSearch := 1 |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2670 |
]. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2671 |
startSearch > self size ifTrue:[ |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2672 |
startSearch := 1. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2673 |
]. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2674 |
]. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2675 |
searchIndex := startSearch. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2676 |
[true] whileTrue:[ |
2187
b5bfc9d40650
allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents:
2169
diff
changeset
|
2677 |
s := self characterSearchItemStringAt:searchIndex. |
b5bfc9d40650
allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents:
2169
diff
changeset
|
2678 |
s notNil ifTrue:[ |
3289 | 2679 |
(s string withoutSeparators asLowercase startsWith:searchPrefix) ifTrue:[ |
1256
13ff2ef827e5
care for nil entries when searching via key-click
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2680 |
searchIndex = selection ifTrue:[^ self]. |
2204
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2681 |
^ self key:key select:searchIndex x:x y:y shifted:false |
1256
13ff2ef827e5
care for nil entries when searching via key-click
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2682 |
]. |
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2683 |
]. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2684 |
backSearch ifTrue:[ |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2685 |
searchIndex := searchIndex - 1. |
1323
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2686 |
searchIndex < 1 ifTrue:[searchIndex := mySize] |
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2687 |
] ifFalse:[ |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2688 |
searchIndex := searchIndex + 1. |
1323
86b03205acc9
care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents:
1310
diff
changeset
|
2689 |
searchIndex > mySize ifTrue:[searchIndex := 1]. |
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2690 |
]. |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2691 |
searchIndex == startSearch ifTrue:[ |
5416 | 2692 |
|prefix| |
2693 |
||
2694 |
"/ none found. |
|
2695 |
searchPrefix size == 1 ifTrue:[ |
|
2696 |
"/ if all start with the same prefix, use the char after the prefix |
|
5429 | 2697 |
prefix := (self list collect:[:l | (l ? '')string]) longestCommonPrefixCaseSensitive:false. |
5416 | 2698 |
prefix isEmptyOrNil ifTrue:[ |
2699 |
^ self |
|
2700 |
]. |
|
2701 |
searchPrefix := prefix , searchPrefix. |
|
2702 |
] ifFalse:[ |
|
2703 |
^ self |
|
2704 |
] |
|
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2705 |
] |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2706 |
] |
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2707 |
]. |
125 | 2708 |
]. |
2709 |
^ 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
|
2710 |
|
1676
a85936a2064c
treat BeginOfLine key like BeginOfText;
Claus Gittinger <cg@exept.de>
parents:
1640
diff
changeset
|
2711 |
"Modified: / 15.9.1998 / 18:22:31 / cg" |
125 | 2712 |
! |
2713 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2714 |
sizeChanged:how |
4758 | 2715 |
"if there is a selection, make certain, it is visible |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2716 |
after the sizechange" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2717 |
|
2204
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2718 |
|first wasAtEnd selectionWasWisible oldFirst| |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2719 |
|
1973 | 2720 |
widthOfWidestLine := nil. |
2204
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2721 |
oldFirst := firstLineShown. |
4758 | 2722 |
wasAtEnd := (nFullLinesShown < list size) and:[ (firstLineShown + nFullLinesShown) >= list size ]. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2723 |
|
1725
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2724 |
selectionWasWisible := false. |
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2725 |
selection notNil ifTrue:[ |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2726 |
self multipleSelectOk ifTrue:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2727 |
first := selection firstIfEmpty:nil |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2728 |
] ifFalse:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2729 |
first := selection |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2730 |
]. |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2731 |
first notNil ifTrue:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2732 |
selectionWasWisible := (first between:firstLineShown and:(firstLineShown + nFullLinesShown)). |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2733 |
] |
1725
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2734 |
]. |
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2735 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2736 |
super sizeChanged:how. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2737 |
|
2204
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2738 |
oldFirst ~~ firstLineShown ifTrue:[ |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2739 |
"/ super did scroll already |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2740 |
^ self |
2204
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2741 |
]. |
53a4c702b4df
multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
2742 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2743 |
shown ifTrue:[ |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2744 |
selection size > 0 ifTrue:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2745 |
selectionWasWisible ifTrue:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2746 |
self multipleSelectOk ifTrue:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2747 |
first := selection firstIfEmpty:nil |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2748 |
] ifFalse:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2749 |
first := selection |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2750 |
]. |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2751 |
first notNil ifTrue:[self makeLineVisible:first] |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2752 |
] |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2753 |
] ifFalse:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2754 |
" |
4758 | 2755 |
if we were at the end before, move to the end again. |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2756 |
Still to be seen, if this is better in real life ... |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2757 |
" |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2758 |
wasAtEnd ifTrue:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2759 |
"at end" |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2760 |
self scrollToBottom |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2761 |
] |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
2762 |
] |
125 | 2763 |
] |
2764 |
||
1725
532f89cec6ae
only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents:
1697
diff
changeset
|
2765 |
"Modified: / 1.12.1998 / 23:27:27 / cg" |
155 | 2766 |
! ! |
2767 |
||
1918
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2768 |
!SelectionInListView methodsFor:'focus handling'! |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2769 |
|
3423 | 2770 |
showFocus:explicit |
2771 |
self invalidateSelection. |
|
2772 |
super showFocus:explicit |
|
2773 |
! |
|
2774 |
||
2775 |
showNoFocus:explicit |
|
2776 |
self invalidateSelection. |
|
2777 |
super showNoFocus:explicit |
|
2778 |
! |
|
2779 |
||
1918
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2780 |
wantsFocusWithPointerEnter |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2781 |
"return true, if I want the focus when |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2782 |
the mouse pointer enters" |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2783 |
|
3306 | 2784 |
(UserPreferences current focusFollowsMouse ~~ false |
1918
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2785 |
and:[(styleSheet at:#'selection.requestFocusOnPointerEnter' default:true) |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2786 |
]) ifTrue:[ |
2481
7b7985560ea7
take focus on pointer enter only if the list is not empty.
Claus Gittinger <cg@exept.de>
parents:
2446
diff
changeset
|
2787 |
list size > 0 ifTrue:[ |
7b7985560ea7
take focus on pointer enter only if the list is not empty.
Claus Gittinger <cg@exept.de>
parents:
2446
diff
changeset
|
2788 |
^ true |
7b7985560ea7
take focus on pointer enter only if the list is not empty.
Claus Gittinger <cg@exept.de>
parents:
2446
diff
changeset
|
2789 |
] |
1918
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2790 |
]. |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2791 |
|
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2792 |
^ false |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2793 |
! ! |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
2794 |
|
5481 | 2795 |
!SelectionInListView methodsFor:'help'! |
2796 |
||
2797 |
flyByHelpTextAt:aPoint |
|
2798 |
|lineNr len| |
|
2799 |
||
2800 |
lineNr := self lineAtY:aPoint y. |
|
5483 | 2801 |
lineNr notNil ifTrue:[ |
2802 |
len := self widthOfLine:lineNr. |
|
2803 |
len > width ifTrue:[ |
|
2804 |
^ (self listAt:lineNr) |
|
2805 |
]. |
|
2806 |
]. |
|
5481 | 2807 |
^ nil |
2808 |
! ! |
|
2809 |
||
105 | 2810 |
!SelectionInListView methodsFor:'initialization'! |
2811 |
||
941 | 2812 |
fetchDeviceResources |
2813 |
"fetch device colors, to avoid reallocation at redraw time" |
|
2814 |
||
4913 | 2815 |
|graphicsDevice| |
2816 |
||
941 | 2817 |
super fetchDeviceResources. |
4913 | 2818 |
graphicsDevice := self graphicsDevice. |
2819 |
||
2820 |
hilightFgColor notNil ifTrue:[hilightFgColor := hilightFgColor onDevice:graphicsDevice]. |
|
2821 |
hilightBgColor notNil ifTrue:[hilightBgColor := hilightBgColor onDevice:graphicsDevice]. |
|
2822 |
||
2823 |
halfIntensityFgColor notNil ifTrue:[halfIntensityFgColor := halfIntensityFgColor onDevice:graphicsDevice]. |
|
2824 |
hilightFrameColor notNil ifTrue:[hilightFrameColor := hilightFrameColor onDevice:graphicsDevice]. |
|
2825 |
||
2826 |
hilightFgColorNoFocus notNil ifTrue:[hilightFgColorNoFocus := hilightFgColorNoFocus onDevice:graphicsDevice]. |
|
2827 |
hilightBgColorNoFocus notNil ifTrue:[hilightBgColorNoFocus := hilightBgColorNoFocus onDevice:graphicsDevice]. |
|
941 | 2828 |
! |
2829 |
||
105 | 2830 |
initCursor |
2831 |
"set the cursor - a hand" |
|
2832 |
||
2833 |
cursor := Cursor hand |
|
2834 |
! |
|
2835 |
||
2836 |
initStyle |
|
968 | 2837 |
"setup viewStyle specifics" |
2838 |
||
105 | 2839 |
super initStyle. |
2840 |
||
2841 |
bgColor := viewBackground. |
|
2842 |
hilightFrameColor := nil. |
|
2843 |
hilightLevel := 0. |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2844 |
hilightStyle := DefaultHilightStyle. |
105 | 2845 |
arrowLevel := 1. |
2846 |
smallArrow := false. |
|
2847 |
||
4913 | 2848 |
self graphicsDevice hasGrayscales ifTrue:[ |
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2849 |
" |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2850 |
must get rid of these hard codings |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2851 |
" |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2852 |
(hilightStyle == #next) ifTrue:[ |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2853 |
hilightFgColor := fgColor. |
4913 | 2854 |
hilightBgColor := self whiteColor. |
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2855 |
hilightFrameColor := fgColor |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2856 |
] ifFalse:[ |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2857 |
(hilightStyle == #motif) ifTrue:[ |
4913 | 2858 |
fgColor := self whiteColor. |
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2859 |
bgColor := Grey. |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2860 |
viewBackground := bgColor. |
4913 | 2861 |
hilightFgColor := bgColor "fgColor" "self whiteColor". |
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2862 |
hilightBgColor := fgColor "bgColor lightened" "darkened". |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2863 |
] ifFalse:[ |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2864 |
(hilightStyle == #openwin) ifTrue:[ |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2865 |
hilightFgColor := fgColor. |
5100 | 2866 |
hilightBgColor := Color gray. |
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2867 |
smallArrow := true. |
1634 | 2868 |
] ifFalse:[ |
2869 |
(hilightStyle == #win95) ifTrue:[ |
|
2870 |
smallArrow := true. |
|
2871 |
] |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2872 |
] |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2873 |
] |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2874 |
] |
105 | 2875 |
]. |
2876 |
||
2877 |
hilightFgColor isNil ifTrue:[ |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2878 |
hilightFgColor := bgColor. |
105 | 2879 |
]. |
2880 |
hilightBgColor isNil ifTrue:[ |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2881 |
hilightBgColor := fgColor. |
105 | 2882 |
]. |
2883 |
DefaultForegroundColor notNil ifTrue:[ |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2884 |
fgColor := DefaultForegroundColor |
105 | 2885 |
]. |
2886 |
DefaultBackgroundColor notNil ifTrue:[ |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2887 |
bgColor := viewBackground := DefaultBackgroundColor |
105 | 2888 |
]. |
2889 |
DefaultHilightForegroundColor notNil ifTrue:[ |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2890 |
hilightFgColor := DefaultHilightForegroundColor |
105 | 2891 |
]. |
2892 |
DefaultHilightBackgroundColor notNil ifTrue:[ |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2893 |
hilightBgColor := DefaultHilightBackgroundColor |
105 | 2894 |
]. |
2895 |
DefaultHilightFrameColor notNil ifTrue:[ |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2896 |
hilightFrameColor := DefaultHilightFrameColor |
105 | 2897 |
]. |
2898 |
DefaultHilightLevel notNil ifTrue:[ |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2899 |
hilightLevel := DefaultHilightLevel |
105 | 2900 |
]. |
2901 |
DefaultRightArrowLevel notNil ifTrue:[ |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2902 |
arrowLevel := DefaultRightArrowLevel |
105 | 2903 |
]. |
2904 |
||
2905 |
DefaultShadowColor notNil ifTrue:[ |
|
941 | 2906 |
shadowColor := DefaultShadowColor |
105 | 2907 |
]. |
2908 |
DefaultLightColor notNil ifTrue:[ |
|
941 | 2909 |
lightColor := DefaultLightColor |
105 | 2910 |
]. |
2911 |
||
2912 |
(hilightLevel abs > 0) ifTrue:[ |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2913 |
lineSpacing := 3 |
105 | 2914 |
] ifFalse:[ |
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2915 |
lineSpacing := 2 |
105 | 2916 |
]. |
4575 | 2917 |
#hack. |
2918 |
"/ q&d temporary hack. |
|
2919 |
"/ X11 fonts are currently so ugly... add more spacing. |
|
4913 | 2920 |
self graphicsDevice platformName = #X11 ifTrue:[ |
4575 | 2921 |
lineSpacing := lineSpacing + 3. |
2922 |
]. |
|
105 | 2923 |
hilightFgColor isNil ifTrue:[ |
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2924 |
hilightFgColor := bgColor. |
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2925 |
hilightBgColor := fgColor |
105 | 2926 |
]. |
2927 |
||
2928 |
DefaultDisabledForegroundColor notNil ifTrue:[ |
|
510
69259a0d7c07
better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2929 |
halfIntensityFgColor := DefaultDisabledForegroundColor |
105 | 2930 |
] ifFalse:[ |
705 | 2931 |
halfIntensityFgColor := Color darkGray. |
105 | 2932 |
]. |
2933 |
||
3423 | 2934 |
hilightFgColorNoFocus isNil ifTrue:[ |
5110 | 2935 |
hilightFgColorNoFocus := DefaultHilightForegroundColorNoFocus. |
2936 |
hilightFgColorNoFocus isNil ifTrue:[ |
|
2937 |
hilightFgColorNoFocus := hilightFgColor slightlyLightened. |
|
2938 |
] |
|
3423 | 2939 |
]. |
2940 |
hilightBgColorNoFocus isNil ifTrue:[ |
|
5100 | 2941 |
hilightBgColorNoFocus := DefaultHilightBackgroundColorNoFocus. |
2942 |
hilightBgColorNoFocus isNil ifTrue:[ |
|
5110 | 2943 |
hilightBgColorNoFocus := hilightBgColor slightlyLightened. |
5100 | 2944 |
] |
3423 | 2945 |
]. |
2946 |
||
4324 | 2947 |
"Modified: / 05-08-1998 / 00:00:00 / cg" |
2948 |
"Modified (comment): / 05-10-2011 / 15:50:50 / az" |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2949 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2950 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2951 |
initialize |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2952 |
super initialize. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2953 |
|
3466 | 2954 |
isButtonPressActive := false. |
4578 | 2955 |
"/ fontHeight := font height + lineSpacing. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2956 |
enabled := true. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2957 |
ignoreReselect := true. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2958 |
multipleSelectOk := toggleSelect := strikeOut := printItems := false. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2959 |
useIndex := true. |
997 | 2960 |
dragIsActive := allowDrag := false. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2961 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2962 |
keyActionStyle := #select. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2963 |
returnKeyActionStyle := #doubleClick. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2964 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2965 |
listMsg := self class defaultListMessage. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2966 |
initialSelectionMsg := self class defaultSelectionMessage. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2967 |
|
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
2968 |
"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
|
2969 |
! |
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 |
realize |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2972 |
super realize. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2973 |
|
1068 | 2974 |
model notNil ifTrue:[ |
2975 |
self getSelectionFromModel. |
|
2976 |
]. |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2977 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2978 |
selection notNil ifTrue:[ |
1068 | 2979 |
selection isCollection ifTrue:[ |
2980 |
selection notEmpty ifTrue:[ |
|
2981 |
self makeLineVisible:selection first |
|
2982 |
] |
|
2983 |
] ifFalse:[ |
|
2984 |
self makeLineVisible:selection |
|
2985 |
] |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
2986 |
]. |
1068 | 2987 |
|
2988 |
"Modified: 27.2.1997 / 14:23:40 / cg" |
|
0 | 2989 |
! ! |
2990 |
||
5121 | 2991 |
!SelectionInListView methodsFor:'native widget support'! |
2992 |
||
2993 |
nativeWindowType |
|
2994 |
"return a symbol describing my native window type |
|
2995 |
(may be used internally by the device as a native window creation hint)" |
|
2996 |
||
2997 |
^ #SelectionInListView |
|
2998 |
! ! |
|
2999 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3000 |
!SelectionInListView methodsFor:'private'! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3001 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3002 |
argForChangeMessage |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3003 |
"return the argument for a selectionChange; |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3004 |
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
|
3005 |
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
|
3006 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3007 |
useIndex ~~ false ifTrue:[ "/ i.e. everything except false |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3008 |
self multipleSelectOk ifTrue:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3009 |
selection isNil ifTrue:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3010 |
^ #() |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3011 |
]. |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3012 |
]. |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3013 |
^ selection |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3014 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3015 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3016 |
printItems ifFalse:[ |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3017 |
^ self selectionValue |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3018 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3019 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3020 |
items notNil ifTrue:[ |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3021 |
self multipleSelectOk ifTrue:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3022 |
^ selection collect:[:nr | items at:nr] |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3023 |
]. |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3024 |
^ items at:selection |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3025 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3026 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3027 |
^ nil "/ cannot happen |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3028 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3029 |
"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
|
3030 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3031 |
|
2187
b5bfc9d40650
allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents:
2169
diff
changeset
|
3032 |
characterSearchItemStringAt:lineNr |
b5bfc9d40650
allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents:
2169
diff
changeset
|
3033 |
"for first-character search: |
b5bfc9d40650
allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents:
2169
diff
changeset
|
3034 |
return a lines item-string. |
b5bfc9d40650
allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents:
2169
diff
changeset
|
3035 |
For multi-col items, this may be different from the actual string" |
b5bfc9d40650
allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents:
2169
diff
changeset
|
3036 |
|
b5bfc9d40650
allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents:
2169
diff
changeset
|
3037 |
|item s| |
b5bfc9d40650
allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents:
2169
diff
changeset
|
3038 |
|
b5bfc9d40650
allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents:
2169
diff
changeset
|
3039 |
item := self at:lineNr. |
b5bfc9d40650
allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents:
2169
diff
changeset
|
3040 |
item isNil ifTrue:[^ nil]. |
2702
1c385145ab46
Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents:
2684
diff
changeset
|
3041 |
(Error catch:[ |
2187
b5bfc9d40650
allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents:
2169
diff
changeset
|
3042 |
s := item asString |
b5bfc9d40650
allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents:
2169
diff
changeset
|
3043 |
]) ifTrue:[ |
b5bfc9d40650
allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents:
2169
diff
changeset
|
3044 |
s := item displayString |
b5bfc9d40650
allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents:
2169
diff
changeset
|
3045 |
]. |
b5bfc9d40650
allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents:
2169
diff
changeset
|
3046 |
^ s |
b5bfc9d40650
allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents:
2169
diff
changeset
|
3047 |
! |
b5bfc9d40650
allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents:
2169
diff
changeset
|
3048 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3049 |
checkRemovingSelection:lineNr |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3050 |
"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
|
3051 |
|
4478 | 3052 |
self checkRemovingSelectionFrom:lineNr to:lineNr |
3053 |
! |
|
3054 |
||
3055 |
checkRemovingSelectionFrom:startNr to:endNr |
|
3056 |
"when a range of lines is removed, we have to adjust the selection" |
|
3057 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3058 |
|newSelection| |
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 |
selection notNil ifTrue:[ |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3061 |
self multipleSelectOk ifTrue:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3062 |
newSelection := OrderedCollection new. |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3063 |
selection do:[:sel | |
4478 | 3064 |
sel < startNr ifTrue:[ |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3065 |
newSelection add:sel |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3066 |
] ifFalse:[ |
4478 | 3067 |
sel > endNr ifTrue:[ |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3068 |
newSelection add:(sel - 1) |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3069 |
] |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3070 |
"otherwise remove it from the selection" |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3071 |
] |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3072 |
]. |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3073 |
newSelection size == 0 ifTrue:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3074 |
selection := nil |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3075 |
] ifFalse:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3076 |
selection := newSelection |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3077 |
] |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3078 |
] ifFalse:[ |
4478 | 3079 |
(selection between:startNr and:endNr) ifTrue:[ |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3080 |
selection := nil |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3081 |
] ifFalse:[ |
4478 | 3082 |
selection > endNr ifTrue:[ |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3083 |
selection := selection - 1 |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3084 |
] |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3085 |
] |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3086 |
] |
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 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3089 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3090 |
getListFromModel |
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3091 |
"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
|
3092 |
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
|
3093 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3094 |
|text msg| |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3095 |
|
1310 | 3096 |
listChannel notNil ifTrue:[ |
1345 | 3097 |
items := listChannel value copy |
1310 | 3098 |
] ifFalse:[ |
3099 |
(model isNil or:[(msg := listMsg) isNil and:[(msg := aspectMsg) isNil]]) ifTrue:[ |
|
3100 |
^ self |
|
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3101 |
]. |
1310 | 3102 |
items := model perform:msg. |
3103 |
]. |
|
3104 |
items notNil ifTrue:[ |
|
3105 |
printItems ifTrue:[ |
|
3106 |
text := items collect:[:element | element printString] |
|
3107 |
] ifFalse:[ |
|
4153 | 3108 |
text := items. |
3109 |
items := nil. |
|
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3110 |
]. |
1310 | 3111 |
text notNil ifTrue:[ |
3112 |
text isSequenceable ifFalse:[ |
|
3113 |
text := text asOrderedCollection |
|
3114 |
] |
|
3115 |
] |
|
105 | 3116 |
]. |
1310 | 3117 |
self list:text keepSelection:true. "/ expandTabs:false |
4153 | 3118 |
|
3119 |
"Modified: / 29-06-2010 / 16:14:14 / sr" |
|
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 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3122 |
getSelectionFromModel |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3123 |
"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
|
3124 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3125 |
|sel| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3126 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3127 |
model notNil ifTrue:[ |
1310 | 3128 |
listChannel notNil ifTrue:[ |
3129 |
sel := model value. |
|
1813
7f51dc0341a6
oops - did not unselect if model was changed to nil.
Claus Gittinger <cg@exept.de>
parents:
1796
diff
changeset
|
3130 |
sel isNil ifTrue:[ |
7f51dc0341a6
oops - did not unselect if model was changed to nil.
Claus Gittinger <cg@exept.de>
parents:
1796
diff
changeset
|
3131 |
self deselect. |
7f51dc0341a6
oops - did not unselect if model was changed to nil.
Claus Gittinger <cg@exept.de>
parents:
1796
diff
changeset
|
3132 |
^ self |
7f51dc0341a6
oops - did not unselect if model was changed to nil.
Claus Gittinger <cg@exept.de>
parents:
1796
diff
changeset
|
3133 |
] |
1310 | 3134 |
] ifFalse:[ |
3135 |
initialSelectionMsg isNil ifTrue:[^ self]. |
|
686
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
3136 |
sel := model perform:initialSelectionMsg. |
1310 | 3137 |
]. |
3138 |
(useIndex or:[sel isNumber]) ifTrue:[ |
|
3139 |
self setSelection:sel |
|
3140 |
] ifFalse:[ |
|
3141 |
self setSelectElement:sel. |
|
686
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
3142 |
] |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3143 |
]. |
686
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
3144 |
|
3424
85f9ca6a0dce
oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
3145 |
"Modified: / 08-11-2006 / 19:46:33 / cg" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3146 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3147 |
|
5373 | 3148 |
highlightLineSpacing |
3149 |
"true if the spacing between lines is to be drawn with selected color, |
|
3150 |
false if it remains white. |
|
3151 |
false for selection in list views; true for edit/text views" |
|
3152 |
||
3153 |
^ false |
|
3154 |
! |
|
3155 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3156 |
isValidSelection:aNumberOrCollection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3157 |
"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
|
3158 |
|
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3159 |
|sz| |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3160 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3161 |
aNumberOrCollection isNil ifTrue:[^ false]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3162 |
|
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3163 |
sz := self size. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3164 |
(aNumberOrCollection isCollection) ifTrue:[ |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3165 |
self multipleSelectOk ifFalse:[^ false]. |
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3166 |
aNumberOrCollection do:[:index | |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3167 |
(index between:1 and:sz) ifFalse:[^ false]. |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3168 |
(self lineIsEnabled:index) ifFalse:[^ false]. |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3169 |
]. |
125 | 3170 |
] ifFalse:[ |
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3171 |
(aNumberOrCollection between:1 and:sz) ifFalse:[^ false]. |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3172 |
(self lineIsEnabled:aNumberOrCollection) ifFalse:[^ false]. |
63 | 3173 |
]. |
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3174 |
^ true. |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3175 |
|
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3176 |
"Modified: / 8.8.1998 / 03:34:27 / cg" |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3177 |
! |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3178 |
|
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3179 |
lineIsEnabled:lineNr |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3180 |
^ (self line:lineNr hasAttribute:#disabled) not |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3181 |
|
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3182 |
"Modified: / 8.8.1998 / 03:22:50 / cg" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3183 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3184 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3185 |
positionToSelectionX:x y:y |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3186 |
"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
|
3187 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3188 |
(x between:0 and:width) ifTrue:[ |
2413 | 3189 |
(y between:0 and:height) ifTrue:[ |
3190 |
^ self lineAtY:y |
|
4601 | 3191 |
"/ ^ self visibleLineToListLine:(self visibleLineOfY:y) |
2413 | 3192 |
] |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3193 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3194 |
^ nil |
125 | 3195 |
! |
3196 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3197 |
scrollSelectDown |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3198 |
"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
|
3199 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3200 |
self scrollDown. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3201 |
Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT. |
2115
c994e244b8cf
with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents:
2102
diff
changeset
|
3202 |
|
c994e244b8cf
with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents:
2102
diff
changeset
|
3203 |
"Modified: / 3.2.2000 / 22:41:59 / cg" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3204 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3205 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3206 |
scrollSelectUp |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3207 |
"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
|
3208 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3209 |
self scrollUp. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3210 |
Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT. |
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 |
|
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3213 |
selectOrToggleAtX:x y:y |
3912
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3214 |
self selectOrToggleAtX:x y:y forRightClickMenu:false |
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3215 |
! |
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3216 |
|
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3217 |
selectOrToggleAtX:x y:y forRightClickMenu:forRightClickMenu |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3218 |
|oldSelection listLineNr| |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3219 |
|
2318
d4bea07df2cd
fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents:
2314
diff
changeset
|
3220 |
selectMode := nil. |
2413 | 3221 |
listLineNr := self lineAtY:y. "/ self visibleLineToListLine:(self visibleLineOfY:y). |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3222 |
listLineNr notNil ifTrue:[ |
2141
a9f9956168b8
undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3223 |
"/ this item selectable ? |
a9f9956168b8
undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3224 |
(selectConditionBlock notNil |
3912
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3225 |
and:[(selectConditionBlock value:listLineNr) not]) ifTrue:[^ false]. |
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3226 |
|
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3227 |
oldSelection := selection copy. |
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3228 |
|
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3229 |
forRightClickMenu ifTrue:[ |
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3230 |
(self isInSelection:listLineNr) ifFalse:[ |
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3231 |
self selectWithoutScroll:listLineNr. |
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3232 |
selectMode := false. |
3917
4267c0a42fa9
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3912
diff
changeset
|
3233 |
(selection ~= oldSelection) ifTrue:[ |
4267c0a42fa9
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3912
diff
changeset
|
3234 |
self selectionChangedFrom:oldSelection. |
4267c0a42fa9
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3912
diff
changeset
|
3235 |
]. |
3912
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3236 |
]. |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3237 |
] ifFalse:[ |
3912
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3238 |
(toggleSelect and:[self isInSelection:listLineNr]) ifTrue:[ |
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3239 |
self removeFromSelection:listLineNr. |
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3240 |
selectMode := false. |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3241 |
] ifFalse:[ |
3912
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3242 |
(self lineIsEnabled:listLineNr) ifFalse:[^ true]. |
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3243 |
|
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3244 |
(toggleSelect and:[self multipleSelectOk]) ifTrue:[ |
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3245 |
self addToSelection:listLineNr |
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3246 |
] ifFalse:[ |
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3247 |
self selectWithoutScroll:listLineNr. |
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3248 |
]. |
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3249 |
selectMode := true. |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3250 |
]. |
3917
4267c0a42fa9
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3912
diff
changeset
|
3251 |
((ignoreReselect not and:[selection notNil]) |
4267c0a42fa9
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3912
diff
changeset
|
3252 |
or:[selection ~= oldSelection]) ifTrue:[ |
4267c0a42fa9
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3912
diff
changeset
|
3253 |
self selectionChangedFrom:oldSelection. |
4267c0a42fa9
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3912
diff
changeset
|
3254 |
]. |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3255 |
]. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3256 |
clickLine := listLineNr |
3912
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3257 |
]. |
303733585541
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3879
diff
changeset
|
3258 |
^ true |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3259 |
|
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3260 |
"Created: / 14.11.1996 / 16:27:17 / cg" |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3261 |
"Modified: / 8.8.1998 / 03:22:26 / cg" |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3262 |
! |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3263 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3264 |
visibleLineNeedsSpecialCare:visLineNr |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3265 |
|listLine| |
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 |
listLine := self visibleLineToListLine:visLineNr. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3268 |
listLine isNil ifTrue:[^ false]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3269 |
(self isInSelection:listLine) ifTrue:[^ true]. |
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3270 |
visualBlock notNil ifTrue:[^true]. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3271 |
listAttributes notNil ifTrue:[ |
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3272 |
(listLine <= listAttributes size) ifTrue:[ |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3273 |
^ (listAttributes at:listLine) notNil |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3274 |
] |
0 | 3275 |
]. |
125 | 3276 |
^ false |
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3277 |
|
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3278 |
"Modified: / 21.6.1998 / 02:43:02 / cg" |
125 | 3279 |
! |
3280 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3281 |
widthForScrollBetween:start and:end |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3282 |
"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
|
3283 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3284 |
| anySelectionInRange | |
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 |
selection notNil ifTrue:[ |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3287 |
self multipleSelectOk ifTrue:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3288 |
anySelectionInRange := false. |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3289 |
selection do:[:s | |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3290 |
(s between:start and:end) ifTrue:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3291 |
anySelectionInRange := true |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3292 |
] |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3293 |
] |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3294 |
] ifFalse:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3295 |
anySelectionInRange := selection between:start and:end |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3296 |
] |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3297 |
] ifFalse:[ |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3298 |
anySelectionInRange := false |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3299 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3300 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3301 |
anySelectionInRange ifTrue:[ |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3302 |
^ width |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3303 |
" |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3304 |
self is3D ifFalse:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3305 |
^ width |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3306 |
]. |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3307 |
( #(next openwin) includes:styleSheet name) ifTrue:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3308 |
^ width |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3309 |
]. |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3310 |
viewBackground = background ifFalse:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3311 |
^ width |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3312 |
] |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3313 |
" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3314 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3315 |
^ super widthForScrollBetween:start and:end |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3316 |
! ! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3317 |
|
2741 | 3318 |
!SelectionInListView methodsFor:'private-drag and drop'! |
2563
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
3319 |
|
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
3320 |
collectionOfDragObjects |
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
3321 |
"returns collection of dragable objects assigned to selection |
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
3322 |
Here, by default, a collection of text-dragObjects is generated; |
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
3323 |
however, if a dragObjectConverter is defined, that one gets a chance |
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
3324 |
to convert as appropriate." |
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
3325 |
|
5248 | 3326 |
|collection indices converted| |
2563
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
3327 |
|
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
3328 |
collection := OrderedCollection new. |
5248 | 3329 |
indices := OrderedCollection new. |
3330 |
||
3331 |
self selectionDo:[:aNumber| |
|
3332 |
|text| |
|
3333 |
||
2563
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
3334 |
text := self at:aNumber. |
5248 | 3335 |
collection add:(DropObject newText:text). |
3336 |
indices add:aNumber. |
|
2563
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
3337 |
]. |
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
3338 |
dragObjectConverter notNil ifTrue:[ |
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
3339 |
converted := OrderedCollection new. |
5248 | 3340 |
collection with:indices do:[:o :idx | |
3341 |
|convertedObject| |
|
3342 |
||
3343 |
convertedObject := dragObjectConverter value:o optionalArgument:idx. |
|
3344 |
convertedObject notNil ifTrue:[ |
|
3345 |
converted add:convertedObject |
|
3346 |
] |
|
3347 |
]. |
|
2563
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
3348 |
collection := converted |
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
3349 |
]. |
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
3350 |
^ collection. |
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
3351 |
|
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
3352 |
"Modified: 6.4.1997 / 14:14:30 / cg" |
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
3353 |
! ! |
ffb88664908a
Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents:
2537
diff
changeset
|
3354 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3355 |
!SelectionInListView methodsFor:'queries'! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3356 |
|
2597
feebf7ba0771
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
3357 |
isCursorKeyConsumer |
feebf7ba0771
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
3358 |
"return true, if the receiver can be controlled by cursor keys; |
feebf7ba0771
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
3359 |
i.e. it can handle some keyboard input, |
feebf7ba0771
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
3360 |
isCursorKeyConsumer are potential candidates for getting the keyboard |
feebf7ba0771
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
3361 |
focus initially within dialogBoxes, or when the focus-follows-pointer |
5237 | 3362 |
mode is off." |
2597
feebf7ba0771
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
3363 |
|
feebf7ba0771
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
3364 |
^ true |
feebf7ba0771
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
3365 |
! |
feebf7ba0771
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
3366 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3367 |
specClass |
1379 | 3368 |
"redefined, since the name of my specClass is nonStandard (i.e. not SelectionInListSpec)" |
3369 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3370 |
self class == SelectionInListView ifTrue:[^ SequenceViewSpec]. |
1045 | 3371 |
^ super specClass |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3372 |
|
1379 | 3373 |
"Modified: / 5.9.1995 / 23:05:53 / claus" |
3374 |
"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
|
3375 |
! ! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3376 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3377 |
!SelectionInListView methodsFor:'redrawing'! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3378 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3379 |
redrawElement:aNumber |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3380 |
"redraw an individual element" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3381 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3382 |
^ self redrawLine:aNumber |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3383 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3384 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3385 |
redrawFromVisibleLine:startVisLineNr to:endVisLineNr |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3386 |
"redraw a range of lines. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3387 |
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
|
3388 |
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
|
3389 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3390 |
|special sel |
393 | 3391 |
l1 "{ Class: SmallInteger }" |
3392 |
l2 "{ Class: SmallInteger }" |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3393 |
selNo "{ Class: SmallInteger }" | |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3394 |
|
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3395 |
((selection isCollection) |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3396 |
or:[listAttributes notNil |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3397 |
or:[visualBlock notNil |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3398 |
or:[selectedVisualBlock notNil]]]) ifTrue:[ |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3399 |
"/ cannot do bulk-redraw ... |
393 | 3400 |
l1 := startVisLineNr. |
3401 |
l2 := endVisLineNr. |
|
3402 |
l1 to:l2 do:[:visLine | |
|
3403 |
self redrawVisibleLine:visLine |
|
3404 |
]. |
|
3405 |
^ self |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3406 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3407 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3408 |
"XXX only if -1/+1" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3409 |
"/ hilightLevel ~~ 0 ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3410 |
"/ self paint:bgColor. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3411 |
"/ 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
|
3412 |
"/ ]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3413 |
special := true. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3414 |
selection isNil ifTrue:[ |
393 | 3415 |
special := false |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3416 |
] ifFalse:[ |
393 | 3417 |
sel := self listLineToVisibleLine:selection. |
3418 |
sel isNil ifTrue:[ |
|
3419 |
special := false |
|
3420 |
] ifFalse:[ |
|
3421 |
special := (sel between:startVisLineNr and:endVisLineNr) |
|
3422 |
] |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3423 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3424 |
special ifFalse:[ |
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3425 |
^ super redrawFromVisibleLine:startVisLineNr to:endVisLineNr |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3426 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3427 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3428 |
selNo := sel. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3429 |
selNo > startVisLineNr ifTrue:[ |
393 | 3430 |
super redrawFromVisibleLine:startVisLineNr to:(selNo - 1) |
320
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 |
self redrawVisibleLine:selNo. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3433 |
selNo < endVisLineNr ifTrue:[ |
393 | 3434 |
super redrawFromVisibleLine:(selNo + 1) to:endVisLineNr |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3435 |
] |
393 | 3436 |
|
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3437 |
"Modified: / 21.6.1998 / 02:42:17 / cg" |
125 | 3438 |
! |
3439 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3440 |
redrawVisibleLine:visLineNr |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3441 |
"redraw a single line. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3442 |
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
|
3443 |
Otherwise draw using supers method." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3444 |
|
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3445 |
|listLine fg bg newFont oldFont id dObj y| |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3446 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3447 |
fg := fgColor. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3448 |
bg := bgColor. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3449 |
listLine := self visibleLineToListLine:visLineNr. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3450 |
listLine notNil ifTrue:[ |
384
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3451 |
(self isInSelection:listLine) ifTrue:[ |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3452 |
^ self drawVisibleLineSelected:visLineNr |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3453 |
]. |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3454 |
|
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3455 |
visualBlock notNil ifTrue:[ |
2290
1c602645fc3a
visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents:
2264
diff
changeset
|
3456 |
y := self yOfVisibleLine:visLineNr. |
1c602645fc3a
visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents:
2264
diff
changeset
|
3457 |
|
1c602645fc3a
visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents:
2264
diff
changeset
|
3458 |
backgroundAlreadyClearedColor == bg ifFalse:[ |
1c602645fc3a
visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents:
2264
diff
changeset
|
3459 |
self paint:bg. |
1c602645fc3a
visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents:
2264
diff
changeset
|
3460 |
self fillRectangleX:margin y:y - (lineSpacing//2) |
1c602645fc3a
visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents:
2264
diff
changeset
|
3461 |
width:(width - (2 * margin)) |
1c602645fc3a
visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents:
2264
diff
changeset
|
3462 |
height:fontHeight. |
1c602645fc3a
visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents:
2264
diff
changeset
|
3463 |
]. |
1c602645fc3a
visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents:
2264
diff
changeset
|
3464 |
|
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3465 |
dObj := visualBlock value:self value:listLine. |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3466 |
self paint:fg on:bg. |
4913 | 3467 |
dObj displayOn:self x:(textStartLeft - viewOrigin) x y:y + gc font ascent opaque:true. |
1600
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3468 |
^ self |
bc8ba748da8a
handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
3469 |
]. |
2290
1c602645fc3a
visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents:
2264
diff
changeset
|
3470 |
|
384
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3471 |
listAttributes notNil ifTrue:[ |
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3472 |
((self line:listLine hasAttribute:#halfIntensity) |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3473 |
or:[ (self lineIsEnabled:listLine) not ]) ifTrue:[ |
384
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3474 |
fg := halfIntensityFgColor |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3475 |
]. |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3476 |
(self line:listLine hasAttribute:#bold) ifTrue:[ |
4913 | 3477 |
newFont := gc font asBold. |
3478 |
(gc font bold |
|
3479 |
or:[id := (newFont onDevice:gc device) fontId. |
|
384
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3480 |
id isNil]) |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3481 |
ifTrue:[ |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3482 |
" |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3483 |
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
|
3484 |
or no such font is available |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3485 |
" |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3486 |
fgColor brightness > 0.5 ifTrue:[ |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3487 |
fg := fgColor darkened "darkened". |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3488 |
] ifFalse:[ |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3489 |
fg := fgColor lightened "lightened" |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3490 |
]. |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3491 |
(fg brightness - bg brightness) abs < 0.25 ifTrue:[ |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3492 |
bgColor brightness > 0.5 ifTrue:[ |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3493 |
fg := fg darkened. |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3494 |
] ifFalse:[ |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3495 |
fg := fg lightened |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3496 |
]. |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3497 |
] |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3498 |
]. |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3499 |
id notNil ifTrue:[ |
4913 | 3500 |
oldFont := gc font. |
384
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3501 |
self basicFont:newFont. |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3502 |
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
|
3503 |
self basicFont:oldFont. |
384
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3504 |
] ifFalse:[ |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3505 |
self drawVisibleLine:visLineNr with:fg and:bg. |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3506 |
]. |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3507 |
^ self |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3508 |
] |
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3509 |
] |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3510 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3511 |
^ self drawVisibleLine:visLineNr with:fg and:bg |
384
0f2676690760
fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents:
364
diff
changeset
|
3512 |
|
4153 | 3513 |
"Modified: / 08-08-1998 / 03:42:13 / cg" |
3514 |
"Modified: / 29-06-2010 / 16:16:03 / sr" |
|
125 | 3515 |
! |
3516 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3517 |
redrawVisibleLine:visLineNr col:colNr |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3518 |
"redraw a single character. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3519 |
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
|
3520 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3521 |
(self visibleLineNeedsSpecialCare:visLineNr) ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3522 |
^ self redrawVisibleLine:visLineNr |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3523 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3524 |
super redrawVisibleLine:visLineNr col:colNr |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3525 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3526 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3527 |
redrawVisibleLine:visLineNr from:startCol |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3528 |
"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
|
3529 |
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
|
3530 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3531 |
(self visibleLineNeedsSpecialCare:visLineNr) ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3532 |
^ self redrawVisibleLine:visLineNr |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3533 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3534 |
super redrawVisibleLine:visLineNr from:startCol |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3535 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3536 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3537 |
redrawVisibleLine:visLineNr from:startCol to:endCol |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3538 |
"redraw from a startCol to endCol. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3539 |
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
|
3540 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3541 |
(self visibleLineNeedsSpecialCare:visLineNr) ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3542 |
^ self redrawVisibleLine:visLineNr |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3543 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3544 |
super redrawVisibleLine:visLineNr from:startCol to:endCol |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3545 |
! ! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3546 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3547 |
!SelectionInListView methodsFor:'selections'! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3548 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3549 |
deselect |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3550 |
"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
|
3551 |
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
|
3552 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3553 |
self selection:nil |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3554 |
|
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3555 |
"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
|
3556 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3557 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3558 |
deselectWithoutRedraw |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3559 |
"deselect without redraw or notifications. |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3560 |
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
|
3561 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3562 |
selection := nil |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3563 |
|
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3564 |
"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
|
3565 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3566 |
|
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3567 |
expandSelectionToX:x y:y |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3568 |
"used with button-motion and shift-press; |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3569 |
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
|
3570 |
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
|
3571 |
|
2738 | 3572 |
|movedLine delta newSelection| |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3573 |
|
4758 | 3574 |
self multipleSelectOk ifFalse:[^ self]. |
5317 | 3575 |
"D120784 - WB when invoked without any selection" |
3576 |
selection size == 0 ifTrue:[^ self]. |
|
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3577 |
|
997 | 3578 |
movedLine := self visibleLineToAbsoluteLine:(self visibleLineOfY:y). |
2764
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3579 |
|
4758 | 3580 |
clickLine isNil ifTrue:[ |
3581 |
selection size == 1 ifTrue:[ |
|
3582 |
clickLine := selection first. |
|
3583 |
] ifFalse:[ |
|
3584 |
movedLine > selection max ifTrue:[ |
|
3585 |
clickLine := selection max |
|
3586 |
] ifFalse:[ |
|
3587 |
movedLine < selection min ifTrue:[ |
|
3588 |
clickLine := selection min |
|
3589 |
]. |
|
3590 |
] |
|
3591 |
]. |
|
3592 |
clickLine isNil ifTrue:[ |
|
3593 |
^ self |
|
3594 |
]. |
|
3595 |
]. |
|
3596 |
||
2764
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3597 |
selectionAtClickTime isNil ifTrue:[ |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3598 |
selectionAtClickTime := selection copy. |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3599 |
]. |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3600 |
|
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3601 |
newSelection := selectionAtClickTime copy. |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3602 |
newSelection isNil ifTrue:[newSelection := OrderedCollection new]. |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3603 |
|
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3604 |
"/ compute new selection |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3605 |
delta := (clickLine < movedLine) ifTrue:[1] ifFalse:[-1]. |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3606 |
clickLine to:movedLine by:delta do:[:ln | |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3607 |
|isSelected doSelect doUnselect| |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3608 |
|
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3609 |
doSelect := doUnselect := false. |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3610 |
|
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3611 |
isSelected := self is:ln inSelection:selectionAtClickTime. |
4758 | 3612 |
(selectMode ? true) == true ifTrue:[ |
2764
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3613 |
doSelect := isSelected not |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3614 |
] ifFalse:[ |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3615 |
selectMode == false ifTrue:[ |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3616 |
doUnselect := isSelected |
2738 | 3617 |
] ifFalse:[ |
2764
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3618 |
selectMode == #toggle ifTrue:[ |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3619 |
doUnselect := isSelected. |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3620 |
doSelect := doUnselect not. |
2334
94cdb9b2d1f9
avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
3621 |
] |
2738 | 3622 |
] |
3623 |
]. |
|
3624 |
||
2764
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3625 |
doSelect ifTrue:[ |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3626 |
newSelection add:ln. |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3627 |
] ifFalse:[ |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3628 |
doUnselect ifTrue:[ |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3629 |
newSelection remove:ln. |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3630 |
] |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3631 |
] |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3632 |
]. |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3633 |
|
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3634 |
newSelection ~= selection ifTrue:[ |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3635 |
self selection:newSelection. |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3636 |
]. |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3637 |
|
2115
c994e244b8cf
with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents:
2102
diff
changeset
|
3638 |
"Created: / 14.11.1996 / 15:48:10 / cg" |
c994e244b8cf
with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents:
2102
diff
changeset
|
3639 |
"Modified: / 3.2.2000 / 22:13:50 / cg" |
882
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3640 |
! |
38df470ab769
shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
3641 |
|
2194
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3642 |
firstInSelection |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3643 |
"return the index of the first selected line - nil if there is no selection" |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3644 |
|
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3645 |
selection isNil ifTrue:[^ nil]. |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3646 |
selection isCollection ifTrue:[ |
5208 | 3647 |
selection isEmpty ifTrue:[ |
2194
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3648 |
^ nil |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3649 |
]. |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3650 |
^ selection min |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3651 |
]. |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3652 |
^ selection |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3653 |
! |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3654 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3655 |
hasSelection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3656 |
"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
|
3657 |
|
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3658 |
self multipleSelectOk ifTrue:[ |
2407
bbf31d2267ea
fixed #hasSelection with multipleSelectOk
Claus Gittinger <cg@exept.de>
parents:
2401
diff
changeset
|
3659 |
^ selection size > 0 |
bbf31d2267ea
fixed #hasSelection with multipleSelectOk
Claus Gittinger <cg@exept.de>
parents:
2401
diff
changeset
|
3660 |
]. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3661 |
^ selection notNil |
125 | 3662 |
! |
3663 |
||
2318
d4bea07df2cd
fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents:
2314
diff
changeset
|
3664 |
is:aNumber inSelection:aSelection |
d4bea07df2cd
fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents:
2314
diff
changeset
|
3665 |
"return true, if line, aNumber is in the selection" |
d4bea07df2cd
fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents:
2314
diff
changeset
|
3666 |
|
d4bea07df2cd
fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents:
2314
diff
changeset
|
3667 |
aSelection isNil ifTrue:[^ false]. |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3668 |
self multipleSelectOk ifTrue:[ |
2318
d4bea07df2cd
fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents:
2314
diff
changeset
|
3669 |
^ (aSelection includes:aNumber) |
d4bea07df2cd
fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents:
2314
diff
changeset
|
3670 |
]. |
d4bea07df2cd
fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents:
2314
diff
changeset
|
3671 |
^ (aNumber == aSelection) |
d4bea07df2cd
fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents:
2314
diff
changeset
|
3672 |
! |
d4bea07df2cd
fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents:
2314
diff
changeset
|
3673 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3674 |
isInSelection:aNumber |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3675 |
"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
|
3676 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3677 |
selection isNil ifTrue:[^ false]. |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3678 |
self multipleSelectOk ifTrue:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3679 |
^ (selection includes:aNumber) |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3680 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3681 |
^ (aNumber == selection) |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3682 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3683 |
|
2194
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3684 |
lastInSelection |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3685 |
"return the index of the last selected line - nil if there is no selection" |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3686 |
|
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3687 |
selection isNil ifTrue:[^ nil]. |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3688 |
selection isCollection ifTrue:[ |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3689 |
selection size == 0 ifTrue:[ |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3690 |
^ nil |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3691 |
]. |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3692 |
^ selection max |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3693 |
]. |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3694 |
^ selection |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3695 |
! |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3696 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3697 |
makeSelectionVisible |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3698 |
"scroll to make the selection line visible" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3699 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3700 |
|line| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3701 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3702 |
selection notNil ifTrue:[ |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3703 |
self multipleSelectOk ifTrue:[ |
2148
a3077508aaa6
do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents:
2142
diff
changeset
|
3704 |
selection isEmpty ifTrue:[^ self]. |
a3077508aaa6
do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents:
2142
diff
changeset
|
3705 |
"/ dont move, if any in the selection isVisible |
a3077508aaa6
do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents:
2142
diff
changeset
|
3706 |
selection do:[:aSelectedLine | |
2165
6c4bfa91517f
ensure fullyVisible in #makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
3707 |
(self lineIsFullyVisible:aSelectedLine) ifTrue:[ |
2148
a3077508aaa6
do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents:
2142
diff
changeset
|
3708 |
^ self |
a3077508aaa6
do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents:
2142
diff
changeset
|
3709 |
] |
a3077508aaa6
do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents:
2142
diff
changeset
|
3710 |
]. |
a3077508aaa6
do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents:
2142
diff
changeset
|
3711 |
line := selection first. |
a3077508aaa6
do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents:
2142
diff
changeset
|
3712 |
] ifFalse:[ |
a3077508aaa6
do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents:
2142
diff
changeset
|
3713 |
line := selection |
a3077508aaa6
do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents:
2142
diff
changeset
|
3714 |
]. |
a3077508aaa6
do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents:
2142
diff
changeset
|
3715 |
self makeLineVisible:line |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3716 |
] |
2148
a3077508aaa6
do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents:
2142
diff
changeset
|
3717 |
|
2165
6c4bfa91517f
ensure fullyVisible in #makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
3718 |
"Modified: / 24.2.2000 / 17:48:00 / cg" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3719 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3720 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3721 |
nextAfterSelection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3722 |
"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
|
3723 |
Wrap at end." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3724 |
|
2194
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3725 |
^ self nextSelectableAfter:selection |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3726 |
! |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3727 |
|
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3728 |
nextSelectableAfter:indexOrIndexCollection |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3729 |
"return the index of the next selectable entry after the indexOrIndexCollection. |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3730 |
Wrap at end." |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3731 |
|
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3732 |
|next sz| |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3733 |
|
2194
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3734 |
indexOrIndexCollection isNil ifTrue:[ |
1244 | 3735 |
next := firstLineShown |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3736 |
] ifFalse:[ |
2194
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3737 |
indexOrIndexCollection isCollection ifTrue:[ |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3738 |
indexOrIndexCollection size == 0 ifTrue:[ |
1244 | 3739 |
next := firstLineShown |
3740 |
] ifFalse:[ |
|
2194
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3741 |
next := indexOrIndexCollection max + 1 |
1244 | 3742 |
] |
3743 |
] ifFalse:[ |
|
2194
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3744 |
next := indexOrIndexCollection + 1 |
1244 | 3745 |
]. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3746 |
]. |
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3747 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3748 |
(self isValidSelection:next) ifFalse:[ |
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3749 |
sz := self size. |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3750 |
next > sz ifTrue:[ |
1244 | 3751 |
next := 1. |
3752 |
] ifFalse:[ |
|
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3753 |
[next <= sz |
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3754 |
and:[(self isValidSelection:next) not ]] whileTrue:[ |
1244 | 3755 |
next := next + 1 |
3756 |
]. |
|
3757 |
]. |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3758 |
]. |
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3759 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3760 |
(self isValidSelection:next) ifFalse:[ |
1244 | 3761 |
next := nil |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3762 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3763 |
^ next |
1640
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3764 |
|
1ddc9c17b4bf
skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
3765 |
"Modified: / 8.8.1998 / 03:36:55 / cg" |
125 | 3766 |
! |
3767 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3768 |
numberOfSelections |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3769 |
"return the number of selected entries" |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3770 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3771 |
|sz| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3772 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3773 |
selection isNil ifTrue:[^ 0]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3774 |
sz := selection size. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3775 |
sz > 0 ifTrue:[^ sz]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3776 |
^ 1 |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3777 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3778 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3779 |
previousBeforeSelection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3780 |
"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
|
3781 |
Wrap at beginning." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3782 |
|
2194
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3783 |
^ self previousSelectableBefore:selection |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3784 |
|
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3785 |
! |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3786 |
|
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3787 |
previousSelectableBefore:indexOrIndexCollection |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3788 |
"return the index of the previous selectable entry before the indexOrIndexCollection. |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3789 |
Wrap at beginning." |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3790 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3791 |
|prev| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3792 |
|
2194
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3793 |
indexOrIndexCollection isNil ifTrue:[ |
1244 | 3794 |
prev := firstLineShown - 1 |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3795 |
] ifFalse:[ |
2194
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3796 |
indexOrIndexCollection isCollection ifTrue:[ |
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3797 |
indexOrIndexCollection size == 0 ifTrue:[ |
1244 | 3798 |
prev := firstLineShown - 1 |
3799 |
] ifFalse:[ |
|
2194
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3800 |
prev := indexOrIndexCollection min - 1 |
1244 | 3801 |
] |
3802 |
] ifFalse:[ |
|
2194
d0487f4d4865
skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
3803 |
prev := indexOrIndexCollection - 1 |
1244 | 3804 |
]. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3805 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3806 |
(self isValidSelection:prev) ifFalse:[ |
1244 | 3807 |
prev < 1 ifTrue:[ |
3808 |
prev := self size. |
|
3809 |
] ifFalse:[ |
|
3810 |
[prev >= 1 |
|
3811 |
and:[(self isValidSelection:prev) not]] whileTrue:[ |
|
3812 |
prev := prev - 1 |
|
3813 |
]. |
|
3814 |
]. |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3815 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3816 |
(self isValidSelection:prev) ifFalse:[ |
1244 | 3817 |
prev := nil |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3818 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3819 |
^ prev |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3820 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3821 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3822 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3823 |
selectAll |
886 | 3824 |
"select all entries. |
3825 |
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
|
3826 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3827 |
|oldSelection| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3828 |
|
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3829 |
self multipleSelectOk ifTrue:[ |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3830 |
oldSelection := selection. |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3831 |
selection := OrderedCollection withAll:(1 to:self size). |
722
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
709
diff
changeset
|
3832 |
self invalidate. |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3833 |
self selectionChangedFrom:oldSelection. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3834 |
] |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3835 |
|
886 | 3836 |
"Modified: 15.11.1996 / 17:00:26 / cg" |
125 | 3837 |
! |
3838 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3839 |
selectElement:anObject |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3840 |
"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
|
3841 |
Scroll to make the new selection visible. |
886 | 3842 |
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
|
3843 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3844 |
|lineNo| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3845 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3846 |
list notNil ifTrue:[ |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3847 |
items notNil ifTrue:[ |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3848 |
lineNo := items indexOf:anObject ifAbsent:nil |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3849 |
] ifFalse:[ |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3850 |
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
|
3851 |
]. |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3852 |
lineNo notNil ifTrue:[self selection:lineNo] |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3853 |
] |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3854 |
|
886 | 3855 |
"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
|
3856 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3857 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3858 |
selectElementWithoutScroll:anObject |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3859 |
"select the element with same printString as the argument, anObject. |
886 | 3860 |
Do not scroll. |
3861 |
*** 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
|
3862 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3863 |
|lineNo| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3864 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3865 |
list notNil ifTrue:[ |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3866 |
items notNil ifTrue:[ |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3867 |
lineNo := items indexOf:anObject ifAbsent:nil |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3868 |
] ifFalse:[ |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3869 |
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
|
3870 |
]. |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3871 |
lineNo notNil ifTrue:[self selectWithoutScroll:lineNo] |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3872 |
] |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3873 |
|
886 | 3874 |
"Modified: 15.11.1996 / 17:01:17 / cg" |
125 | 3875 |
! |
3876 |
||
4718 | 3877 |
selectFirst |
4719 | 3878 |
"select the first selectable element. |
4718 | 3879 |
Model and/or actionBlock notification IS done." |
3880 |
||
3881 |
self selection:(self nextSelectableAfter:0) |
|
3882 |
! |
|
3883 |
||
5514 | 3884 |
selectFirstVisibleLine |
3885 |
"select the first selectable element. |
|
3886 |
Model and/or actionBlock notification IS done." |
|
3887 |
||
3888 |
self selection:(self nextSelectableAfter:self firstLineShown -1) |
|
3889 |
! |
|
3890 |
||
4719 | 3891 |
selectLast |
3892 |
"select the last selectable element. |
|
3893 |
Model and/or actionBlock notification IS done." |
|
3894 |
||
3895 |
self selection:(self previousSelectableBefore:list size + 1) |
|
3896 |
! |
|
3897 |
||
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3898 |
selectNext |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3899 |
"select next line or first visible if there is currrently no selection. |
886 | 3900 |
Wrap at end. |
3901 |
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
|
3902 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3903 |
self selection:(self nextAfterSelection) |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3904 |
|
886 | 3905 |
"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
|
3906 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3907 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3908 |
selectPrevious |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3909 |
"select previous line or previous visible if there is currently no selection. |
886 | 3910 |
Wrap at beginning. |
3911 |
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
|
3912 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3913 |
self selection:(self previousBeforeSelection). |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3914 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3915 |
"Modified: 26.9.1995 / 09:41:16 / stefan" |
886 | 3916 |
"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
|
3917 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3918 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3919 |
selectWithoutScroll:aNumberOrNilOrCollection |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3920 |
"select line, aNumber or deselect if argument is nil. |
886 | 3921 |
*** 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
|
3922 |
|
2767 | 3923 |
|newSelection multipleSelectOk oldItems newItems addedItems removedItems| |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3924 |
|
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
3925 |
multipleSelectOk := self multipleSelectOk. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3926 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3927 |
newSelection := aNumberOrNilOrCollection. |
2314
03348b8ae78b
empty-list with cursorUp/Down lead into debugger
Claus Gittinger <cg@exept.de>
parents:
2290
diff
changeset
|
3928 |
multipleSelectOk ifTrue:[ |
2770
6b49ba35c070
multiselect: care for numeric arg in setSelection
Claus Gittinger <cg@exept.de>
parents:
2767
diff
changeset
|
3929 |
newSelection notNil ifTrue:[ |
6b49ba35c070
multiselect: care for numeric arg in setSelection
Claus Gittinger <cg@exept.de>
parents:
2767
diff
changeset
|
3930 |
newSelection isNumber ifTrue:[ |
6b49ba35c070
multiselect: care for numeric arg in setSelection
Claus Gittinger <cg@exept.de>
parents:
2767
diff
changeset
|
3931 |
newSelection := OrderedCollection with:newSelection |
6b49ba35c070
multiselect: care for numeric arg in setSelection
Claus Gittinger <cg@exept.de>
parents:
2767
diff
changeset
|
3932 |
]. |
6b49ba35c070
multiselect: care for numeric arg in setSelection
Claus Gittinger <cg@exept.de>
parents:
2767
diff
changeset
|
3933 |
|
2314
03348b8ae78b
empty-list with cursorUp/Down lead into debugger
Claus Gittinger <cg@exept.de>
parents:
2290
diff
changeset
|
3934 |
newSelection := newSelection select:[:each | each notNil]. |
03348b8ae78b
empty-list with cursorUp/Down lead into debugger
Claus Gittinger <cg@exept.de>
parents:
2290
diff
changeset
|
3935 |
newSelection size == 0 ifTrue:[newSelection := nil]. |
03348b8ae78b
empty-list with cursorUp/Down lead into debugger
Claus Gittinger <cg@exept.de>
parents:
2290
diff
changeset
|
3936 |
]. |
03348b8ae78b
empty-list with cursorUp/Down lead into debugger
Claus Gittinger <cg@exept.de>
parents:
2290
diff
changeset
|
3937 |
]. |
03348b8ae78b
empty-list with cursorUp/Down lead into debugger
Claus Gittinger <cg@exept.de>
parents:
2290
diff
changeset
|
3938 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3939 |
newSelection notNil ifTrue:[ |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3940 |
(self isValidSelection:newSelection) ifFalse:[ |
2761 | 3941 |
multipleSelectOk ifTrue:[ |
3942 |
newSelection := newSelection select:[:each | self isValidSelection:each]. |
|
3943 |
] ifFalse:[ |
|
3944 |
newSelection := nil. |
|
3945 |
]. |
|
1484 | 3946 |
]. |
3947 |
newSelection == 0 ifTrue:[ |
|
3948 |
newSelection := nil |
|
3949 |
] ifFalse:[ |
|
3950 |
(newSelection isCollection |
|
3951 |
and:[newSelection size == 0]) ifTrue:[ |
|
3952 |
newSelection := nil |
|
3953 |
] |
|
3954 |
]. |
|
3955 |
||
3956 |
newSelection notNil ifTrue:[ |
|
3957 |
multipleSelectOk ifTrue:[ |
|
3958 |
newSelection isCollection ifFalse:[ |
|
3959 |
newSelection := OrderedCollection with:newSelection |
|
3960 |
] |
|
3961 |
] |
|
3962 |
]. |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3963 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3964 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3965 |
(newSelection = selection) ifTrue: [^ self]. |
125 | 3966 |
|
2764
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3967 |
multipleSelectOk ifTrue:[ |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3968 |
oldItems := selection ? #(). |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3969 |
newItems := newSelection ? #(). |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3970 |
] ifFalse:[ |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3971 |
(selection isNil or:[selection == 0]) ifTrue:[ |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3972 |
oldItems := #() |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
3973 |
] ifFalse:[ |
2764
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3974 |
oldItems := Array with:selection |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3975 |
]. |
2767 | 3976 |
(newSelection isNil or:[newSelection == 0]) ifTrue:[ |
2766 | 3977 |
newItems := #() |
2764
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3978 |
] ifFalse:[ |
2767 | 3979 |
newItems := Array with:newSelection |
2764
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3980 |
]. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3981 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3982 |
|
4599 | 3983 |
addedItems := newItems reject:[:item | (oldItems includes:item)]. |
3984 |
removedItems := oldItems reject:[:item | (newItems includes:item)]. |
|
2764
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3985 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3986 |
selection := newSelection. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
3987 |
|
2767 | 3988 |
addedItems do:[:line | |
3989 |
self redrawElement:line |
|
3990 |
]. |
|
3991 |
removedItems do:[:line | |
|
2764
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3992 |
self redrawElement:line |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3993 |
]. |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3994 |
|
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3995 |
"/ " |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3996 |
"/ redraw old selection unhighlighted |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3997 |
"/ " |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3998 |
"/ selection notnil iftrue: [ |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
3999 |
"/ prevselection := selection. |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4000 |
"/ selection := nil. |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4001 |
"/ multipleselectok iftrue:[ |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4002 |
"/ prevselection do:[:line | |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4003 |
"/ self redrawelement:line |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4004 |
"/ ] |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4005 |
"/ ] iffalse:[ |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4006 |
"/ self redrawelement:prevselection |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4007 |
"/ ] |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4008 |
"/ ]. |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4009 |
"/ |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4010 |
"/ selection := newSelection. |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4011 |
"/ |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4012 |
"/ " |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4013 |
"/ redraw new selection unhighlighted |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4014 |
"/ " |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4015 |
"/ newSelection notNil ifTrue:[ |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4016 |
"/ multipleSelectOk ifTrue:[ |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4017 |
"/"/ newSelection isCollection ifFalse:[ |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4018 |
"/"/ selection := OrderedCollection with:newSelection. |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4019 |
"/"/ ]. |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4020 |
"/ selection do:[:line | |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4021 |
"/ self redrawElement:line |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4022 |
"/ ] |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4023 |
"/ ] ifFalse:[ |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4024 |
"/ self redrawElement:selection |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4025 |
"/ ] |
36363d57b32d
dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents:
2761
diff
changeset
|
4026 |
"/ ] |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4027 |
|
886 | 4028 |
"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
|
4029 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4030 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4031 |
selection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4032 |
"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
|
4033 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4034 |
^ selection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4035 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4036 |
|
2738 | 4037 |
selection:aNumberOrNilOrCollection |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4038 |
"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
|
4039 |
scroll to make the selected line visible. |
886 | 4040 |
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
|
4041 |
|
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
4042 |
|oldSelection| |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
4043 |
|
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
4044 |
oldSelection := selection. |
2738 | 4045 |
self setSelection:aNumberOrNilOrCollection. |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
4046 |
selection ~= oldSelection ifTrue:[ |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
4047 |
self selectionChangedFrom:oldSelection |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
4048 |
] |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
4049 |
|
1638 | 4050 |
"Modified: / 7.8.1998 / 13:36:34 / cg" |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4051 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4052 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4053 |
selectionAsCollection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4054 |
"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
|
4055 |
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
|
4056 |
the multipleSelect style." |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4057 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4058 |
selection isNil ifTrue:[^ #()]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4059 |
|
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
4060 |
"/ self multipleSelectOk ifTrue:[ |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4061 |
"/ ^ (OrderedCollection new) add:selection; yourself. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4062 |
"/ ]. |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
4063 |
self multipleSelectOk ifFalse:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
4064 |
^ (OrderedCollection new) add:selection; yourself. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4065 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4066 |
^ selection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4067 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4068 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4069 |
selectionChangedFrom:oldSelection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4070 |
"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
|
4071 |
|
2503
05307dff92f1
use new #valueWithOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2481
diff
changeset
|
4072 |
|changeArg actionArg| |
970 | 4073 |
|
4074 |
changeArg := actionArg := self argForChangeMessage. |
|
965
ff8e6542eb13
when both model & actionBlocks are present,
Claus Gittinger <cg@exept.de>
parents:
941
diff
changeset
|
4075 |
|
1010 | 4076 |
"/ |
4077 |
"/ the MVC way of doing things - notify model via changeMsg |
|
4078 |
"/ |
|
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
4079 |
self multipleSelectOk ifFalse:[ |
965
ff8e6542eb13
when both model & actionBlocks are present,
Claus Gittinger <cg@exept.de>
parents:
941
diff
changeset
|
4080 |
"/ 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
|
4081 |
selection == oldSelection ifTrue:[ |
970 | 4082 |
changeArg := 0 |
965
ff8e6542eb13
when both model & actionBlocks are present,
Claus Gittinger <cg@exept.de>
parents:
941
diff
changeset
|
4083 |
]. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4084 |
]. |
2125
f9000f830c2c
tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents:
2124
diff
changeset
|
4085 |
|
f9000f830c2c
tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents:
2124
diff
changeset
|
4086 |
"/ must take care, if model is == to the selection-collection |
f9000f830c2c
tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents:
2124
diff
changeset
|
4087 |
"/ in this case, we must force a change on the model |
f9000f830c2c
tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents:
2124
diff
changeset
|
4088 |
"/ (valueHolder would not send a change in the == case) |
f9000f830c2c
tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents:
2124
diff
changeset
|
4089 |
"/ Q: should this be done in #sendChangeMessage ? |
f9000f830c2c
tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents:
2124
diff
changeset
|
4090 |
model isValueModel ifTrue:[ |
f9000f830c2c
tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents:
2124
diff
changeset
|
4091 |
model value == changeArg ifTrue:[ |
f9000f830c2c
tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents:
2124
diff
changeset
|
4092 |
model setValue:nil. |
f9000f830c2c
tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents:
2124
diff
changeset
|
4093 |
] |
f9000f830c2c
tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents:
2124
diff
changeset
|
4094 |
]. |
970 | 4095 |
self sendChangeMessageWith:changeArg. |
965
ff8e6542eb13
when both model & actionBlocks are present,
Claus Gittinger <cg@exept.de>
parents:
941
diff
changeset
|
4096 |
|
1010 | 4097 |
"/ |
4098 |
"/ the ST/X way of doing things - perform the actionBlock |
|
4099 |
"/ |
|
1745
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
4100 |
actionBlock notNil ifTrue:[ |
2503
05307dff92f1
use new #valueWithOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2481
diff
changeset
|
4101 |
actionBlock valueWithOptionalArgument:actionArg |
1745
cca5376d130d
doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents:
1744
diff
changeset
|
4102 |
]. |
965
ff8e6542eb13
when both model & actionBlocks are present,
Claus Gittinger <cg@exept.de>
parents:
941
diff
changeset
|
4103 |
|
1010 | 4104 |
"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
|
4105 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4106 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4107 |
selectionDo:aBlock |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4108 |
"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
|
4109 |
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
|
4110 |
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
|
4111 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4112 |
selection notNil ifTrue:[ |
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
4113 |
self multipleSelectOk ifTrue:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
4114 |
selection do:aBlock |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
4115 |
] ifFalse:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
4116 |
aBlock value:selection |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
4117 |
]. |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4118 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4119 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4120 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4121 |
selectionValue |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4122 |
"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
|
4123 |
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
|
4124 |
|
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
4125 |
self multipleSelectOk ifTrue:[ |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
4126 |
selection isNil ifTrue:[^ #()]. |
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
4127 |
^ selection collect:[:nr | self at:nr] |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4128 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4129 |
selection isNil ifTrue:[^ nil]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4130 |
^ self at:selection |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4131 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4132 |
|
988 | 4133 |
selectionValueAsCollection |
4134 |
"return the selection values as a collection - allows selectionValues to |
|
4135 |
be enumerated independent of the multiSelect settings" |
|
4136 |
||
4137 |
selection isNil ifTrue:[^ #()]. |
|
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
4138 |
self multipleSelectOk ifTrue:[ |
988 | 4139 |
^ selection collect:[:nr | self at:nr] |
4140 |
]. |
|
4141 |
^ Array with:(self at:selection) |
|
4142 |
! |
|
4143 |
||
2122
eaf474215daa
setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents:
2115
diff
changeset
|
4144 |
setSelectElement:anObject |
686
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
4145 |
"select the element with same printString as the argument, anObject. |
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
4146 |
Scroll to make the new selection visible. |
886 | 4147 |
*** No model and/or actionBlock notification is done here." |
686
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
4148 |
|
2122
eaf474215daa
setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents:
2115
diff
changeset
|
4149 |
|size lineNo coll s| |
1358 | 4150 |
|
4151 |
list isNil ifTrue:[ |
|
4152 |
^ self |
|
4153 |
]. |
|
2446
3771875cd836
multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
4154 |
self multipleSelectOk ifTrue:[ |
1358 | 4155 |
(size := anObject size) == 0 ifTrue:[ |
4156 |
^ self setSelection:nil |
|
686
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
4157 |
]. |
1358 | 4158 |
coll := OrderedCollection new:size. |
2122
eaf474215daa
setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents:
2115
diff
changeset
|
4159 |
anObject do:[:o | |
1358 | 4160 |
items notNil ifTrue:[ |
2229
ece191c81264
use indexOf: instead of findFirst:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
4161 |
lineNo := items indexOf:o |
1358 | 4162 |
] ifFalse:[ |
4527 | 4163 |
lineNo := list findFirst:[:el | (o ? '') string = (el ? '') string] |
1358 | 4164 |
]. |
2122
eaf474215daa
setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents:
2115
diff
changeset
|
4165 |
lineNo ~~ 0 ifTrue:[ |
1358 | 4166 |
coll add:lineNo |
4167 |
] |
|
4168 |
]. |
|
4169 |
^ self setSelection:coll |
|
4170 |
]. |
|
2124
b4123a418b82
oops - care for nil arg in setSelection
Claus Gittinger <cg@exept.de>
parents:
2122
diff
changeset
|
4171 |
anObject isNil ifTrue:[ |
b4123a418b82
oops - care for nil arg in setSelection
Claus Gittinger <cg@exept.de>
parents:
2122
diff
changeset
|
4172 |
^ self setSelection:nil |
b4123a418b82
oops - care for nil arg in setSelection
Claus Gittinger <cg@exept.de>
parents:
2122
diff
changeset
|
4173 |
]. |
b4123a418b82
oops - care for nil arg in setSelection
Claus Gittinger <cg@exept.de>
parents:
2122
diff
changeset
|
4174 |
|
1358 | 4175 |
items notNil ifTrue:[ |
2122
eaf474215daa
setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents:
2115
diff
changeset
|
4176 |
lineNo := items findFirst:[:el | anObject = el] |
1358 | 4177 |
] ifFalse:[ |
2122
eaf474215daa
setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents:
2115
diff
changeset
|
4178 |
s := anObject string. |
eaf474215daa
setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents:
2115
diff
changeset
|
4179 |
lineNo := list findFirst:[:el | s = el string] |
1358 | 4180 |
]. |
2122
eaf474215daa
setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents:
2115
diff
changeset
|
4181 |
lineNo ~~ 0 ifTrue:[ |
eaf474215daa
setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents:
2115
diff
changeset
|
4182 |
self setSelection:lineNo |
eaf474215daa
setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents:
2115
diff
changeset
|
4183 |
] |
686
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
4184 |
! |
03328d8ef2b6
more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
4185 |
|
2232
b65df4a6af2d
when the selection is lost (due to a changed list),
Claus Gittinger <cg@exept.de>
parents:
2229
diff
changeset
|
4186 |
setSelection:aNumberOrNilOrCollection |
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
4187 |
"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
|
4188 |
scroll to make the selected line visible. |
886 | 4189 |
*** 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
|
4190 |
|
2232
b65df4a6af2d
when the selection is lost (due to a changed list),
Claus Gittinger <cg@exept.de>
parents:
2229
diff
changeset
|
4191 |
self selectWithoutScroll:aNumberOrNilOrCollection. |
2235
b51a9d465386
selection should be a colletion if multiSelect is on (keyPress)
Claus Gittinger <cg@exept.de>
parents:
2234
diff
changeset
|
4192 |
|
3466 | 4193 |
"/ makeSelectionVisible handled in #buttonRelease |
4194 |
isButtonPressActive ifTrue:[^ self ]. |
|
4195 |
||
4196 |
self hasSelection ifTrue:[ |
|
1638 | 4197 |
self makeSelectionVisible |
3466 | 4198 |
]. |
1638 | 4199 |
|
4200 |
"Created: / 25.5.1996 / 12:23:18 / cg" |
|
4201 |
"Modified: / 7.8.1998 / 13:36:42 / cg" |
|
681
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
4202 |
! |
9347a4f72cc9
#selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
4203 |
|
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4204 |
toggleSelection:aNumber |
886 | 4205 |
"toggle selection-state of entry, aNumber. |
4206 |
*** 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
|
4207 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4208 |
(self isInSelection:aNumber) ifTrue:[ |
886 | 4209 |
self removeFromSelection:aNumber |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4210 |
] ifFalse:[ |
886 | 4211 |
self addToSelection:aNumber |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4212 |
] |
886 | 4213 |
|
4214 |
"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
|
4215 |
! |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4216 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4217 |
valueIsInSelection:someString |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4218 |
"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
|
4219 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4220 |
|sel| |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4221 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4222 |
selection isNil ifTrue:[^ false]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4223 |
sel := self selectionValue. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4224 |
self numberOfSelections > 1 ifTrue:[ |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4225 |
^ (sel includes:someString) |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4226 |
]. |
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4227 |
^ (someString = sel) |
125 | 4228 |
! ! |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4229 |
|
869
4b09e6fe33b6
allow multiSelect modifier to be changed
Claus Gittinger <cg@exept.de>
parents:
838
diff
changeset
|
4230 |
!SelectionInListView class methodsFor:'documentation'! |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4231 |
|
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4232 |
version |
5373 | 4233 |
^ '$Header$' |
4014 | 4234 |
! |
4235 |
||
4236 |
version_CVS |
|
5373 | 4237 |
^ '$Header$' |
4971
c67f7d22e6d8
class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4913
diff
changeset
|
4238 |
! |
c67f7d22e6d8
class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4913
diff
changeset
|
4239 |
|
c67f7d22e6d8
class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4913
diff
changeset
|
4240 |
version_HG |
c67f7d22e6d8
class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4913
diff
changeset
|
4241 |
|
c67f7d22e6d8
class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4913
diff
changeset
|
4242 |
^ '$Changeset: <not expanded> $' |
320
b2ca0310ead0
fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
4243 |
! ! |
4527 | 4244 |