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