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