author | Claus Gittinger <cg@exept.de> |
Thu, 04 Mar 2004 10:33:47 +0100 | |
changeset 2670 | 27dacfff1d6d |
parent 2637 | d563163414b8 |
child 2695 | 02d2039ec6a6 |
permissions | -rw-r--r-- |
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
1 |
"{ Encoding: utf8 }" |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
2 |
|
542 | 3 |
" |
4 |
COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG |
|
5 |
All Rights Reserved |
|
6 |
||
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
14 |
||
15 |
||
16 |
||
17 |
||
1754 | 18 |
"{ Package: 'stx:libwidg2' }" |
19 |
||
542 | 20 |
View subclass:#DSVColumnView |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
21 |
instanceVariableNames:'labelView listHolder editValue editView multipleSelectOk useIndex |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
22 |
selectedColIndex selectedRowIndex selectRowOnDefault |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
23 |
buttonMotionAction buttonReleaseAction rowHeight minRowHeight |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
24 |
columnDescriptors viewOrigin colorMap rowFontAscent lockRowIndex |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
25 |
rowIfAbsentBlock columnHolder registererImages list fgColor |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
26 |
separatorSize catchChangeEvents beDependentOfRows bgColor |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
27 |
actionBlock builder tabIntern doubleClickActionBlock |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
28 |
verticalSpacing horizontalSpacing rowSelectorForm |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
29 |
buttonLightColor buttonShadowColor buttonHalfLightColor |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
30 |
buttonHalfShadowColor checkToggleExtent checkToggleForm |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
31 |
checkToggleActiveImage checkTogglePassiveImage checkToggleLevel |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
32 |
comboButtonExtent comboButtonForm comboButtonLevel dropTarget |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
33 |
dropSource columnAdaptor tabAtEndAction tabAtStartAction |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
34 |
modifiedChannel autoScroll autoScrollBlock needFitColumns |
2637 | 35 |
scrollWhenUpdating separatorOneDColor selectionForegroundColor |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
36 |
selectionBackgroundColor previousExtent selectConditionBlock' |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
37 |
classVariableNames:'DefaultForegroundColor DefaultBackgroundColor |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
38 |
DefaultHilightForegroundColor DefaultHilightBackgroundColor |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
39 |
ButtonLightColor ButtonShadowColor CheckToggleActiveImage |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
40 |
CheckTogglePassiveImage ButtonHalfLightColor |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
41 |
ButtonHalfShadowColor ButtonEdgeStyle CheckToggleForm |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
42 |
CheckToggleLevel CheckToggleExtent ComboButtonForm |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
43 |
ComboButtonLevel ComboButtonExtent StopRedrawSignal' |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
44 |
poolDictionaries:'' |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
45 |
category:'Views-DataSet' |
542 | 46 |
! |
47 |
||
48 |
!DSVColumnView class methodsFor:'documentation'! |
|
49 |
||
50 |
copyright |
|
51 |
" |
|
52 |
COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG |
|
53 |
All Rights Reserved |
|
54 |
||
55 |
This software is furnished under a license and may be used |
|
56 |
only in accordance with the terms of that license and with the |
|
57 |
inclusion of the above copyright notice. This software may not |
|
58 |
be provided or otherwise made available to, or used by, any |
|
59 |
other person. No title to or ownership of the software is |
|
60 |
hereby transferred. |
|
61 |
" |
|
62 |
||
63 |
||
64 |
||
65 |
! |
|
66 |
||
67 |
documentation |
|
68 |
" |
|
69 |
implements a scrollable selection view based on rows and columns |
|
70 |
||
71 |
[Instance variables:] |
|
72 |
||
73 |
editValue <Model> current editing model |
|
74 |
editView <View> current editing component |
|
1087 | 75 |
|
2398 | 76 |
buttonReleaseAction <Action or nil> called if the mouse button is released |
77 |
buttonMotionAction <Action or nil> called during mouse motion with one |
|
78 |
argument the point under the mouse. |
|
79 |
||
1087 | 80 |
multipleSelectOk <Boolean> multiple selection enabled/disabled |
81 |
||
542 | 82 |
selectedColIndex <Integer> selected column index or 0 |
1087 | 83 |
selectedRowIndex <Integer> selected row index or 0 |
84 |
||
542 | 85 |
rowHeight <Integer> maximum height of any row |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
86 |
minRowHeight <Integer> minimum height of all displayed labels |
1087 | 87 |
|
542 | 88 |
columnDescriptors <SequancableCollection> list of column descriptors |
1087 | 89 |
|
90 |
viewOrigin <Point> current view origin |
|
91 |
||
92 |
colorMap <Dictionary> store and register used colors on device |
|
93 |
||
94 |
rowFontAscent <SmallInteger> inset of a printable text in a row |
|
95 |
including separator and font ascent. |
|
96 |
||
97 |
lockRowIndex <SmallInteger> internal used to indicate a row which has |
|
98 |
changed its contents but no redraw should be |
|
99 |
done( at:put: ). |
|
100 |
||
101 |
columnHolder <ValueHolder> holder which keeps the list of column descriptors. |
|
102 |
||
103 |
registererImages <IdentityDictionary> list of images registered on the device |
|
104 |
||
542 | 105 |
list <SequancableCollection> list of rows |
1087 | 106 |
|
107 |
||
108 |
catchChangeEvents <Boolean> internal used to discard change notifications |
|
109 |
||
110 |
beDependentOfRows <Boolean> keep rows dependent; on default is disabled. |
|
567 | 111 |
in case of enabled a row can raise a change |
112 |
notification whithout a parameter which |
|
113 |
will force a redraw of the row or the |
|
114 |
readSelector of the column which will |
|
115 |
redraw the cell in the row only. |
|
542 | 116 |
|
1087 | 117 |
fgColor <Color> foreground color |
118 |
bgColor <Color> background color |
|
119 |
hgLgFgColor <Color> highlight foreground color (selected) |
|
120 |
hgLgBgColor <Color> highlight background color (selected) |
|
121 |
||
122 |
buttonLightColor <Color> LightColor ( drawing the edge of a button ) |
|
123 |
buttonShadowColor <Color> ShadowColor ( drawing the edge of a button ) |
|
124 |
buttonHalfLightColor <Color> HalfLightColor ( drawing the edge of a button ) |
|
125 |
buttonHalfShadowColor <Color> HalfShadowColor ( drawing the edge of a button ) |
|
126 |
||
127 |
actionBlock <a OneArgBlock> action block performed on select |
|
128 |
doubleClickActionBlock <a OneArgBlock> action block performed on double click |
|
129 |
rowIfAbsentBlock <a OneArgBlock> this block is performed on an emty list entry |
|
130 |
to retrive the item from the application. The |
|
131 |
argument to the block is the index into the list. |
|
132 |
The block should return the row instance which |
|
133 |
is put to the list under the index. |
|
134 |
||
135 |
builder <UIBuilder> builder set by application |
|
136 |
||
137 |
verticalSpacing <SmallInteger> vertical row spacing( top & bottom ) |
|
138 |
horizontalSpacing <SmallInteger> horizontal row spacing( left & right ) |
|
139 |
separatorSize <SmallInteger> line width of a vertical or horizontal separator |
|
140 |
||
141 |
rowSelectorForm <Form> form used by a row selector |
|
142 |
||
143 |
checkToggleForm <Form> form used by a checkToggle |
|
144 |
checkToggleExtent <Point> extent of a checkToggle |
|
145 |
checkToggleLevel <SmallInteger> level used to draw a check toggle |
|
146 |
||
147 |
comboButtonForm <Form> form used by a comboList or -Box |
|
148 |
comboButtonExtent <Point> extent of a comboList or -Box |
|
149 |
comboButtonLevel <SmallInteger> level used to draw a comboList or -Box |
|
150 |
||
151 |
dropTarget <DropTarget> drag & drop target |
|
152 |
dropSource <DropSource> drag & drop source |
|
153 |
||
542 | 154 |
[author:] |
155 |
Claus Atzkern |
|
156 |
||
157 |
[see also:] |
|
158 |
DataSetColumnSpec |
|
159 |
DataSetColumn |
|
160 |
DataSetView |
|
161 |
" |
|
162 |
! ! |
|
163 |
||
647 | 164 |
!DSVColumnView class methodsFor:'accessing forms'! |
165 |
||
166 |
rowSelector |
|
989 | 167 |
"This resource specification was automatically generated |
168 |
by the ImageEditor of ST/X." |
|
169 |
||
170 |
"Do not manually edit this!! If it is corrupted, |
|
171 |
the ImageEditor may not be able to read the specification." |
|
172 |
||
173 |
" |
|
174 |
self rowSelector inspect |
|
175 |
ImageEditor openOnClass:self andSelector:#rowSelector |
|
176 |
" |
|
177 |
||
178 |
<resource: #image> |
|
179 |
||
180 |
^Icon |
|
181 |
constantNamed:#'DSVColumnView rowSelector' |
|
1129 | 182 |
ifAbsentPut:[(Depth2Image new) width: 11; height: 11; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@A@@@AP@@A4@EW=@G?? O?:@@C(@@B @@B@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170]; mask:((Depth1Image new) width: 11; height: 11; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'C@@N@@<@?8C?0O? ?<C? @<@C @L@@@a') ; yourself); yourself] |
183 |
||
184 |
||
185 |
! ! |
|
647 | 186 |
|
187 |
!DSVColumnView class methodsFor:'defaults'! |
|
607 | 188 |
|
1844 | 189 |
defaultFont |
190 |
^ SelectionInListView defaultFont |
|
191 |
! |
|
192 |
||
563 | 193 |
horizontalSpacing |
1087 | 194 |
"returns the default horizontal space between rows |
195 |
" |
|
563 | 196 |
^ 4 |
197 |
||
198 |
! |
|
199 |
||
542 | 200 |
updateStyleCache |
201 |
"extract values from the styleSheet and cache them in class variables |
|
202 |
" |
|
2146 | 203 |
<resource: #style (#textForegroundColor |
204 |
#'scrollableView.backgroundColor' |
|
582 | 205 |
#'selection.hilightForegroundColor' |
206 |
#'selection.hilightBackgroundColor' )> |
|
542 | 207 |
|
1333 | 208 |
DefaultForegroundColor := StyleSheet colorAt:#'textForegroundColor' default:(Color black). |
209 |
DefaultBackgroundColor := StyleSheet colorAt:#'scrollableView.backgroundColor' default:DefaultViewBackgroundColor. |
|
210 |
||
211 |
DefaultHilightForegroundColor := StyleSheet colorAt:#'selection.hilightForegroundColor' default:DefaultBackgroundColor. |
|
212 |
DefaultHilightBackgroundColor := StyleSheet colorAt:#'selection.hilightBackgroundColor' default:DefaultForegroundColor. |
|
607 | 213 |
|
647 | 214 |
DefaultHilightForegroundColor = DefaultHilightBackgroundColor ifTrue:[ |
988 | 215 |
DefaultHilightBackgroundColor := Color black |
647 | 216 |
]. |
1333 | 217 |
ButtonLightColor := StyleSheet colorAt:#'button.lightColor'. |
218 |
ButtonShadowColor := StyleSheet colorAt:#'button.shadowColor'. |
|
219 |
ButtonHalfLightColor := StyleSheet colorAt:#'button.halfLightColor'. |
|
220 |
ButtonHalfShadowColor := StyleSheet colorAt:#'button.halfShadowColor'. |
|
221 |
ButtonEdgeStyle := StyleSheet at:#'button.edgeStyle'. |
|
222 |
CheckToggleActiveImage := StyleSheet at:#'checkToggle.activeImage'. |
|
1100 | 223 |
|
224 |
CheckToggleActiveImage isNil ifTrue:[ |
|
225 |
CheckTogglePassiveImage := nil |
|
226 |
] ifFalse:[ |
|
1333 | 227 |
CheckTogglePassiveImage := StyleSheet at:#'checkToggle.passiveImage'. |
1100 | 228 |
|
229 |
CheckTogglePassiveImage isNil ifTrue:[ |
|
230 |
CheckToggleActiveImage := nil |
|
231 |
] |
|
232 |
]. |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
233 |
ComboButtonForm := nil. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
234 |
ComboButtonLevel := nil. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
235 |
ComboButtonExtent := nil. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
236 |
|
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
237 |
CheckToggleForm := nil. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
238 |
CheckToggleLevel := nil. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
239 |
CheckToggleExtent := nil. |
647 | 240 |
|
542 | 241 |
" |
242 |
self updateStyleCache. |
|
243 |
" |
|
244 |
||
582 | 245 |
"Modified: / 26.10.1997 / 17:09:07 / cg" |
563 | 246 |
! |
247 |
||
248 |
verticalSpacing |
|
1087 | 249 |
"returns the default vertical space between rows |
250 |
" |
|
563 | 251 |
^ 2 |
252 |
||
542 | 253 |
! ! |
254 |
||
809 | 255 |
!DSVColumnView class methodsFor:'resources'! |
256 |
||
257 |
dragIconMulti |
|
988 | 258 |
"This resource specification was automatically generated |
259 |
by the ImageEditor of ST/X." |
|
260 |
||
261 |
"Do not manually edit this!! If it is corrupted, |
|
262 |
the ImageEditor may not be able to read the specification." |
|
263 |
||
809 | 264 |
" |
988 | 265 |
self dragIconMulti inspect |
266 |
ImageEditor openOnClass:self andSelector:#dragIconMulti |
|
809 | 267 |
" |
268 |
||
269 |
<resource: #image> |
|
270 |
||
271 |
^Icon |
|
272 |
constantNamed:#'DSVColumnView dragIconMulti' |
|
1926
9bcb6b59ea37
if never set, the default menuPerformer is
Claus Gittinger <cg@exept.de>
parents:
1844
diff
changeset
|
273 |
ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@O?<0@C??L@@<@@@@O@@@@C3??L@<??3@OO?<<C3??O@<??0@OO?<@C3???0<???<OO???C3???0<???<OO???@C???0@???<@O???@C???0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((ImageMask new) width: 32; height: 32; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@O??<@C???@@???<@O???@C????@????0O????C????0?????O????3?????????????????????????????????????????????????????@????0O???<C????@????0@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself] |
9bcb6b59ea37
if never set, the default menuPerformer is
Claus Gittinger <cg@exept.de>
parents:
1844
diff
changeset
|
274 |
! |
809 | 275 |
|
276 |
dragIconSingle |
|
988 | 277 |
"This resource specification was automatically generated |
278 |
by the ImageEditor of ST/X." |
|
279 |
||
280 |
"Do not manually edit this!! If it is corrupted, |
|
281 |
the ImageEditor may not be able to read the specification." |
|
282 |
||
809 | 283 |
" |
988 | 284 |
self dragIconSingle inspect |
285 |
ImageEditor openOnClass:self andSelector:#dragIconSingle |
|
809 | 286 |
" |
287 |
||
288 |
<resource: #image> |
|
289 |
||
290 |
^Icon |
|
291 |
constantNamed:#'DSVColumnView dragIconSingle' |
|
1926
9bcb6b59ea37
if never set, the default menuPerformer is
Claus Gittinger <cg@exept.de>
parents:
1844
diff
changeset
|
292 |
ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@O?<0@C??L@@??30@O?<<@C??@@@??0@@O???@C???0@???<@O???@C???0@???<@O???@C???0@???<@O???@C???0@???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((ImageMask new) width: 32; height: 32; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@O??<@C???@@???<@O???@C???<@????@O???<C????@????0O???<C????@????0O???<C????@????0O???<C????@????0O???<C????@????0O???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself] |
9bcb6b59ea37
if never set, the default menuPerformer is
Claus Gittinger <cg@exept.de>
parents:
1844
diff
changeset
|
293 |
! ! |
809 | 294 |
|
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
295 |
!DSVColumnView class methodsFor:'signal constants'! |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
296 |
|
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
297 |
stopRedrawSignal |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
298 |
"returns the signal which is raised during drawing if the |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
299 |
required label height is less than the current rowHeight |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
300 |
" |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
301 |
StopRedrawSignal isNil ifTrue:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
302 |
StopRedrawSignal := Notification newSignalMayProceed:true. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
303 |
StopRedrawSignal nameClass:self message:#stopRedrawSignal. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
304 |
]. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
305 |
^ StopRedrawSignal |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
306 |
! ! |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
307 |
|
886 | 308 |
!DSVColumnView methodsFor:'accessing'! |
309 |
||
1042 | 310 |
builder |
1087 | 311 |
"get the builder (UIBuilder or nil) |
312 |
" |
|
1042 | 313 |
^ builder |
314 |
! |
|
315 |
||
316 |
builder:aBuilder |
|
1087 | 317 |
"set the builder (UIBuilder or nil) |
318 |
" |
|
1042 | 319 |
builder := aBuilder |
320 |
! |
|
321 |
||
886 | 322 |
columnView |
1087 | 323 |
"returns self |
324 |
" |
|
886 | 325 |
^ self |
1067
c66188014600
keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents:
1042
diff
changeset
|
326 |
! |
c66188014600
keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents:
1042
diff
changeset
|
327 |
|
1487 | 328 |
labelView:aView |
329 |
labelView := aView for:self. |
|
330 |
||
2146 | 331 |
labelView layout:(LayoutFrame |
332 |
leftFraction:0 offset:0 |
|
333 |
rightFraction:1 offset:0 |
|
334 |
topFraction:0 offset:0 |
|
335 |
bottomFraction:0 offset:[self preferredLabelViewHeight]). |
|
1067
c66188014600
keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents:
1042
diff
changeset
|
336 |
! |
c66188014600
keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents:
1042
diff
changeset
|
337 |
|
1487 | 338 |
level:aLevel |
339 |
"change the level and thus the level of the labelView |
|
340 |
" |
|
341 |
aLevel ~~ level ifTrue:[ |
|
342 |
super level:aLevel. |
|
2146 | 343 |
"/ labelView level:aLevel. |
1487 | 344 |
] |
1087 | 345 |
! |
346 |
||
1661 | 347 |
modifiedChannel |
348 |
^ modifiedChannel |
|
349 |
||
350 |
"Created: / 30.1.2000 / 12:10:57 / cg" |
|
351 |
! |
|
352 |
||
353 |
modifiedChannel:something |
|
354 |
modifiedChannel := something. |
|
355 |
||
356 |
"Created: / 30.1.2000 / 12:10:57 / cg" |
|
357 |
! |
|
358 |
||
2146 | 359 |
preferredLabelViewHeight |
360 |
^ labelView preferredHeight + (labelView margin + self verticalSpacing * 2). |
|
361 |
! |
|
362 |
||
1087 | 363 |
rowFontAscent |
364 |
"returns the inset of a printable text in a row |
|
365 |
" |
|
366 |
^ rowFontAscent |
|
886 | 367 |
! ! |
368 |
||
1818 | 369 |
!DSVColumnView methodsFor:'accessing-actions'! |
542 | 370 |
|
371 |
action:aOneArgAction |
|
607 | 372 |
"set the action block to be performed on select |
373 |
" |
|
542 | 374 |
actionBlock := aOneArgAction |
375 |
||
376 |
||
377 |
! |
|
378 |
||
809 | 379 |
doubleClickAction:aOneArgAction |
380 |
"set the action block to be performed on doubleclick |
|
381 |
" |
|
382 |
doubleClickActionBlock := aOneArgAction |
|
383 |
||
384 |
||
385 |
! |
|
386 |
||
387 |
rowIfAbsent:aOneArgAction |
|
388 |
"set the action block to be performed on each 'nil' entry into the |
|
389 |
list. The argument to the block is the index into the list. The |
|
390 |
block returns the row which is put to the list |
|
391 |
" |
|
392 |
rowIfAbsentBlock := aOneArgAction |
|
393 |
||
394 |
||
1416 | 395 |
! |
396 |
||
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
397 |
selectConditionBlock |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
398 |
"get the select-conditionBlock; this block is evaluated before |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
399 |
any selection change is performed (passing the to-be-changed row number |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
400 |
index as arg). |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
401 |
The change will not be done, if the block returns false. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
402 |
" |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
403 |
^ selectConditionBlock |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
404 |
! |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
405 |
|
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
406 |
selectConditionBlock:aOneArgBlockOrNil |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
407 |
"set the select-conditionBlock; this block is evaluated before |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
408 |
any selection change is performed (passing the to-be-changed row number |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
409 |
index as arg). |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
410 |
The change will not be done, if the block returns false. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
411 |
" |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
412 |
selectConditionBlock := aOneArgBlockOrNil. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
413 |
! |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
414 |
|
1416 | 415 |
tabAtEndAction:aNoneArgAction |
416 |
"set the action, called without any argument at end of the list entering |
|
417 |
tab next. |
|
418 |
The default is to give the focus to the view after self in the focusSequence |
|
419 |
" |
|
420 |
tabAtEndAction := aNoneArgAction |
|
421 |
||
422 |
||
423 |
! |
|
424 |
||
425 |
tabAtStartAction:aNoneArgAction |
|
426 |
"set the action, called without any argument at start of the list entering |
|
427 |
tab previous. |
|
428 |
The default is to give the focus to the view before self in the focusSequence |
|
429 |
" |
|
430 |
tabAtStartAction := aNoneArgAction |
|
431 |
||
432 |
||
809 | 433 |
! ! |
434 |
||
1818 | 435 |
!DSVColumnView methodsFor:'accessing-behavior'! |
809 | 436 |
|
542 | 437 |
beDependentOfRows |
438 |
"make myself dependent of any row; in this case any change notification |
|
439 |
raised by a row is catched and the cell identified by the 'readSelector' |
|
440 |
is redrawn. In case of a nil readSelector, the whole raw is redrawn. |
|
441 |
-> row changed:'what' |
|
1953
9190339e9fad
lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents:
1952
diff
changeset
|
442 |
On default the attribute is set to false (disabled). |
542 | 443 |
" |
444 |
^ beDependentOfRows |
|
445 |
! |
|
446 |
||
447 |
beDependentOfRows:aBool |
|
448 |
"make myself dependent of any row; in this case any change notification |
|
449 |
raised by a row is catched and the cell identified by the 'readSelector' |
|
450 |
is redrawn. In case of a nil readSelector, the whole raw is redrawn. |
|
451 |
-> row changed:'what' |
|
1953
9190339e9fad
lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents:
1952
diff
changeset
|
452 |
On default the attribute is set to false (disabled). |
542 | 453 |
" |
454 |
aBool ~~ beDependentOfRows ifTrue:[ |
|
618 | 455 |
beDependentOfRows := aBool. |
456 |
||
1497 | 457 |
list size ~~ 0 ifTrue:[ |
618 | 458 |
list do:[:aRow| aRow notNil ifTrue:[ |
459 |
beDependentOfRows ifTrue:[aRow addDependent:self] |
|
460 |
ifFalse:[aRow removeDependent:self] |
|
461 |
] |
|
462 |
] |
|
542 | 463 |
] |
618 | 464 |
] |
607 | 465 |
! |
466 |
||
1805 | 467 |
enableChannel:aChannel |
468 |
enableChannel notNil ifTrue:[ |
|
469 |
enableChannel removeDependent:self |
|
470 |
]. |
|
471 |
(enableChannel := aChannel) notNil ifTrue:[ |
|
472 |
enableChannel addDependent:self |
|
473 |
]. |
|
474 |
! |
|
475 |
||
607 | 476 |
multipleSelectOk |
477 |
"allow/disallow multiple row selections; the default is false |
|
478 |
" |
|
479 |
^ multipleSelectOk |
|
480 |
! |
|
481 |
||
482 |
multipleSelectOk:aState |
|
483 |
"allow/disallow multiple row selections; the default is false |
|
484 |
" |
|
485 |
aState == multipleSelectOk ifFalse:[ |
|
486 |
multipleSelectOk := aState. |
|
487 |
self deselect |
|
488 |
] |
|
1112 | 489 |
! |
490 |
||
1938 | 491 |
opaqueColumnResize |
492 |
^ labelView opaqueColumnResize |
|
493 |
! |
|
494 |
||
495 |
opaqueColumnResize:aBoolean |
|
496 |
labelView opaqueColumnResize:aBoolean |
|
497 |
! |
|
498 |
||
1946
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
499 |
scrollWhenUpdating |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
500 |
"return the scroll behavior, when I get a new text |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
501 |
(via the model or the #contents/#list) |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
502 |
Possible returnValues are: |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
503 |
#keep / nil -> no change |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
504 |
#endOfText -> scroll to the end |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
505 |
#beginOfText -> scroll to the top |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
506 |
The default is #beginOfText. |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
507 |
This may be useful for fields which get new values assigned from |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
508 |
the program (i.e. not from the user)" |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
509 |
|
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
510 |
^ scrollWhenUpdating |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
511 |
! |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
512 |
|
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
513 |
scrollWhenUpdating:aSymbolOrNil |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
514 |
"define how to scroll, when I get a new text |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
515 |
(via the model or the #contents/#list) |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
516 |
Allowed arguments are: |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
517 |
#keep / nil -> no change |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
518 |
#endOfText -> scroll to the end |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
519 |
#beginOfText -> scroll to the top |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
520 |
The default is #beginOfText. |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
521 |
This may be useful for fields which get new values assigned from |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
522 |
the program (i.e. not from the user)" |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
523 |
|
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
524 |
scrollWhenUpdating := aSymbolOrNil |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
525 |
! |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
526 |
|
1112 | 527 |
selectRowOnDefault |
528 |
"in case of selecting a none selectable cell, the row is selected |
|
529 |
" |
|
530 |
^ selectRowOnDefault |
|
531 |
! |
|
532 |
||
533 |
selectRowOnDefault:aBool |
|
534 |
"in case of selecting a none selectable cell, the row is selected |
|
535 |
" |
|
536 |
selectRowOnDefault := aBool |
|
1487 | 537 |
! |
538 |
||
1668 | 539 |
tabIntern |
540 |
"returns true if tabing is supported in the widget |
|
541 |
" |
|
542 |
^ tabIntern |
|
543 |
! |
|
544 |
||
545 |
tabIntern:aBool |
|
546 |
"returns true if tabing is supported in the widget |
|
547 |
" |
|
548 |
tabIntern := aBool ? true |
|
549 |
! |
|
550 |
||
1487 | 551 |
useIndex |
552 |
"specify, if the selected components value or its index in the |
|
553 |
list should be sent to the model. The default is its index. |
|
554 |
" |
|
555 |
^ useIndex |
|
556 |
||
557 |
||
558 |
! |
|
559 |
||
560 |
useIndex:aBool |
|
561 |
"specify, if the selected components value or its index in the |
|
562 |
list should be sent to the model. The default is its index. |
|
563 |
" |
|
564 |
useIndex := aBool |
|
565 |
||
542 | 566 |
! ! |
567 |
||
1818 | 568 |
!DSVColumnView methodsFor:'accessing-colors'! |
824 | 569 |
|
570 |
backgroundColor |
|
571 |
"get the background color of the rows |
|
572 |
" |
|
573 |
^ bgColor |
|
574 |
||
575 |
||
576 |
! |
|
577 |
||
578 |
backgroundColor:aColor |
|
579 |
"set the background color of the rows |
|
580 |
" |
|
581 |
bgColor ~~ aColor ifTrue:[ |
|
582 |
super viewBackground:bgColor. |
|
583 |
||
584 |
self realized ifTrue:[ |
|
1480 | 585 |
bgColor := aColor onDevice:device. |
824 | 586 |
self invalidate |
587 |
] ifFalse:[ |
|
588 |
bgColor := aColor |
|
589 |
] |
|
590 |
] |
|
591 |
! |
|
592 |
||
593 |
foregroundColor |
|
594 |
"return the foreground color of the rows |
|
595 |
" |
|
596 |
^ fgColor |
|
597 |
||
598 |
! |
|
599 |
||
600 |
foregroundColor:aColor |
|
601 |
"set the foreground color of the rows |
|
602 |
" |
|
603 |
fgColor ~~ aColor ifTrue:[ |
|
604 |
self realized ifTrue:[ |
|
1480 | 605 |
fgColor := aColor onDevice:device. |
824 | 606 |
self invalidate |
607 |
] ifFalse:[ |
|
608 |
fgColor := aColor |
|
609 |
] |
|
610 |
] |
|
611 |
||
612 |
! |
|
613 |
||
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
614 |
selectionBackgroundColor |
824 | 615 |
"returns the background color of a selected row |
616 |
" |
|
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
617 |
^ selectionBackgroundColor |
824 | 618 |
! |
619 |
||
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
620 |
selectionForegroundColor |
824 | 621 |
"returns the foreground color of a selected row |
622 |
" |
|
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
623 |
^ selectionForegroundColor |
824 | 624 |
! |
625 |
||
626 |
separatorDarkColor |
|
627 |
"returns the dark color used for drawing a shadowed separator (3D) |
|
628 |
" |
|
629 |
^ shadowColor |
|
630 |
||
631 |
||
632 |
! |
|
633 |
||
634 |
separatorLightColor |
|
635 |
"returns the light color used for drawing a shadowed separator (3D) |
|
636 |
" |
|
637 |
^ lightColor |
|
638 |
||
639 |
||
2637 | 640 |
! |
641 |
||
642 |
separatorOneDColor |
|
643 |
"returns the color used for drawing a oneD separator |
|
644 |
" |
|
645 |
separatorOneDColor isNil ifTrue:[^ fgColor]. |
|
646 |
^ separatorOneDColor |
|
647 |
! |
|
648 |
||
649 |
separatorOneDColor:aColorOrNil |
|
650 |
"set the color used for drawing a oneD separator; if the color |
|
651 |
is nil, the current forgroundColor is used |
|
652 |
" |
|
653 |
separatorOneDColor = aColorOrNil ifTrue:[^ self]. |
|
654 |
separatorOneDColor := aColorOrNil. |
|
655 |
||
656 |
self realized ifTrue:[ |
|
657 |
separatorOneDColor notNil ifTrue:[ |
|
658 |
separatorOneDColor := separatorOneDColor onDevice:device. |
|
659 |
]. |
|
660 |
self invalidate. |
|
661 |
]. |
|
824 | 662 |
! ! |
663 |
||
1818 | 664 |
!DSVColumnView methodsFor:'accessing-columns'! |
542 | 665 |
|
666 |
columnAt:anIndex |
|
607 | 667 |
"returns the column at an index |
542 | 668 |
" |
1112 | 669 |
^ columnDescriptors at:anIndex ifAbsent:nil |
542 | 670 |
! |
671 |
||
886 | 672 |
columnDescriptors |
673 |
"returns list of column descriptors |
|
674 |
" |
|
675 |
^ columnDescriptors collect:[:aCol| aCol description ] |
|
676 |
! |
|
677 |
||
678 |
columnDescriptors:aColumnDescriptionList |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
679 |
"set the columnDescriptors; scroll to top and deselect |
542 | 680 |
" |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
681 |
| delta| |
612 | 682 |
|
886 | 683 |
self deselect. |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
684 |
|
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
685 |
(viewOrigin x ~~ 0 or:[viewOrigin y ~~ 0]) ifTrue:[ |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
686 |
delta := viewOrigin negated. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
687 |
viewOrigin := 0@0. |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
688 |
self originChanged:delta |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
689 |
]. |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
690 |
self setColumnDescriptors:aColumnDescriptionList |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
691 |
! |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
692 |
|
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
693 |
firstColumn |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
694 |
"returns the first column |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
695 |
" |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
696 |
^ columnDescriptors at:1 |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
697 |
|
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
698 |
! |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
699 |
|
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
700 |
lastColumn |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
701 |
"returns the last column |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
702 |
" |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
703 |
^ columnDescriptors last |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
704 |
|
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
705 |
! |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
706 |
|
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
707 |
setColumnDescriptors:aColumnDescriptionList |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
708 |
"set the columnDescriptors; dont deselect and do not scroll to top |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
709 |
" |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
710 |
|cid| |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
711 |
|
1487 | 712 |
cid := 0. |
713 |
columnDescriptors := aColumnDescriptionList ? #(). |
|
714 |
||
715 |
columnDescriptors := columnDescriptors collect:[:el||dsc lbl| |
|
716 |
dsc := el isSequenceable ifTrue:[DataSetColumnSpec new fromLiteralArrayEncoding:el] |
|
717 |
ifFalse:[el]. |
|
718 |
cid := cid + 1. |
|
719 |
lbl := DataSetLabel new description:dsc builder:builder on:labelView. |
|
720 |
DataSetColumn new on:self description:dsc columnNumber:cid label:lbl |
|
542 | 721 |
]. |
1487 | 722 |
|
723 |
preferredExtent := nil. |
|
724 |
labelView columns:columnDescriptors. |
|
542 | 725 |
|
612 | 726 |
shown ifTrue:[ |
1487 | 727 |
self fitColumns. |
563 | 728 |
]. |
542 | 729 |
! ! |
730 |
||
1818 | 731 |
!DSVColumnView methodsFor:'accessing-interactors'! |
809 | 732 |
|
1100 | 733 |
checkToggleActiveImage |
734 |
^ checkToggleActiveImage |
|
735 |
! |
|
736 |
||
809 | 737 |
checkToggleExtent |
1087 | 738 |
"returns the extent of a checkToggle |
739 |
" |
|
809 | 740 |
^ checkToggleExtent |
741 |
! |
|
742 |
||
743 |
checkToggleForm |
|
1087 | 744 |
"returns the form of a checkToggle |
745 |
" |
|
809 | 746 |
^ checkToggleForm |
747 |
! |
|
748 |
||
749 |
checkToggleLevel |
|
1087 | 750 |
"returns the level of a checkToggle button |
751 |
" |
|
809 | 752 |
^ checkToggleLevel |
753 |
! |
|
754 |
||
1100 | 755 |
checkTogglePassiveImage |
756 |
^ checkTogglePassiveImage |
|
757 |
! |
|
758 |
||
809 | 759 |
comboButtonExtent |
1087 | 760 |
"returns the extent of a comboList or -Box |
761 |
" |
|
809 | 762 |
^ comboButtonExtent |
763 |
! |
|
764 |
||
765 |
comboButtonForm |
|
1087 | 766 |
"returns the form of a comboList or -Box |
767 |
" |
|
809 | 768 |
^ comboButtonForm |
769 |
! |
|
770 |
||
771 |
comboButtonLevel |
|
1087 | 772 |
"returns the level of a comboList or -Box button |
773 |
" |
|
809 | 774 |
^ comboButtonLevel |
775 |
! |
|
776 |
||
777 |
rowSelectorExtent |
|
778 |
"returns the bitmap of a selected row |
|
779 |
" |
|
780 |
^ rowSelectorForm extent |
|
781 |
! |
|
782 |
||
783 |
rowSelectorForm |
|
784 |
"returns the bitmap of a selected row |
|
785 |
" |
|
786 |
^ rowSelectorForm |
|
787 |
! ! |
|
788 |
||
1818 | 789 |
!DSVColumnView methodsFor:'accessing-mvc'! |
612 | 790 |
|
1008
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
791 |
columnAdaptor |
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
792 |
"return the value of the instance variable 'columnAdaptor' (automatically generated)" |
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
793 |
|
1711 | 794 |
columnAdaptor isValueModel ifTrue:[^ columnAdaptor value]. |
795 |
^ columnAdaptor |
|
796 |
! |
|
1008
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
797 |
|
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
798 |
columnAdaptor:something |
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
799 |
"set the value of the instance variable 'columnAdaptor' (automatically generated)" |
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
800 |
|
1711 | 801 |
columnAdaptor isValueModel ifTrue:[ |
802 |
columnAdaptor removeDependent:self |
|
803 |
]. |
|
804 |
(columnAdaptor := something) isValueModel ifTrue:[ |
|
805 |
columnAdaptor addDependent:self |
|
806 |
]. |
|
807 |
! |
|
1008
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
808 |
|
612 | 809 |
columnHolder |
1087 | 810 |
"get the valueHolder, which keeps the list of column descriptions |
811 |
" |
|
612 | 812 |
^ columnHolder |
813 |
||
814 |
! |
|
815 |
||
816 |
columnHolder:aValueHolder |
|
1087 | 817 |
"set the valueHolder, which keeps the list of column descriptions |
818 |
" |
|
612 | 819 |
|columns| |
820 |
||
821 |
columnHolder notNil ifTrue:[ |
|
822 |
columnHolder removeDependent:self |
|
823 |
]. |
|
824 |
||
825 |
(columnHolder := aValueHolder) notNil ifTrue:[ |
|
826 |
columnHolder addDependent:self. |
|
827 |
columns := columnHolder value. |
|
828 |
||
829 |
columns notNil ifTrue:[ |
|
830 |
self columnDescriptors:columns |
|
831 |
] |
|
832 |
]. |
|
833 |
||
1487 | 834 |
! |
835 |
||
836 |
listAt:index put:newElement |
|
837 |
"kludge callback, when an element hs to be replaced |
|
838 |
due to a col-adaptor returning a new row element |
|
839 |
" |
|
840 |
|list| |
|
841 |
||
842 |
(list := listHolder value) notNil ifTrue:[ |
|
843 |
list at:index put:newElement |
|
844 |
] |
|
845 |
! |
|
846 |
||
2318 | 847 |
listHolder |
848 |
"get the valueHolder which holds the list of rows |
|
849 |
" |
|
850 |
^ listHolder |
|
851 |
! |
|
852 |
||
1487 | 853 |
listHolder:aListHolder |
854 |
"set the valueHolder which holds the list of rows |
|
855 |
" |
|
856 |
listHolder ~~ aListHolder ifTrue:[ |
|
857 |
listHolder notNil ifTrue:[ |
|
858 |
listHolder removeDependent:self |
|
859 |
]. |
|
860 |
||
861 |
(listHolder := aListHolder) notNil ifTrue:[ |
|
862 |
listHolder addDependent:self |
|
863 |
] |
|
864 |
]. |
|
865 |
self pushEvent:#list: with:(listHolder value). |
|
866 |
||
867 |
! |
|
868 |
||
869 |
model:aModel |
|
870 |
"set the valueHolder which holds the selection and maybe the list of rows |
|
871 |
" |
|
872 |
model notNil ifTrue:[ |
|
873 |
model removeDependent:self. |
|
874 |
(model respondsTo:#list) ifTrue:[ |
|
875 |
(model list == listHolder) ifTrue:[ |
|
876 |
self listHolder:nil |
|
877 |
] |
|
878 |
] |
|
879 |
]. |
|
880 |
||
881 |
(model := aModel) notNil ifTrue:[ |
|
882 |
model addDependent:self. |
|
883 |
||
884 |
(aModel respondsTo:#list) ifTrue:[ |
|
885 |
self listHolder:model list |
|
886 |
] |
|
887 |
] |
|
888 |
||
612 | 889 |
! ! |
890 |
||
1818 | 891 |
!DSVColumnView methodsFor:'accessing-rows'! |
542 | 892 |
|
893 |
at:aRowNr |
|
894 |
"return the row at an index, aRowNr |
|
895 |
" |
|
618 | 896 |
|row| |
897 |
||
898 |
(row := list at:aRowNr) isNil ifTrue:[ |
|
899 |
lockRowIndex := aRowNr. |
|
900 |
||
1034
bd02c4cd7582
care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
901 |
(rowIfAbsentBlock notNil |
bd02c4cd7582
care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
902 |
and:[(row := rowIfAbsentBlock value:aRowNr) notNil]) ifTrue:[ |
618 | 903 |
list at:aRowNr put:row. |
904 |
beDependentOfRows ifTrue:[row addDependent:self]. |
|
905 |
]. |
|
906 |
||
907 |
lockRowIndex := 0 |
|
908 |
]. |
|
909 |
^ row |
|
1034
bd02c4cd7582
care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
910 |
|
bd02c4cd7582
care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
911 |
"Modified: / 31.7.1998 / 01:07:46 / cg" |
542 | 912 |
! |
913 |
||
914 |
at:aRowNr ifAbsent:exceptionBlock |
|
607 | 915 |
"return the row at a aRowNr. If the index is invalid, return the |
542 | 916 |
result of evaluating the exceptionblock |
917 |
" |
|
1497 | 918 |
(aRowNr between:1 and:list size) ifTrue:[ |
618 | 919 |
^ self at:aRowNr |
920 |
]. |
|
921 |
^ exceptionBlock value |
|
542 | 922 |
! |
923 |
||
924 |
at:aRowNr put:aRow |
|
925 |
"change the row at an index. The added row is returned |
|
926 |
" |
|
1956 | 927 |
lockRowIndex ~~ aRowNr ifTrue:[ |
928 |
(aRowNr <= list size and:[(list at:aRowNr) == aRow]) ifTrue:[ |
|
929 |
self invalidateRowAt:aRowNr |
|
930 |
] ifFalse:[ |
|
931 |
self replaceFrom:aRowNr to:aRowNr with:(Array with:aRow) startingAt:1. |
|
618 | 932 |
] |
542 | 933 |
]. |
1956 | 934 |
^ aRow |
542 | 935 |
! |
936 |
||
937 |
first |
|
938 |
"return the first row |
|
939 |
" |
|
618 | 940 |
^ self at:1 |
941 |
! |
|
942 |
||
943 |
identityIndexOfRow:aRow |
|
944 |
"returns index of a row or 0 |
|
945 |
" |
|
946 |
(list size ~~ 0 and:[aRow notNil]) ifTrue:[ |
|
947 |
^ list identityIndexOf:aRow |
|
948 |
]. |
|
949 |
^ 0 |
|
542 | 950 |
! |
951 |
||
952 |
last |
|
953 |
"return the last row |
|
954 |
" |
|
1497 | 955 |
^ self at:(list size) |
542 | 956 |
! |
957 |
||
958 |
list |
|
959 |
"get the list of rows |
|
960 |
" |
|
961 |
^ list |
|
962 |
||
963 |
||
964 |
||
965 |
! |
|
966 |
||
967 |
list:aList |
|
968 |
"set the list of rows |
|
969 |
" |
|
1259 | 970 |
|makeDependent selectionHasChanged| |
656 | 971 |
|
618 | 972 |
"/ remove selection without redraw |
622 | 973 |
|
1259 | 974 |
selectionHasChanged := self hasSelection. |
975 |
||
622 | 976 |
editValue notNil ifTrue:[ |
977 |
editValue removeDependent:self. |
|
978 |
editValue := nil |
|
979 |
]. |
|
1111 | 980 |
self destroyEditView. |
622 | 981 |
|
618 | 982 |
selectedColIndex := 0. |
983 |
selectedRowIndex := multipleSelectOk ifTrue:[nil] ifFalse:[0]. |
|
542 | 984 |
|
612 | 985 |
shown ifFalse:[ |
986 |
preferredExtent := nil |
|
987 |
] ifTrue:[ |
|
988 |
aList size ~~ 0 ifTrue:[ "/ otherwise keep old values |
|
2524 | 989 |
columnDescriptors notNil ifTrue:[ |
990 |
columnDescriptors do:[:aCol| aCol invalidate ]. |
|
991 |
]. |
|
612 | 992 |
preferredExtent := nil. |
618 | 993 |
] |
542 | 994 |
]. |
995 |
||
656 | 996 |
(makeDependent := beDependentOfRows) ifTrue:[ |
997 |
self beDependentOfRows:false. |
|
998 |
]. |
|
643 | 999 |
|
1000 |
aList size ~~ 0 ifTrue:[ |
|
1001 |
list := OrderedCollection new:(aList size). |
|
645
53c78cc2ee08
redraw twice in case of expose event during adding a new entry
ca
parents:
643
diff
changeset
|
1002 |
aList do:[:el| list add:el ]. |
542 | 1003 |
] ifFalse:[ |
1948
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
1004 |
list := nil. |
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
1005 |
viewOrigin := 0 @ 0. |
542 | 1006 |
]. |
656 | 1007 |
self beDependentOfRows:makeDependent. |
542 | 1008 |
|
612 | 1009 |
shown ifTrue:[ |
1484 | 1010 |
self fitColumns |
1949 | 1011 |
] ifFalse:[ |
1012 |
needFitColumns := true |
|
637 | 1013 |
]. |
1259 | 1014 |
selectionHasChanged ifTrue:[ |
1015 |
self selectionChanged. |
|
1016 |
]. |
|
2044
8e36106065f0
fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
1017 |
self contentsChanged. |
542 | 1018 |
! ! |
1019 |
||
1818 | 1020 |
!DSVColumnView methodsFor:'accessing-visibility'! |
542 | 1021 |
|
1022 |
font:aFont |
|
1023 |
"set the font for all shown rows. |
|
1024 |
" |
|
1025 |
(aFont notNil and:[aFont ~~ font]) ifTrue:[ |
|
1480 | 1026 |
super font:(aFont onDevice:device). |
542 | 1027 |
realized ifTrue:[ |
1497 | 1028 |
columnDescriptors do:[:aCol| aCol invalidate ]. |
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1029 |
self preferredExtentChanged. |
542 | 1030 |
self invalidate. |
1031 |
self contentsChanged |
|
1842 | 1032 |
]. |
1033 |
labelView notNil ifTrue:[ |
|
1034 |
labelView font:font |
|
1035 |
]. |
|
542 | 1036 |
] |
1037 |
! |
|
1038 |
||
607 | 1039 |
has3Dseparators |
1040 |
"returns true if shown in 3D mode |
|
1041 |
" |
|
1042 |
^ separatorSize ~~ 1 |
|
542 | 1043 |
! |
1044 |
||
607 | 1045 |
has3Dseparators:aBool |
1046 |
"enable or disable 3D mode |
|
1047 |
" |
|
1048 |
|newSepSize| |
|
542 | 1049 |
|
637 | 1050 |
newSepSize := aBool ifTrue:[2] ifFalse:[1]. |
607 | 1051 |
|
1052 |
newSepSize ~~ separatorSize ifTrue:[ |
|
1053 |
separatorSize := newSepSize. |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1054 |
|
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1055 |
realized ifTrue:[ |
1497 | 1056 |
columnDescriptors do:[:aCol| aCol invalidate ]. |
1136 | 1057 |
self preferredExtentChanged. |
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1058 |
self invalidate. |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1059 |
self contentsChanged |
647 | 1060 |
] |
542 | 1061 |
] |
1062 |
||
1063 |
||
1064 |
! |
|
1065 |
||
1066 |
horizontalSpacing |
|
1067 |
"horizontal spacing used by columns |
|
1068 |
" |
|
563 | 1069 |
^ horizontalSpacing |
1070 |
! |
|
1071 |
||
1072 |
horizontalSpacing:aNumber |
|
1073 |
"horizontal spacing used by columns |
|
1074 |
" |
|
1075 |
horizontalSpacing ~~ aNumber ifTrue:[ |
|
1076 |
horizontalSpacing := aNumber. |
|
1077 |
self preferredExtentChanged. |
|
1078 |
]. |
|
542 | 1079 |
! |
1080 |
||
1487 | 1081 |
showLabels |
1082 |
"control the labels view to be visible or unvisible |
|
1083 |
" |
|
1084 |
^ labelView isVisible |
|
1085 |
||
1086 |
! |
|
1087 |
||
1088 |
showLabels:aState |
|
1089 |
"control the labels view to be visible or unvisible |
|
1090 |
" |
|
1091 |
labelView isVisible:aState |
|
1092 |
! |
|
1093 |
||
542 | 1094 |
verticalSpacing |
1095 |
"vertical spacing used by columns |
|
1096 |
" |
|
563 | 1097 |
^ verticalSpacing |
1098 |
! |
|
1099 |
||
1100 |
verticalSpacing:aNumber |
|
1101 |
"vertical spacing used by columns |
|
1102 |
" |
|
1103 |
verticalSpacing ~~ aNumber ifTrue:[ |
|
1104 |
verticalSpacing := aNumber. |
|
1105 |
self preferredExtentChanged. |
|
1106 |
]. |
|
542 | 1107 |
! ! |
1108 |
||
1109 |
!DSVColumnView methodsFor:'adding & removing rows'! |
|
1110 |
||
1111 |
add:aRow |
|
618 | 1112 |
"insert row at end |
542 | 1113 |
" |
1497 | 1114 |
^ self add:aRow beforeIndex:(1 + list size) |
542 | 1115 |
! |
1116 |
||
1117 |
add:aRow afterIndex:aRowNr |
|
1118 |
"add a new row after slot aRowNr and redisplay; returns nil in case |
|
618 | 1119 |
of an invalid index or the row |
542 | 1120 |
" |
1121 |
^ self add:aRow beforeIndex:(aRowNr + 1) |
|
1122 |
! |
|
1123 |
||
1124 |
add:aRow beforeIndex:aRowNr |
|
1125 |
"add a new row before slot aRowNr and redisplay; returns nil in case |
|
618 | 1126 |
of an invalid index or the row |
542 | 1127 |
" |
861 | 1128 |
self addAll:(Array with:aRow) beforeIndex:aRowNr. |
1129 |
^ aRow. |
|
1130 |
! |
|
1131 |
||
1132 |
addAll:aList beforeIndex:start |
|
1133 |
"add a collection of rows before slot start and redisplay |
|
1134 |
" |
|
1135 |
|y0 y1 yD h dH size noSel| |
|
1136 |
||
1137 |
(size := aList size) == 0 ifTrue:[ |
|
1138 |
^ self |
|
1139 |
]. |
|
1140 |
||
1497 | 1141 |
list size == 0 ifTrue:[ |
861 | 1142 |
^ self list:aList |
618 | 1143 |
]. |
643 | 1144 |
|
618 | 1145 |
beDependentOfRows ifTrue:[ |
861 | 1146 |
aList do:[:aRow| aRow notNil ifTrue:[aRow addDependent:self]] |
542 | 1147 |
]. |
637 | 1148 |
|
861 | 1149 |
noSel := self numberOfSelections. |
1150 |
||
1151 |
noSel ~~ 0 ifTrue:[ |
|
1152 |
multipleSelectOk ifFalse:[ |
|
1153 |
selectedRowIndex >= start ifTrue:[ |
|
1154 |
selectedRowIndex := selectedRowIndex + size |
|
1155 |
] |
|
1156 |
] ifTrue:[ |
|
1157 |
1 to:noSel do:[:i||v| |
|
1158 |
(v := selectedRowIndex at:i) >= start ifTrue:[ |
|
1159 |
selectedRowIndex at:i put:(v + size) |
|
607 | 1160 |
] |
1161 |
] |
|
1162 |
] |
|
542 | 1163 |
]. |
861 | 1164 |
list addAll:aList beforeIndex:start. |
1165 |
self recomputeHeightOfContents. |
|
1166 |
||
1167 |
y0 := (start - 1) * rowHeight. |
|
1168 |
yD := size * rowHeight. |
|
1169 |
y1 := y0 + yD. |
|
542 | 1170 |
|
1171 |
y0 < viewOrigin y ifTrue:[ |
|
1172 |
self originWillChange. |
|
1948
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
1173 |
viewOrigin := viewOrigin x @ (yD + viewOrigin y). |
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
1174 |
"/ viewOrigin y:(yD + viewOrigin y). |
861 | 1175 |
self originChanged:(0 @ yD). |
1176 |
]. |
|
1177 |
||
1178 |
(shown not or:[self sensor hasDamageFor:self]) ifTrue:[ |
|
2044
8e36106065f0
fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
1179 |
self invalidate. |
8e36106065f0
fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
1180 |
self contentsChanged. |
8e36106065f0
fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
1181 |
^ self |
542 | 1182 |
]. |
645
53c78cc2ee08
redraw twice in case of expose event during adding a new entry
ca
parents:
643
diff
changeset
|
1183 |
|
861 | 1184 |
y0 := self yVisibleOfRowNr:start. |
1258 | 1185 |
h := height - margin. |
1186 |
y1 := y0 + yD min:h. |
|
1187 |
||
1188 |
(y1 > margin and:[y0 < h]) ifTrue:[ |
|
1952 | 1189 |
"/ cg: if I have a non-solid background color, |
1190 |
"/ or individual items have a bgColor selector, |
|
1191 |
"/ invalidate the area (and readraw) instead of a scroll. |
|
1192 |
(viewBackground isImageOrForm |
|
1193 |
or:[ self anyColumnHasPotentialNonConstantBackground ]) |
|
1194 |
ifTrue:[ |
|
1195 |
"/ do not scroll but invalidate ... |
|
1196 |
self invalidateX:margin y:y0 width:width - margin - margin height:(height - y0). |
|
1197 |
] ifFalse:[ |
|
1198 |
h := h - y1. |
|
1199 |
y0 := y0 max:margin. |
|
1200 |
dH := y1 - y0. |
|
1201 |
||
1202 |
start == list size ifFalse:[ |
|
1203 |
self copyFrom:self x:0 y:y0 toX:0 y:y1 width:width height:h async:false |
|
1204 |
]. |
|
1205 |
self invalidateX:margin y:y0 width:width - margin - margin height:dH. |
|
1206 |
] |
|
542 | 1207 |
]. |
1208 |
self contentsChanged. |
|
567 | 1209 |
! |
1210 |
||
542 | 1211 |
addFirst:aRow |
618 | 1212 |
"insert a row at start |
542 | 1213 |
" |
1214 |
^ self add:aRow beforeIndex:1 |
|
1215 |
! |
|
1216 |
||
1487 | 1217 |
remove:aRow |
1218 |
"remove a row |
|
1219 |
" |
|
1220 |
|idx| |
|
1221 |
||
1222 |
idx := list identityIndexOf:aRow. |
|
1223 |
||
1224 |
idx ~~ 0 ifTrue:[ |
|
1225 |
self removeFrom:idx to:idx. |
|
1226 |
]. |
|
1227 |
^ aRow |
|
1228 |
! |
|
1229 |
||
542 | 1230 |
removeFirst |
1231 |
"remove first row; returns the removed row |
|
1232 |
" |
|
1112 | 1233 |
^ self removeIndex:1 |
542 | 1234 |
! |
1235 |
||
861 | 1236 |
removeFrom:startIndex to:stopIndex |
1237 |
"remove rows from start to stop |
|
542 | 1238 |
" |
861 | 1239 |
|coll noRedraw |
1240 |
noSel "{ Class: SmallInteger }" |
|
1241 |
size "{ Class: SmallInteger }" |
|
1242 |
start "{ Class: SmallInteger }" |
|
1243 |
stop "{ Class: SmallInteger }" |
|
1244 |
y0 "{ Class: SmallInteger }" |
|
1245 |
y1 "{ Class: SmallInteger }" |
|
1246 |
oY "{ Class: SmallInteger }" |
|
1247 |
dY "{ Class: SmallInteger }" |
|
1248 |
yB "{ Class: SmallInteger }" |
|
1249 |
h "{ Class: SmallInteger }" |
|
1250 |
| |
|
1251 |
||
1252 |
( (start := startIndex) < 1 |
|
1253 |
or:[(stop := stopIndex) > list size] |
|
1254 |
) ifTrue:[ |
|
1255 |
^ self subscriptBoundsError:start |
|
618 | 1256 |
]. |
861 | 1257 |
size := stop - start + 1. |
1258 |
||
1259 |
beDependentOfRows ifTrue:[ |
|
1260 |
list from:start to:stop do:[:r| r notNil ifTrue:[r removeDependent:self]]. |
|
1261 |
]. |
|
1262 |
noSel := self numberOfSelections. |
|
1263 |
||
1264 |
noSel ~~ 0 ifTrue:[ |
|
1265 |
noSel == 1 ifTrue:[ |
|
1266 |
noSel := self firstIndexSelected. |
|
1267 |
||
1268 |
noSel < start ifFalse:[ |
|
1269 |
noSel > stop ifTrue:[ |
|
1270 |
noSel := noSel - size. |
|
1271 |
||
1272 |
multipleSelectOk ifFalse:[selectedRowIndex := noSel] |
|
1273 |
ifTrue:[selectedRowIndex at:1 put:noSel] |
|
1274 |
] ifFalse:[ |
|
637 | 1275 |
editValue notNil ifTrue:[ |
1276 |
editValue removeDependent:self. |
|
1277 |
editValue := nil. |
|
1278 |
]. |
|
861 | 1279 |
self deselect. |
637 | 1280 |
] |
607 | 1281 |
] |
1282 |
] ifFalse:[ |
|
861 | 1283 |
coll := OrderedCollection new:noSel. |
1284 |
||
1285 |
selectedRowIndex do:[:i| |
|
1286 |
i < start ifTrue:[ |
|
1287 |
coll add:i |
|
1288 |
] ifFalse:[ |
|
1289 |
i > stop ifTrue:[ |
|
1290 |
coll add:(i - size) |
|
1291 |
] |
|
1292 |
] |
|
1293 |
]. |
|
1294 |
coll size == 0 ifTrue:[ |
|
1295 |
self deselect |
|
1296 |
] ifFalse:[ |
|
1297 |
selectedRowIndex := coll |
|
1298 |
] |
|
542 | 1299 |
] |
1300 |
]. |
|
861 | 1301 |
list removeFrom:start to:stop. |
1302 |
||
1303 |
y0 := start - 1 * rowHeight. |
|
1304 |
dY := size * rowHeight. |
|
1305 |
y1 := dY + y0. |
|
542 | 1306 |
yB := y1 + margin - viewOrigin y. |
1307 |
self recomputeHeightOfContents. |
|
1308 |
||
1309 |
y0 < (oY := viewOrigin y) ifTrue:[ |
|
1310 |
(noRedraw := y1 <= oY) ifFalse:[dY := y0 - oY] |
|
861 | 1311 |
ifTrue:[dY := dY negated]. |
542 | 1312 |
self originWillChange. |
1948
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
1313 |
viewOrigin := viewOrigin x @ (dY + oY). |
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
1314 |
"/ viewOrigin y:(dY + oY). |
542 | 1315 |
self originChanged:(0 @ dY). |
1316 |
] ifFalse:[ |
|
1317 |
noRedraw := y0 > (height + viewOrigin y) |
|
1318 |
]. |
|
1319 |
||
1483 | 1320 |
(shown not or:[self sensor hasDamageFor:self]) ifTrue:[ |
1321 |
self invalidate. |
|
1322 |
^ self contentsChanged. |
|
1323 |
]. |
|
1324 |
||
542 | 1325 |
(noRedraw or:[shown not]) ifFalse:[ |
861 | 1326 |
y0 := self yVisibleOfRowNr:start. |
542 | 1327 |
y0 := y0 max:margin. |
1328 |
||
1951 | 1329 |
"/ cg: if I have a non-solid background color, |
1330 |
"/ or individual items have a bgColor selector, |
|
1331 |
"/ invalidate the area (and readraw) instead of a scroll. |
|
1332 |
(viewBackground isImageOrForm |
|
1333 |
or:[ self anyColumnHasPotentialNonConstantBackground ]) |
|
1334 |
ifTrue:[ |
|
1335 |
"/ do not scroll but invalidate ... |
|
1336 |
] ifFalse:[ |
|
1337 |
y1 := yB. |
|
1338 |
h := height - margin - yB. |
|
1339 |
||
1340 |
h > 0 ifTrue:[ |
|
1341 |
self copyFrom:self x:0 y:yB toX:0 y:y0 width:width height:h async:false |
|
1342 |
]. |
|
1343 |
y0 := y0 + h. |
|
561 | 1344 |
]. |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1345 |
self invalidateX:margin y:y0 width:width - margin - margin height:(height - y0). |
542 | 1346 |
]. |
1347 |
self contentsChanged. |
|
861 | 1348 |
! |
1349 |
||
1350 |
removeIndex:aRowNr |
|
1351 |
"remove row at an index; returns the removed row |
|
1352 |
" |
|
1353 |
|row| |
|
1354 |
||
1355 |
row := list at:aRowNr ifAbsent:nil. |
|
1356 |
self removeFrom:aRowNr to:aRowNr. |
|
1357 |
^ row |
|
542 | 1358 |
! |
1359 |
||
1360 |
removeLast |
|
1361 |
"remove last row; the row is returned |
|
1362 |
" |
|
1497 | 1363 |
^ self removeIndex:(list size) |
1956 | 1364 |
! |
1365 |
||
1366 |
replaceFrom:start to:stop with:aCollection startingAt:repStart |
|
1367 |
"replace elements in the receiver between index start and stop, |
|
1368 |
with elements taken from replacementCollection starting at repStart. |
|
1369 |
Return the receiver. |
|
1370 |
" |
|
2032 | 1371 |
|inSelList listSize repStop run| |
1956 | 1372 |
|
1373 |
inSelList := OrderedCollection new. |
|
1374 |
listSize := list size. |
|
1375 |
repStop := repStart + (stop - start). |
|
1376 |
||
1377 |
list isNil ifTrue:[ |
|
1378 |
list := OrderedCollection new |
|
1379 |
]. |
|
1380 |
||
1381 |
[listSize < stop] whileTrue:[ list add:nil. listSize := listSize + 1 ]. |
|
1382 |
||
1383 |
start to:stop do:[:i| |aRow| |
|
1384 |
aRow := list at:i ifAbsent:nil. |
|
1385 |
||
1386 |
aRow notNil ifTrue:[ |
|
1387 |
beDependentOfRows ifTrue:[aRow removeDependent:self]. |
|
1388 |
||
1389 |
(self isInSelection:i) ifTrue:[ |
|
1390 |
inSelList add:i |
|
1391 |
]. |
|
1392 |
list at:i put:nil. |
|
1393 |
] |
|
1394 |
]. |
|
1395 |
||
1396 |
beDependentOfRows ifTrue:[ |
|
1397 |
aCollection from:repStart to:repStop do:[:aRow| |
|
1398 |
aRow notNil ifTrue:[aRow addDependent:self] |
|
1399 |
] |
|
1400 |
]. |
|
1401 |
||
1402 |
run := start. |
|
1403 |
aCollection from:repStart to:repStop do:[:aRow| |
|
1404 |
list at:run put:aRow. |
|
1405 |
run := run + 1. |
|
1406 |
]. |
|
1407 |
self invalidateRowsFrom:start to:stop. |
|
1408 |
||
1409 |
inSelList size ~~ 0 ifTrue:[ |
|
1410 |
self numberOfSelections == inSelList size ifTrue:[ |
|
1411 |
self deselect |
|
1412 |
] ifFalse:[ |
|
1413 |
selectedRowIndex := selectedRowIndex select:[:i| (inSelList identityIndexOf:i) == 0 ]. |
|
1414 |
self selectionChanged. |
|
1415 |
] |
|
1416 |
]. |
|
542 | 1417 |
! ! |
1418 |
||
1419 |
!DSVColumnView methodsFor:'change & update'! |
|
1420 |
||
1492 | 1421 |
changeWidthOfColumn:aColumn deltaX:aDeltaX |
1422 |
||
1423 |
aColumn setDescWidth:(aColumn width + aDeltaX). |
|
1424 |
preferredExtent notNil ifTrue:[self fitColumns] |
|
1425 |
! |
|
1426 |
||
1487 | 1427 |
update:what with:aPara from:chgObj |
542 | 1428 |
"one of my rows/cells changed its value |
1429 |
" |
|
1953
9190339e9fad
lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents:
1952
diff
changeset
|
1430 |
|row newValue realValue listHoldersList arg1 arg2 col idx| |
1487 | 1431 |
|
1432 |
chgObj == columnHolder ifTrue:[ |
|
612 | 1433 |
^ self columnDescriptors:(columnHolder value) |
622 | 1434 |
]. |
1711 | 1435 |
|
1436 |
chgObj == columnAdaptor ifTrue:[ |
|
1437 |
col := columnAdaptor value. |
|
1438 |
columnDescriptors do:[:aCol| aCol columnAdaptor:col]. |
|
1439 |
^ self invalidate |
|
1440 |
]. |
|
1441 |
||
1487 | 1442 |
chgObj == editValue ifTrue:[ |
1227 | 1443 |
newValue := editValue value. |
1673
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1444 |
col := self selectedColumn. |
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1445 |
idx := self firstIndexSelected. |
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1446 |
|
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1447 |
col at:idx put:newValue. |
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1448 |
realValue := col at:idx. |
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1449 |
|
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1450 |
"/ !!!! editValue could be changed before set !!!! therefore: chgObj == editValue |
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1451 |
|
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1452 |
(chgObj == editValue and:[realValue ~= newValue]) ifTrue:[ |
1227 | 1453 |
"/ some validation by the row-object; the stored value |
1454 |
"/ is different from what I think. |
|
1455 |
"/ update my input fields modelValue |
|
1456 |
editValue value:realValue. |
|
1457 |
]. |
|
1673
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1458 |
|
1661 | 1459 |
modifiedChannel notNil ifTrue:[ |
1460 |
modifiedChannel value:true. |
|
1461 |
]. |
|
1227 | 1462 |
^ self |
622 | 1463 |
]. |
1464 |
||
1487 | 1465 |
chgObj == model ifTrue:[ |
1466 |
(what == #selectionIndex or:[what == #selection]) ifTrue:[ |
|
1467 |
^ self selectRowIndex:(model selectionIndex copy) |
|
1468 |
]. |
|
1469 |
what == #list ifTrue:[ |
|
1470 |
^ self listHolder:model list |
|
1471 |
]. |
|
1472 |
what == #value ifTrue:[ |
|
1473 |
model == listHolder ifTrue:[ |
|
1474 |
self list:(listHolder value) |
|
1475 |
] ifFalse:[ |
|
1476 |
self selectRowIndex:model value |
|
1477 |
] |
|
1478 |
]. |
|
1479 |
^ self |
|
1480 |
]. |
|
1481 |
||
1482 |
chgObj == listHolder ifTrue:[ |
|
1953
9190339e9fad
lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents:
1952
diff
changeset
|
1483 |
listHoldersList := listHolder value. |
1487 | 1484 |
|
1485 |
what == #value ifTrue:[ |
|
1953
9190339e9fad
lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents:
1952
diff
changeset
|
1486 |
^ self list:listHoldersList |
1487 | 1487 |
]. |
1488 |
aPara isCollection ifTrue:[ |
|
1489 |
arg1 := aPara at:1. |
|
1490 |
arg2 := aPara at:2. |
|
1491 |
] ifFalse:[ |
|
1492 |
arg1 := arg2 := aPara |
|
1493 |
]. |
|
1494 |
||
1495 |
what == #at: ifTrue:[ |
|
1953
9190339e9fad
lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents:
1952
diff
changeset
|
1496 |
^ self at:arg1 put:(listHoldersList at:arg1) |
1487 | 1497 |
]. |
1498 |
||
1499 |
what == #insert: ifTrue:[ |
|
1953
9190339e9fad
lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents:
1952
diff
changeset
|
1500 |
^ self add:(listHoldersList at:arg1) beforeIndex:arg1 |
1487 | 1501 |
]. |
1502 |
||
1503 |
what == #remove: ifTrue:[ |
|
1504 |
^ self removeFrom:arg1 to:arg1 |
|
1505 |
]. |
|
1506 |
what == #removeFrom: ifTrue:[ |
|
1954 | 1507 |
listHoldersList size == 0 ifTrue:[self list:nil] |
1487 | 1508 |
ifFalse:[self removeFrom:arg1 to:arg2]. |
1509 |
^ self |
|
1510 |
]. |
|
1511 |
||
1512 |
what == #insertCollection: ifTrue:[ |
|
1513 |
arg2 ~~ 0 ifTrue:[ |
|
1953
9190339e9fad
lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents:
1952
diff
changeset
|
1514 |
self addAll:(listHoldersList copyFrom:arg1 to:(arg1 + arg2 - 1)) beforeIndex:arg1 |
1487 | 1515 |
]. |
1516 |
^ self. |
|
1517 |
]. |
|
1518 |
what == #replace: ifTrue:[ |
|
1956 | 1519 |
self replaceFrom:arg1 to:arg2 with:listHoldersList startingAt:arg1. |
2537 | 1520 |
^ self |
1487 | 1521 |
]. |
2537 | 1522 |
self list:listHoldersList. |
1487 | 1523 |
^ self |
1524 |
]. |
|
1593 | 1525 |
arg1 := aPara ? what. |
1487 | 1526 |
row := (what isNumber) ifTrue:[what] ifFalse:[chgObj]. |
2190 | 1527 |
self invalidateVisibleRow:row readSelector:arg1. |
1593 | 1528 |
|
1661 | 1529 |
"Modified: / 30.1.2000 / 12:16:49 / cg" |
809 | 1530 |
! ! |
1531 |
||
1532 |
!DSVColumnView methodsFor:'drag & drop'! |
|
1533 |
||
824 | 1534 |
canDrag |
1535 |
"returns true if dragging is enabled |
|
1536 |
" |
|
1537 |
^ dropSource notNil |
|
1538 |
||
1539 |
! |
|
1540 |
||
2575 | 1541 |
dragAutoScroll:aContext |
1542 |
"called by the DragAndDropManager to scroll during a drag/drop operation |
|
1543 |
if necassery (decided by the widget itself); If a scroll is done return |
|
1544 |
true otherwise false (used to restore the background) |
|
1545 |
" |
|
1546 |
|yInset absLnNr y| |
|
1547 |
||
1548 |
y := aContext targetPoint y. |
|
1549 |
yInset := margin + rowHeight. |
|
1550 |
y > yInset ifTrue:[ |
|
1551 |
y >= (height - yInset) ifFalse:[^ false]. |
|
1552 |
]. |
|
1553 |
||
1554 |
absLnNr := self yVisibleToRowNr:y. |
|
1555 |
absLnNr isNil ifTrue:[^ false]. |
|
1556 |
||
1557 |
(absLnNr > 1 and:[absLnNr < self size]) ifFalse:[ |
|
1558 |
^ false |
|
1559 |
]. |
|
1560 |
aContext contentsWillChange. |
|
1561 |
||
2580 | 1562 |
y > yInset |
1563 |
ifTrue:[self scrollDown:rowHeight] |
|
1564 |
ifFalse:[self scrollUp:rowHeight]. |
|
2575 | 1565 |
|
1566 |
^ true |
|
1567 |
! |
|
1568 |
||
824 | 1569 |
dropSource |
1570 |
"returns the dropSource or nil |
|
809 | 1571 |
" |
824 | 1572 |
^ dropSource |
1573 |
||
1574 |
||
1575 |
! |
|
1576 |
||
1577 |
dropSource:aDropSourceOrNil |
|
1578 |
"set the dropSource or nil |
|
1579 |
" |
|
1580 |
dropSource := aDropSourceOrNil. |
|
1581 |
||
809 | 1582 |
|
1583 |
! |
|
1584 |
||
824 | 1585 |
dropTarget |
1586 |
"returns the dropTarget or nil |
|
809 | 1587 |
" |
824 | 1588 |
^ dropTarget |
1589 |
||
1590 |
! |
|
1591 |
||
1592 |
dropTarget:aDropTragetOrNil |
|
1593 |
"set the dropTarget or nil |
|
1594 |
" |
|
1595 |
dropTarget := aDropTragetOrNil. |
|
1596 |
||
1597 |
! |
|
1598 |
||
1599 |
startDragAt:aPoint |
|
2398 | 1600 |
|
1601 |
dropSource notNil ifTrue:[ |
|
1602 |
dropSource startDragIn:self at:aPoint. |
|
1603 |
buttonReleaseAction := buttonMotionAction := nil. |
|
809 | 1604 |
] |
542 | 1605 |
! ! |
1606 |
||
637 | 1607 |
!DSVColumnView methodsFor:'drawing'! |
1608 |
||
1609 |
colorOnDevice:aColor |
|
1610 |
"returns color on device |
|
1611 |
" |
|
1612 |
|col| |
|
1613 |
||
641 | 1614 |
aColor = Color noColor ifFalse:[ |
1615 |
col := colorMap at:aColor ifAbsent:nil. |
|
637 | 1616 |
|
641 | 1617 |
col isNil ifTrue:[ |
1480 | 1618 |
colorMap at:aColor put:(col := aColor onDevice:device) |
641 | 1619 |
]. |
1620 |
^ col |
|
637 | 1621 |
]. |
641 | 1622 |
^ bgColor |
637 | 1623 |
! |
1624 |
||
1625 |
forceRedraw |
|
1626 |
"a redraw forced by any other component |
|
1627 |
" |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1628 |
shown ifTrue:[ |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1629 |
self invalidate |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1630 |
] |
637 | 1631 |
! |
1632 |
||
1633 |
invalidate |
|
1634 |
"recompute extent before repair range |
|
1635 |
" |
|
1636 |
self recomputeHeightOfContents. |
|
1637 |
super invalidate. |
|
1638 |
||
1639 |
||
1640 |
! |
|
1641 |
||
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1642 |
invalidateRowAt:aRowNr |
637 | 1643 |
"redraw total row at an index |
1644 |
" |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1645 |
self invalidateRowAt:aRowNr colAt:0 |
637 | 1646 |
! |
1647 |
||
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1648 |
invalidateRowAt:aRowNr colAt:aColNr |
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1649 |
"redraw either a single column in a row, |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1650 |
or the complete visible row (in case of aColNr == 0). |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1651 |
If the row/column is hidden, no redraw is done |
637 | 1652 |
" |
1497 | 1653 |
|x "{ Class:SmallInteger }" |
1654 |
y "{ Class:SmallInteger }" |
|
1655 |
h "{ Class:SmallInteger }" |
|
1656 |
w "{ Class:SmallInteger }" |
|
2523
a7d71e57632f
care for non-existing column
Claus Gittinger <cg@exept.de>
parents:
2500
diff
changeset
|
1657 |
col| |
1497 | 1658 |
|
1659 |
(shown and:[aRowNr notNil and:[aRowNr between:1 and:list size]]) ifTrue:[ |
|
1131 | 1660 |
h := rowHeight. |
1497 | 1661 |
y := self yVisibleOfRowNr:aRowNr. |
1662 |
||
1663 |
y < margin ifTrue:[ |
|
637 | 1664 |
(h := h + y) <= margin ifTrue:[ |
1665 |
^ self |
|
1666 |
]. "/ row not visible |
|
1667 |
h := h - margin. |
|
1668 |
y := margin. |
|
1669 |
] ifFalse:[ |
|
1670 |
y >= height ifTrue:[^ self]. |
|
1671 |
]. |
|
1672 |
aColNr ~~ 0 ifTrue:[ "/ redraw column in row |
|
2523
a7d71e57632f
care for non-existing column
Claus Gittinger <cg@exept.de>
parents:
2500
diff
changeset
|
1673 |
col := (self columnAt:aColNr). |
a7d71e57632f
care for non-existing column
Claus Gittinger <cg@exept.de>
parents:
2500
diff
changeset
|
1674 |
w := col isNil ifTrue:0 ifFalse:[col width]. |
1497 | 1675 |
x := self xVisibleOfColNr:aColNr. |
1676 |
||
1677 |
x < margin ifTrue:[ |
|
637 | 1678 |
(w := w + x) <= margin ifTrue:[ |
1679 |
^ self |
|
1680 |
]. "/ column not visible |
|
1681 |
w := w - margin. |
|
1682 |
x := margin. |
|
1683 |
] ifFalse:[ |
|
1684 |
x >= width ifTrue:[^ self]. |
|
1685 |
] |
|
1686 |
] ifFalse:[ "/ redraw whole row |
|
1687 |
x := margin. |
|
1688 |
w := width. |
|
1689 |
]. |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1690 |
self invalidateX:x y:y width:w height:h |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1691 |
] |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1692 |
! |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1693 |
|
2469
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
1694 |
invalidateRows:aCollection |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
1695 |
"redraw some visible rows" |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
1696 |
|
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
1697 |
shown ifTrue:[ |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
1698 |
aCollection do:[:rowIndex | |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
1699 |
self invalidateRowAt:rowIndex |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
1700 |
] |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
1701 |
] |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
1702 |
! |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
1703 |
|
1956 | 1704 |
invalidateRowsFrom:aStart to:aStop |
1705 |
"redraw visible row from start to stop |
|
1706 |
" |
|
1707 |
|size start stop y0 y1| |
|
1708 |
||
1709 |
shown ifTrue:[ |
|
1710 |
size := list size. |
|
1711 |
start := aStart notNil ifTrue:[aStart max:1] ifFalse:[1]. |
|
1712 |
stop := aStop notNil ifTrue:[aStop min:size] ifFalse:[size]. |
|
1713 |
||
1714 |
start <= stop ifTrue:[ |
|
1715 |
y0 := (self yVisibleOfRowNr:start) max:margin. |
|
1716 |
y1 := ((self yVisibleOfRowNr:stop) + rowHeight) min:height. |
|
1717 |
||
1718 |
y0 < y1 ifTrue:[ |
|
1719 |
self invalidateX:margin y:y0 width:width height:(y1 - y0) |
|
1720 |
] |
|
1721 |
] |
|
1722 |
] |
|
1723 |
! |
|
1724 |
||
2190 | 1725 |
invalidateVisibleRow:aRow |
637 | 1726 |
"redraw row if visible |
1727 |
" |
|
2190 | 1728 |
self invalidateVisibleRow:aRow colAt:0 |
809 | 1729 |
! |
1730 |
||
2190 | 1731 |
invalidateVisibleRow:aRow colAt:aColNr |
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1732 |
"redraw either a single column in a row, |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1733 |
or the complete visible row (in case of aColNr == 0). |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1734 |
If the row/column is hidden, no redraw is done |
809 | 1735 |
" |
637 | 1736 |
|start "{ Class:SmallInteger }" |
1737 |
stop "{ Class:SmallInteger }" |
|
1738 |
| |
|
1739 |
||
1740 |
(start := self indexOfFirstRowShown) ~~ 0 ifTrue:[ |
|
1497 | 1741 |
stop := (start + (height // rowHeight)) min:(list size). |
637 | 1742 |
|
1743 |
aRow isNumber ifTrue:[ |
|
1744 |
(aRow between:start and:stop) ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1745 |
self invalidateRowAt:aRow colAt:aColNr |
637 | 1746 |
] |
1747 |
] ifFalse:[ |
|
1748 |
start to:stop do:[:i| |
|
1749 |
(self at:i) == aRow ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1750 |
^ self invalidateRowAt:i colAt:aColNr |
637 | 1751 |
] |
1752 |
] |
|
1753 |
] |
|
1754 |
] |
|
809 | 1755 |
! |
1756 |
||
2190 | 1757 |
invalidateVisibleRow:aRow readSelector:aSelector |
809 | 1758 |
"redraw a column identified by its read selector; if no column with |
1759 |
the specified read selector is detected, the whole line is drawn. |
|
1760 |
" |
|
1761 |
|row idx| |
|
1762 |
||
1763 |
aSelector isNil ifTrue:[ |
|
1764 |
idx := 0 |
|
1765 |
] ifFalse:[ |
|
1766 |
(row := aRow) isNumber ifTrue:[ |
|
1767 |
(row := self at:aRow) isNil ifTrue:[ ^ self ] |
|
1768 |
]. |
|
1769 |
idx := columnDescriptors findFirst:[:aCol||desc| |
|
1770 |
aCol description readSelector == aSelector |
|
1771 |
] |
|
1772 |
]. |
|
2190 | 1773 |
self invalidateVisibleRow:aRow colAt:idx |
637 | 1774 |
! |
1775 |
||
1776 |
redrawX:x y:y width:w height:h |
|
1777 |
"redraw part of myself immediately, given logical coordinates |
|
1778 |
" |
|
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1779 |
|c0 savClip stopRedraw |
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1780 |
start "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1781 |
stop "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1782 |
x0 "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1783 |
x1 "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1784 |
maxX "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1785 |
yTop "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1786 |
yBot "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1787 |
clHg "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1788 |
size "{ Class:SmallInteger }" |
637 | 1789 |
| |
1790 |
||
1791 |
shown ifFalse:[^ self]. |
|
1792 |
self paint:bgColor. |
|
1115 | 1793 |
|
1794 |
columnDescriptors isEmpty ifTrue:[ |
|
1795 |
^ self fillRectangleX:x y:y width:w height:h |
|
1796 |
]. |
|
1131 | 1797 |
size := list size. |
1115 | 1798 |
yTop := margin - viewOrigin y. |
1799 |
c0 := y - yTop max:0. |
|
1800 |
start := (c0 // rowHeight) + 1. |
|
1131 | 1801 |
stop := (c0 + h - 1 // rowHeight + 1) min:size. |
1115 | 1802 |
|
1803 |
stop < start ifTrue:[ |
|
1804 |
^ self fillRectangleX:x y:y width:w height:h |
|
1805 |
]. |
|
1806 |
savClip := clipRect. |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1807 |
|
1115 | 1808 |
maxX := (x + w) min:(width - margin). |
1809 |
x0 := margin - viewOrigin x. |
|
1810 |
yTop := yTop + ((start - 1) * rowHeight). |
|
1131 | 1811 |
clHg := (stop - start + 1) * rowHeight. |
1812 |
yBot := yTop + clHg. |
|
1813 |
||
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1814 |
stopRedraw := false. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1815 |
|
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1816 |
self class stopRedrawSignal handle:[:ex| |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1817 |
stopRedraw := true. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1818 |
] do:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1819 |
columnDescriptors do:[:aCol| |cw| |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1820 |
x1 := x0 + aCol width. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1821 |
|
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1822 |
(x1 > x and:[x0 < maxX]) ifTrue:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1823 |
|left right rect| |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1824 |
left := x0 max:x. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1825 |
right := x1 min:maxX. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1826 |
rect := Rectangle left:left top:y width:(right - left) height:h. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1827 |
|
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1828 |
clipRect := nil. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1829 |
self clippingRectangle:rect. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1830 |
aCol redrawX:x0 y:yTop h:clHg from:start to:stop. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1831 |
]. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1832 |
x0 := x1 |
1115 | 1833 |
]. |
1834 |
]. |
|
1131 | 1835 |
|
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1836 |
"/ restore old clipping rectangle |
1115 | 1837 |
self clippingRectangle:savClip. |
1131 | 1838 |
|
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1839 |
stopRedraw ifTrue:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1840 |
self invalidate. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1841 |
self makeSelectionVisible. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1842 |
^ self |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1843 |
]. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1844 |
|
1131 | 1845 |
stop == size ifTrue:[ |
1115 | 1846 |
yTop := y + h. |
1847 |
yBot < (yTop - margin) ifTrue:[ |
|
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1848 |
"/ clear to bottom of screen |
1115 | 1849 |
self paint:bgColor. |
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1850 |
self fillRectangleX:x y:yBot width:w height:(yTop - yBot). |
1112 | 1851 |
] |
1136 | 1852 |
]. |
1853 |
||
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1854 |
(c0 := w + x- x1) > 0 ifTrue:[ |
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1855 |
"/ clear to right of screen |
1136 | 1856 |
self paint:bgColor. |
1857 |
self fillRectangleX:x1 y:y width:c0 height:h. |
|
1858 |
]. |
|
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1859 |
|
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1860 |
"/ draw the selection in the right part, after the last column |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1861 |
x1 < (width-margin) ifTrue:[ |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1862 |
self hasRowSelection ifTrue:[ |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1863 |
self selectionIndicesDo:[:selIdx | |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1864 |
|y| |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1865 |
|
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1866 |
y := self yVisibleOfRowNr:selIdx. |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
1867 |
self paint:selectionBackgroundColor. |
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1868 |
self |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1869 |
fillRectangleX:x1 y:y |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1870 |
width:(width-margin-x1) height:rowHeight. |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1871 |
]. |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1872 |
]. |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1873 |
]. |
1112 | 1874 |
! ! |
1875 |
||
1876 |
!DSVColumnView methodsFor:'drawing interactors'! |
|
1877 |
||
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1878 |
displayLabel:aLabel x:xLeft y:yTop |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1879 |
"display the label at x y; test whether the height of the label matches to the current |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1880 |
rowHeight. If not, an exception is raised and the rowHeight is recomputed |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1881 |
" |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1882 |
|y h | |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1883 |
|
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1884 |
aLabel notNil ifTrue:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1885 |
aLabel isString ifTrue:[ |
2593
24ddc48c5ad4
bugfix: recomputation of rowHeight if label is heigher than current rowHeight
ca
parents:
2592
diff
changeset
|
1886 |
y := yTop + self rowFontAscent. |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1887 |
] ifFalse:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1888 |
h := aLabel heightOn:self. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1889 |
|
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1890 |
h > minRowHeight ifTrue:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1891 |
minRowHeight := h. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1892 |
|
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1893 |
preferredExtent notNil ifTrue:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1894 |
rowHeight := (minRowHeight + separatorSize + verticalSpacing + verticalSpacing + 1) // 2 * 2. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1895 |
preferredExtent := preferredExtent copy. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1896 |
preferredExtent y: (list size * rowHeight). |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1897 |
self contentsChanged. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1898 |
]. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1899 |
self class stopRedrawSignal raiseRequest. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1900 |
]. |
2593
24ddc48c5ad4
bugfix: recomputation of rowHeight if label is heigher than current rowHeight
ca
parents:
2592
diff
changeset
|
1901 |
y := yTop + (aLabel ascentOn:self). |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1902 |
]. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1903 |
aLabel displayOn:self x:xLeft y:y. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1904 |
]. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1905 |
! |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1906 |
|
1131 | 1907 |
drawCheckToggleAtX:xTop y:yTop w:rowWidth state:aState |
1112 | 1908 |
"draw a check toggle button |
1909 |
" |
|
1910 |
|e form |
|
1911 |
y "{ Class:SmallInteger }" |
|
1912 |
x "{ Class:SmallInteger }" |
|
1913 |
h "{ Class:SmallInteger }" |
|
1914 |
w "{ Class:SmallInteger }" |
|
1915 |
| |
|
1916 |
w := checkToggleExtent x. |
|
1917 |
h := checkToggleExtent y. |
|
1918 |
y := yTop + (rowHeight - h // 2). |
|
1919 |
x := xTop + (rowWidth - w // 2). |
|
1529 | 1920 |
h odd ifTrue:[y := y + 1]. |
1112 | 1921 |
|
1922 |
(form := checkToggleActiveImage) isNil ifTrue:[ |
|
1131 | 1923 |
self paint:bgColor. |
1924 |
self fillRectangleX:x y:y width:w height:h. |
|
1925 |
self drawEdgesAtX:x y:y width:w height:h level:checkToggleLevel on:self. |
|
1926 |
||
1112 | 1927 |
aState ifFalse:[ |
1928 |
^ self |
|
1929 |
]. |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1930 |
self paint:fgColor on:bgColor. |
1112 | 1931 |
form := checkToggleForm |
1932 |
] ifFalse:[ |
|
1933 |
aState ifFalse:[form := checkTogglePassiveImage] |
|
859 | 1934 |
]. |
1112 | 1935 |
e := (checkToggleExtent - form extent) // 2. |
1936 |
self displayForm:form x:(x + e x) y:(y + e y). |
|
1937 |
||
1938 |
||
1939 |
||
1940 |
||
1941 |
||
1942 |
! |
|
1943 |
||
1131 | 1944 |
drawComboButtonAtX:xTop y:yTop w:rowWidth |
1112 | 1945 |
"draw a combo button |
1946 |
" |
|
1947 |
|e |
|
1948 |
x "{ Class:SmallInteger }" |
|
1949 |
y "{ Class:SmallInteger }" |
|
1950 |
h "{ Class:SmallInteger }" |
|
1951 |
w "{ Class:SmallInteger }" |
|
1952 |
| |
|
1953 |
w := comboButtonExtent x. |
|
1954 |
h := comboButtonExtent y. |
|
1955 |
y := yTop + (rowHeight - h // 2). |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1956 |
x := xTop + (rowWidth - w - separatorSize - 1). |
1112 | 1957 |
e := (comboButtonExtent - comboButtonForm extent) // 2. |
1958 |
||
1131 | 1959 |
self paint:bgColor. |
1960 |
self fillRectangleX:x y:y width:w height:h. |
|
1961 |
self drawEdgesAtX:x y:y width:w height:h level:comboButtonLevel on:self. |
|
1136 | 1962 |
self paint:fgColor on:bgColor. |
1112 | 1963 |
self displayForm:comboButtonForm x:(x + e x) y:(y + e y) |
1964 |
||
1965 |
! |
|
1966 |
||
1967 |
drawEdgesAtX:x y:y width:w height:h level:aLevel on:aGC |
|
1968 |
"draw edges for a cell or label |
|
1969 |
" |
|
1970 |
aGC drawEdgesForX:x |
|
1971 |
y:y |
|
1972 |
width:w |
|
1973 |
height:h |
|
1974 |
level:aLevel |
|
1975 |
shadow:buttonShadowColor |
|
1976 |
light:buttonLightColor |
|
1977 |
halfShadow:buttonHalfShadowColor |
|
1978 |
halfLight:buttonHalfLightColor |
|
1979 |
style:ButtonEdgeStyle. |
|
1980 |
||
637 | 1981 |
! ! |
1982 |
||
542 | 1983 |
!DSVColumnView methodsFor:'enumerating columns'! |
1984 |
||
1985 |
columnsDo:aOneArgBlock |
|
1986 |
"evaluate the argument, aOneArgBlock for every column |
|
1987 |
" |
|
1988 |
columnDescriptors do:aOneArgBlock |
|
1989 |
||
1990 |
||
1991 |
! |
|
1992 |
||
1993 |
columnsFrom:start to:stop do:aOneArgBlock |
|
1994 |
"evaluate the argument, aOneArgBlock for the columns with index start to |
|
1995 |
stop in the collection of column descriptors |
|
1996 |
" |
|
1997 |
columnDescriptors from:start to:stop do:aOneArgBlock |
|
1998 |
||
1999 |
||
2000 |
! ! |
|
2001 |
||
2002 |
!DSVColumnView methodsFor:'event handling'! |
|
2003 |
||
2398 | 2004 |
buttonControlPressAtRowNr:aStartRow |
2005 |
|isSelected prvRow doAdd chgSet| |
|
2006 |
||
2007 |
buttonMotionAction := nil. |
|
2008 |
isSelected := self isInSelection:aStartRow. |
|
2009 |
||
2010 |
isSelected ifTrue:[ self removeRowFromSelection:aStartRow ] |
|
2011 |
ifFalse:[ self addRowToSelection:aStartRow ]. |
|
2012 |
||
2013 |
multipleSelectOk ifFalse:[ ^ self ]. |
|
2014 |
||
2015 |
prvRow := aStartRow. |
|
2016 |
chgSet := IdentitySet new. |
|
2017 |
doAdd := isSelected not. |
|
2018 |
||
2019 |
buttonMotionAction := [:p| |rowNr mustRestore step f| |
|
2020 |
rowNr := self yVisibleToRowNr:(p y). |
|
2021 |
||
2022 |
(rowNr notNil and:[rowNr ~~ prvRow]) ifTrue:[ |
|
2023 |
rowNr == aStartRow ifTrue:[ |
|
2024 |
mustRestore := true |
|
2025 |
] ifFalse:[ |
|
2026 |
rowNr > aStartRow ifTrue:[ mustRestore := (rowNr < prvRow) ] |
|
2027 |
ifFalse:[ mustRestore := (rowNr > prvRow) ]. |
|
2028 |
]. |
|
2029 |
prvRow > rowNr ifTrue:[ step := -1 ] |
|
2030 |
ifFalse:[ step := 1 ]. |
|
2031 |
mustRestore ifTrue:[ |
|
2032 |
[ prvRow ~~ rowNr ] whileTrue:[ |
|
2033 |
(chgSet removeIdentical:prvRow ifAbsent:nil) notNil ifTrue:[ |
|
2034 |
doAdd ifFalse:[ self addRowToSelection:prvRow ] |
|
2035 |
ifTrue:[ self removeRowFromSelection:prvRow ]. |
|
2036 |
]. |
|
2037 |
prvRow := prvRow + step. |
|
2038 |
]. |
|
2039 |
] ifFalse:[ |
|
2040 |
[ prvRow ~~ rowNr ] whileTrue:[ |
|
2041 |
prvRow := prvRow + step. |
|
2042 |
||
2043 |
doAdd ~~ (self isInSelection:rowNr) ifTrue:[ |
|
2044 |
chgSet add:prvRow. |
|
2045 |
||
2046 |
doAdd ifTrue:[ self addRowToSelection:prvRow ] |
|
2047 |
ifFalse:[ self removeRowFromSelection:prvRow ]. |
|
2048 |
] |
|
2049 |
]. |
|
2050 |
]. |
|
2051 |
]. |
|
2052 |
]. |
|
2053 |
! |
|
2054 |
||
607 | 2055 |
buttonMotion:buttonMask x:x y:y |
2056 |
"mouse-move while button was pressed - handle multiple selection changes |
|
2057 |
" |
|
1809 | 2058 |
self isEnabled ifFalse:[^ self]. |
2059 |
||
2398 | 2060 |
buttonMotionAction notNil ifTrue:[ |
2061 |
buttonMotionAction value:(x@y). |
|
2062 |
||
2063 |
buttonMotionAction notNil ifTrue:[ |
|
2064 |
autoScroll ifTrue:[ |
|
2065 |
"/ if moved outside of view, start autoscroll |
|
2066 |
(y < 0) ifTrue:[ |
|
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
2067 |
^ self startAutoScroll:#scrollUp distance:y. |
2398 | 2068 |
]. |
2069 |
(y > height) ifTrue:[ |
|
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
2070 |
^ self startAutoScroll:#scrollDown distance:(y - height). |
2398 | 2071 |
]. |
2072 |
] |
|
607 | 2073 |
] |
2074 |
]. |
|
2398 | 2075 |
self stopAutoScroll. |
607 | 2076 |
! |
2077 |
||
542 | 2078 |
buttonMultiPress:button x:x y:y |
2079 |
"a button was pressed twice - handle doubleclick here |
|
2080 |
" |
|
2398 | 2081 |
buttonMotionAction := buttonReleaseAction := nil. |
2082 |
||
1805 | 2083 |
self isEnabled ifFalse:[^ self]. |
2084 |
||
542 | 2085 |
((button == 1) or:[button == #select]) ifFalse:[ |
2086 |
^ super buttonMultiPress:button x:x y:y |
|
2087 |
]. |
|
607 | 2088 |
self numberOfSelections == 1 ifTrue:[ |
2089 |
self firstIndexSelected == (self yVisibleToRowNr:y) ifTrue:[ |
|
2090 |
( selectedColIndex == 0 |
|
2091 |
or:[selectedColIndex == (self xVisibleToColNr:x)] |
|
2092 |
) ifTrue:[ |
|
2093 |
self doubleClicked |
|
2094 |
] |
|
542 | 2095 |
] |
2096 |
] |
|
2097 |
! |
|
2098 |
||
2099 |
buttonPress:button x:x y:y |
|
2100 |
"a button was pressed - handle selection here |
|
2101 |
" |
|
2398 | 2102 |
|rowNr colNr menu sensor clickPoint| |
2103 |
||
2104 |
buttonMotionAction := buttonReleaseAction := nil. |
|
542 | 2105 |
|
1805 | 2106 |
self isEnabled ifFalse:[^ self]. |
2107 |
||
1947
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
2108 |
sensor := self sensor. |
809 | 2109 |
|
667 | 2110 |
((button == 2) or:[button == #menu]) ifTrue:[ |
2398 | 2111 |
menu := self findMenuForSelection. |
2112 |
||
2113 |
menu notNil ifTrue:[ self startUpMenu:menu ] |
|
2114 |
ifFalse:[ super buttonPress:button x:x y:y ]. |
|
2115 |
^ self |
|
2116 |
]. |
|
2117 |
||
2118 |
( (rowNr := self yVisibleToRowNr:y) notNil |
|
2119 |
and:[(colNr := self xVisibleToColNr:x) notNil] |
|
2120 |
) ifFalse:[ |
|
2121 |
super buttonPress:button x:x y:y. |
|
2122 |
^ self |
|
2123 |
]. |
|
2124 |
||
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2125 |
(self isRowSelectable:rowNr) ifFalse:[^ self ]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2126 |
|
2398 | 2127 |
sensor ctrlDown ifTrue:[ |
2128 |
self buttonControlPressAtRowNr:rowNr. |
|
2129 |
^ self |
|
2130 |
]. |
|
2131 |
||
2132 |
sensor shiftDown ifTrue:[ |
|
2133 |
(multipleSelectOk and:[selectedRowIndex size ~~ 0]) ifTrue:[ |
|
2134 |
self selectRowFrom:(selectedRowIndex min min:rowNr) |
|
2135 |
to:(selectedRowIndex max max:rowNr). |
|
2136 |
] ifFalse:[ |
|
2137 |
self selectColIndex:0 rowIndex:rowNr. |
|
2138 |
]. |
|
2139 |
^ self |
|
2140 |
]. |
|
2141 |
||
2142 |
(self canDrag and:[self isSelected:rowNr inColumn:colNr]) ifTrue:[ |
|
2143 |
clickPoint := x @ y. |
|
2144 |
buttonReleaseAction := [ self selectRowAt:rowNr colAt:colNr atPoint:(x @ y) ]. |
|
2145 |
||
2146 |
buttonMotionAction := [:aPoint| |
|
2147 |
(clickPoint dist:aPoint) > 5.0 ifTrue:[ |
|
2148 |
buttonReleaseAction := buttonMotionAction := nil. |
|
2149 |
self startDragAt:aPoint. |
|
2150 |
] |
|
2151 |
]. |
|
2152 |
^ self. |
|
2153 |
]. |
|
2154 |
||
2155 |
self withWaitCursorDo:[ |
|
2156 |
self selectRowAt:rowNr colAt:colNr atPoint:(x @ y) |
|
2157 |
]. |
|
2158 |
||
2159 |
(multipleSelectOk and:[selectedColIndex == 0 and:[selectedRowIndex size == 1]]) ifTrue:[ |
|
2160 |
buttonMotionAction := [:p| |r| |
|
2161 |
r := self yVisibleToRowNr:(p y). |
|
2162 |
r notNil ifTrue:[ self selectRowFrom:rowNr to:r ]. |
|
542 | 2163 |
] |
2164 |
]. |
|
2165 |
! |
|
2166 |
||
643 | 2167 |
buttonRelease:button x:x y:y |
2168 |
||
2398 | 2169 |
buttonMotionAction := nil. |
1749 | 2170 |
self stopAutoScroll. |
2171 |
||
2398 | 2172 |
buttonReleaseAction notNil ifTrue:[ |
2173 |
buttonReleaseAction value. |
|
2174 |
buttonReleaseAction := nil. |
|
643 | 2175 |
]. |
2176 |
super buttonRelease:button x:x y:y |
|
2177 |
! |
|
2178 |
||
809 | 2179 |
characterPress:aChar x:x y:y |
2180 |
"search row in column at x/y starting its printable label with cahracter. |
|
2181 |
" |
|
2182 |
|colNr rowNr lsize found column| |
|
2183 |
||
2445
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2184 |
lsize := list size. |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2185 |
|
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2186 |
"/ (rowIfAbsentBlock notNil |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2187 |
"/ or:[x isNil |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2188 |
"/ or:[(colNr := self xVisibleToColNr:x) isNil]]) ifTrue:[ |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2189 |
"/ ^ self |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2190 |
"/ ]. |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2191 |
colNr := self findFirstColumnWithStringFrom:1 to:lsize. |
2535 | 2192 |
colNr isNil ifTrue:[ ^ self ]. |
2193 |
||
809 | 2194 |
rowNr := self lastIndexSelected. |
2195 |
column := self columnAt:colNr. |
|
2196 |
found := 0. |
|
2197 |
||
2198 |
lsize > rowNr ifTrue:[ |
|
2445
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2199 |
"/ search to end |
809 | 2200 |
found := column findRowNrStartingWithChar:aChar start:(rowNr + 1) stop:lsize. |
2201 |
]. |
|
2202 |
||
2203 |
(found == 0 and:[rowNr > 1]) ifTrue:[ |
|
2204 |
"/ search from begin |
|
2205 |
found := column findRowNrStartingWithChar:aChar start:1 stop:(rowNr - 1) |
|
2206 |
]. |
|
2207 |
found ~~ 0 ifTrue:[ |
|
2208 |
self selectColIndex:colNr rowIndex:found. |
|
2209 |
]. |
|
2210 |
||
896
aa07612a7c04
care for redirected messages in characterPress:
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
2211 |
"Modified: / 21.5.1998 / 03:30:22 / cg" |
809 | 2212 |
! |
2213 |
||
542 | 2214 |
contentsChanged |
2215 |
"contents changed - move origin up if possible |
|
2216 |
" |
|
2217 |
|y| |
|
2218 |
||
2219 |
shown ifTrue:[ |
|
2220 |
self recomputeHeightOfContents. |
|
2221 |
y := self maxViewOriginY. |
|
2222 |
||
2223 |
viewOrigin y > y ifTrue:[ |
|
1948
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
2224 |
scrollWhenUpdating ~~ false ifTrue:[ |
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
2225 |
self scrollTo:(viewOrigin x @ y) |
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
2226 |
] |
542 | 2227 |
] ifFalse:[ |
2228 |
self updateEditViewOrigin. |
|
2229 |
] |
|
2230 |
]. |
|
2231 |
super contentsChanged |
|
2232 |
! |
|
2233 |
||
2234 |
doubleClicked |
|
2235 |
"handle a double click |
|
2236 |
" |
|
637 | 2237 |
|col sel idx| |
2238 |
||
2239 |
self hasSelection ifTrue:[ |
|
2240 |
idx := self firstIndexSelected. |
|
2241 |
col := self selectedColumn. |
|
2242 |
(col notNil and:[(sel := col doubleClickedSelector) notNil]) ifTrue:[ |
|
2074 | 2243 |
col doubleClickOn:idx |
637 | 2244 |
] ifFalse:[ |
2245 |
doubleClickActionBlock notNil ifTrue:[ |
|
2246 |
doubleClickActionBlock value:idx |
|
2247 |
] |
|
2248 |
] |
|
2249 |
] |
|
542 | 2250 |
! |
2251 |
||
2445
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2252 |
findFirstColumnWithStringFrom:start to:stop |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2253 |
start to:stop do:[:eachNr| |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2254 |
|row lbl| |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2255 |
row := self at:eachNr. |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2256 |
columnDescriptors keysAndValuesDo:[:colNr :col | |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2257 |
lbl := col shownValueForRow:row rowNr:eachNr. |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2258 |
|
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2259 |
(lbl isSequenceable and:[lbl isString not]) ifTrue:[ |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2260 |
lbl := lbl at:1 ifAbsent:nil |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2261 |
]. |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2262 |
|
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2263 |
(lbl respondsTo:#string) ifTrue:[ |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2264 |
lbl := lbl string. |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2265 |
]. |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2266 |
(lbl size > 0 and:[(lbl at:1) isCharacter]) ifTrue:[ |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2267 |
^ colNr |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2268 |
] |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2269 |
] |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2270 |
]. |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2271 |
^ nil |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2272 |
! |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2273 |
|
667 | 2274 |
findMenuForSelection |
2275 |
"find the middle button menu for the current selection; returns the menu or nil |
|
2276 |
" |
|
2277 |
|col row menu| |
|
2278 |
||
2279 |
self numberOfSelections == 1 ifTrue:[ |
|
2280 |
row := self at:(self firstIndexSelected). |
|
2281 |
col := self selectedColumn. |
|
2282 |
||
2074 | 2283 |
(col notNil and:[(menu := col menuForRow:row orAdaptor:columnAdaptor) notNil]) ifTrue:[ |
667 | 2284 |
^ menu |
2285 |
]. |
|
2286 |
col := columnDescriptors detect:[:c| c rendererType == #rowSelector] |
|
2287 |
ifNone:[nil]. |
|
2288 |
||
2289 |
col notNil ifTrue:[ |
|
1223
176702811314
kludge: when asking for an itemMenu, pass application to
tm
parents:
1215
diff
changeset
|
2290 |
^ col menuForRow:row inApplication:(self application) |
667 | 2291 |
] |
2292 |
]. |
|
2293 |
^ nil |
|
2294 |
! |
|
2295 |
||
1111 | 2296 |
keyPress:aKey x:x y:y |
542 | 2297 |
"a key was pressed - handle page-keys here |
2298 |
" |
|
2299 |
<resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown |
|
809 | 2300 |
#BeginOfText #EndOfText #ScrollUp #ScrollDown |
1947
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
2301 |
#CursorUp #CursorDown #CursorRight #CursorLeft #SelectAll)> |
542 | 2302 |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
2303 |
|maxColNr firstSelRowNr minSelRowNr maxSelRowNr selRowNr selColNr |
2470 | 2304 |
key column isTab listSize hasSelectables rawKey| |
1111 | 2305 |
|
1805 | 2306 |
self isEnabled ifFalse:[^ self]. |
2307 |
||
1416 | 2308 |
(listSize := list size) == 0 ifTrue:[ |
2309 |
^ super keyPress:aKey x:x y:y |
|
2310 |
]. |
|
1776 | 2311 |
aKey isCharacter ifTrue:[ |
2312 |
^ self characterPress:aKey x:x y:y |
|
542 | 2313 |
]. |
1111 | 2314 |
|
1947
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
2315 |
(aKey == #SelectAll) ifTrue:[ |
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
2316 |
multipleSelectOk ifTrue:[ |
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
2317 |
self selectAllRows. |
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
2318 |
]. |
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
2319 |
^ self |
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
2320 |
]. |
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
2321 |
|
1776 | 2322 |
aKey == #PreviousPage ifTrue:[^ self pageUp]. |
2323 |
aKey == #NextPage ifTrue:[^ self pageDown]. |
|
2324 |
aKey == #HalfPageUp ifTrue:[^ self halfPageUp]. |
|
2325 |
aKey == #HalfPageDown ifTrue:[^ self halfPageDown]. |
|
2326 |
aKey == #BeginOfText ifTrue:[^ self scrollToTop]. |
|
2327 |
aKey == #EndOfText ifTrue:[^ self scrollToBottom]. |
|
2328 |
aKey == #ScrollUp ifTrue:[^ self scrollUp]. |
|
2329 |
aKey == #ScrollDown ifTrue:[^ self scrollDown]. |
|
2330 |
||
1111 | 2331 |
aKey == #Return ifTrue:[ |
1416 | 2332 |
self numberOfSelections == 1 ifTrue:[self doubleClicked]. |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2333 |
^ self |
542 | 2334 |
]. |
1111 | 2335 |
|
1668 | 2336 |
hasSelectables := false. |
2337 |
||
2338 |
columnDescriptors do:[:aCol| |
|
2339 |
(hasSelectables or:[aCol rendererType == #rowSelector]) ifFalse:[ |
|
2340 |
hasSelectables := aCol description canSelect |
|
2341 |
] |
|
2342 |
]. |
|
2470 | 2343 |
|
2344 |
rawKey := (WindowGroup lastEventQuerySignal query) rawKey. |
|
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2345 |
|
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2346 |
(aKey == #CursorUp |
2470 | 2347 |
or:[aKey == #CursorDown |
2348 |
or:[rawKey == #Home |
|
2349 |
or:[rawKey == #End] |
|
2350 |
]]) ifTrue:[ |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2351 |
(hasSelectables or:[selectRowOnDefault]) ifTrue:[ |step start| |
2470 | 2352 |
minSelRowNr := self minIndexSelected. |
2353 |
maxSelRowNr := self maxIndexSelected. |
|
2354 |
||
1776 | 2355 |
selColNr := hasSelectables ifFalse:[0] |
2356 |
ifTrue:[selectedColIndex]. |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2357 |
|
1776 | 2358 |
aKey == #CursorUp ifTrue:[ |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2359 |
selRowNr := minSelRowNr > 1 ifTrue:[minSelRowNr - 1] ifFalse:[listSize]. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2360 |
step := -1. |
1776 | 2361 |
] ifFalse:[ |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2362 |
aKey == #CursorDown ifTrue:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2363 |
selRowNr := maxSelRowNr < listSize ifTrue:[maxSelRowNr + 1] ifFalse:[1]. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2364 |
step := 1. |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2365 |
] ifFalse:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2366 |
aKey == #BeginOfLine ifTrue:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2367 |
selRowNr := 1. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2368 |
step := 1. |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2369 |
] ifFalse:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2370 |
selRowNr := listSize. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2371 |
step := -1. |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2372 |
] |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2373 |
] |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2374 |
]. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2375 |
start := selRowNr. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2376 |
|
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2377 |
[ self isRowSelectable:selRowNr ] whileFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2378 |
selRowNr := selRowNr + step. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2379 |
|
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2380 |
selRowNr == 0 ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2381 |
selRowNr := listSize. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2382 |
] ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2383 |
selRowNr > listSize ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2384 |
selRowNr := 1. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2385 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2386 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2387 |
selRowNr == start ifTrue:[^ self ]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2388 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2389 |
|
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2390 |
((aKey == #CursorUp) or:[aKey == #CursorDown]) ifTrue:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2391 |
(multipleSelectOk and:[self sensor shiftDown]) ifTrue:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2392 |
self addRowToSelection:selRowNr. |
2370 | 2393 |
|
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2394 |
aKey == #CursorDown ifTrue:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2395 |
self makeLineVisible:((selRowNr+1) min:listSize) |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2396 |
] ifFalse:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2397 |
self makeLineVisible:((selRowNr-1) max:1) |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2398 |
]. |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2399 |
^ self |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2400 |
] |
1776 | 2401 |
]. |
2402 |
self selectColIndex:selColNr rowIndex:selRowNr |
|
2403 |
]. |
|
2404 |
^ self |
|
2405 |
]. |
|
1668 | 2406 |
|
2407 |
hasSelectables ifFalse:[ |
|
2408 |
^ super keyPress:aKey x:x y:y |
|
2409 |
]. |
|
2410 |
||
1776 | 2411 |
"/ CURSOR LEFT/RIGHT or TABING |
2470 | 2412 |
(aKey == #CursorLeft or:[aKey == #CursorRight]) ifTrue:[ |
2413 |
isTab := false. |
|
2414 |
key := aKey. |
|
2415 |
] ifFalse:[ |
|
1668 | 2416 |
tabIntern ifFalse:[ |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2417 |
^ super keyPress:aKey x:x y:y |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2418 |
]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2419 |
|
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2420 |
(aKey includesString:'Tab') ifTrue:[ |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
2421 |
key := (self sensor shiftDown or:[aKey includesString:'Left']) |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
2422 |
ifTrue:[#CursorLeft] |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
2423 |
ifFalse:[#CursorRight] |
1416 | 2424 |
] ifFalse:[ |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2425 |
(aKey == #FocusPrevious or:[aKey == #FocusNext]) ifFalse:[ |
1416 | 2426 |
^ super keyPress:aKey x:x y:y |
2427 |
]. |
|
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2428 |
key := aKey == #FocusPrevious ifTrue:[#CursorLeft] ifFalse:[#CursorRight]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2429 |
]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2430 |
isTab := true. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2431 |
]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2432 |
|
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2433 |
maxColNr := self numberOfColumns. |
1776 | 2434 |
selColNr := selectedColIndex. |
612 | 2435 |
|
2470 | 2436 |
firstSelRowNr := self firstIndexSelected. |
2437 |
||
1111 | 2438 |
key == #CursorLeft ifTrue:[ |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2439 |
selRowNr := firstSelRowNr. |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2440 |
selRowNr == 0 ifTrue:[selRowNr := listSize]. |
1776 | 2441 |
selColNr == 0 ifTrue:[selColNr := maxColNr + 1]. |
2442 |
||
2443 |
[true] whileTrue:[ |
|
2444 |
(selColNr := selColNr - 1) == 0 ifTrue:[ |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2445 |
[ selRowNr := selRowNr - 1. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2446 |
selRowNr == 0 ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2447 |
isTab ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2448 |
tabAtStartAction notNil ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2449 |
tabAtStartAction value |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2450 |
] ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2451 |
self deselect. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2452 |
self windowGroup focusPreviousFrom:self |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2453 |
] |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2454 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2455 |
^ self |
1416 | 2456 |
]. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2457 |
(self isRowSelectable:selRowNr) |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2458 |
] whileFalse. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2459 |
|
1776 | 2460 |
selColNr := maxColNr |
1111 | 2461 |
]. |
1776 | 2462 |
column := self columnAt:selColNr. |
1416 | 2463 |
|
1111 | 2464 |
(column rendererType ~~ #rowSelector and:[column canSelect:selRowNr]) ifTrue:[ |
1776 | 2465 |
^ self selectColIndex:selColNr rowIndex:selRowNr. |
1111 | 2466 |
] |
2467 |
] |
|
542 | 2468 |
]. |
1776 | 2469 |
|
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2470 |
selRowNr := firstSelRowNr. |
1776 | 2471 |
selRowNr == 0 ifTrue:[selRowNr := 1]. |
2472 |
||
2473 |
[true] whileTrue:[ |
|
2474 |
(selColNr := selColNr + 1) > maxColNr ifTrue:[ |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2475 |
[ selRowNr := selRowNr + 1. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2476 |
selRowNr > listSize ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2477 |
isTab ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2478 |
tabAtEndAction notNil ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2479 |
tabAtEndAction value |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2480 |
] ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2481 |
self deselect. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2482 |
self windowGroup focusNextFrom:self |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2483 |
] |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2484 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2485 |
^ self |
1776 | 2486 |
]. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2487 |
(self isRowSelectable:selRowNr) |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2488 |
] whileFalse. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2489 |
|
1776 | 2490 |
selColNr := 1 |
2491 |
]. |
|
2492 |
column := self columnAt:selColNr. |
|
2493 |
||
2494 |
(column rendererType ~~ #rowSelector and:[column canSelect:selRowNr]) ifTrue:[ |
|
2495 |
^ self selectColIndex:selColNr rowIndex:selRowNr |
|
2496 |
] |
|
2497 |
]. |
|
542 | 2498 |
! |
2499 |
||
2500 |
originChanged:delta |
|
2501 |
"this one is sent, after the origin of my contents has changed - |
|
2502 |
tell dependents (i.e. scrollers) about this |
|
2503 |
" |
|
2504 |
super originChanged:delta. |
|
2505 |
self updateEditViewOrigin. |
|
2276
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2506 |
! |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2507 |
|
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2508 |
sizeChanged:how |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2509 |
"size changed - move origin up if possible |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2510 |
change the layout of the labelView dependent on my layout |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2511 |
" |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2512 |
|selectionWasVisible| |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2513 |
|
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2514 |
selectionWasVisible := self isSelectionVisibleIn:(previousExtent ? self extent). |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2515 |
|
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2516 |
previousExtent := self extent. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2517 |
super sizeChanged:how. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2518 |
|
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2519 |
"/ no - must compute even if not visible. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2520 |
"/ (could be invisible in a notebook ...) |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2521 |
realized ifTrue:[ "used to be: shown" |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2522 |
"/ labelView isVisible ifTrue:[ |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2523 |
"/ lyt := labelView layout. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2524 |
"/ lyt leftOffset:(layout leftOffset). |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2525 |
"/ lyt rightOffset:(layout rightOffset). |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2526 |
"/ labelView layout:lyt. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2527 |
"/ ]. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2528 |
self fitColumns. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2529 |
selectionWasVisible ifTrue:[ |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2530 |
self makeSelectionVisible. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2531 |
] |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2532 |
]. |
542 | 2533 |
! ! |
2534 |
||
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2535 |
!DSVColumnView methodsFor:'focus handling'! |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2536 |
|
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2537 |
canTab |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2538 |
super canTab ifTrue:[ |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2539 |
^ editView isNil |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2540 |
]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2541 |
^ false |
2101 | 2542 |
! |
2543 |
||
2544 |
wantsFocusWithPointerEnter |
|
2545 |
"views which like to take the keyboard focus |
|
2546 |
when the pointer enters can do so by redefining this |
|
2547 |
to return true" |
|
2548 |
||
2549 |
|pref| |
|
2550 |
||
2237 | 2551 |
editView ifNotNil:[^ false]. |
2552 |
||
2101 | 2553 |
pref := UserPreferences current focusFollowsMouse. |
2554 |
(pref ~~ false |
|
2555 |
and:[(styleSheet at:#'selection.requestFocusOnPointerEnter' default:true) |
|
2556 |
]) ifTrue:[ |
|
2557 |
list size > 0 ifTrue:[ |
|
2558 |
^ true |
|
2559 |
] |
|
2560 |
]. |
|
2561 |
^ false |
|
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2562 |
! ! |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2563 |
|
542 | 2564 |
!DSVColumnView methodsFor:'gc operations'! |
2565 |
||
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2566 |
imageOnMyDevice:anImage |
1100 | 2567 |
"associate image to device and clear pixel mask; returns the new image. |
2568 |
" |
|
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2569 |
|deviceImage| |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2570 |
|
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2571 |
anImage isNil ifTrue:[^ anImage]. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2572 |
|
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2573 |
deviceImage := anImage onDevice:device. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2574 |
deviceImage isImage ifTrue:[ |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2575 |
deviceImage clearMaskedPixels. |
1100 | 2576 |
]. |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2577 |
^ deviceImage |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2578 |
"/ |image| |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2579 |
"/ |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2580 |
"/ (image := anImage) notNil ifTrue:[ |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2581 |
"/ image device ~~ device ifTrue:[ |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2582 |
"/ image := image copy onDevice:device. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2583 |
"/ ]. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2584 |
"/ image isImage ifTrue:[ |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2585 |
"/ image := image clearMaskedPixels |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2586 |
"/ ] |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2587 |
"/ ]. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2588 |
"/ ^ image |
1100 | 2589 |
! |
2590 |
||
542 | 2591 |
registerImage:anImage key:aKey |
2592 |
"any row can register an image with a unique identifier a key symbol |
|
2593 |
" |
|
2594 |
|img| |
|
2595 |
||
2596 |
(img := registererImages at:aKey ifAbsent:nil) notNil ifTrue:[ |
|
2597 |
^ img |
|
2598 |
]. |
|
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2599 |
img := self imageOnMyDevice:anImage. |
567 | 2600 |
registererImages at:aKey put:img. |
2601 |
^ img |
|
542 | 2602 |
! |
2603 |
||
2604 |
registeredImageAt:aKey |
|
2605 |
"any row can register an image with a unique identifier |
|
2606 |
" |
|
2607 |
^ registererImages at:aKey ifAbsent:nil |
|
2608 |
! |
|
2609 |
||
2610 |
releaseAllRegisteredImages |
|
2611 |
"release all registered images |
|
2612 |
" |
|
2613 |
registererImages := IdentityDictionary new. |
|
2614 |
! ! |
|
2615 |
||
2500 | 2616 |
!DSVColumnView methodsFor:'initialization & release'! |
542 | 2617 |
|
2618 |
create |
|
607 | 2619 |
"set color on device |
542 | 2620 |
" |
2621 |
super create. |
|
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
2622 |
|
1480 | 2623 |
fgColor := fgColor onDevice:device. |
2624 |
bgColor := bgColor onDevice:device. |
|
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
2625 |
selectionForegroundColor := selectionForegroundColor onDevice:device. |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
2626 |
selectionBackgroundColor := selectionBackgroundColor onDevice:device. |
1480 | 2627 |
|
2628 |
buttonShadowColor := buttonShadowColor onDevice:device. |
|
2629 |
buttonLightColor := buttonLightColor onDevice:device. |
|
809 | 2630 |
|
2631 |
buttonHalfShadowColor notNil ifTrue:[ |
|
1480 | 2632 |
buttonHalfShadowColor := buttonHalfShadowColor onDevice:device |
809 | 2633 |
]. |
2634 |
||
2635 |
buttonHalfLightColor notNil ifTrue:[ |
|
1480 | 2636 |
buttonHalfLightColor := buttonHalfLightColor onDevice:device |
809 | 2637 |
]. |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2638 |
rowSelectorForm := self imageOnMyDevice:rowSelectorForm. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2639 |
checkToggleActiveImage := self imageOnMyDevice:checkToggleActiveImage. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2640 |
checkTogglePassiveImage := self imageOnMyDevice:checkTogglePassiveImage. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2641 |
comboButtonForm := self imageOnMyDevice:comboButtonForm. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2642 |
checkToggleForm := self imageOnMyDevice:checkToggleForm. |
542 | 2643 |
! |
2644 |
||
2645 |
initStyle |
|
607 | 2646 |
"setup colors |
2647 |
" |
|
1100 | 2648 |
|button widget| |
809 | 2649 |
|
542 | 2650 |
super initStyle. |
2651 |
||
2652 |
DefaultForegroundColor isNil ifTrue:[ |
|
2653 |
self class updateStyleCache |
|
2654 |
]. |
|
2655 |
fgColor := DefaultForegroundColor. |
|
2656 |
bgColor := DefaultBackgroundColor. |
|
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
2657 |
selectionForegroundColor := DefaultHilightForegroundColor. |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
2658 |
selectionBackgroundColor := DefaultHilightBackgroundColor. |
809 | 2659 |
|
2660 |
shadowColor isNil ifTrue:[ |
|
2661 |
shadowColor := Color grayPercent:40. |
|
2662 |
]. |
|
2663 |
||
2664 |
lightColor isNil ifTrue:[ |
|
2665 |
lightColor := Color grayPercent:75 |
|
2666 |
]. |
|
2667 |
||
2668 |
buttonLightColor := ButtonLightColor ? lightColor. |
|
2669 |
buttonShadowColor := ButtonShadowColor ? shadowColor. |
|
2670 |
||
2671 |
(ButtonEdgeStyle == #soft) ifTrue:[ |
|
2672 |
buttonHalfShadowColor := ButtonHalfShadowColor. |
|
2673 |
buttonHalfLightColor := ButtonHalfLightColor. |
|
2674 |
||
2675 |
buttonHalfShadowColor isNil ifTrue:[ |
|
2676 |
buttonHalfShadowColor := buttonShadowColor lightened |
|
2677 |
] |
|
2678 |
]. |
|
1490 | 2679 |
|
2680 |
buttonHalfShadowColor isNil ifTrue:[ |
|
2681 |
buttonHalfShadowColor := Color gray |
|
2682 |
]. |
|
2683 |
||
1100 | 2684 |
rowSelectorForm := self class rowSelector. |
2685 |
checkToggleActiveImage := CheckToggleActiveImage. |
|
2686 |
checkTogglePassiveImage := CheckTogglePassiveImage. |
|
2687 |
||
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2688 |
ComboButtonForm isNil ifTrue:[ |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2689 |
widget := ComboListView new. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2690 |
button := widget menuButton. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2691 |
ComboButtonForm := button label. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2692 |
ComboButtonLevel := button offLevel. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2693 |
ComboButtonExtent := (button preferredExtent x) @ (widget preferredExtent y). |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2694 |
]. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2695 |
|
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2696 |
CheckToggleForm isNil ifTrue:[ |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2697 |
widget := CheckToggle new. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2698 |
CheckToggleForm := widget label. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2699 |
CheckToggleLevel := widget offLevel. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2700 |
CheckToggleExtent := widget preferredExtent. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2701 |
]. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2702 |
comboButtonForm := ComboButtonForm. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2703 |
comboButtonLevel := ComboButtonLevel. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2704 |
comboButtonExtent := ComboButtonExtent. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2705 |
|
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2706 |
checkToggleForm := CheckToggleForm. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2707 |
checkToggleLevel := CheckToggleLevel. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2708 |
checkToggleExtent := CheckToggleExtent. |
542 | 2709 |
! |
2710 |
||
2711 |
initialize |
|
2712 |
"set default attributes |
|
2713 |
" |
|
2714 |
super initialize. |
|
1487 | 2715 |
self lineWidth:0. |
2716 |
||
1668 | 2717 |
tabIntern := true. |
1487 | 2718 |
useIndex := true. |
1112 | 2719 |
viewOrigin := 0@0. |
1480 | 2720 |
font := font onDevice:device. |
1112 | 2721 |
rowHeight := font height. |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2722 |
minRowHeight := rowHeight. |
1112 | 2723 |
multipleSelectOk := false. "/ multiselect disabled |
2724 |
selectedRowIndex := selectedColIndex := 0. "/ no selection |
|
1778
51bbd960baf9
change registeredIcons from IdentityDictionary to Dictionary
ca
parents:
1776
diff
changeset
|
2725 |
registererImages := Dictionary new. |
1112 | 2726 |
columnDescriptors := #(). |
2727 |
beDependentOfRows := false. |
|
2728 |
verticalSpacing := self class verticalSpacing. |
|
2729 |
horizontalSpacing := self class horizontalSpacing. |
|
2730 |
colorMap := Dictionary new. |
|
2731 |
catchChangeEvents := false. |
|
2732 |
rowFontAscent := 1. "/ dummy initialization |
|
2733 |
separatorSize := 1. "/ separators mode 2D |
|
2734 |
selectRowOnDefault := true. |
|
1749 | 2735 |
autoScroll := true. |
542 | 2736 |
! |
2737 |
||
705 | 2738 |
mapped |
2739 |
"set selection if exists after mapping |
|
2740 |
" |
|
2032 | 2741 |
"/ |idx| |
2742 |
"/ |
|
705 | 2743 |
super mapped. |
2011
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2744 |
"/ needFitColumns == true ifTrue:[ |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2745 |
"/ self fitColumns |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2746 |
"/ ]. |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2747 |
"/ |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2748 |
"/ (idx := self firstIndexSelected) ~~ 0 ifTrue:[ |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2749 |
"/ self scrollToRowAt:idx colAt:0. |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2750 |
"/ ]. |
705 | 2751 |
! |
2752 |
||
542 | 2753 |
realize |
607 | 2754 |
"recompute contents and fit columns to view |
542 | 2755 |
" |
1487 | 2756 |
|selection| |
2757 |
||
607 | 2758 |
self bitGravity:#NorthWest. |
542 | 2759 |
self recomputeHeightOfContents. |
1487 | 2760 |
|
2761 |
selection := 0. |
|
2762 |
||
2763 |
model notNil ifTrue:[ |
|
2764 |
(model respondsTo:#selectionIndex) ifTrue:[ |
|
2765 |
selection := model selectionIndex |
|
2766 |
] ifFalse:[ |
|
2767 |
model == listHolder ifFalse:[ |
|
2768 |
selection := model value |
|
2769 |
] |
|
2770 |
] |
|
2771 |
]. |
|
2772 |
self selectRowIndex:selection. |
|
2773 |
||
542 | 2774 |
super realize. |
607 | 2775 |
self fitColumns. |
2011
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2776 |
! |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2777 |
|
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2778 |
realized |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2779 |
"set selection if exists after mapping |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2780 |
" |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2781 |
|idx| |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2782 |
|
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2783 |
super realized. |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2784 |
|
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2785 |
needFitColumns == true ifTrue:[ |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2786 |
self fitColumns |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2787 |
]. |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2788 |
|
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2789 |
(idx := self firstIndexSelected) ~~ 0 ifTrue:[ |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2790 |
self scrollToRowAt:idx colAt:0. |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2791 |
]. |
2157 | 2792 |
! |
2793 |
||
2794 |
release |
|
2795 |
"remove dependencies |
|
2796 |
" |
|
2797 |
self columnHolder:nil. |
|
2798 |
||
2799 |
listHolder removeDependent:self. |
|
2800 |
||
2801 |
columnAdaptor isValueModel ifTrue:[ |
|
2802 |
columnAdaptor removeDependent:self |
|
2803 |
]. |
|
2804 |
||
2805 |
self beDependentOfRows:false. |
|
2806 |
super release |
|
607 | 2807 |
! ! |
2808 |
||
2809 |
!DSVColumnView methodsFor:'obsolete'! |
|
2810 |
||
2811 |
has3Dsepartors |
|
2812 |
"shouldn't be used any more |
|
2813 |
" |
|
2814 |
^ self has3Dseparators |
|
2815 |
! |
|
2816 |
||
2817 |
has3Dsepartors:aBool |
|
2818 |
"shouldn't be used any more |
|
2819 |
" |
|
2820 |
self has3Dseparators:aBool |
|
542 | 2821 |
|
2822 |
! ! |
|
2823 |
||
2824 |
!DSVColumnView methodsFor:'private'! |
|
2825 |
||
1951 | 2826 |
anyColumnHasBackground |
2827 |
columnDescriptors isNil ifTrue:[^ false]. |
|
2828 |
columnDescriptors do:[:eachCol | |
|
2829 |
|bg| |
|
2830 |
||
2831 |
bg := eachCol backgroundColor. |
|
2832 |
(bg notNil and:[bg isImageOrForm]) ifTrue:[^ true]. |
|
2833 |
eachCol bgSelector notNil ifTrue:[^ true]. |
|
2834 |
]. |
|
2835 |
^ false. |
|
2836 |
! |
|
2837 |
||
2838 |
anyColumnHasPotentialNonConstantBackground |
|
2839 |
columnDescriptors isNil ifTrue:[^ false]. |
|
2840 |
columnDescriptors do:[:eachCol | eachCol hasPotentialNonConstantBackground ifTrue:[^ true]]. |
|
2841 |
^ false. |
|
2842 |
! |
|
2843 |
||
1111 | 2844 |
destroyEditView |
2845 |
"destroy the edit view; release KeyboardForwarder |
|
2846 |
" |
|
2847 |
editView notNil ifTrue:[ |
|
2848 |
editView withAllSubViewsDo:[:aView| |
|
2849 |
aView delegate:nil |
|
2850 |
]. |
|
2851 |
editView destroy. |
|
2852 |
editView := nil. |
|
2853 |
self windowGroup focusView:nil. |
|
2854 |
]. |
|
2855 |
||
2856 |
||
2857 |
! |
|
2858 |
||
637 | 2859 |
detectViewAt:aPoint in:aView |
1087 | 2860 |
"returns the view at a point |
2861 |
" |
|
2031 | 2862 |
aView isNil ifTrue:[^ nil]. |
2019
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2863 |
^ aView detectViewAt:aPoint. |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2864 |
|
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2865 |
"/ cg: old code was (refactored to use common code) |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2866 |
"/ |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2867 |
"/ |p| |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2868 |
"/ |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2869 |
"/ (aView notNil and:[aView subViews notNil]) ifTrue:[ |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2870 |
"/ aView subViews do:[:sv| |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2871 |
"/ p := device translatePoint:aPoint fromView:self toView:sv. |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2872 |
"/ |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2873 |
"/ (p x >= 0 and:[p y >= 0 and:[p x <= sv width and:[p y <= sv height]]]) ifTrue:[ |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2874 |
"/ ^ self detectViewAt:aPoint in:sv |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2875 |
"/ ] |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2876 |
"/ ] |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2877 |
"/ ]. |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2878 |
"/ ^ aView |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2879 |
|
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2880 |
"Modified: / 10.10.2001 / 13:53:24 / cg" |
637 | 2881 |
! |
2882 |
||
542 | 2883 |
fitColumns |
1484 | 2884 |
"fit columns to view; |
542 | 2885 |
" |
2319
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
2886 |
|selectedColumn list width changed dX sz oldOrgX newOrgX| |
1487 | 2887 |
|
2888 |
preferredExtent isNil ifTrue:[ |
|
2889 |
self preferredExtent. |
|
2890 |
]. |
|
1484 | 2891 |
|
2892 |
columnDescriptors isEmpty ifTrue:[ |
|
2893 |
^ self |
|
2894 |
]. |
|
1492 | 2895 |
width := 0. |
2896 |
list := OrderedCollection new. |
|
1484 | 2897 |
|
2898 |
columnDescriptors do:[:aCol| |
|
2899 |
aCol canResize ifTrue:[ |
|
2900 |
changed := true. |
|
2901 |
aCol invalidate. |
|
1492 | 2902 |
aCol hasRelativeWidth ifFalse:[list add:aCol]. |
1484 | 2903 |
]. |
1492 | 2904 |
width := width + aCol minWidth. |
1484 | 2905 |
]. |
1492 | 2906 |
preferredExtent x:width. |
2907 |
width := self innerWidth - width. |
|
2908 |
||
2909 |
(list notEmpty and:[width > 0]) ifTrue:[ |
|
2910 |
sz := list size. |
|
2911 |
width >= sz ifTrue:[ |
|
2912 |
dX := width // sz. |
|
1484 | 2913 |
list do:[:aCol|aCol growWidth:dX]. |
1492 | 2914 |
width := width - (dX * sz). |
1484 | 2915 |
]. |
1492 | 2916 |
width ~~ 0 ifTrue:[list last growWidth:width]. |
1484 | 2917 |
]. |
1492 | 2918 |
|
612 | 2919 |
shown ifTrue:[ |
1492 | 2920 |
self invalidate. |
1487 | 2921 |
labelView invalidate. |
542 | 2922 |
|
1498 | 2923 |
(oldOrgX := viewOrigin x) ~~ 0 ifTrue:[ |
2924 |
"/ UPDATE VIEW-ORIGIN X |
|
2925 |
||
2926 |
width := preferredExtent x. |
|
2927 |
newOrgX := (width - self innerWidth) max:0. |
|
2928 |
||
2929 |
newOrgX < oldOrgX ifTrue:[ |
|
2930 |
self originWillChange. |
|
2931 |
viewOrigin := newOrgX @ (viewOrigin y). |
|
2932 |
self originChanged:((newOrgX - oldOrgX) @ 0). |
|
2933 |
] |
|
2934 |
]. |
|
2935 |
||
1930
31274c3264d6
do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
2936 |
"/ cg: do not scroll to selection when a column-size is changed |
2319
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
2937 |
|
1930
31274c3264d6
do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
2938 |
"/ self hasSelection ifTrue:[ |
31274c3264d6
do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
2939 |
"/ editView notNil ifTrue:[ |
31274c3264d6
do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
2940 |
"/ editView width:(self selectedColumn width - (2 * separatorSize)). |
31274c3264d6
do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
2941 |
"/ ]. |
31274c3264d6
do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
2942 |
"/ self scrollToSelection. |
31274c3264d6
do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
2943 |
"/ ]. |
2319
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
2944 |
|
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
2945 |
"/ ca: but resize the editView |
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
2946 |
|
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
2947 |
editView notNil ifTrue:[ |
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
2948 |
selectedColumn := self selectedColumn. |
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
2949 |
selectedColumn notNil ifTrue:[ |
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
2950 |
editView width:(selectedColumn width - (2 * separatorSize)). |
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
2951 |
] |
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
2952 |
]. |
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
2953 |
|
1498 | 2954 |
self contentsChanged. |
542 | 2955 |
]. |
2956 |
! |
|
2957 |
||
2958 |
maxViewOriginY |
|
2959 |
"returns the maximum possible y of the view origin |
|
2960 |
" |
|
2961 |
|y| |
|
2962 |
||
2963 |
y := self heightOfContents - self innerHeight. |
|
2964 |
^ y max:0 |
|
2965 |
||
2966 |
! |
|
2967 |
||
2968 |
updateEditViewOrigin |
|
2969 |
"update origin of the editView |
|
2970 |
" |
|
2971 |
|x y| |
|
2972 |
||
2973 |
editView notNil ifTrue:[ |
|
607 | 2974 |
y := self yVisibleOfRowNr:(self firstIndexSelected). |
1498 | 2975 |
x := self xVisibleOfColNr:selectedColIndex. |
542 | 2976 |
|
1112 | 2977 |
editView origin:(x @ y + separatorSize). |
542 | 2978 |
]. |
2979 |
||
2980 |
! |
|
2981 |
||
2982 |
xVisibleOfColNr:aColNr |
|
2983 |
"returns visible x assigned to a column number |
|
2984 |
" |
|
1497 | 2985 |
|x |
2986 |
end "{ Class:SmallInteger }" |
|
2987 |
| |
|
542 | 2988 |
x := margin - viewOrigin x. |
1497 | 2989 |
|
1498 | 2990 |
aColNr > 1 ifTrue:[ |
1497 | 2991 |
end := aColNr - 1. |
2992 |
||
2993 |
columnDescriptors from:1 to:end do:[:aCol| |
|
2994 |
x := x + aCol width |
|
2995 |
] |
|
2996 |
]. |
|
542 | 2997 |
^ x |
2998 |
||
2999 |
! |
|
3000 |
||
3001 |
xVisibleToColNr:x |
|
607 | 3002 |
"returns the column number assigned to a physical x or nil |
3003 |
" |
|
1497 | 3004 |
|x0 |
3005 |
nr "{ Class:SmallInteger }" |
|
3006 |
| |
|
542 | 3007 |
|
3008 |
x0 := x + viewOrigin x - margin. |
|
3009 |
nr := 1. |
|
3010 |
||
1497 | 3011 |
columnDescriptors do:[:aCol| |
1951 | 3012 |
x0 := x0 - aCol width. |
3013 |
x0 <= 0 ifTrue:[^ nr]. |
|
542 | 3014 |
nr := nr + 1. |
3015 |
]. |
|
3016 |
^ nil. |
|
3017 |
||
3018 |
! |
|
3019 |
||
3020 |
yVisibleOfRowNr:aRowNr |
|
3021 |
"returns visible y assigned to the row number |
|
3022 |
" |
|
3023 |
^ (aRowNr - 1) * rowHeight + margin - viewOrigin y |
|
3024 |
||
3025 |
! |
|
3026 |
||
3027 |
yVisibleToRowNr:y |
|
607 | 3028 |
"returns the row number assigned to a physical y or nil |
542 | 3029 |
" |
2398 | 3030 |
|rowNr| |
3031 |
||
3032 |
rowNr := (y + viewOrigin y - margin) // rowHeight + 1. |
|
3033 |
||
3034 |
(rowNr between:1 and:(list size)) ifTrue:[ |
|
3035 |
^ rowNr |
|
3036 |
]. |
|
3037 |
^ nil |
|
542 | 3038 |
! ! |
3039 |
||
3040 |
!DSVColumnView methodsFor:'queries'! |
|
3041 |
||
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3042 |
hasOpenEditor |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3043 |
^ editView notNil |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3044 |
! |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3045 |
|
563 | 3046 |
indexOfFirstRowShown |
3047 |
"returns index of first row shown |
|
3048 |
" |
|
3049 |
|idx| |
|
3050 |
||
1498 | 3051 |
idx := (viewOrigin y // rowHeight) + 1. |
1497 | 3052 |
^ (idx <= list size) ifTrue:[idx] ifFalse:[0] |
563 | 3053 |
|
3054 |
! |
|
3055 |
||
1805 | 3056 |
isEnabled |
3057 |
^ enableChannel value ~~ false |
|
3058 |
! |
|
3059 |
||
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3060 |
isRowSelectable:aRowNumber |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3061 |
"returne true if a row number is selectable |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3062 |
" |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3063 |
(aRowNumber notNil and:[aRowNumber ~~ 0]) ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3064 |
selectConditionBlock isNil ifTrue:[^ true]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3065 |
^ (selectConditionBlock value:aRowNumber) |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3066 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3067 |
^ false |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3068 |
! |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3069 |
|
542 | 3070 |
numberOfColumns |
3071 |
"returns number of columns |
|
3072 |
" |
|
3073 |
^ columnDescriptors size |
|
3074 |
||
3075 |
! |
|
3076 |
||
3077 |
numberOfRows |
|
3078 |
"returns number of raws |
|
3079 |
" |
|
1497 | 3080 |
^ list size |
542 | 3081 |
|
3082 |
! |
|
3083 |
||
3084 |
rowHeight |
|
3085 |
"get the height of the highest row in pixels |
|
3086 |
" |
|
3087 |
^ rowHeight |
|
3088 |
||
3089 |
! |
|
3090 |
||
3091 |
separatorSize |
|
3092 |
"returns vertical/horizontal size of a separator dependent on the |
|
3093 |
3D effect. |
|
3094 |
" |
|
607 | 3095 |
^ separatorSize |
542 | 3096 |
|
3097 |
! |
|
3098 |
||
3099 |
size |
|
3100 |
"returns number of raws |
|
3101 |
" |
|
3102 |
^ list size |
|
3103 |
||
3104 |
! ! |
|
3105 |
||
3106 |
!DSVColumnView methodsFor:'recomputation'! |
|
3107 |
||
647 | 3108 |
hasPreferredExtent |
3109 |
"returns true if preferred extent is accumulated |
|
3110 |
" |
|
3111 |
^ preferredExtent notNil |
|
3112 |
! |
|
3113 |
||
542 | 3114 |
preferredExtent |
647 | 3115 |
"recompute preferred extent; raise notification |
542 | 3116 |
" |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
3117 |
|x| |
542 | 3118 |
|
3119 |
preferredExtent notNil ifTrue:[ |
|
3120 |
^ preferredExtent |
|
3121 |
]. |
|
3122 |
x := 3. |
|
1497 | 3123 |
|
3124 |
columnDescriptors do:[:aCol| |
|
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
3125 |
minRowHeight := (aCol heightOfHighestRow) max:minRowHeight. |
1497 | 3126 |
x := x + (aCol minWidth). |
542 | 3127 |
]. |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
3128 |
rowHeight := (minRowHeight + separatorSize + verticalSpacing + verticalSpacing + 1) // 2 * 2. |
1497 | 3129 |
preferredExtent := x @ (list size * rowHeight). |
1201 | 3130 |
rowFontAscent := font ascent. |
3131 |
||
542 | 3132 |
^ preferredExtent |
3133 |
! |
|
3134 |
||
3135 |
preferredExtentChanged |
|
1087 | 3136 |
"called if the preffered extent changed |
3137 |
" |
|
1497 | 3138 |
|x "{ Class:SmallInteger }" |
3139 |
y "{ Class:SmallInteger }" |
|
3140 |
| |
|
542 | 3141 |
y := viewOrigin y. |
3142 |
x := viewOrigin x. |
|
3143 |
||
3144 |
(y ~~ 0 or:[x ~~ 0]) ifTrue:[ |
|
3145 |
self originWillChange. |
|
1948
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
3146 |
|
542 | 3147 |
viewOrigin := 0 @ 0. |
3148 |
preferredExtent := nil. |
|
3149 |
self originChanged:(x negated @ y negated). |
|
3150 |
] |
|
3151 |
! |
|
3152 |
||
3153 |
recomputeHeightOfContents |
|
1087 | 3154 |
"recompute height of contents( scrolling ) |
3155 |
" |
|
542 | 3156 |
preferredExtent notNil ifTrue:[ |
1497 | 3157 |
preferredExtent y:(rowHeight * list size) |
542 | 3158 |
] ifFalse:[ |
3159 |
self preferredExtent |
|
3160 |
]. |
|
3161 |
! ! |
|
3162 |
||
3163 |
!DSVColumnView methodsFor:'scroller interface'! |
|
3164 |
||
3165 |
heightOfContents |
|
3166 |
"return the height of the contents in pixels |
|
3167 |
" |
|
1498 | 3168 |
preferredExtent isNil ifTrue:[ |
3169 |
self preferredExtent |
|
3170 |
]. |
|
3171 |
^ preferredExtent y |
|
542 | 3172 |
! |
3173 |
||
3174 |
innerHeight |
|
3175 |
"returns the inner height of the contents shown |
|
3176 |
" |
|
3177 |
^ height - margin - margin |
|
3178 |
||
3179 |
! |
|
3180 |
||
3181 |
verticalScrollStep |
|
3182 |
"return the amount to scroll when stepping up/down. |
|
3183 |
" |
|
3184 |
^ rowHeight |
|
3185 |
||
3186 |
||
3187 |
||
3188 |
! |
|
3189 |
||
3190 |
viewOrigin |
|
3191 |
"return the viewOrigin; thats the coordinate of the contents |
|
3192 |
which is shown topLeft in the view. |
|
3193 |
" |
|
3194 |
^ viewOrigin |
|
3195 |
||
3196 |
! |
|
3197 |
||
3198 |
widthOfContents |
|
3199 |
"return the width of the contents in pixels |
|
3200 |
" |
|
647 | 3201 |
preferredExtent isNil ifTrue:[ |
3202 |
self preferredExtent |
|
3203 |
]. |
|
3204 |
^ preferredExtent x |
|
542 | 3205 |
|
3206 |
! |
|
3207 |
||
3208 |
xOriginOfContents |
|
3209 |
"return the horizontal origin of the contents in pixels |
|
3210 |
" |
|
3211 |
^ viewOrigin x |
|
3212 |
||
3213 |
! |
|
3214 |
||
3215 |
yOriginOfContents |
|
3216 |
"return the vertical origin of the contents in pixels |
|
3217 |
" |
|
3218 |
^ viewOrigin y |
|
3219 |
||
3220 |
! ! |
|
3221 |
||
3222 |
!DSVColumnView methodsFor:'scrolling'! |
|
3223 |
||
3224 |
scrollTo:anOrigin redraw:doRedraw |
|
3225 |
"change origin to have newOrigin be visible at the top-left. |
|
3226 |
" |
|
1497 | 3227 |
|newOrg dltOrg wg |
3228 |
h "{ Class:SmallInteger }" |
|
3229 |
w "{ Class:SmallInteger }" |
|
3230 |
x "{ Class:SmallInteger }" |
|
3231 |
x0 "{ Class:SmallInteger }" |
|
3232 |
x1 "{ Class:SmallInteger }" |
|
3233 |
y "{ Class:SmallInteger }" |
|
3234 |
y0 "{ Class:SmallInteger }" |
|
3235 |
y1 "{ Class:SmallInteger }" |
|
3236 |
dX "{ Class:SmallInteger }" |
|
3237 |
dY "{ Class:SmallInteger }" |
|
3238 |
innerHG "{ Class:SmallInteger }" |
|
3239 |
innerWT "{ Class:SmallInteger }" |
|
2146 | 3240 |
lMargin |
1497 | 3241 |
| |
2146 | 3242 |
|
542 | 3243 |
shown ifFalse:[ |
3244 |
^ self |
|
3245 |
]. |
|
612 | 3246 |
|
1448 | 3247 |
(wg := self windowGroup) notNil ifTrue:[ |
3248 |
wg processRealExposeEventsFor:self. |
|
542 | 3249 |
]. |
612 | 3250 |
|
542 | 3251 |
innerWT := self innerWidth. |
3252 |
innerHG := self innerHeight. |
|
3253 |
||
3254 |
h := viewOrigin y. |
|
3255 |
||
3256 |
(y := anOrigin y) > h ifTrue:[ "/ end of contents |
|
3257 |
y > (dY := self maxViewOriginY) ifTrue:[ |
|
3258 |
y := dY max:h |
|
3259 |
] |
|
3260 |
] ifFalse:[ |
|
3261 |
y := y max:0. |
|
3262 |
]. |
|
3263 |
||
3264 |
(x := anOrigin x) > 0 ifTrue:[ |
|
3265 |
x := x min:(self widthOfContents - innerWT). |
|
3266 |
]. |
|
3267 |
x := x max:0. |
|
3268 |
newOrg := (x @ y). |
|
3269 |
dltOrg := newOrg - viewOrigin. |
|
3270 |
dX := dltOrg x. |
|
3271 |
dY := dltOrg y. |
|
3272 |
||
3273 |
(dX == 0 and:[dY == 0]) ifTrue:[ |
|
3274 |
^ self |
|
3275 |
]. |
|
3276 |
self originWillChange. |
|
3277 |
viewOrigin := newOrg. |
|
3278 |
||
3279 |
doRedraw ifFalse:[ |
|
3280 |
^ self originChanged:dltOrg |
|
3281 |
]. |
|
3282 |
||
3283 |
dY ~~ 0 ifTrue:[ "/ SCROLL VERTICAL |
|
3284 |
dY := dY abs. |
|
3285 |
||
3286 |
(dX ~~ 0 or:[innerHG - dY < 20]) ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3287 |
self invalidate. |
542 | 3288 |
] ifFalse:[ "/ COPY VERTICAL |
3289 |
y0 := y1 := margin + dY. |
|
3290 |
h := innerHG - dY. |
|
3291 |
||
3292 |
dltOrg y < 0 ifTrue:[y0 := margin. y := y0] |
|
3293 |
ifFalse:[y1 := margin. y := y1 + h]. |
|
3294 |
||
1460 | 3295 |
self copyFrom:self x:margin y:y0 toX:margin y:y1 width:innerWT height:h async:false. |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3296 |
self invalidateX:margin y:y width:innerWT height:(innerHG - h). |
542 | 3297 |
] |
3298 |
] ifFalse:[ "/ SCROLL HORIZONTAL |
|
3299 |
dX := dX abs. |
|
3300 |
||
3301 |
innerWT - dX < 20 ifTrue:[ |
|
1487 | 3302 |
labelView invalidate. |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3303 |
self invalidate. |
542 | 3304 |
] ifFalse:[ "/ COPY HORIZONTAL |
643 | 3305 |
x0 := x1 := dX + margin. |
2146 | 3306 |
w := width - dX. |
3307 |
lMargin := labelView margin. |
|
3308 |
||
3309 |
dltOrg x < 0 ifTrue:[ |
|
3310 |
" ->" |
|
3311 |
x0 := x := margin. |
|
3312 |
self copyFrom:self x:margin y:margin toX:margin+dX y:margin width:innerWT-dX height:innerHG async:false. |
|
3313 |
self invalidateX:margin y:margin width:dX height:innerHG. |
|
3314 |
||
3315 |
labelView notNil ifTrue:[ |
|
3316 |
labelView copyFrom:labelView x:lMargin y:lMargin toX:lMargin+dX y:lMargin width:labelView innerWidth-dX height:labelView innerHeight async:false. |
|
3317 |
labelView invalidateX:lMargin y:lMargin width:dX height:labelView innerHeight. |
|
3318 |
]. |
|
3319 |
] ifFalse:[ |
|
3320 |
x1 := margin. x := w. |
|
3321 |
self copyFrom:self x:margin+dX y:margin toX:margin y:margin width:innerWT-dX height:innerHG async:false. |
|
3322 |
self invalidateX:width-margin-dX y:margin width:dX height:innerHG. |
|
3323 |
||
3324 |
labelView notNil ifTrue:[ |
|
3325 |
labelView copyFrom:labelView x:lMargin+dX y:lMargin toX:lMargin y:lMargin width:labelView innerWidth-dX height:labelView innerHeight async:false. |
|
3326 |
labelView invalidateX:labelView width-lMargin-dX y:lMargin width:dX height:labelView innerHeight. |
|
3327 |
]. |
|
1487 | 3328 |
]. |
2146 | 3329 |
labelView repairDamage. |
542 | 3330 |
] |
3331 |
]. |
|
3332 |
self originChanged:dltOrg. |
|
1123
ea32a2e3d44d
care for sensor becoming nil while handling exposeEvents
Claus Gittinger <cg@exept.de>
parents:
1115
diff
changeset
|
3333 |
|
2458
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
3334 |
wg notNil ifTrue:[ |
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
3335 |
wg processRealExposeEventsFor:self. |
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
3336 |
]. |
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
3337 |
|
1123
ea32a2e3d44d
care for sensor becoming nil while handling exposeEvents
Claus Gittinger <cg@exept.de>
parents:
1115
diff
changeset
|
3338 |
"Modified: / 7.9.1998 / 16:39:49 / cg" |
542 | 3339 |
! |
3340 |
||
3341 |
scrollToRowAt:aRowNr colAt:aColNr |
|
3342 |
"make row at a row number in column at a column number visible |
|
3343 |
" |
|
1497 | 3344 |
|x "{ Class:SmallInteger }" |
3345 |
y "{ Class:SmallInteger }" |
|
3346 |
l "{ Class:SmallInteger }" |
|
3347 |
dY "{ Class:SmallInteger }" |
|
3348 |
dX "{ Class:SmallInteger }" |
|
3349 |
| |
|
3350 |
||
3351 |
( (aRowNr between:1 and:(list size)) |
|
3352 |
and:[aColNr between:0 and:(columnDescriptors size)] |
|
542 | 3353 |
) ifFalse:[ |
3354 |
^ self |
|
3355 |
]. |
|
3356 |
||
3357 |
dY := dX := 0. |
|
3358 |
y := self yVisibleOfRowNr:aRowNr. |
|
3359 |
||
3360 |
y < margin ifTrue:[ |
|
3361 |
dY := margin - y. |
|
3362 |
] ifFalse:[ |
|
3363 |
y := y + rowHeight. |
|
3364 |
l := height - margin. |
|
3365 |
y > l ifTrue:[dY := l - y] |
|
3366 |
]. |
|
3367 |
||
3368 |
aColNr == 0 ifTrue:[ |
|
3369 |
dY == 0 ifTrue:[^ self]. |
|
3370 |
dX := 0. |
|
3371 |
] ifFalse:[ |
|
3372 |
x := self xVisibleOfColNr:aColNr. |
|
3373 |
||
1163 | 3374 |
x <= margin ifTrue:[ |
542 | 3375 |
dX := margin - x |
3376 |
] ifFalse:[ |
|
1497 | 3377 |
x := x + (columnDescriptors at:aColNr) width. |
542 | 3378 |
l := width - margin. |
3379 |
x > l ifTrue:[dX := l - x] |
|
3380 |
] |
|
3381 |
]. |
|
3382 |
||
3383 |
(dX == 0 and:[dY == 0]) ifFalse:[ |
|
3384 |
self scrollTo:(viewOrigin - (dX @ dY)). |
|
3385 |
] |
|
3386 |
||
3387 |
||
3388 |
! |
|
3389 |
||
3390 |
scrollToSelection |
|
3391 |
"make selection visible |
|
3392 |
" |
|
607 | 3393 |
|rowNr| |
3394 |
||
3395 |
(rowNr := self firstIndexSelected) ~~ 0 ifTrue:[ |
|
1497 | 3396 |
self scrollToRowAt:rowNr colAt:selectedColIndex |
542 | 3397 |
] |
3398 |
||
1506 | 3399 |
! |
3400 |
||
3401 |
scrollVerticalTo:aPixelOffset |
|
3402 |
"change origin to make aPixelOffset be the top line" |
|
3403 |
||
3404 |
|orgX orgY| |
|
3405 |
||
3406 |
orgX := viewOrigin x. |
|
3407 |
orgY := (aPixelOffset + rowHeight - 1) // rowHeight * rowHeight. |
|
3408 |
^ self scrollTo:(orgX @ orgY). |
|
3409 |
||
1749 | 3410 |
! |
3411 |
||
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3412 |
startAutoScroll:aSelectorOrBlock distance:aDistance |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3413 |
"setup for auto-scroll (when button-press-moving below/above view); |
1749 | 3414 |
- timeDelta for scroll is computed from distance |
3415 |
" |
|
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3416 |
|timeDelta scrollBlock| |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3417 |
|
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3418 |
autoScroll ifFalse:[ |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3419 |
self stopAutoScroll. |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3420 |
^ self |
1749 | 3421 |
]. |
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3422 |
|
1749 | 3423 |
autoScrollBlock notNil ifTrue:[ |
3424 |
Processor removeTimedBlock:autoScrollBlock. |
|
3425 |
] ifFalse:[ |
|
3426 |
self compressMotionEvents:false. |
|
3427 |
]. |
|
3428 |
||
3429 |
timeDelta := 0.5 / (aDistance abs). |
|
3430 |
||
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3431 |
scrollBlock := |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3432 |
[ |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3433 |
aSelectorOrBlock isSymbol ifTrue:[ |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3434 |
self perform:aSelectorOrBlock. |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3435 |
] ifFalse:[ |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3436 |
aSelectorOrBlock value |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3437 |
]. |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3438 |
autoScrollBlock notNil ifTrue:[ |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3439 |
Processor addTimedBlock:autoScrollBlock afterSeconds:timeDelta. |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3440 |
] |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3441 |
]. |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3442 |
|
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3443 |
autoScrollBlock := [self sensor pushUserEvent:#value for:scrollBlock]. |
1749 | 3444 |
Processor addTimedBlock:autoScrollBlock afterSeconds:timeDelta. |
3445 |
! |
|
3446 |
||
3447 |
stopAutoScroll |
|
3448 |
"stop any autoScroll |
|
3449 |
" |
|
3450 |
autoScrollBlock notNil ifTrue:[ |
|
3451 |
Processor removeTimedBlock:autoScrollBlock. |
|
3452 |
autoScrollBlock := nil. |
|
3453 |
self compressMotionEvents:true. |
|
3454 |
]. |
|
3455 |
||
3456 |
||
542 | 3457 |
! ! |
3458 |
||
3459 |
!DSVColumnView methodsFor:'selection'! |
|
3460 |
||
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3461 |
addRowToSelection:aRowNr |
2370 | 3462 |
"add a row to the selection |
3463 |
if a column is selected, the column will be closed |
|
3464 |
" |
|
3465 |
|newSelection| |
|
3466 |
||
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3467 |
(self isRowSelectable:aRowNr) ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3468 |
^ self |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3469 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3470 |
|
2398 | 3471 |
self numberOfSelections == 0 ifTrue:[ |
3472 |
self selectColIndex:0 rowIndex:aRowNr. |
|
2370 | 3473 |
^ self |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3474 |
]. |
2398 | 3475 |
(self isInSelection:aRowNr) ifTrue:[^ self]. |
3476 |
||
3477 |
multipleSelectOk ifFalse:[ |
|
3478 |
self selectColIndex:0 rowIndex:aRowNr. |
|
2370 | 3479 |
^ self |
3480 |
]. |
|
2371 | 3481 |
newSelection := selectedRowIndex copyWith:aRowNr. |
2370 | 3482 |
|
3483 |
selectedColIndex ~~ 0 ifTrue:[ |
|
3484 |
self selectColIndex:0 rowIndex:newSelection. |
|
2398 | 3485 |
] ifFalse:[ |
3486 |
selectedRowIndex := selectedRowIndex copyWith:aRowNr. |
|
3487 |
self invalidateRowAt:aRowNr. |
|
3488 |
self selectionChanged. |
|
2370 | 3489 |
]. |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3490 |
! |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3491 |
|
607 | 3492 |
deselect |
3493 |
"deselect |
|
3494 |
" |
|
3495 |
self selectColIndex:0 rowIndex:0 |
|
3496 |
! |
|
3497 |
||
3498 |
firstIndexSelected |
|
809 | 3499 |
"returns index of first row selected or 0 |
607 | 3500 |
" |
3501 |
multipleSelectOk ifFalse:[ |
|
3502 |
^ selectedRowIndex |
|
3503 |
]. |
|
3504 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
3505 |
^ selectedRowIndex at:1 |
|
3506 |
]. |
|
3507 |
^ 0 |
|
3508 |
! |
|
3509 |
||
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
3510 |
hasRowSelection |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
3511 |
"returns true if a selection exists, and its a complete row |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
3512 |
(as opposed to either no selection, or a columnSelection) |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
3513 |
" |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
3514 |
^ self hasSelection and:[selectedColIndex == 0] |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
3515 |
! |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
3516 |
|
542 | 3517 |
hasSelection |
607 | 3518 |
"returns true if a selection exists |
542 | 3519 |
" |
607 | 3520 |
^ self numberOfSelections ~~ 0 |
542 | 3521 |
|
3522 |
||
3523 |
! |
|
3524 |
||
607 | 3525 |
isInSelection:aRowNr |
3526 |
"return true, if row, aRowNr is in the selection |
|
542 | 3527 |
" |
607 | 3528 |
aRowNr ~~ 0 ifTrue:[ |
3529 |
multipleSelectOk ifFalse:[ |
|
3530 |
^ aRowNr == selectedRowIndex |
|
3531 |
]. |
|
3532 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
3533 |
^ selectedRowIndex includes:aRowNr |
|
3534 |
] |
|
3535 |
]. |
|
3536 |
^ false |
|
3537 |
! |
|
3538 |
||
647 | 3539 |
isRowSelected:aRowNr |
3540 |
"return true, if row is in the selection |
|
3541 |
" |
|
3542 |
selectedColIndex == 0 ifTrue:[ |
|
3543 |
^ self isInSelection:aRowNr |
|
3544 |
]. |
|
3545 |
^ false |
|
3546 |
! |
|
3547 |
||
2263 | 3548 |
isRowVisible:aRowNr |
3549 |
|y h| |
|
3550 |
||
3551 |
h := rowHeight. |
|
3552 |
y := self yVisibleOfRowNr:aRowNr. |
|
3553 |
||
3554 |
y < margin ifTrue:[ |
|
3555 |
(h := h + y) <= margin ifTrue:[ |
|
3556 |
^ false |
|
3557 |
]. |
|
3558 |
] ifFalse:[ |
|
3559 |
y >= (height-margin) ifTrue:[^ false]. |
|
3560 |
]. |
|
3561 |
^ true |
|
3562 |
! |
|
3563 |
||
607 | 3564 |
isSelected:aRowNr inColumn:aColNr |
612 | 3565 |
"returns true if cell in a row; a row number, in a column, a column |
3566 |
number is selected. |
|
3567 |
" |
|
1042 | 3568 |
multipleSelectOk ifFalse:[ |
3569 |
aRowNr ~~ selectedRowIndex ifTrue:[ |
|
3570 |
^ false |
|
3571 |
] |
|
3572 |
] ifTrue:[ |
|
3573 |
(selectedRowIndex size ~~ 0 and:[selectedRowIndex includes:aRowNr]) ifFalse:[ |
|
3574 |
^ false |
|
3575 |
] |
|
607 | 3576 |
]. |
1042 | 3577 |
^ (selectedColIndex == 0 or:[selectedColIndex == aColNr]) |
3578 |
||
607 | 3579 |
! |
3580 |
||
2276
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3581 |
isSelectionVisibleIn:anExtentPoint |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3582 |
self selectionIndicesDo:[:selRowNr | |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3583 |
|y| |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3584 |
|
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3585 |
y := self yVisibleOfRowNr:selRowNr. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3586 |
(y between:margin and:(anExtentPoint y - margin)) ifTrue:[^ true]. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3587 |
]. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3588 |
^ false. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3589 |
! |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3590 |
|
809 | 3591 |
lastIndexSelected |
3592 |
"returns index of last row selected or 0 |
|
3593 |
" |
|
3594 |
multipleSelectOk ifFalse:[ |
|
3595 |
^ selectedRowIndex |
|
3596 |
]. |
|
3597 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
3598 |
^ selectedRowIndex last |
|
3599 |
]. |
|
3600 |
^ 0 |
|
3601 |
! |
|
3602 |
||
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3603 |
makeLineVisible:aLine |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3604 |
"scroll to make aLine visible |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3605 |
" |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3606 |
|colNr| |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3607 |
|
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3608 |
aLine == 0 ifTrue:[^ self]. |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3609 |
(self isRowVisible:aLine) ifTrue:[^ self]. |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3610 |
|
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3611 |
(selectedColIndex notNil and:[selectedColIndex ~~ 0]) ifTrue:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3612 |
colNr := selectedColIndex |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3613 |
] ifFalse:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3614 |
colNr := 1 |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3615 |
]. |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3616 |
|
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3617 |
self scrollToRowAt:aLine colAt:colNr |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3618 |
! |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3619 |
|
2246 | 3620 |
makeSelectionVisible |
3621 |
"scroll to make the selection line visible |
|
3622 |
" |
|
3623 |
|rowNr colNr| |
|
3624 |
||
3625 |
rowNr := self firstIndexSelected. |
|
3626 |
rowNr == 0 ifTrue:[^ self]. |
|
3627 |
||
3628 |
(selectedColIndex notNil and:[selectedColIndex ~~ 0]) ifTrue:[ |
|
3629 |
colNr := selectedColIndex |
|
3630 |
] ifFalse:[ |
|
3631 |
colNr := 1 |
|
3632 |
]. |
|
3633 |
self scrollToRowAt:rowNr colAt:colNr |
|
3634 |
! |
|
3635 |
||
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3636 |
maxIndexSelected |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3637 |
"return the largest index selected or 0 |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3638 |
" |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3639 |
multipleSelectOk ifFalse:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3640 |
^ selectedRowIndex |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3641 |
]. |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3642 |
selectedRowIndex size ~~ 0 ifTrue:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3643 |
^ selectedRowIndex max |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3644 |
]. |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3645 |
^ 0 |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3646 |
! |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3647 |
|
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3648 |
minIndexSelected |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3649 |
"return the smallest index selected or 0 |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3650 |
" |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3651 |
multipleSelectOk ifFalse:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3652 |
^ selectedRowIndex |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3653 |
]. |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3654 |
selectedRowIndex size ~~ 0 ifTrue:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3655 |
^ selectedRowIndex min |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3656 |
]. |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3657 |
^ 0 |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3658 |
! |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3659 |
|
607 | 3660 |
numberOfSelections |
3661 |
"return the number of selected rows |
|
3662 |
" |
|
3663 |
multipleSelectOk ifFalse:[ |
|
3664 |
^ selectedRowIndex ~~ 0 ifTrue:[1] ifFalse:[0] |
|
3665 |
]. |
|
3666 |
^ selectedRowIndex size |
|
542 | 3667 |
! |
3668 |
||
2398 | 3669 |
removeRowFromSelection:aRowNr |
3670 |
"remove a row from the selection |
|
3671 |
" |
|
3672 |
(self isInSelection:aRowNr) ifFalse:[^ self]. |
|
3673 |
||
3674 |
self numberOfSelections == 1 ifTrue:[ |
|
3675 |
self deselect. |
|
3676 |
] ifFalse:[ |
|
3677 |
selectedRowIndex := selectedRowIndex copyWithout:aRowNr. |
|
3678 |
self invalidateRowAt:aRowNr. |
|
3679 |
self selectionChanged. |
|
3680 |
]. |
|
3681 |
! |
|
3682 |
||
1947
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
3683 |
selectAllRows |
1971 | 3684 |
"select all |
3685 |
" |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3686 |
multipleSelectOk ifFalse:[^ self]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3687 |
|
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3688 |
selectedRowIndex := (1 to:list size) select:[:idx| self isRowSelectable:idx ]. |
1947
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
3689 |
self selectionChanged. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3690 |
self invalidate. |
1947
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
3691 |
! |
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
3692 |
|
542 | 3693 |
selectColIndex:aColNr rowIndex:aRowNr |
3694 |
"change selection with notification |
|
3695 |
" |
|
3696 |
|oC oR| |
|
3697 |
||
607 | 3698 |
oC := self selectedColIndex. |
3699 |
oR := self selectedRowIndex. |
|
542 | 3700 |
|
3701 |
self setSelectColIndex:aColNr rowIndex:aRowNr. |
|
3702 |
||
607 | 3703 |
(oC ~~ self selectedColIndex or:[oR ~= self selectedRowIndex]) ifTrue:[ |
542 | 3704 |
self selectionChanged |
3705 |
]. |
|
3706 |
! |
|
3707 |
||
607 | 3708 |
selectRow:something |
542 | 3709 |
"select a row |
3710 |
" |
|
607 | 3711 |
^ self selectedRowIndex:something |
542 | 3712 |
! |
3713 |
||
809 | 3714 |
selectRowAt:rowNr colAt:colNr atPoint:aPoint |
3715 |
|v p| |
|
3716 |
||
3717 |
self selectColIndex:colNr rowIndex:rowNr. |
|
3718 |
||
2044
8e36106065f0
fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
3719 |
((v := self detectViewAt:aPoint ignoreInvisible:true) notNil |
8e36106065f0
fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
3720 |
and:[v ~~ self]) |
8e36106065f0
fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
3721 |
ifTrue:[ |
2019
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
3722 |
p := device translatePoint:aPoint fromView:self toView:v. |
2125 | 3723 |
"/ simulate clicking into the editor |
2470 | 3724 |
self sensor |
3725 |
pushEvent:(WindowEvent buttonPress:#select x:p x y:p y view:v); |
|
3726 |
pushEvent:(WindowEvent buttonRelease:#select x:p x y:p y view:v) |
|
809 | 3727 |
]. |
3728 |
! |
|
3729 |
||
2398 | 3730 |
selectRowFrom:start to:stop |
2470 | 3731 |
|step oldSelection newSelection| |
2398 | 3732 |
|
3733 |
start == stop ifTrue:[ |
|
3734 |
self selectColIndex:0 rowIndex:start. |
|
3735 |
^ self |
|
3736 |
]. |
|
3737 |
||
2470 | 3738 |
step := (start <= stop) ifTrue:1 ifFalse:-1. |
3739 |
||
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3740 |
newSelection := (start to:stop by:step) select:[:idx| self isRowSelectable: idx ]. |
2398 | 3741 |
|
3742 |
selectedColIndex ~~ 0 ifTrue:[ |
|
2470 | 3743 |
self selectColIndex:0 rowIndex:newSelection. |
2398 | 3744 |
^ self |
3745 |
]. |
|
2470 | 3746 |
|
3747 |
oldSelection := selectedRowIndex ? #(). |
|
3748 |
selectedRowIndex := newSelection. |
|
3749 |
||
3750 |
newSelection |
|
3751 |
select:[:i | (oldSelection includes:i) not] |
|
3752 |
thenDo:[:i | self invalidateRowAt:i]. |
|
3753 |
||
3754 |
oldSelection |
|
3755 |
select:[:i | (newSelection includes:i) not] |
|
3756 |
thenDo:[:i | self invalidateRowAt:i]. |
|
3757 |
||
2398 | 3758 |
self selectionChanged. |
3759 |
! |
|
3760 |
||
607 | 3761 |
selectRowIndex:something |
3762 |
"set selection of rows |
|
542 | 3763 |
" |
607 | 3764 |
self selectColIndex:selectedColIndex rowIndex:something |
3765 |
||
3766 |
||
542 | 3767 |
! |
3768 |
||
3769 |
selectedColIndex |
|
3770 |
"returns selected column number or 0 |
|
3771 |
" |
|
3772 |
^ selectedColIndex |
|
3773 |
! |
|
3774 |
||
3775 |
selectedColumn |
|
3776 |
"returns selected column or nil |
|
3777 |
" |
|
3778 |
^ columnDescriptors at:selectedColIndex ifAbsent:nil. |
|
3779 |
! |
|
3780 |
||
3781 |
selectedRow |
|
607 | 3782 |
"returns selected row (or collection if multiple selection) or nil |
542 | 3783 |
" |
607 | 3784 |
multipleSelectOk ifFalse:[ |
3785 |
^ self at:selectedRowIndex ifAbsent:nil |
|
3786 |
]. |
|
3787 |
||
3788 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
3789 |
^ selectedRowIndex collect:[:i| self at:i] |
|
3790 |
]. |
|
3791 |
^ nil |
|
3792 |
! |
|
3793 |
||
3794 |
selectedRow:something |
|
3795 |
"select something |
|
3796 |
" |
|
3797 |
self selectedRowIndex:something |
|
542 | 3798 |
! |
3799 |
||
3800 |
selectedRowIndex |
|
3801 |
"returns selected row number or 0 |
|
3802 |
" |
|
3803 |
^ selectedRowIndex |
|
3804 |
! |
|
3805 |
||
607 | 3806 |
selectedRowIndex:something |
2470 | 3807 |
"set the row selection (single or multiple rows); |
3808 |
does NOT change the selectoed column. |
|
607 | 3809 |
" |
3810 |
self selectColIndex:selectedColIndex rowIndex:something |
|
542 | 3811 |
! |
3812 |
||
3813 |
selectionChanged |
|
3814 |
"selection has changed |
|
3815 |
" |
|
1487 | 3816 |
|val| |
3817 |
||
3818 |
model notNil ifTrue:[ |
|
3819 |
val := self selectedRowIndex copy. |
|
3820 |
||
3821 |
(model respondsTo:#selectionIndex:) ifTrue:[ |
|
3822 |
model selectionIndex:val |
|
3823 |
] ifFalse:[ |
|
3824 |
useIndex ifFalse:[ model value:(self selectedRow) ] |
|
3825 |
ifTrue:[ model value:val ] |
|
3826 |
] |
|
3827 |
]. |
|
542 | 3828 |
|
3829 |
actionBlock notNil ifTrue:[ |
|
607 | 3830 |
actionBlock value:(self selectedRowIndex) |
3831 |
] |
|
3832 |
! |
|
3833 |
||
3834 |
selectionIndicesDo:aOneArgBlock |
|
3835 |
"evaluate block on each row selected; the argument to the row |
|
3836 |
is the index of the selected row |
|
3837 |
" |
|
3838 |
multipleSelectOk ifFalse:[ |
|
3839 |
selectedRowIndex ~~ 0 ifTrue:[ |
|
3840 |
aOneArgBlock value:selectedRowIndex |
|
3841 |
] |
|
3842 |
] ifTrue:[ |
|
3843 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
3844 |
selectedRowIndex do:[:i| aOneArgBlock value:i ] |
|
3845 |
] |
|
542 | 3846 |
] |
3847 |
! |
|
3848 |
||
2470 | 3849 |
setSelectColIndex:colNrArg rowIndex:rowNrArg |
542 | 3850 |
"change selection without notification |
3851 |
" |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3852 |
|editSpec rowNr colNr newCol oldCol oldRow sensor sglSelRow oldSz |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3853 |
keyBrdFwd filter edValue edView| |
542 | 3854 |
|
2470 | 3855 |
rowNr := self validateSelection:rowNrArg. |
3856 |
colNr := colNrArg. |
|
3857 |
||
3858 |
(rowNr == 0 |
|
3859 |
or:[multipleSelectOk and:[rowNr size ~~ 1]]) ifTrue:[ |
|
3860 |
colNr := 0 |
|
542 | 3861 |
]. |
3862 |
||
607 | 3863 |
(colNr := colNr ? 0) ~~ 0 ifTrue:[ |
3864 |
newCol := self columnAt:colNr. |
|
3865 |
newCol rendererType == #rowSelector ifTrue:[ |
|
3866 |
colNr := 0. |
|
3867 |
newCol := nil |
|
3868 |
] ifFalse:[ |
|
3869 |
multipleSelectOk ifTrue:[sglSelRow := rowNr at:1] |
|
3870 |
ifFalse:[sglSelRow := rowNr]. |
|
3871 |
||
3872 |
(newCol canSelect:sglSelRow) ifFalse:[ |
|
3873 |
newCol := nil. |
|
1112 | 3874 |
colNr := 0. |
3875 |
||
3876 |
selectRowOnDefault ifFalse:[ |
|
3877 |
rowNr := multipleSelectOk ifFalse:[0] ifTrue:[nil] |
|
3878 |
] |
|
607 | 3879 |
] |
3880 |
] |
|
3881 |
]. |
|
3882 |
||
3883 |
(rowNr = selectedRowIndex and:[colNr == selectedColIndex]) ifTrue:[ |
|
643 | 3884 |
^ self |
542 | 3885 |
]. |
3886 |
||
3887 |
"/ release old selection |
|
3888 |
||
612 | 3889 |
oldSz := self numberOfSelections. |
542 | 3890 |
oldCol := selectedColIndex. |
3891 |
oldRow := selectedRowIndex. |
|
612 | 3892 |
|
1968
857cd9f14570
fixed store-into-wrong-col bug (imageEditors color table)
Claus Gittinger <cg@exept.de>
parents:
1959
diff
changeset
|
3893 |
"/ cg: must change the selectedRow/Col AFTER we have stored the editValue. |
857cd9f14570
fixed store-into-wrong-col bug (imageEditors color table)
Claus Gittinger <cg@exept.de>
parents:
1959
diff
changeset
|
3894 |
"/ (otherwise, the editvalue might be stored into the new col as well ...) |
857cd9f14570
fixed store-into-wrong-col bug (imageEditors color table)
Claus Gittinger <cg@exept.de>
parents:
1959
diff
changeset
|
3895 |
|
857cd9f14570
fixed store-into-wrong-col bug (imageEditors color table)
Claus Gittinger <cg@exept.de>
parents:
1959
diff
changeset
|
3896 |
"/ selectedRowIndex := rowNr. |
857cd9f14570
fixed store-into-wrong-col bug (imageEditors color table)
Claus Gittinger <cg@exept.de>
parents:
1959
diff
changeset
|
3897 |
"/ selectedColIndex := colNr. |
542 | 3898 |
|
612 | 3899 |
oldSz == 1 ifTrue:[ |
3900 |
multipleSelectOk ifTrue:[oldRow := oldRow at:1]. |
|
542 | 3901 |
|
612 | 3902 |
editValue notNil ifTrue:[ |
1215 | 3903 |
editValue removeDependent:self |
3904 |
]. |
|
3905 |
editView notNil ifTrue:[ |
|
3906 |
editView allSubViewsDo:[:aSubView| |
|
2320 | 3907 |
(aSubView respondsTo:#accept) ifTrue:[ |
3908 |
aSubView accept |
|
3909 |
]. |
|
1215 | 3910 |
] |
3911 |
]. |
|
3912 |
||
3913 |
editValue notNil ifTrue:[ |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3914 |
edValue := editValue value. |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3915 |
edValue isSequenceable ifTrue:[ |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3916 |
edValue size == 0 ifTrue:[ |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3917 |
edValue := nil |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3918 |
] ifFalse:[ |
2470 | 3919 |
edValue isString ifFalse:[ |
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3920 |
edValue := edValue select:[:el| el notNil ]. |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3921 |
edValue size == 0 ifTrue:[ |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3922 |
edValue := nil |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3923 |
] |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3924 |
] |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3925 |
] |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3926 |
]. |
1661 | 3927 |
(self columnAt:oldCol) at:oldRow put:edValue. |
3928 |
modifiedChannel notNil ifTrue:[ |
|
3929 |
modifiedChannel value:true |
|
3930 |
]. |
|
612 | 3931 |
editValue := nil |
3932 |
]. |
|
1111 | 3933 |
self destroyEditView. |
612 | 3934 |
]. |
1968
857cd9f14570
fixed store-into-wrong-col bug (imageEditors color table)
Claus Gittinger <cg@exept.de>
parents:
1959
diff
changeset
|
3935 |
selectedRowIndex := rowNr. |
857cd9f14570
fixed store-into-wrong-col bug (imageEditors color table)
Claus Gittinger <cg@exept.de>
parents:
1959
diff
changeset
|
3936 |
selectedColIndex := colNr. |
857cd9f14570
fixed store-into-wrong-col bug (imageEditors color table)
Claus Gittinger <cg@exept.de>
parents:
1959
diff
changeset
|
3937 |
|
612 | 3938 |
shown ifFalse:[^ self ]. |
542 | 3939 |
|
618 | 3940 |
oldSz > 1 ifTrue:[ "/ redraw old selection |
3941 |
oldRow do:[:aRowNr| "/ unselected if visible |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3942 |
self invalidateRowAt:aRowNr colAt:0 |
618 | 3943 |
] |
3944 |
] ifFalse:[ |
|
3945 |
oldSz == 1 ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3946 |
self invalidateRowAt:oldRow colAt:oldCol |
618 | 3947 |
] |
3948 |
]. |
|
3949 |
||
542 | 3950 |
"/ show new selection |
3951 |
||
3952 |
newCol notNil ifTrue:[ |
|
607 | 3953 |
self scrollToRowAt:sglSelRow colAt:colNr. |
833 | 3954 |
editSpec := newCol editorAt:sglSelRow. |
3955 |
||
3956 |
editSpec notNil ifTrue:[ |
|
1112 | 3957 |
editView := SimpleView extent:( (newCol width - (2 * separatorSize)) |
3958 |
@ (rowHeight - (2 * separatorSize)) |
|
607 | 3959 |
) |
3960 |
in:self. |
|
542 | 3961 |
self updateEditViewOrigin. |
1112 | 3962 |
|
1134 | 3963 |
(newCol containsText or:[newCol showSelectionHighLighted not]) ifTrue:[ |
1565 | 3964 |
editView viewBackground:(newCol backgroundColorAt:sglSelRow) |
1112 | 3965 |
] ifFalse:[ |
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
3966 |
editView viewBackground:selectionBackgroundColor |
1112 | 3967 |
]. |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3968 |
edView := editSpec at:1. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3969 |
editView add:edView. |
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3970 |
oldSz := editSpec size. |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3971 |
|
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3972 |
oldSz == 3 ifTrue:[ |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3973 |
filter := [:aKey| #(#Tab #CursorUp #CursorDown) includes:aKey] |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3974 |
] ifFalse:[ |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3975 |
filter := [:aKey| aKey == #Tab] |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3976 |
]. |
1111 | 3977 |
keyBrdFwd := KeyboardForwarder toView:self |
3978 |
condition:nil |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3979 |
filter:filter. |
1111 | 3980 |
|
3981 |
editView withAllSubViewsDo:[:aView| |
|
1112 | 3982 |
aView delegate:keyBrdFwd. |
3983 |
aView font:font. |
|
1111 | 3984 |
]. |
3985 |
||
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3986 |
(editValue := editSpec at:2 ifAbsent:nil) notNil ifTrue:[ |
809 | 3987 |
editValue addDependent:self. |
648 | 3988 |
]. |
542 | 3989 |
editView realize. |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3990 |
edView canTab:true. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3991 |
self windowGroup focusView:edView. |
1111 | 3992 |
|
542 | 3993 |
] ifFalse:[ |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3994 |
self invalidateRowAt:sglSelRow colAt:colNr |
612 | 3995 |
]. |
3996 |
] ifFalse:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3997 |
self selectionIndicesDo:[:i| self invalidateRowAt:i colAt:0 ]. |
612 | 3998 |
self scrollToRowAt:(self firstIndexSelected) colAt:0 |
3999 |
]. |
|
4000 |
||
4001 |
sensor := self sensor. "/ catch expose events |
|
4002 |
||
4003 |
[sensor hasExposeEventFor:nil] whileTrue:[ |
|
4004 |
self windowGroup processExposeEvents |
|
4005 |
]. |
|
4006 |
||
1661 | 4007 |
"Modified: / 30.1.2000 / 12:18:25 / cg" |
607 | 4008 |
! |
4009 |
||
4010 |
validateSelection:aSelection |
|
4011 |
|newSel| |
|
4012 |
||
4013 |
newSel := aSelection. |
|
4014 |
||
1497 | 4015 |
(list size == 0 or:[newSel isNil or:[newSel == 0]]) ifTrue:[ |
607 | 4016 |
^ multipleSelectOk ifFalse:[0] ifTrue:[nil] |
4017 |
]. |
|
4018 |
||
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4019 |
multipleSelectOk ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4020 |
newSel isNumber ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4021 |
newSel := self identityIndexOfRow:aSelection. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4022 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4023 |
^ (self isRowSelectable:newSel) ifTrue:[newSel] ifFalse:[0]. |
607 | 4024 |
]. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4025 |
|
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4026 |
"multiple selection |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4027 |
" |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4028 |
aSelection size ~~ 0 ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4029 |
aSelection first isNumber ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4030 |
newSel := aSelection select:[:idx| self isRowSelectable:idx ]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4031 |
] ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4032 |
newSel := aSelection |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4033 |
collect:[:el| self identityIndexOfRow:el ] |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4034 |
thenSelect:[:idx| self isRowSelectable:idx ]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4035 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4036 |
newSel notEmpty ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4037 |
^ newSel |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4038 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4039 |
] ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4040 |
(newSel isNumber and:[self isRowSelectable:newSel]) ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4041 |
^ Array with:newSel |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4042 |
]. |
607 | 4043 |
]. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4044 |
^ nil |
542 | 4045 |
! ! |
4046 |
||
4047 |
!DSVColumnView class methodsFor:'documentation'! |
|
4048 |
||
4049 |
version |
|
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4050 |
^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.180 2004-03-04 09:33:31 cg Exp $' |
542 | 4051 |
! ! |