author | Claus Gittinger <cg@exept.de> |
Thu, 14 Oct 1999 19:16:58 +0200 | |
changeset 1592 | 2226c318c393 |
parent 1591 | 6996391ee3ba |
child 1712 | 5511cc404d6b |
permissions | -rw-r--r-- |
542 | 1 |
" |
2 |
COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
||
14 |
||
15 |
||
16 |
Object subclass:#DataSetColumn |
|
1592 | 17 |
instanceVariableNames:'columnNumber dataSet width description buttonExtent shownValue |
18 |
rendererType backgroundColor rowSeparatorSelector |
|
19 |
showColSeparator showRowSeparator foregroundColor fgSelector |
|
20 |
bgSelector columnAlignment label readSelector containsText |
|
21 |
numArgsToReadSelector numArgsToFgSelector numArgsToBgSelector |
|
22 |
columnAdaptor descWidth descMinWidth' |
|
23 |
classVariableNames:'' |
|
24 |
poolDictionaries:'' |
|
25 |
category:'Views-DataSet' |
|
542 | 26 |
! |
27 |
||
28 |
!DataSetColumn class methodsFor:'documentation'! |
|
29 |
||
30 |
copyright |
|
31 |
" |
|
32 |
COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG |
|
33 |
All Rights Reserved |
|
34 |
||
35 |
This software is furnished under a license and may be used |
|
36 |
only in accordance with the terms of that license and with the |
|
37 |
inclusion of the above copyright notice. This software may not |
|
38 |
be provided or otherwise made available to, or used by, any |
|
39 |
other person. No title to or ownership of the software is |
|
40 |
hereby transferred. |
|
41 |
" |
|
42 |
||
43 |
||
44 |
||
45 |
! |
|
46 |
||
47 |
documentation |
|
48 |
" |
|
49 |
represent one single column description of a DataSetView |
|
50 |
||
51 |
[Instance variables:] |
|
52 |
||
647 | 53 |
columnNumber <Integer> sequence number (into list of columns) |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
54 |
|
542 | 55 |
dataSet <DSVColumnView> the view it belongs to |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
56 |
|
1088 | 57 |
width <Integer> width of column |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
58 |
|
1088 | 59 |
description <DataSetColumnSpec> the column description |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
60 |
|
1088 | 61 |
buttonExtent <Point> extent of drawable form |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
62 |
|
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
63 |
rendererType <Type> renderer type (cached value from |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
64 |
the column specification). |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
65 |
|
647 | 66 |
backgroundColor <Color or nil> background color of all cells or nil |
67 |
(nil: use default background color). |
|
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
68 |
|
647 | 69 |
foregroundColor <Color or nil> foreground color of all cells or nil |
70 |
(nil: use default foreground color). |
|
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
71 |
|
647 | 72 |
fgSelector <Selector or nil> access specific foreground color for |
73 |
a cell |
|
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
74 |
|
647 | 75 |
bgSelector <Selector or nil> access specific background color for |
76 |
a cell |
|
77 |
||
1088 | 78 |
columnAlignment <Symbol> align text/icon #left #right or #center |
79 |
in row (on default: #left). |
|
80 |
||
81 |
label <label/icon or nil> label resolved by the builder shown |
|
82 |
in the column description field. |
|
83 |
||
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
84 |
readSelector <Symbol> cached readSelector (from the spec) |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
85 |
|
1113 | 86 |
numArgsToReadSelector <Integer> number of arguments to the readSelector |
87 |
||
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
88 |
columnAdaptor <nil or any> if non-nil, that one is asked (via |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
89 |
read-writeSelectors to extract a column |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
90 |
from a row object. |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
91 |
If nil, the row object is used itself. |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
92 |
|
1113 | 93 |
showColSeparator <Boolean> true: vertical separators are enabled; |
94 |
separator between columns |
|
95 |
||
96 |
showRowSeparator <Boolean> true: horizontal separators are enabled; |
|
97 |
separator between rows |
|
98 |
||
99 |
rowSeparatorSelector <Selector or nil> access specific showRowSeparator state |
|
100 |
for a cell |
|
542 | 101 |
|
102 |
[author:] |
|
103 |
Claus Atzkern |
|
104 |
||
105 |
[see also:] |
|
106 |
DataSetColumnSpec |
|
107 |
DSVColumnView |
|
108 |
DataSetView |
|
109 |
" |
|
110 |
||
111 |
||
112 |
! ! |
|
113 |
||
114 |
!DataSetColumn methodsFor:'accessing'! |
|
115 |
||
116 |
at:aRowNr |
|
117 |
"get the value of the raw at an index, aRowNr |
|
118 |
" |
|
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
119 |
^ self extractColFromRow:(dataSet at:aRowNr). |
542 | 120 |
! |
121 |
||
122 |
at:aRowNr put:something |
|
123 |
"set the value of the raw at an index, aRowNr |
|
124 |
" |
|
1059 | 125 |
|row newRow| |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
126 |
|
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
127 |
row := dataSet at:aRowNr. |
1059 | 128 |
newRow := self storeCol:something inRow:row. |
129 |
newRow ~~ row ifTrue:[ |
|
1487 | 130 |
dataSet listAt:aRowNr put:newRow. |
1059 | 131 |
] |
1065
332afeb89d6b
modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents:
1059
diff
changeset
|
132 |
|
332afeb89d6b
modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents:
1059
diff
changeset
|
133 |
"Modified: / 7.8.1998 / 22:17:27 / cg" |
542 | 134 |
! |
135 |
||
1558
00b34d71898a
columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
136 |
columnAdaptor |
00b34d71898a
columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
137 |
^ columnAdaptor |
00b34d71898a
columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
138 |
! |
00b34d71898a
columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
139 |
|
807 | 140 |
description |
141 |
"returns the column description |
|
142 |
" |
|
143 |
^ description |
|
144 |
||
145 |
||
146 |
! |
|
147 |
||
542 | 148 |
label |
149 |
"get the label assigned to the column |
|
150 |
" |
|
891 | 151 |
^ label |
542 | 152 |
|
153 |
||
154 |
! |
|
155 |
||
1487 | 156 |
rendererType |
157 |
"returns my renderer type |
|
158 |
" |
|
159 |
^ rendererType |
|
160 |
! ! |
|
161 |
||
1565 | 162 |
!DataSetColumn methodsFor:'accessing colors'! |
163 |
||
164 |
backgroundColor |
|
165 |
"returns the background color or nil |
|
166 |
" |
|
167 |
^ backgroundColor == dataSet backgroundColor ifTrue:[nil] |
|
168 |
ifFalse:[backgroundColor] |
|
169 |
||
170 |
! |
|
171 |
||
172 |
backgroundColorAt:aRowNr |
|
173 |
"returns the background color for a row at list index a rowNr |
|
174 |
" |
|
175 |
bgSelector notNil ifTrue:[ |
|
176 |
^ self backgroundColorFor:(dataSet at:aRowNr) at:aRowNr |
|
177 |
]. |
|
178 |
^ backgroundColor |
|
179 |
||
180 |
! |
|
181 |
||
182 |
backgroundColorFor:aRow at:aRowNr |
|
183 |
"returns the background color for a row at list index a rowNr |
|
184 |
" |
|
185 |
|bg| |
|
186 |
||
187 |
bgSelector notNil ifTrue:[ |
|
188 |
numArgsToBgSelector == 0 ifTrue:[ |
|
189 |
bg := aRow perform:bgSelector |
|
190 |
] ifFalse:[ |
|
191 |
bg := aRow perform:bgSelector with:aRowNr |
|
192 |
]. |
|
193 |
bg notNil ifTrue:[^ bg] |
|
194 |
]. |
|
195 |
^ backgroundColor |
|
196 |
||
197 |
! |
|
198 |
||
199 |
foregroundColor |
|
200 |
"returns the foreground color or nil |
|
201 |
" |
|
202 |
^ foregroundColor == dataSet foregroundColor ifTrue:[nil] |
|
203 |
ifFalse:[foregroundColor] |
|
204 |
||
205 |
! |
|
206 |
||
207 |
foregroundColorFor:aRow at:aRowNr |
|
208 |
"returns the foreground color for a row at list index a rowNr |
|
209 |
" |
|
210 |
|fg| |
|
211 |
||
212 |
fgSelector notNil ifTrue:[ |
|
213 |
numArgsToFgSelector == 0 ifTrue:[ |
|
214 |
fg := aRow perform:fgSelector |
|
215 |
] ifFalse:[ |
|
216 |
fg := aRow perform:fgSelector with:aRowNr |
|
217 |
]. |
|
218 |
fg notNil ifTrue:[^ fg] |
|
219 |
]. |
|
220 |
^ foregroundColor |
|
221 |
||
222 |
! ! |
|
223 |
||
1487 | 224 |
!DataSetColumn methodsFor:'accessing dimension'! |
225 |
||
1484 | 226 |
minWidth |
1490 | 227 |
"get the minimum width required by the column |
1484 | 228 |
" |
1490 | 229 |
descMinWidth notNil ifTrue:[ |
230 |
^ descMinWidth |
|
231 |
]. |
|
232 |
width := nil. |
|
233 |
^ self width |
|
1484 | 234 |
|
1490 | 235 |
! |
236 |
||
1492 | 237 |
minimumRequiredWidth |
238 |
"returns the minimum required width |
|
239 |
" |
|
240 |
|minWidth| |
|
241 |
||
242 |
minWidth := dataSet separatorSize |
|
243 |
+ (2 * dataSet horizontalSpacing) |
|
244 |
+ label preferredWidth. |
|
245 |
||
246 |
^ minWidth |
|
247 |
||
248 |
||
249 |
! |
|
250 |
||
1490 | 251 |
setDescWidth:aWidth |
252 |
"set a fixed width |
|
253 |
" |
|
1492 | 254 |
|minWidth| |
255 |
||
256 |
minWidth := self minimumRequiredWidth. |
|
257 |
descWidth := aWidth max:minWidth. |
|
1490 | 258 |
descMinWidth := width := descWidth. |
1484 | 259 |
|
260 |
||
261 |
! |
|
262 |
||
542 | 263 |
width |
264 |
"returns the width in pixels |
|
265 |
" |
|
1526 | 266 |
|max "{ Class:SmallInteger }" |
267 |
lsz "{ Class:SmallInteger }"| |
|
542 | 268 |
|
1484 | 269 |
width notNil ifTrue:[^ width]. "/ already computed |
542 | 270 |
|
1490 | 271 |
descMinWidth notNil ifTrue:[ |
272 |
width := descMinWidth. |
|
273 |
^ width |
|
1484 | 274 |
]. |
1482 | 275 |
|
1493 | 276 |
(descWidth ~~ 0 and:[descWidth isReal not]) ifTrue:[ |
277 |
width := descMinWidth := descWidth. |
|
278 |
^ width |
|
279 |
]. |
|
280 |
||
1490 | 281 |
width := description minWidth max:(label preferredWidth). |
282 |
||
283 |
descWidth isReal ifTrue:[ |
|
284 |
width := width max:(descWidth * dataSet width) rounded. |
|
285 |
^ width |
|
1482 | 286 |
]. |
287 |
||
1496 | 288 |
containsText ifTrue:[ |
1484 | 289 |
"/ take maximum 5 entries to calculate the width; |
290 |
"/ can be resized later if neccessary |
|
1526 | 291 |
lsz := dataSet size. |
1484 | 292 |
max := 5 min:dataSet size. |
542 | 293 |
|
1526 | 294 |
max ~~ 0 ifTrue:[ |
295 |
1 to:max do:[:i| |
|
296 |
width := width max:(self widthOfLabel:(shownValue value:(dataSet at:i))) |
|
297 |
]. |
|
298 |
width := width max:(self widthOfLabel:(shownValue value:(dataSet at:lsz))) |
|
1484 | 299 |
]. |
300 |
description editorType ~~ #None ifTrue:[ |
|
301 |
width := width + (dataSet font widthOn:dataSet device) |
|
542 | 302 |
]. |
1493 | 303 |
] ifFalse:[ |
304 |
max := 1 |
|
1484 | 305 |
]. |
1490 | 306 |
width := width + buttonExtent x + dataSet separatorSize + (2 * dataSet horizontalSpacing). |
1493 | 307 |
|
308 |
max ~~ 0 ifTrue:[ |
|
1526 | 309 |
descMinWidth := width. |
310 |
description usePreferredWidth ifTrue:[ |
|
311 |
descWidth := width |
|
312 |
] |
|
1493 | 313 |
]. |
1490 | 314 |
^ width |
1484 | 315 |
|
316 |
||
542 | 317 |
! ! |
318 |
||
319 |
!DataSetColumn methodsFor:'drawing'! |
|
320 |
||
1147 | 321 |
drawLabel:aLabel atX:xLeft y:yTop |
322 |
"redraw label |
|
323 |
" |
|
1586
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
324 |
|x space prevClip mustUndoClip| |
1147 | 325 |
|
326 |
space := dataSet horizontalSpacing. |
|
327 |
||
328 |
columnAlignment == #left ifTrue:[ |
|
329 |
x := xLeft + space. |
|
330 |
] ifFalse:[ |
|
331 |
x := width - (aLabel widthOn:dataSet). |
|
332 |
||
333 |
columnAlignment == #right ifTrue:[x := x - space] |
|
334 |
ifFalse:[x := x // 2]. |
|
1586
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
335 |
|
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
336 |
"/ cg: old code (did not right-align if string is larger than width |
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
337 |
"/ x := xLeft + (x max:0). |
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
338 |
|
1587 | 339 |
"/ new code: always right-align. |
340 |
x := xLeft + x. |
|
341 |
||
342 |
"/ must clip left, if string is too large |
|
343 |
x < xLeft ifTrue:[ |
|
1586
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
344 |
"/ must clip ... |
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
345 |
prevClip := dataSet clippingRectangleOrNil. |
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
346 |
mustUndoClip := true. |
1591
6996391ee3ba
Avoid obsolete method. (stefan)
Claus Gittinger <cg@exept.de>
parents:
1590
diff
changeset
|
347 |
dataSet clippingRectangle:(Rectangle |
1586
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
348 |
left:xLeft top:yTop |
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
349 |
width:width height:(aLabel heightOn:dataSet)). |
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
350 |
]. |
1147 | 351 |
]. |
1447 | 352 |
|
1147 | 353 |
aLabel isImageOrForm ifTrue:[ |
354 |
aLabel displayOn:dataSet x:x y:yTop. |
|
1586
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
355 |
] ifFalse:[ |
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
356 |
aLabel displayOn:dataSet x:x y:(yTop + dataSet rowFontAscent) |
1147 | 357 |
]. |
358 |
||
1586
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
359 |
mustUndoClip == true ifTrue:[ |
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
360 |
dataSet clippingRectangle:prevClip |
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
361 |
]. |
1147 | 362 |
! |
363 |
||
1132 | 364 |
drawLabelsAtX:xLeft y:yTop h:h from:start to:stop |
365 |
"redraw labels from start to stop |
|
1088 | 366 |
" |
1113 | 367 |
|fg bg label row isSel |
1132 | 368 |
y "{ Class:SmallInteger }" |
369 |
yT "{ Class:SmallInteger }" |
|
370 |
x "{ Class:SmallInteger }" |
|
371 |
hspace "{ Class:SmallInteger }" |
|
372 |
ascent "{ Class:SmallInteger }" |
|
1147 | 373 |
lblHg "{ Class:SmallInteger }" |
1088 | 374 |
| |
1132 | 375 |
yT := yTop. |
376 |
ascent := dataSet rowFontAscent. |
|
377 |
hspace := dataSet horizontalSpacing. |
|
1100 | 378 |
|
1132 | 379 |
start to:stop do:[:anIndex| |
380 |
row := dataSet at:anIndex. |
|
381 |
y := yT. |
|
382 |
x := xLeft. |
|
383 |
||
384 |
"/ GET BACKGROUND AND FOREGROUND-COLOR |
|
385 |
"/ =================================== |
|
386 |
||
387 |
isSel := dataSet isSelected:anIndex inColumn:columnNumber. |
|
388 |
||
389 |
isSel ifTrue:[ |
|
390 |
( description editorType ~~ #None |
|
391 |
and:[dataSet selectedColIndex == columnNumber] |
|
392 |
) ifTrue:[ |
|
393 |
isSel := false |
|
1115 | 394 |
] |
1113 | 395 |
]. |
396 |
||
1132 | 397 |
(isSel and:[description showSelectionHighLighted]) ifTrue:[ |
398 |
"/ SHOW SELECTED( MUST REDRAW BACKGROUND ) |
|
399 |
"/ ======================================= |
|
400 |
fg := dataSet hgLgFgColor. |
|
401 |
bg := dataSet hgLgBgColor. |
|
402 |
dataSet paint:bg. |
|
403 |
dataSet fillRectangleX:x y:y width:width height:h. |
|
1113 | 404 |
] ifFalse:[ |
1132 | 405 |
bgSelector notNil ifTrue:[ |
406 |
"/ MUST REDRAW BACKGROUND |
|
407 |
"/ ====================== |
|
1565 | 408 |
bg := self backgroundColorFor:row at:anIndex. |
409 |
||
410 |
bg ~~ backgroundColor ifTrue:[ |
|
1132 | 411 |
bg := dataSet colorOnDevice:bg |
412 |
]. |
|
413 |
dataSet paint:bg. |
|
414 |
dataSet fillRectangleX:x y:y width:width height:h. |
|
415 |
] ifFalse:[ |
|
416 |
bg := backgroundColor |
|
417 |
]. |
|
1100 | 418 |
|
1565 | 419 |
fg := self foregroundColorFor:row at:anIndex. |
420 |
||
421 |
fg ~~ foregroundColor ifTrue:[ |
|
1132 | 422 |
fg := dataSet colorOnDevice:fg |
1565 | 423 |
]. |
1132 | 424 |
]. |
833 | 425 |
|
1132 | 426 |
"/ GET AND DRAW LABEL |
427 |
"/ ================== |
|
428 |
rendererType == #rowSelector ifTrue:[ |
|
429 |
isSel ifTrue:[ |
|
430 |
label := dataSet rowSelectorForm. |
|
431 |
x := x + hspace. |
|
432 |
] ifFalse:[ |
|
433 |
label := nil |
|
434 |
] |
|
1113 | 435 |
] ifFalse:[ |
1147 | 436 |
(isSel and:[dataSet hasOpenEditor]) ifTrue:[ |
437 |
label := nil |
|
438 |
] ifFalse:[ |
|
439 |
label := shownValue value:row |
|
1132 | 440 |
] |
441 |
]. |
|
442 |
label notNil ifTrue:[ |
|
1589
8bb71707b51a
remove any color emphasis when displaying the selection.
Claus Gittinger <cg@exept.de>
parents:
1587
diff
changeset
|
443 |
"/ care for a dark-colored label, |
8bb71707b51a
remove any color emphasis when displaying the selection.
Claus Gittinger <cg@exept.de>
parents:
1587
diff
changeset
|
444 |
"/ with a dark selection-bg color |
1592 | 445 |
(isSel and:[label isString and:[label hasChangeOfEmphasis]]) ifTrue:[ |
1589
8bb71707b51a
remove any color emphasis when displaying the selection.
Claus Gittinger <cg@exept.de>
parents:
1587
diff
changeset
|
446 |
"/ take away the labels own color info |
8bb71707b51a
remove any color emphasis when displaying the selection.
Claus Gittinger <cg@exept.de>
parents:
1587
diff
changeset
|
447 |
label := label emphasisAllRemove:#color. |
8bb71707b51a
remove any color emphasis when displaying the selection.
Claus Gittinger <cg@exept.de>
parents:
1587
diff
changeset
|
448 |
]. |
8bb71707b51a
remove any color emphasis when displaying the selection.
Claus Gittinger <cg@exept.de>
parents:
1587
diff
changeset
|
449 |
|
1147 | 450 |
lblHg := self heightOfLabel:label. |
451 |
||
452 |
lblHg ~~ 0 ifTrue:[ |
|
453 |
y := y + (h - lblHg // 2). |
|
454 |
dataSet paint:fg on:bg. |
|
1113 | 455 |
|
1147 | 456 |
(label isSequenceable and:[label isString not]) ifFalse:[ |
457 |
self drawLabel:label atX:x y:y |
|
458 |
] ifTrue:[ |
|
459 |
label do:[:el| |
|
460 |
el notNil ifTrue:[ |
|
461 |
self drawLabel:el atX:x y:y. |
|
462 |
y := y + (el heightOn:dataSet). |
|
463 |
] |
|
464 |
] |
|
465 |
]. |
|
466 |
] |
|
1132 | 467 |
]. |
468 |
yT := yT + h |
|
469 |
] |
|
1113 | 470 |
|
833 | 471 |
|
472 |
! |
|
473 |
||
1132 | 474 |
drawSeparatorsAtX:xLeft y:yTop h:h from:start to:stop |
475 |
"redraw separators for cells between start and stop |
|
1088 | 476 |
" |
1132 | 477 |
|is3D |
478 |
xL "{ Class:SmallInteger }" |
|
1113 | 479 |
xR "{ Class:SmallInteger }" |
480 |
yB "{ Class:SmallInteger }" |
|
481 |
yT "{ Class:SmallInteger }" |
|
1132 | 482 |
times "{ Class:SmallInteger }" |
1088 | 483 |
| |
1132 | 484 |
(showColSeparator or:[showRowSeparator]) ifFalse:[ |
485 |
^ self |
|
486 |
]. |
|
487 |
is3D := dataSet has3Dseparators. |
|
488 |
||
1113 | 489 |
is3D ifTrue:[dataSet paint:(dataSet separatorDarkColor)] |
490 |
ifFalse:[dataSet paint:(dataSet foregroundColor)]. |
|
1088 | 491 |
|
1132 | 492 |
times := stop - start + 1. |
493 |
xL := xLeft. |
|
494 |
xR := xL - 1 + width. |
|
1088 | 495 |
|
1113 | 496 |
showRowSeparator ifTrue:[ |
1132 | 497 |
"/ DRAW SEPARATORS AT BOTTOM( DARK COLOR ) |
498 |
"/ ======================================= |
|
499 |
yB := yTop - 1 + h. |
|
500 |
||
501 |
rowSeparatorSelector isNil ifTrue:[ |
|
502 |
times timesRepeat:[ |
|
503 |
dataSet displayLineFromX:xL y:yB toX:xR y:yB. |
|
504 |
yB := yB + h. |
|
505 |
] |
|
506 |
] ifFalse:[ |
|
507 |
start to:stop do:[:idx| |
|
508 |
((dataSet at:idx) perform:rowSeparatorSelector) ~~ false ifTrue:[ |
|
509 |
dataSet displayLineFromX:xL y:yB toX:xR y:yB |
|
510 |
]. |
|
511 |
yB := yB + h. |
|
512 |
] |
|
1113 | 513 |
] |
514 |
]. |
|
1132 | 515 |
|
1113 | 516 |
showColSeparator ifTrue:[ |
1132 | 517 |
"/ DRAW SEPARATORS AT RIGHT( DARK COLOR ) |
518 |
"/ ====================================== |
|
519 |
yT := yTop. |
|
520 |
||
521 |
times timesRepeat:[ |
|
522 |
dataSet displayLineFromX:xR y:yT toX:xR y:(yT - 1 + h). |
|
523 |
yT := yT + h. |
|
524 |
] |
|
1113 | 525 |
]. |
1089 | 526 |
|
1113 | 527 |
is3D ifFalse:[ |
528 |
^ self |
|
529 |
]. |
|
1088 | 530 |
|
1113 | 531 |
dataSet paint:(dataSet separatorLightColor). |
1040
c8e6a2ed7928
use the same background color for a selected rowSelector
ca
parents:
1007
diff
changeset
|
532 |
|
1113 | 533 |
( columnNumber == 1 |
534 |
or:[(dataSet columnAt:(columnNumber - 1)) showColSeparator] |
|
535 |
) ifTrue:[ |
|
1132 | 536 |
|
537 |
"/ DRAW SEPARATORS AT LEFT( LIGHT COLOR ) |
|
538 |
"/ ====================================== |
|
539 |
yT := yTop. |
|
540 |
||
541 |
times timesRepeat:[ |
|
542 |
dataSet displayLineFromX:xL y:yT toX:xL y:(yT - 1 + h). |
|
543 |
yT := yT + h. |
|
544 |
]. |
|
1113 | 545 |
] ifFalse:[ |
1132 | 546 |
xL := xL - 1 |
1113 | 547 |
]. |
1092 | 548 |
|
1113 | 549 |
showRowSeparator ifTrue:[ |
1132 | 550 |
"/ DRAW SEPARATORS AT TOP( LIGHT COLOR ) |
551 |
"/ ===================================== |
|
552 |
yT := yTop. |
|
553 |
||
554 |
rowSeparatorSelector isNil ifTrue:[ |
|
555 |
times timesRepeat:[ |
|
556 |
dataSet displayLineFromX:xL y:yT toX:xR y:yT. |
|
557 |
yT := yT + h. |
|
558 |
] |
|
559 |
] ifFalse:[ |
|
560 |
"/ CHECK WHETHER PREVIOUS ROW HAS A SEPARATOR AT BOTTOM |
|
561 |
"/ ==================================================== |
|
562 |
start to:stop do:[:idx| |
|
563 |
( idx == 1 |
|
564 |
or:[((dataSet at:(idx - 1)) perform:rowSeparatorSelector) ~~ false] |
|
565 |
) ifTrue:[ |
|
566 |
dataSet displayLineFromX:xL y:yT toX:xR y:yT. |
|
567 |
]. |
|
568 |
yT := yT + h. |
|
569 |
] |
|
1088 | 570 |
] |
542 | 571 |
]. |
572 |
||
573 |
||
607 | 574 |
! |
575 |
||
542 | 576 |
invalidate |
1484 | 577 |
"invalidate width of column; forces a recomputation |
542 | 578 |
" |
1484 | 579 |
width := nil. |
542 | 580 |
|
1088 | 581 |
! |
582 |
||
1132 | 583 |
redrawX:xLeft y:yTop h:h from:start to:stop |
1088 | 584 |
"redraw rows between start and stop |
585 |
" |
|
1132 | 586 |
|rH "{ Class:SmallInteger }" |
587 |
y "{ Class:SmallInteger }" |
|
1088 | 588 |
| |
1132 | 589 |
rH := dataSet rowHeight. |
1088 | 590 |
|
1115 | 591 |
bgSelector isNil ifTrue:[ |
1132 | 592 |
dataSet paint:backgroundColor. |
593 |
dataSet fillRectangleX:xLeft y:yTop width:width height:h |
|
1115 | 594 |
]. |
595 |
||
1132 | 596 |
"/ DRAW CELLS: BACKGROUND/FOREGROUND/LABEL |
597 |
"/ ======================================= |
|
598 |
self drawLabelsAtX:xLeft y:yTop h:rH from:start to:stop. |
|
1113 | 599 |
|
600 |
"/ DRAW INDICATORS |
|
601 |
"/ =============== |
|
602 |
(rendererType == #ComboBox or:[rendererType == #ComboList]) ifTrue:[ |
|
1132 | 603 |
y := yTop. |
604 |
start to:stop do:[:i| |
|
605 |
(self hasChoices:i) ifTrue:[ |
|
606 |
dataSet drawComboButtonAtX:xLeft y:y w:width |
|
1113 | 607 |
]. |
1132 | 608 |
y := y + rH. |
1113 | 609 |
] |
610 |
] ifFalse:[ |
|
611 |
rendererType == #CheckToggle ifTrue:[ |
|
1132 | 612 |
y := yTop. |
613 |
start to:stop do:[:i| |
|
614 |
dataSet drawCheckToggleAtX:xLeft y:y w:width |
|
615 |
state:(self extractColFromRow:(dataSet at:i)). |
|
616 |
y := y + rH. |
|
1113 | 617 |
] |
618 |
] |
|
1088 | 619 |
]. |
620 |
||
621 |
"/ DRAW SEPARATORS |
|
1113 | 622 |
"/ =============== |
1132 | 623 |
self drawSeparatorsAtX:xLeft y:yTop h:rH from:start to:stop |
542 | 624 |
! ! |
625 |
||
614 | 626 |
!DataSetColumn methodsFor:'editing'! |
627 |
||
833 | 628 |
editorAt:aRowNr |
1268 | 629 |
|val row| |
614 | 630 |
|
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
631 |
row := (dataSet at:aRowNr). |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
632 |
val := self extractColFromRow:row. |
614 | 633 |
|
833 | 634 |
val isText ifTrue:[val := val string]. |
1558
00b34d71898a
columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
635 |
^ description editorOn:row column:self value:val. |
614 | 636 |
! ! |
637 |
||
542 | 638 |
!DataSetColumn methodsFor:'event handling'! |
639 |
||
640 |
doesNotUnderstand:aMessage |
|
641 |
||
642 |
(description respondsTo:(aMessage selector)) ifTrue:[ |
|
643 |
^ aMessage sendTo:description |
|
644 |
]. |
|
645 |
^ super doesNotUnderstand:aMessage |
|
646 |
||
647 |
! ! |
|
648 |
||
649 |
!DataSetColumn methodsFor:'grow & degrow'! |
|
650 |
||
651 |
growWidth:n |
|
652 |
"grow the width for n pixels |
|
653 |
" |
|
1492 | 654 |
width := self width + n. |
542 | 655 |
|
656 |
||
657 |
! ! |
|
658 |
||
659 |
!DataSetColumn methodsFor:'initialization'! |
|
660 |
||
1147 | 661 |
on:aDSVColumnView description:aDescription columnNumber:aNumber label:aLabel |
542 | 662 |
"instance creation; set attributes dependent on the description |
663 |
" |
|
1268 | 664 |
|device selector format idx type args| |
542 | 665 |
|
1089 | 666 |
columnNumber := aNumber. |
667 |
dataSet := aDSVColumnView. |
|
1147 | 668 |
label := aLabel. |
1487 | 669 |
|
1089 | 670 |
description := aDescription. |
671 |
rendererType := description rendererType. |
|
1496 | 672 |
containsText := ( rendererType ~~ #CheckToggle |
673 |
and:[rendererType ~~ #rowSelector] |
|
674 |
). |
|
1490 | 675 |
descWidth := description width. |
1526 | 676 |
|
677 |
description usePreferredWidth ifTrue:[ |
|
678 |
descWidth := 0 |
|
679 |
]. |
|
680 |
||
1565 | 681 |
width := nil. |
682 |
device := dataSet device. |
|
683 |
shownValue := [:aRow| nil ]. |
|
684 |
||
1113 | 685 |
rowSeparatorSelector := description rowSeparatorSelector. |
1565 | 686 |
|
687 |
(fgSelector := description foregroundSelector) notNil ifTrue:[ |
|
688 |
numArgsToFgSelector := fgSelector numArgs. |
|
689 |
] ifFalse:[ |
|
690 |
numArgsToFgSelector := 0 |
|
691 |
]. |
|
692 |
||
693 |
(bgSelector := description backgroundSelector) notNil ifTrue:[ |
|
694 |
numArgsToBgSelector := bgSelector numArgs. |
|
695 |
] ifFalse:[ |
|
696 |
numArgsToBgSelector := 0 |
|
697 |
]. |
|
698 |
||
1113 | 699 |
showColSeparator := description showColSeparator. |
700 |
showRowSeparator := description showRowSeparator. |
|
1089 | 701 |
columnAdaptor := dataSet columnAdaptor. |
702 |
buttonExtent := 0 @ 0. |
|
703 |
columnAlignment := #left. |
|
584 | 704 |
|
1113 | 705 |
(readSelector := description readSelector) notNil ifTrue:[ |
706 |
numArgsToReadSelector := readSelector numArgs. |
|
707 |
] ifFalse:[ |
|
708 |
numArgsToReadSelector := 0 |
|
709 |
]. |
|
710 |
||
1132 | 711 |
(backgroundColor := description backgroundColor) isNil ifTrue:[ |
712 |
backgroundColor := dataSet backgroundColor |
|
713 |
] ifFalse:[ |
|
1480 | 714 |
backgroundColor := backgroundColor onDevice:dataSet device |
584 | 715 |
]. |
1113 | 716 |
|
717 |
(foregroundColor := description foregroundColor) isNil ifTrue:[ |
|
718 |
foregroundColor := dataSet foregroundColor |
|
719 |
] ifFalse:[ |
|
1480 | 720 |
foregroundColor := foregroundColor onDevice:dataSet device |
584 | 721 |
]. |
542 | 722 |
|
723 |
rendererType == #CheckToggle ifTrue:[ |
|
1113 | 724 |
buttonExtent := dataSet checkToggleExtent. |
647 | 725 |
^ self |
542 | 726 |
]. |
727 |
||
728 |
rendererType == #rowSelector ifTrue:[ |
|
807 | 729 |
buttonExtent := dataSet rowSelectorExtent. |
647 | 730 |
^ self |
542 | 731 |
]. |
732 |
||
733 |
(rendererType == #ComboBox or:[rendererType == #ComboList]) ifTrue:[ |
|
807 | 734 |
buttonExtent := dataSet comboButtonExtent. |
883 | 735 |
] ifFalse:[ |
736 |
columnAlignment := description columnAlignment |
|
542 | 737 |
]. |
738 |
||
739 |
selector := description printSelector. |
|
740 |
||
741 |
selector notNil ifTrue:[ |
|
1113 | 742 |
args := selector numArgs. |
743 |
args == 0 ifTrue:[ |
|
1147 | 744 |
shownValue := [:aRow| aRow perform:selector ] |
1113 | 745 |
] ifFalse:[ |
746 |
args == 1 ifTrue:[ |
|
1147 | 747 |
shownValue := [:aRow| aRow perform:selector with:dataSet ] |
1113 | 748 |
] ifFalse:[ |
1147 | 749 |
shownValue := [:aRow| aRow perform:selector with:dataSet with:columnNumber ] |
1113 | 750 |
] |
751 |
]. |
|
542 | 752 |
^ self |
753 |
]. |
|
754 |
||
614 | 755 |
( (format := description formatString) notNil |
756 |
and:[(type := description type) == #number or:[type == #numberOrNil]] |
|
757 |
) ifTrue:[ |
|
542 | 758 |
"/ has a format string for number (supports only floats) |
759 |
||
614 | 760 |
(idx := format indexOf:$.) ~~ 0 ifTrue:[ |
761 |
idx := format size - idx |
|
542 | 762 |
]. |
614 | 763 |
format := '%0.', idx printString, 'f'. |
542 | 764 |
|
1147 | 765 |
shownValue := [:aRow||n| |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
766 |
n := self extractColFromRow:aRow. |
621 | 767 |
n isReal ifTrue:[n := n asFloat printfPrintString:format]. |
768 |
n |
|
614 | 769 |
] |
621 | 770 |
] ifFalse:[ "/ default: no format string |
1147 | 771 |
shownValue := [:aRow| self extractColFromRow:aRow ] |
614 | 772 |
] |
542 | 773 |
|
774 |
||
775 |
! ! |
|
776 |
||
621 | 777 |
!DataSetColumn methodsFor:'private'! |
778 |
||
1113 | 779 |
extractColFromRow:aRow |
1226 | 780 |
readSelector isNil ifTrue:[^ nil]. |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
781 |
|
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
782 |
columnAdaptor notNil ifTrue:[ |
1113 | 783 |
numArgsToReadSelector == 1 ifTrue:[ |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
784 |
^ columnAdaptor perform:readSelector with:aRow |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
785 |
]. |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
786 |
^ columnAdaptor perform:readSelector with:aRow with:columnNumber |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
787 |
]. |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
788 |
|
1113 | 789 |
numArgsToReadSelector == 0 ifTrue:[ |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
790 |
^ aRow perform:readSelector |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
791 |
]. |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
792 |
^ aRow perform:readSelector with:columnNumber |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
793 |
! |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
794 |
|
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
795 |
storeCol:newValue inRow:aRow |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
796 |
|writeSelector numArgs| |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
797 |
|
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
798 |
writeSelector := description writeSelector. |
1226 | 799 |
writeSelector isNil ifTrue:[^ aRow]. |
800 |
||
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
801 |
numArgs := writeSelector numArgs. |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
802 |
|
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
803 |
columnAdaptor notNil ifTrue:[ |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
804 |
numArgs == 2 ifTrue:[ |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
805 |
^ columnAdaptor perform:writeSelector with:aRow with:newValue |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
806 |
]. |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
807 |
^ columnAdaptor perform:writeSelector with:aRow with:columnNumber with:newValue |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
808 |
]. |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
809 |
|
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
810 |
numArgs == 1 ifTrue:[ |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
811 |
aRow perform:writeSelector with:newValue |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
812 |
] ifFalse:[ |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
813 |
aRow perform:writeSelector with:columnNumber with:newValue |
1059 | 814 |
]. |
815 |
^ aRow |
|
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
816 |
|
621 | 817 |
! ! |
818 |
||
542 | 819 |
!DataSetColumn methodsFor:'queries'! |
820 |
||
1492 | 821 |
canResize |
822 |
||
1496 | 823 |
containsText ifTrue:[ |
1492 | 824 |
^ descWidth == 0 or:[descWidth isReal] |
825 |
]. |
|
826 |
^ false |
|
827 |
||
828 |
||
829 |
! |
|
830 |
||
607 | 831 |
canSelect:aRowNr |
832 |
"returns true if cell in column is selectable |
|
833 |
" |
|
834 |
|s| |
|
835 |
||
836 |
description canSelect ifTrue:[ |
|
1065
332afeb89d6b
modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents:
1059
diff
changeset
|
837 |
(s := description selectSelector) notNil ifTrue:[ |
332afeb89d6b
modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents:
1059
diff
changeset
|
838 |
columnAdaptor notNil ifTrue:[ |
332afeb89d6b
modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents:
1059
diff
changeset
|
839 |
s numArgs == 2 ifTrue:[ |
332afeb89d6b
modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents:
1059
diff
changeset
|
840 |
^ columnAdaptor perform:s with:(dataSet at:aRowNr) with:columnNumber |
332afeb89d6b
modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents:
1059
diff
changeset
|
841 |
]. |
332afeb89d6b
modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents:
1059
diff
changeset
|
842 |
^ columnAdaptor perform:s with:(dataSet at:aRowNr) |
332afeb89d6b
modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents:
1059
diff
changeset
|
843 |
]. |
332afeb89d6b
modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents:
1059
diff
changeset
|
844 |
s numArgs == 1 ifTrue:[ |
332afeb89d6b
modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents:
1059
diff
changeset
|
845 |
^ (dataSet at:aRowNr) perform:s with:columnNumber |
332afeb89d6b
modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents:
1059
diff
changeset
|
846 |
]. |
332afeb89d6b
modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents:
1059
diff
changeset
|
847 |
^ (dataSet at:aRowNr) perform:s |
332afeb89d6b
modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents:
1059
diff
changeset
|
848 |
]. |
332afeb89d6b
modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents:
1059
diff
changeset
|
849 |
^ true |
607 | 850 |
]. |
851 |
^ false |
|
852 |
||
1065
332afeb89d6b
modify the model (i.e. the list), when a
Claus Gittinger <cg@exept.de>
parents:
1059
diff
changeset
|
853 |
"Modified: / 7.8.1998 / 22:49:20 / cg" |
607 | 854 |
! |
855 |
||
647 | 856 |
containsText |
857 |
"returns true if text might exist |
|
858 |
" |
|
1496 | 859 |
^ containsText |
647 | 860 |
! |
861 |
||
833 | 862 |
hasChoices:aRowNr |
863 |
^ (description choicesFor:(dataSet at:aRowNr)) notNil |
|
864 |
! |
|
865 |
||
1484 | 866 |
hasRelativeWidth |
867 |
"returns true if width is relative |
|
868 |
" |
|
1496 | 869 |
^ descWidth isReal |
1484 | 870 |
|
871 |
||
872 |
||
873 |
! |
|
874 |
||
542 | 875 |
heightOfHighestRow |
876 |
"returns the height of the highest row in pixels |
|
877 |
" |
|
1559
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
878 |
|h end bE editor| |
542 | 879 |
|
1496 | 880 |
(h := description height) == 0 ifTrue:[ |
881 |
containsText ifTrue:[ |
|
542 | 882 |
"/ search first none empty drawable object |
1496 | 883 |
end := 5 min:dataSet size. |
542 | 884 |
|
1496 | 885 |
1 to:end do:[:i| |
886 |
h := h max:(self heightOfLabel:(shownValue value:(dataSet at:i))) |
|
542 | 887 |
] |
888 |
] |
|
889 |
]. |
|
1559
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
890 |
(bE := buttonExtent y) = 0 ifTrue:[ |
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
891 |
((editor := description editorType) == #ComboList |
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
892 |
or:[ editor == #ComboBox]) ifTrue:[ |
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
893 |
bE := dataSet comboButtonExtent y. |
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
894 |
]. |
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
895 |
]. |
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
896 |
^ h max:bE |
1113 | 897 |
! |
898 |
||
1147 | 899 |
heightOfLabel:aLabel |
900 |
"returns the height of the label |
|
901 |
" |
|
1496 | 902 |
|h| |
1147 | 903 |
|
1496 | 904 |
(aLabel isString or:[aLabel isImageOrForm]) ifTrue:[ |
905 |
^ aLabel heightOn:dataSet |
|
906 |
]. |
|
1147 | 907 |
aLabel isNil ifTrue:[ ^ 0 ]. |
908 |
||
1496 | 909 |
aLabel isSequenceable ifFalse:[ |
910 |
^ aLabel perform:#heightOn: with:dataSet ifNotUnderstood:[ |
|
911 |
aLabel displayString heightOn:dataSet |
|
912 |
] |
|
1147 | 913 |
]. |
914 |
||
1496 | 915 |
h := 0. |
916 |
aLabel do:[:el|h := h + (el heightOn:dataSet)]. |
|
917 |
^ h |
|
1147 | 918 |
|
919 |
! |
|
920 |
||
1113 | 921 |
showColSeparator |
922 |
"returns true if column separator is on |
|
923 |
" |
|
924 |
^ showColSeparator |
|
1133 | 925 |
! |
926 |
||
927 |
showSelectionHighLighted |
|
928 |
"returns true if selection is highLighted |
|
929 |
" |
|
930 |
^ description showSelectionHighLighted ~~ false |
|
1147 | 931 |
! |
932 |
||
933 |
widthOfLabel:aLabel |
|
934 |
"returns the width of the label |
|
935 |
" |
|
1496 | 936 |
|w| |
1147 | 937 |
|
1496 | 938 |
(aLabel isString or:[aLabel isImageOrForm]) ifTrue:[ |
939 |
^ aLabel widthOn:dataSet |
|
940 |
]. |
|
1147 | 941 |
aLabel isNil ifTrue:[ ^ 0 ]. |
942 |
||
1496 | 943 |
aLabel isSequenceable ifFalse:[ |
944 |
^ aLabel perform:#widthOn: with:dataSet ifNotUnderstood:[ |
|
945 |
aLabel displayString widthOn:dataSet |
|
946 |
] |
|
1147 | 947 |
]. |
948 |
||
1496 | 949 |
w := 0. |
950 |
aLabel do:[:el|w := w max:(el widthOn:dataSet)]. |
|
951 |
^ w |
|
542 | 952 |
! ! |
953 |
||
954 |
!DataSetColumn methodsFor:'searching'! |
|
955 |
||
956 |
findRowNrStartingWithChar:aChar start:start stop:stop |
|
957 |
"find the first row starting at start to stop, which drawable label |
|
958 |
starts with the character, aChar. The index of the detected row is |
|
959 |
returned or if no row is found 0. |
|
960 |
" |
|
961 |
|char| |
|
962 |
||
1496 | 963 |
containsText ifTrue:[ |
542 | 964 |
char := aChar asLowercase. |
965 |
||
966 |
start to:stop do:[:aRowNr| |lbl| |
|
1147 | 967 |
lbl := shownValue value:(dataSet at:aRowNr). |
968 |
||
969 |
(lbl isSequenceable and:[lbl isString not]) ifTrue:[ |
|
970 |
lbl := lbl at:1 ifAbsent:nil |
|
971 |
]. |
|
542 | 972 |
|
1113 | 973 |
(lbl respondsTo:#string) ifTrue:[ |
974 |
lbl := lbl string. |
|
542 | 975 |
(lbl size ~~ 0 and:[(lbl at:1) asLowercase == char]) ifTrue:[ |
976 |
^ aRowNr |
|
977 |
] |
|
978 |
] ifFalse:[ |
|
979 |
lbl isNil ifFalse:[ |
|
980 |
^ 0 |
|
981 |
] |
|
982 |
] |
|
983 |
] |
|
984 |
]. |
|
985 |
^ 0 |
|
986 |
||
987 |
! ! |
|
988 |
||
989 |
!DataSetColumn class methodsFor:'documentation'! |
|
990 |
||
991 |
version |
|
1592 | 992 |
^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.60 1999-10-14 17:16:58 cg Exp $' |
542 | 993 |
! ! |