author | Claus Gittinger <cg@exept.de> |
Fri, 18 Nov 2005 15:56:28 +0100 | |
changeset 2863 | c0585cbcd922 |
parent 2862 | 3279303eabd8 |
child 2864 | a2b8598dc659 |
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 |
||
1818 | 16 |
"{ Package: 'stx:libwidg2' }" |
17 |
||
542 | 18 |
Object subclass:#DataSetColumn |
2444 | 19 |
instanceVariableNames:'columnNumber dataSet width description buttonExtent rendererType |
20 |
backgroundColor foregroundColor rowSeparatorSelector |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
21 |
showColSeparator showRowSeparator columnAlignment label |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
22 |
containsText columnAdaptor descWidth descMinWidth |
2693 | 23 |
longStringCompression minValue maxValue' |
1712 | 24 |
classVariableNames:'' |
25 |
poolDictionaries:'' |
|
26 |
category:'Views-DataSet' |
|
542 | 27 |
! |
28 |
||
29 |
!DataSetColumn class methodsFor:'documentation'! |
|
30 |
||
31 |
copyright |
|
32 |
" |
|
33 |
COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG |
|
34 |
All Rights Reserved |
|
35 |
||
36 |
This software is furnished under a license and may be used |
|
37 |
only in accordance with the terms of that license and with the |
|
38 |
inclusion of the above copyright notice. This software may not |
|
39 |
be provided or otherwise made available to, or used by, any |
|
40 |
other person. No title to or ownership of the software is |
|
41 |
hereby transferred. |
|
42 |
" |
|
43 |
||
44 |
||
45 |
||
46 |
! |
|
47 |
||
48 |
documentation |
|
49 |
" |
|
50 |
represent one single column description of a DataSetView |
|
51 |
||
52 |
[Instance variables:] |
|
53 |
||
647 | 54 |
columnNumber <Integer> sequence number (into list of columns) |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
55 |
|
542 | 56 |
dataSet <DSVColumnView> the view it belongs to |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
57 |
|
1088 | 58 |
width <Integer> width of column |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
59 |
|
2710
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
60 |
description <DataSetColumnSpec> the column description (a spec) |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
61 |
|
1088 | 62 |
buttonExtent <Point> extent of drawable form |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
63 |
|
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
64 |
rendererType <Type> renderer type (cached value from |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
65 |
the column specification). |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
66 |
|
647 | 67 |
backgroundColor <Color or nil> background color of all cells or nil |
68 |
(nil: use default background color). |
|
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
69 |
|
647 | 70 |
foregroundColor <Color or nil> foreground color of all cells or nil |
71 |
(nil: use default foreground color). |
|
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
72 |
|
1088 | 73 |
columnAlignment <Symbol> align text/icon #left #right or #center |
74 |
in row (on default: #left). |
|
75 |
||
76 |
label <label/icon or nil> label resolved by the builder shown |
|
77 |
in the column description field. |
|
78 |
||
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
79 |
readSelector <Symbol> cached readSelector (from the spec) |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
80 |
|
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
81 |
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
|
82 |
read-writeSelectors to extract a column |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
83 |
from a row object. |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
84 |
If nil, the row object is used itself. |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
85 |
|
1113 | 86 |
showColSeparator <Boolean> true: vertical separators are enabled; |
87 |
separator between columns |
|
88 |
||
89 |
showRowSeparator <Boolean> true: horizontal separators are enabled; |
|
90 |
separator between rows |
|
91 |
||
92 |
rowSeparatorSelector <Selector or nil> access specific showRowSeparator state |
|
93 |
for a cell |
|
542 | 94 |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
95 |
[from description:] |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
96 |
fgSelector <Selector or nil> access specific foreground color for |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
97 |
a cell |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
98 |
|
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
99 |
bgSelector <Selector or nil> access specific background color for |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
100 |
a cell |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
101 |
|
1725
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
102 |
numberOfRowsProbedForColumnSize the number of rows which are queries |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
103 |
<Integer> in order to compute the columns width. |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
104 |
(for scrollBar/col width computation) |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
105 |
Notice, if its expensive to fetch rows |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
106 |
(dataBase apps), this should be small. |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
107 |
Default:15 |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
108 |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
109 |
|
542 | 110 |
[author:] |
111 |
Claus Atzkern |
|
112 |
||
113 |
[see also:] |
|
114 |
DataSetColumnSpec |
|
115 |
DSVColumnView |
|
116 |
DataSetView |
|
117 |
" |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
118 |
! ! |
542 | 119 |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
120 |
!DataSetColumn class methodsFor:'utilities'! |
542 | 121 |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
122 |
shortenedStringFor:aString on:aGC maxWidth:maxWidth |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
123 |
"common code to shorten a string; used in both the DSV label- and column Views, |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
124 |
if the string is too long for the column" |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
125 |
|
2221 | 126 |
|widthOf3Dots wRest shortenedLabel lUsed lMin lMax| |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
127 |
|
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
128 |
aString isString ifFalse:[^ aString]. |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
129 |
(aString widthOn:aGC) > maxWidth ifFalse:[aString]. |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
130 |
|
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
131 |
widthOf3Dots := '...' widthOn:aGC. |
2221 | 132 |
|
133 |
lMin := 1. |
|
134 |
lMax := aString size. |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
135 |
[ |
2221 | 136 |
lUsed := (lMax + lMin) // 2. |
137 |
wRest := aString widthFrom:1 to:lUsed on:aGC. |
|
138 |
wRest > (maxWidth-widthOf3Dots) ifTrue:[ |
|
139 |
lMax := lUsed - 1. |
|
140 |
] ifFalse:[ |
|
141 |
lMin := lUsed + 1. |
|
142 |
]. |
|
143 |
lMin < lMax |
|
144 |
] whileTrue. |
|
145 |
shortenedLabel := aString copyFrom:1 to:lUsed. |
|
146 |
||
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
147 |
shortenedLabel isEmpty ifTrue:[ |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
148 |
((aString first asString , '..') widthOn:aGC) < maxWidth ifTrue:[ |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
149 |
"/ only two dots and the first character |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
150 |
^ (aString first asString , '..') |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
151 |
] |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
152 |
]. |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
153 |
^ (shortenedLabel , '...'). |
542 | 154 |
! ! |
155 |
||
156 |
!DataSetColumn methodsFor:'accessing'! |
|
157 |
||
158 |
at:aRowNr |
|
159 |
"get the value of the raw at an index, aRowNr |
|
160 |
" |
|
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
161 |
|
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
162 |
|row| |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
163 |
|
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
164 |
row := dataSet at:aRowNr. |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
165 |
^ self extractColFromRow:row rowNr:aRowNr. |
542 | 166 |
! |
167 |
||
168 |
at:aRowNr put:something |
|
169 |
"set the value of the raw at an index, aRowNr |
|
170 |
" |
|
1059 | 171 |
|row newRow| |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
172 |
|
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
173 |
row := dataSet at:aRowNr. |
2419
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
174 |
self storeCol:something inRow:row. |
542 | 175 |
! |
176 |
||
1558
00b34d71898a
columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
177 |
columnAdaptor |
00b34d71898a
columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
178 |
^ columnAdaptor |
00b34d71898a
columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
179 |
! |
00b34d71898a
columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
180 |
|
1712 | 181 |
columnAdaptor:anAdapter |
182 |
columnAdaptor := anAdapter. |
|
183 |
! |
|
184 |
||
807 | 185 |
description |
2710
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
186 |
"returns the column spec |
807 | 187 |
" |
188 |
^ description |
|
189 |
! |
|
190 |
||
542 | 191 |
label |
192 |
"get the label assigned to the column |
|
193 |
" |
|
891 | 194 |
^ label |
542 | 195 |
|
196 |
||
197 |
! |
|
198 |
||
2419
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
199 |
longStringCompression:aBoolean |
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
200 |
^ longStringCompression ? true |
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
201 |
! |
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
202 |
|
1487 | 203 |
rendererType |
204 |
"returns my renderer type |
|
205 |
" |
|
206 |
^ rendererType |
|
207 |
! ! |
|
208 |
||
1818 | 209 |
!DataSetColumn methodsFor:'accessing-colors'! |
1565 | 210 |
|
211 |
backgroundColor |
|
212 |
"returns the background color or nil |
|
213 |
" |
|
2710
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
214 |
^ backgroundColor == dataSet backgroundColor ifTrue:[nil] ifFalse:[backgroundColor] |
1565 | 215 |
! |
216 |
||
2693 | 217 |
backgroundColor: aColor |
218 |
backgroundColor := aColor |
|
219 |
! |
|
220 |
||
1565 | 221 |
backgroundColorAt:aRowNr |
222 |
"returns the background color for a row at list index a rowNr |
|
223 |
" |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
224 |
description backgroundSelector notNil ifTrue:[ |
1565 | 225 |
^ self backgroundColorFor:(dataSet at:aRowNr) at:aRowNr |
226 |
]. |
|
227 |
^ backgroundColor |
|
228 |
! |
|
229 |
||
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
230 |
backgroundColorFor:aRow at:aRowNr |
2727
5cb5708a6982
No extra handling needed for LimitedPrecisionReal
Stefan Vogel <sv@exept.de>
parents:
2710
diff
changeset
|
231 |
"return the background color for a row at list index a rowNr" |
5cb5708a6982
No extra handling needed for LimitedPrecisionReal
Stefan Vogel <sv@exept.de>
parents:
2710
diff
changeset
|
232 |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
233 |
|bgSelector bg| |
1565 | 234 |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
235 |
bgSelector := description backgroundSelector. |
1565 | 236 |
bgSelector notNil ifTrue:[ |
1924 | 237 |
columnAdaptor notNil ifTrue:[ |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
238 |
bg := columnAdaptor perform:bgSelector withOptionalArgument:aRow and:aRowNr and:columnNumber and:dataSet |
1565 | 239 |
] ifFalse:[ |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
240 |
bg := aRow perform:bgSelector withOptionalArgument:aRowNr and:columnNumber and:dataSet |
1565 | 241 |
]. |
1928
2dcf8e62af64
debug: care for non-color to be returned from fg/bg message.
Claus Gittinger <cg@exept.de>
parents:
1924
diff
changeset
|
242 |
bg notNil ifTrue:[ |
2dcf8e62af64
debug: care for non-color to be returned from fg/bg message.
Claus Gittinger <cg@exept.de>
parents:
1924
diff
changeset
|
243 |
(bg isColor or:[bg isImageOrForm]) ifTrue:[ |
2dcf8e62af64
debug: care for non-color to be returned from fg/bg message.
Claus Gittinger <cg@exept.de>
parents:
1924
diff
changeset
|
244 |
^ bg |
2dcf8e62af64
debug: care for non-color to be returned from fg/bg message.
Claus Gittinger <cg@exept.de>
parents:
1924
diff
changeset
|
245 |
]. |
2727
5cb5708a6982
No extra handling needed for LimitedPrecisionReal
Stefan Vogel <sv@exept.de>
parents:
2710
diff
changeset
|
246 |
self error:'unexpected background (not a color or image)'. |
1928
2dcf8e62af64
debug: care for non-color to be returned from fg/bg message.
Claus Gittinger <cg@exept.de>
parents:
1924
diff
changeset
|
247 |
] |
1565 | 248 |
]. |
249 |
^ backgroundColor |
|
250 |
! |
|
251 |
||
252 |
foregroundColor |
|
253 |
"returns the foreground color or nil |
|
254 |
" |
|
2710
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
255 |
^ foregroundColor == dataSet foregroundColor ifTrue:[nil] ifFalse:[foregroundColor] |
1565 | 256 |
! |
257 |
||
2693 | 258 |
foregroundColor: aColor |
259 |
foregroundColor := aColor |
|
260 |
! |
|
261 |
||
1565 | 262 |
foregroundColorFor:aRow at:aRowNr |
263 |
"returns the foreground color for a row at list index a rowNr |
|
264 |
" |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
265 |
|fgSelector fg| |
1565 | 266 |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
267 |
fgSelector := description foregroundSelector. |
1565 | 268 |
fgSelector notNil ifTrue:[ |
1924 | 269 |
columnAdaptor notNil ifTrue:[ |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
270 |
fg := columnAdaptor perform:fgSelector withOptionalArgument:aRow and:aRowNr and:columnNumber and:dataSet |
1565 | 271 |
] ifFalse:[ |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
272 |
fg := aRow perform:fgSelector withOptionalArgument:aRowNr and:dataSet |
1565 | 273 |
]. |
1928
2dcf8e62af64
debug: care for non-color to be returned from fg/bg message.
Claus Gittinger <cg@exept.de>
parents:
1924
diff
changeset
|
274 |
fg notNil ifTrue:[ |
2dcf8e62af64
debug: care for non-color to be returned from fg/bg message.
Claus Gittinger <cg@exept.de>
parents:
1924
diff
changeset
|
275 |
(fg isColor or:[fg isImageOrForm]) ifTrue:[ |
2dcf8e62af64
debug: care for non-color to be returned from fg/bg message.
Claus Gittinger <cg@exept.de>
parents:
1924
diff
changeset
|
276 |
^ fg |
2dcf8e62af64
debug: care for non-color to be returned from fg/bg message.
Claus Gittinger <cg@exept.de>
parents:
1924
diff
changeset
|
277 |
]. |
2727
5cb5708a6982
No extra handling needed for LimitedPrecisionReal
Stefan Vogel <sv@exept.de>
parents:
2710
diff
changeset
|
278 |
self error:'unexpected foreground (not a color or image)'. |
1928
2dcf8e62af64
debug: care for non-color to be returned from fg/bg message.
Claus Gittinger <cg@exept.de>
parents:
1924
diff
changeset
|
279 |
] |
1565 | 280 |
]. |
281 |
^ foregroundColor |
|
2710
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
282 |
! |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
283 |
|
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
284 |
selectedBackgroundColorFor:aRow at:aRowNr |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
285 |
"returns the selected background color for a row at list index a rowNr |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
286 |
" |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
287 |
|bgSelector bg| |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
288 |
|
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
289 |
bgSelector := description selectedBackgroundSelector. |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
290 |
bgSelector notNil ifTrue:[ |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
291 |
columnAdaptor notNil ifTrue:[ |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
292 |
bg := columnAdaptor perform:bgSelector withOptionalArgument:aRow and:aRowNr and:columnNumber and:dataSet |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
293 |
] ifFalse:[ |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
294 |
bg := aRow perform:bgSelector withOptionalArgument:aRowNr and:columnNumber and:dataSet |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
295 |
]. |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
296 |
bg notNil ifTrue:[ |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
297 |
(bg isColor or:[bg isImageOrForm]) ifTrue:[ |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
298 |
^ bg |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
299 |
]. |
2727
5cb5708a6982
No extra handling needed for LimitedPrecisionReal
Stefan Vogel <sv@exept.de>
parents:
2710
diff
changeset
|
300 |
self error:'unexpected background (not a color or image)'. |
2710
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
301 |
] |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
302 |
]. |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
303 |
bg := description selectedBackgroundColor. |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
304 |
bg isNil ifTrue:[ |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
305 |
bg := dataSet selectionBackgroundColor |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
306 |
]. |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
307 |
^ bg |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
308 |
! |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
309 |
|
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
310 |
selectedForegroundColorFor:aRow at:aRowNr |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
311 |
"returns the selected foreground color for a row at list index a rowNr |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
312 |
" |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
313 |
|fgSelector fg| |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
314 |
|
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
315 |
fgSelector := description selectedForegroundSelector. |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
316 |
fgSelector notNil ifTrue:[ |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
317 |
columnAdaptor notNil ifTrue:[ |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
318 |
fg := columnAdaptor perform:fgSelector withOptionalArgument:aRow and:aRowNr and:columnNumber and:dataSet |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
319 |
] ifFalse:[ |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
320 |
fg := aRow perform:fgSelector withOptionalArgument:aRowNr and:columnNumber and:dataSet |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
321 |
]. |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
322 |
fg notNil ifTrue:[ |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
323 |
(fg isColor or:[fg isImageOrForm]) ifTrue:[ |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
324 |
^ fg |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
325 |
]. |
2727
5cb5708a6982
No extra handling needed for LimitedPrecisionReal
Stefan Vogel <sv@exept.de>
parents:
2710
diff
changeset
|
326 |
self error:'unexpected foreground (not a color or image)'. |
2710
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
327 |
] |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
328 |
]. |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
329 |
fg := description selectedForegroundColor. |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
330 |
fg isNil ifTrue:[ |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
331 |
fg := dataSet selectionForegroundColor |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
332 |
]. |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
333 |
^ fg |
1565 | 334 |
! ! |
335 |
||
1818 | 336 |
!DataSetColumn methodsFor:'accessing-dimension'! |
1487 | 337 |
|
1484 | 338 |
minWidth |
1490 | 339 |
"get the minimum width required by the column |
1484 | 340 |
" |
1490 | 341 |
descMinWidth notNil ifTrue:[ |
342 |
^ descMinWidth |
|
343 |
]. |
|
344 |
width := nil. |
|
345 |
^ self width |
|
1484 | 346 |
|
1490 | 347 |
! |
348 |
||
1492 | 349 |
minimumRequiredWidth |
350 |
"returns the minimum required width |
|
351 |
" |
|
352 |
|minWidth| |
|
353 |
||
1940 | 354 |
descMinWidth notNil ifTrue:[ |
355 |
minWidth := DSVLabelView tabSpacing max:2. |
|
356 |
^ minWidth // 2 + minWidth |
|
357 |
]. |
|
1492 | 358 |
|
1940 | 359 |
minWidth := dataSet separatorSize + (2 * dataSet horizontalSpacing). |
360 |
^ minWidth + label preferredWidth. |
|
1492 | 361 |
! |
362 |
||
1490 | 363 |
setDescWidth:aWidth |
364 |
"set a fixed width |
|
365 |
" |
|
1940 | 366 |
descMinWidth := 1. |
367 |
descMinWidth := width := descWidth := self minimumRequiredWidth max:aWidth. |
|
1484 | 368 |
! |
369 |
||
542 | 370 |
width |
371 |
"returns the width in pixels |
|
1725
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
372 |
Warning: |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
373 |
only the first numberOfRowsProbedForColumnSize are probed, |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
374 |
in case the access is expensive (dataBase apps) |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
375 |
If the descriptor defines a width, that is used, and the items |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
376 |
are not probed at all." |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
377 |
|
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
378 |
|max "{ Class:SmallInteger }" |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
379 |
listSize "{ Class:SmallInteger }"| |
542 | 380 |
|
1484 | 381 |
width notNil ifTrue:[^ width]. "/ already computed |
542 | 382 |
|
1490 | 383 |
descMinWidth notNil ifTrue:[ |
384 |
width := descMinWidth. |
|
385 |
^ width |
|
1484 | 386 |
]. |
1482 | 387 |
|
2017
5cbe1d46c01d
isReal -> isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents:
1984
diff
changeset
|
388 |
(descWidth ~~ 0 and:[descWidth isLimitedPrecisionReal not]) ifTrue:[ |
1493 | 389 |
width := descMinWidth := descWidth. |
390 |
^ width |
|
391 |
]. |
|
392 |
||
1490 | 393 |
width := description minWidth max:(label preferredWidth). |
394 |
||
2017
5cbe1d46c01d
isReal -> isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents:
1984
diff
changeset
|
395 |
descWidth isLimitedPrecisionReal ifTrue:[ |
2093 | 396 |
width := width max:(descWidth * dataSet innerWidth) rounded. |
1490 | 397 |
^ width |
1482 | 398 |
]. |
399 |
||
1496 | 400 |
containsText ifTrue:[ |
1725
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
401 |
"/ take maximum numberOfRowsProbedForColumnSize entries to calculate the width; |
1484 | 402 |
"/ can be resized later if neccessary |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
403 |
listSize := dataSet size. |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
404 |
max := listSize min:description numberOfRowsProbedForColumnSize. |
542 | 405 |
|
1526 | 406 |
max ~~ 0 ifTrue:[ |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
407 |
1 to:max do:[:rowNr| |row| |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
408 |
row := dataSet at:rowNr. |
2444 | 409 |
width := width max:(self widthOfLabel:(self shownValueForRow:row rowNr:rowNr)) |
1526 | 410 |
]. |
2444 | 411 |
width := width max:(self widthOfLabel:(self shownValueForRow:(dataSet at:listSize) rowNr:listSize)) |
1484 | 412 |
]. |
413 |
description editorType ~~ #None ifTrue:[ |
|
414 |
width := width + (dataSet font widthOn:dataSet device) |
|
542 | 415 |
]. |
1493 | 416 |
] ifFalse:[ |
417 |
max := 1 |
|
1484 | 418 |
]. |
1490 | 419 |
width := width + buttonExtent x + dataSet separatorSize + (2 * dataSet horizontalSpacing). |
1493 | 420 |
|
421 |
max ~~ 0 ifTrue:[ |
|
1526 | 422 |
descMinWidth := width. |
423 |
description usePreferredWidth ifTrue:[ |
|
424 |
descWidth := width |
|
425 |
] |
|
1493 | 426 |
]. |
1490 | 427 |
^ width |
1484 | 428 |
|
1725
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
429 |
"Modified: / 25.2.2000 / 14:29:16 / cg" |
542 | 430 |
! ! |
431 |
||
432 |
!DataSetColumn methodsFor:'drawing'! |
|
433 |
||
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
434 |
drawLabel:aLabelToDraw atX:xLeft y:yTop |
2420
9b4e4333004a
added #decimal columnAlignment.
Claus Gittinger <cg@exept.de>
parents:
2419
diff
changeset
|
435 |
"draw aLabelToDraw; handle columnAlignment" |
9b4e4333004a
added #decimal columnAlignment.
Claus Gittinger <cg@exept.de>
parents:
2419
diff
changeset
|
436 |
|
2581
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
437 |
|drawnLabel x space prevClip mustUndoClip |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2581
diff
changeset
|
438 |
labelWidth leftPart leftShift indexOfFirstDigit indexOfFirstNonDigit| |
1147 | 439 |
|
440 |
space := dataSet horizontalSpacing. |
|
441 |
||
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
442 |
drawnLabel := aLabelToDraw. |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
443 |
labelWidth := drawnLabel widthOn:dataSet. |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
444 |
|
2419
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
445 |
(longStringCompression ~~ false |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
446 |
and:[ drawnLabel isString |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
447 |
and:[ labelWidth > width]]) ifTrue:[ |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
448 |
drawnLabel := self class shortenedStringFor:drawnLabel on:dataSet maxWidth:width-space. |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
449 |
labelWidth := drawnLabel widthOn:dataSet. |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
450 |
]. |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
451 |
|
1147 | 452 |
columnAlignment == #left ifTrue:[ |
453 |
x := xLeft + space. |
|
454 |
] ifFalse:[ |
|
2420
9b4e4333004a
added #decimal columnAlignment.
Claus Gittinger <cg@exept.de>
parents:
2419
diff
changeset
|
455 |
columnAlignment == #decimal ifTrue:[ |
2581
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
456 |
(drawnLabel includes:$.) ifTrue:[ |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
457 |
leftPart := drawnLabel upTo:$.. |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
458 |
] ifFalse:[ |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
459 |
leftPart := drawnLabel. |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
460 |
|
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
461 |
indexOfFirstDigit := drawnLabel findFirst:[:char | char isDigit]. |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
462 |
indexOfFirstDigit ~~ 0 ifTrue:[ |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
463 |
indexOfFirstNonDigit := drawnLabel findFirst:[:char | char isDigit not] startingAt:indexOfFirstDigit+1. |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
464 |
indexOfFirstNonDigit ~~ 0 ifTrue:[ |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
465 |
leftPart := drawnLabel copyTo:indexOfFirstNonDigit-1. |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
466 |
]. |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
467 |
]. |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
468 |
]. |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
469 |
leftShift := leftPart widthOn:dataSet. |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
470 |
x := (width // 2) - leftShift. |
2420
9b4e4333004a
added #decimal columnAlignment.
Claus Gittinger <cg@exept.de>
parents:
2419
diff
changeset
|
471 |
] ifFalse:[ |
9b4e4333004a
added #decimal columnAlignment.
Claus Gittinger <cg@exept.de>
parents:
2419
diff
changeset
|
472 |
x := width - labelWidth. |
1147 | 473 |
|
2420
9b4e4333004a
added #decimal columnAlignment.
Claus Gittinger <cg@exept.de>
parents:
2419
diff
changeset
|
474 |
columnAlignment == #right ifTrue:[x := x - space] |
9b4e4333004a
added #decimal columnAlignment.
Claus Gittinger <cg@exept.de>
parents:
2419
diff
changeset
|
475 |
ifFalse:[x := x // 2]. |
9b4e4333004a
added #decimal columnAlignment.
Claus Gittinger <cg@exept.de>
parents:
2419
diff
changeset
|
476 |
]. |
9b4e4333004a
added #decimal columnAlignment.
Claus Gittinger <cg@exept.de>
parents:
2419
diff
changeset
|
477 |
"/ cg: old code (did not right-align if string is larger than width |
9b4e4333004a
added #decimal columnAlignment.
Claus Gittinger <cg@exept.de>
parents:
2419
diff
changeset
|
478 |
"/ x := xLeft + (x max:0). |
1586
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
479 |
|
1587 | 480 |
"/ new code: always right-align. |
481 |
x := xLeft + x. |
|
482 |
||
483 |
"/ must clip left, if string is too large |
|
484 |
x < xLeft ifTrue:[ |
|
1586
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
485 |
"/ must clip ... |
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
486 |
prevClip := dataSet clippingRectangleOrNil. |
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
487 |
mustUndoClip := true. |
1591
6996391ee3ba
Avoid obsolete method. (stefan)
Claus Gittinger <cg@exept.de>
parents:
1590
diff
changeset
|
488 |
dataSet clippingRectangle:(Rectangle |
1586
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
489 |
left:xLeft top:yTop |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
490 |
width:width height:(drawnLabel heightOn:dataSet)). |
1586
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
491 |
]. |
1147 | 492 |
]. |
1447 | 493 |
|
2443
e88b4123061a
changes to allow for Object>>displayOn:x:y: to work correctly
Claus Gittinger <cg@exept.de>
parents:
2424
diff
changeset
|
494 |
"/ drawnLabel isImageOrForm ifTrue:[ |
e88b4123061a
changes to allow for Object>>displayOn:x:y: to work correctly
Claus Gittinger <cg@exept.de>
parents:
2424
diff
changeset
|
495 |
"/ y := yTop. |
e88b4123061a
changes to allow for Object>>displayOn:x:y: to work correctly
Claus Gittinger <cg@exept.de>
parents:
2424
diff
changeset
|
496 |
"/ ] ifFalse:[ |
e88b4123061a
changes to allow for Object>>displayOn:x:y: to work correctly
Claus Gittinger <cg@exept.de>
parents:
2424
diff
changeset
|
497 |
"/ y := (yTop + dataSet rowFontAscent) |
e88b4123061a
changes to allow for Object>>displayOn:x:y: to work correctly
Claus Gittinger <cg@exept.de>
parents:
2424
diff
changeset
|
498 |
"/ ]. |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2581
diff
changeset
|
499 |
|
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2581
diff
changeset
|
500 |
"/ drawnLabel isString ifFalse:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2581
diff
changeset
|
501 |
"/ y := yTop + (drawnLabel ascentOn:dataSet). |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2581
diff
changeset
|
502 |
"/ ] ifTrue:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2581
diff
changeset
|
503 |
"/ y := yTop + dataSet rowFontAscent |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2581
diff
changeset
|
504 |
"/ ]. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2581
diff
changeset
|
505 |
"/ drawnLabel displayOn:dataSet x:x y:y. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2581
diff
changeset
|
506 |
|
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2581
diff
changeset
|
507 |
dataSet displayLabel:drawnLabel x:x y:yTop. |
1147 | 508 |
|
1586
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
509 |
mustUndoClip == true ifTrue:[ |
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
510 |
dataSet clippingRectangle:prevClip |
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
511 |
]. |
1147 | 512 |
! |
513 |
||
1132 | 514 |
drawLabelsAtX:xLeft y:yTop h:h from:start to:stop |
515 |
"redraw labels from start to stop |
|
1088 | 516 |
" |
2613
2de5a812418b
nomore win-workaround for drawbug when filling a rectangle
ca
parents:
2592
diff
changeset
|
517 |
|fg y yT x hspace lblHg bg label row isSel| |
2578 | 518 |
|
1132 | 519 |
yT := yTop. |
520 |
hspace := dataSet horizontalSpacing. |
|
1100 | 521 |
|
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
522 |
start to:stop do:[:aRowNr| |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
523 |
row := dataSet at:aRowNr. |
1132 | 524 |
y := yT. |
525 |
x := xLeft. |
|
526 |
||
2710
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
527 |
"/ GET BACKGROUND AND FOREGROUND-COLOR |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
528 |
"/ =================================== |
1132 | 529 |
|
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
530 |
isSel := dataSet isSelected:aRowNr inColumn:columnNumber. |
1132 | 531 |
|
2578 | 532 |
isSel ifTrue:[ |
1132 | 533 |
( description editorType ~~ #None |
534 |
and:[dataSet selectedColIndex == columnNumber] |
|
535 |
) ifTrue:[ |
|
536 |
isSel := false |
|
1115 | 537 |
] |
1113 | 538 |
]. |
539 |
||
1132 | 540 |
(isSel and:[description showSelectionHighLighted]) ifTrue:[ |
541 |
"/ SHOW SELECTED( MUST REDRAW BACKGROUND ) |
|
542 |
"/ ======================================= |
|
2710
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
543 |
bg := self selectedBackgroundColorFor:row at:aRowNr. |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
544 |
fg := self selectedForegroundColorFor:row at:aRowNr. |
2578 | 545 |
|
1132 | 546 |
dataSet paint:bg. |
2613
2de5a812418b
nomore win-workaround for drawbug when filling a rectangle
ca
parents:
2592
diff
changeset
|
547 |
dataSet fillRectangleX:x y:y width:width height:h. |
1113 | 548 |
] ifFalse:[ |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
549 |
description backgroundSelector notNil ifTrue:[ |
1132 | 550 |
"/ MUST REDRAW BACKGROUND |
551 |
"/ ====================== |
|
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
552 |
bg := self backgroundColorFor:row at:aRowNr. |
1565 | 553 |
|
554 |
bg ~~ backgroundColor ifTrue:[ |
|
1132 | 555 |
bg := dataSet colorOnDevice:bg |
556 |
]. |
|
557 |
dataSet paint:bg. |
|
558 |
dataSet fillRectangleX:x y:y width:width height:h. |
|
559 |
] ifFalse:[ |
|
560 |
bg := backgroundColor |
|
561 |
]. |
|
1100 | 562 |
|
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
563 |
fg := self foregroundColorFor:row at:aRowNr. |
1565 | 564 |
|
565 |
fg ~~ foregroundColor ifTrue:[ |
|
1132 | 566 |
fg := dataSet colorOnDevice:fg |
1565 | 567 |
]. |
1132 | 568 |
]. |
833 | 569 |
|
1132 | 570 |
"/ GET AND DRAW LABEL |
571 |
"/ ================== |
|
2542 | 572 |
(self isRowVisible:aRowNr) ifTrue:[ |
573 |
rendererType == #rowSelector ifTrue:[ |
|
574 |
isSel ifTrue:[ |
|
575 |
label := dataSet rowSelectorForm. |
|
576 |
x := x + hspace. |
|
577 |
] ifFalse:[ |
|
578 |
label := nil |
|
579 |
] |
|
1132 | 580 |
] ifFalse:[ |
2542 | 581 |
(isSel and:[dataSet hasOpenEditor]) ifTrue:[ |
582 |
label := nil |
|
583 |
] ifFalse:[ |
|
584 |
label := self shownValueForRow:row rowNr:aRowNr |
|
585 |
] |
|
1589
8bb71707b51a
remove any color emphasis when displaying the selection.
Claus Gittinger <cg@exept.de>
parents:
1587
diff
changeset
|
586 |
]. |
2542 | 587 |
label notNil ifTrue:[ |
588 |
"/ care for a dark-colored label, |
|
589 |
"/ with a dark selection-bg color |
|
590 |
(isSel and:[label isString and:[label hasChangeOfEmphasis]]) ifTrue:[ |
|
591 |
"/ take away the labels own color info |
|
592 |
label := label emphasisAllRemove:#color. |
|
593 |
]. |
|
594 |
||
595 |
lblHg := self heightOfLabel:label. |
|
1589
8bb71707b51a
remove any color emphasis when displaying the selection.
Claus Gittinger <cg@exept.de>
parents:
1587
diff
changeset
|
596 |
|
2542 | 597 |
lblHg ~~ 0 ifTrue:[ |
598 |
y := y + (h - lblHg // 2). |
|
599 |
dataSet paint:fg on:bg. |
|
1113 | 600 |
|
2542 | 601 |
(label isSequenceable and:[label isString not]) ifFalse:[ |
602 |
self drawLabel:label atX:x y:y |
|
603 |
] ifTrue:[ |
|
604 |
label do:[:el| |
|
605 |
el notNil ifTrue:[ |
|
606 |
self drawLabel:el atX:x y:y. |
|
607 |
y := y + (el heightOn:dataSet). |
|
608 |
] |
|
1147 | 609 |
] |
2542 | 610 |
]. |
611 |
] |
|
612 |
]. |
|
1132 | 613 |
]. |
614 |
yT := yT + h |
|
615 |
] |
|
833 | 616 |
! |
617 |
||
1132 | 618 |
drawSeparatorsAtX:xLeft y:yTop h:h from:start to:stop |
619 |
"redraw separators for cells between start and stop |
|
1088 | 620 |
" |
1132 | 621 |
|is3D |
622 |
xL "{ Class:SmallInteger }" |
|
1113 | 623 |
xR "{ Class:SmallInteger }" |
624 |
yB "{ Class:SmallInteger }" |
|
625 |
yT "{ Class:SmallInteger }" |
|
1132 | 626 |
times "{ Class:SmallInteger }" |
1088 | 627 |
| |
1132 | 628 |
(showColSeparator or:[showRowSeparator]) ifFalse:[ |
629 |
^ self |
|
630 |
]. |
|
631 |
is3D := dataSet has3Dseparators. |
|
632 |
||
1113 | 633 |
is3D ifTrue:[dataSet paint:(dataSet separatorDarkColor)] |
2638
f2b2ecc2c851
use user defined color for drawing separators in OneD mode
ca
parents:
2636
diff
changeset
|
634 |
ifFalse:[dataSet paint:(dataSet separatorOneDColor)]. |
1088 | 635 |
|
1132 | 636 |
times := stop - start + 1. |
637 |
xL := xLeft. |
|
638 |
xR := xL - 1 + width. |
|
1088 | 639 |
|
1113 | 640 |
showRowSeparator ifTrue:[ |
1132 | 641 |
"/ DRAW SEPARATORS AT BOTTOM( DARK COLOR ) |
642 |
"/ ======================================= |
|
643 |
yB := yTop - 1 + h. |
|
644 |
||
645 |
rowSeparatorSelector isNil ifTrue:[ |
|
646 |
times timesRepeat:[ |
|
647 |
dataSet displayLineFromX:xL y:yB toX:xR y:yB. |
|
648 |
yB := yB + h. |
|
649 |
] |
|
650 |
] ifFalse:[ |
|
651 |
start to:stop do:[:idx| |
|
652 |
((dataSet at:idx) perform:rowSeparatorSelector) ~~ false ifTrue:[ |
|
653 |
dataSet displayLineFromX:xL y:yB toX:xR y:yB |
|
654 |
]. |
|
655 |
yB := yB + h. |
|
656 |
] |
|
1113 | 657 |
] |
658 |
]. |
|
1132 | 659 |
|
1113 | 660 |
showColSeparator ifTrue:[ |
1132 | 661 |
"/ DRAW SEPARATORS AT RIGHT( DARK COLOR ) |
662 |
"/ ====================================== |
|
663 |
yT := yTop. |
|
664 |
||
665 |
times timesRepeat:[ |
|
666 |
dataSet displayLineFromX:xR y:yT toX:xR y:(yT - 1 + h). |
|
667 |
yT := yT + h. |
|
668 |
] |
|
1113 | 669 |
]. |
1089 | 670 |
|
1113 | 671 |
is3D ifFalse:[ |
672 |
^ self |
|
673 |
]. |
|
1088 | 674 |
|
1113 | 675 |
dataSet paint:(dataSet separatorLightColor). |
1040
c8e6a2ed7928
use the same background color for a selected rowSelector
ca
parents:
1007
diff
changeset
|
676 |
|
1113 | 677 |
( columnNumber == 1 |
678 |
or:[(dataSet columnAt:(columnNumber - 1)) showColSeparator] |
|
679 |
) ifTrue:[ |
|
1132 | 680 |
|
681 |
"/ DRAW SEPARATORS AT LEFT( LIGHT COLOR ) |
|
682 |
"/ ====================================== |
|
683 |
yT := yTop. |
|
684 |
||
685 |
times timesRepeat:[ |
|
686 |
dataSet displayLineFromX:xL y:yT toX:xL y:(yT - 1 + h). |
|
687 |
yT := yT + h. |
|
688 |
]. |
|
1113 | 689 |
] ifFalse:[ |
1132 | 690 |
xL := xL - 1 |
1113 | 691 |
]. |
1092 | 692 |
|
1113 | 693 |
showRowSeparator ifTrue:[ |
1132 | 694 |
"/ DRAW SEPARATORS AT TOP( LIGHT COLOR ) |
695 |
"/ ===================================== |
|
696 |
yT := yTop. |
|
697 |
||
698 |
rowSeparatorSelector isNil ifTrue:[ |
|
699 |
times timesRepeat:[ |
|
700 |
dataSet displayLineFromX:xL y:yT toX:xR y:yT. |
|
701 |
yT := yT + h. |
|
702 |
] |
|
703 |
] ifFalse:[ |
|
704 |
"/ CHECK WHETHER PREVIOUS ROW HAS A SEPARATOR AT BOTTOM |
|
705 |
"/ ==================================================== |
|
706 |
start to:stop do:[:idx| |
|
707 |
( idx == 1 |
|
708 |
or:[((dataSet at:(idx - 1)) perform:rowSeparatorSelector) ~~ false] |
|
709 |
) ifTrue:[ |
|
710 |
dataSet displayLineFromX:xL y:yT toX:xR y:yT. |
|
711 |
]. |
|
712 |
yT := yT + h. |
|
713 |
] |
|
1088 | 714 |
] |
542 | 715 |
]. |
607 | 716 |
! |
717 |
||
542 | 718 |
invalidate |
1484 | 719 |
"invalidate width of column; forces a recomputation |
542 | 720 |
" |
1484 | 721 |
width := nil. |
542 | 722 |
|
1088 | 723 |
! |
724 |
||
1132 | 725 |
redrawX:xLeft y:yTop h:h from:start to:stop |
1088 | 726 |
"redraw rows between start and stop |
727 |
" |
|
1132 | 728 |
|rH "{ Class:SmallInteger }" |
729 |
y "{ Class:SmallInteger }" |
|
1088 | 730 |
| |
1132 | 731 |
rH := dataSet rowHeight. |
1088 | 732 |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
733 |
description backgroundSelector isNil ifTrue:[ |
1132 | 734 |
dataSet paint:backgroundColor. |
735 |
dataSet fillRectangleX:xLeft y:yTop width:width height:h |
|
1115 | 736 |
]. |
737 |
||
1132 | 738 |
"/ DRAW CELLS: BACKGROUND/FOREGROUND/LABEL |
739 |
"/ ======================================= |
|
740 |
self drawLabelsAtX:xLeft y:yTop h:rH from:start to:stop. |
|
1113 | 741 |
|
742 |
"/ DRAW INDICATORS |
|
743 |
"/ =============== |
|
744 |
(rendererType == #ComboBox or:[rendererType == #ComboList]) ifTrue:[ |
|
1132 | 745 |
y := yTop. |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
746 |
start to:stop do:[:rowNr| |
2542 | 747 |
(self isRowVisible:rowNr) ifTrue:[ |
748 |
(self hasChoices:rowNr) ifTrue:[ |
|
749 |
dataSet drawComboButtonAtX:xLeft y:y w:width |
|
750 |
]. |
|
1113 | 751 |
]. |
1132 | 752 |
y := y + rH. |
1113 | 753 |
] |
754 |
] ifFalse:[ |
|
755 |
rendererType == #CheckToggle ifTrue:[ |
|
1132 | 756 |
y := yTop. |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
757 |
start to:stop do:[:rowNr| |state| |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
758 |
state := self at:rowNr. |
2542 | 759 |
(self isRowVisible:rowNr) ifTrue:[ |
760 |
dataSet drawCheckToggleAtX:xLeft y:y w:width state:state. |
|
761 |
]. |
|
1132 | 762 |
y := y + rH. |
1113 | 763 |
] |
764 |
] |
|
1088 | 765 |
]. |
766 |
||
767 |
"/ DRAW SEPARATORS |
|
1113 | 768 |
"/ =============== |
1132 | 769 |
self drawSeparatorsAtX:xLeft y:yTop h:rH from:start to:stop |
2693 | 770 |
! |
771 |
||
772 |
shownValueForRow:aRow rowNr:aRowNr |
|
773 |
|selector format value| |
|
774 |
||
775 |
rendererType == #CheckToggle ifTrue:[ |
|
776 |
^ nil |
|
777 |
]. |
|
778 |
||
779 |
rendererType == #rowSelector ifTrue:[ |
|
780 |
^ nil |
|
781 |
]. |
|
782 |
||
783 |
selector := description printSelector. |
|
784 |
selector notNil ifTrue:[ |
|
785 |
^ aRow |
|
786 |
perform:selector |
|
787 |
withOptionalArgument:dataSet and:columnNumber and:aRowNr and:dataSet. |
|
788 |
]. |
|
789 |
||
790 |
value := self extractColFromRow:aRow rowNr:aRowNr. |
|
791 |
||
792 |
selector := description formatSelector. |
|
793 |
selector notNil ifTrue:[ |
|
794 |
format := aRow |
|
795 |
perform:selector |
|
796 |
withOptionalArgument:dataSet and:columnNumber and:aRowNr and:dataSet. |
|
797 |
] ifFalse:[ |
|
798 |
format := description formatString. |
|
799 |
]. |
|
800 |
format notNil ifTrue:[ |
|
801 |
"/ cannot remember what this was used for ... |
|
802 |
"/ (idx := format indexOf:$.) ~~ 0 ifTrue:[ |
|
803 |
"/ idx := format size - idx |
|
804 |
"/ ]. |
|
805 |
"/ format := '%0.', idx printString, 'f'. |
|
806 |
||
807 |
value := value printfPrintString:format |
|
808 |
]. |
|
809 |
||
810 |
^ value |
|
542 | 811 |
! ! |
812 |
||
614 | 813 |
!DataSetColumn methodsFor:'editing'! |
814 |
||
833 | 815 |
editorAt:aRowNr |
1268 | 816 |
|val row| |
614 | 817 |
|
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
818 |
row := (dataSet at:aRowNr). |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
819 |
val := self extractColFromRow:row rowNr:aRowNr. |
614 | 820 |
|
833 | 821 |
val isText ifTrue:[val := val string]. |
1984
ccdfdf1c89af
fetch editor from adaptor if not nil.
Claus Gittinger <cg@exept.de>
parents:
1950
diff
changeset
|
822 |
^ description editorOn:row column:self value:val usingAdaptor:columnAdaptor. |
2693 | 823 |
! ! |
824 |
||
825 |
!DataSetColumn methodsFor:'event handling'! |
|
826 |
||
827 |
doesNotUnderstand:aMessage |
|
828 |
||
829 |
(description respondsTo:(aMessage selector)) ifTrue:[ |
|
830 |
^ aMessage sendTo:description |
|
831 |
]. |
|
832 |
^ super doesNotUnderstand:aMessage |
|
833 |
||
834 |
! ! |
|
835 |
||
836 |
!DataSetColumn methodsFor:'grow & shrink'! |
|
837 |
||
838 |
growWidth:n |
|
839 |
"grow the width for n pixels |
|
840 |
" |
|
841 |
width := self width + n. |
|
842 |
||
843 |
||
844 |
! ! |
|
845 |
||
846 |
!DataSetColumn methodsFor:'initialization'! |
|
542 | 847 |
|
1147 | 848 |
on:aDSVColumnView description:aDescription columnNumber:aNumber label:aLabel |
542 | 849 |
"instance creation; set attributes dependent on the description |
850 |
" |
|
1089 | 851 |
columnNumber := aNumber. |
852 |
dataSet := aDSVColumnView. |
|
1147 | 853 |
label := aLabel. |
1487 | 854 |
|
1089 | 855 |
description := aDescription. |
856 |
rendererType := description rendererType. |
|
1496 | 857 |
containsText := ( rendererType ~~ #CheckToggle |
858 |
and:[rendererType ~~ #rowSelector] |
|
859 |
). |
|
1490 | 860 |
descWidth := description width. |
2424
576621beeacb
Care for #longStringCompression
Stefan Vogel <sv@exept.de>
parents:
2420
diff
changeset
|
861 |
longStringCompression := description longStringCompression. |
1526 | 862 |
|
863 |
description usePreferredWidth ifTrue:[ |
|
864 |
descWidth := 0 |
|
865 |
]. |
|
866 |
||
1565 | 867 |
width := nil. |
868 |
||
2693 | 869 |
minValue := description minValue. |
870 |
maxValue := description maxValue. |
|
1113 | 871 |
rowSeparatorSelector := description rowSeparatorSelector. |
1565 | 872 |
|
1113 | 873 |
showColSeparator := description showColSeparator. |
874 |
showRowSeparator := description showRowSeparator. |
|
1089 | 875 |
columnAdaptor := dataSet columnAdaptor. |
876 |
buttonExtent := 0 @ 0. |
|
877 |
columnAlignment := #left. |
|
584 | 878 |
|
1132 | 879 |
(backgroundColor := description backgroundColor) isNil ifTrue:[ |
880 |
backgroundColor := dataSet backgroundColor |
|
881 |
] ifFalse:[ |
|
1480 | 882 |
backgroundColor := backgroundColor onDevice:dataSet device |
584 | 883 |
]. |
1113 | 884 |
|
885 |
(foregroundColor := description foregroundColor) isNil ifTrue:[ |
|
886 |
foregroundColor := dataSet foregroundColor |
|
887 |
] ifFalse:[ |
|
1480 | 888 |
foregroundColor := foregroundColor onDevice:dataSet device |
584 | 889 |
]. |
542 | 890 |
|
891 |
rendererType == #CheckToggle ifTrue:[ |
|
1113 | 892 |
buttonExtent := dataSet checkToggleExtent. |
2067
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
893 |
^ self |
542 | 894 |
]. |
895 |
||
896 |
rendererType == #rowSelector ifTrue:[ |
|
807 | 897 |
buttonExtent := dataSet rowSelectorExtent. |
2067
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
898 |
^ self |
542 | 899 |
]. |
900 |
||
901 |
(rendererType == #ComboBox or:[rendererType == #ComboList]) ifTrue:[ |
|
807 | 902 |
buttonExtent := dataSet comboButtonExtent. |
883 | 903 |
] ifFalse:[ |
904 |
columnAlignment := description columnAlignment |
|
542 | 905 |
]. |
906 |
||
2444 | 907 |
"Modified: / 25.2.2000 / 14:25:56 / cg" |
2424
576621beeacb
Care for #longStringCompression
Stefan Vogel <sv@exept.de>
parents:
2420
diff
changeset
|
908 |
! ! |
576621beeacb
Care for #longStringCompression
Stefan Vogel <sv@exept.de>
parents:
2420
diff
changeset
|
909 |
|
621 | 910 |
!DataSetColumn methodsFor:'private'! |
911 |
||
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
912 |
extractColFromRow:aRow rowNr:rowNr |
2444 | 913 |
|readSelector col| |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
914 |
|
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
915 |
readSelector := description readSelector. |
1226 | 916 |
readSelector isNil ifTrue:[^ nil]. |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
917 |
|
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
918 |
readSelector isBlock ifTrue:[ |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
919 |
readSelector numArgs == 0 ifTrue:[ |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
920 |
^ readSelector value |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
921 |
]. |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
922 |
readSelector numArgs == 1 ifTrue:[ |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
923 |
^ readSelector value:aRow |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
924 |
]. |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
925 |
readSelector numArgs == 2 ifTrue:[ |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
926 |
^ readSelector value:aRow value:columnNumber |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
927 |
]. |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
928 |
readSelector numArgs == 3 ifTrue:[ |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
929 |
^ readSelector value:aRow value:columnNumber value:rowNr |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
930 |
]. |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
931 |
^ readSelector value:aRow value:columnNumber value:rowNr value:dataSet |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
932 |
]. |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
933 |
|
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
934 |
columnAdaptor notNil ifTrue:[ |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
935 |
^ columnAdaptor perform:readSelector withOptionalArgument:aRow and:columnNumber and:rowNr and:dataSet |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
936 |
]. |
2635
a8add4698dea
care for nil rows when extracting columns
Claus Gittinger <cg@exept.de>
parents:
2613
diff
changeset
|
937 |
aRow isNil ifTrue:[^ nil]. |
a8add4698dea
care for nil rows when extracting columns
Claus Gittinger <cg@exept.de>
parents:
2613
diff
changeset
|
938 |
|
2444 | 939 |
col := aRow perform:readSelector withOptionalArgument:columnNumber and:rowNr and:dataSet. |
940 |
^ col |
|
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
941 |
! |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
942 |
|
2693 | 943 |
storeCol:newValueArg inRow:aRow |
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
944 |
|writeSelector numArgs newValue| |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
945 |
|
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
946 |
writeSelector := description writeSelector. |
1226 | 947 |
writeSelector isNil ifTrue:[^ aRow]. |
948 |
||
2693 | 949 |
newValue := newValueArg. |
950 |
(newValue isNumber) ifTrue:[ |
|
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
951 |
minValue notNil ifTrue:[ |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
952 |
newValue < minValue ifTrue:[ |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
953 |
newValue := minValue |
2693 | 954 |
] |
955 |
]. |
|
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
956 |
maxValue notNil ifTrue:[ |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
957 |
newValue > maxValue ifTrue:[ |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
958 |
newValue := maxValue |
2693 | 959 |
] |
960 |
]. |
|
961 |
]. |
|
962 |
||
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
963 |
numArgs := writeSelector numArgs. |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
964 |
|
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
965 |
writeSelector isBlock ifTrue:[ |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
966 |
numArgs == 2 ifTrue:[ |
2863
c0585cbcd922
argument order when using write-store-blocks
Claus Gittinger <cg@exept.de>
parents:
2862
diff
changeset
|
967 |
^ writeSelector value:newValue value:aRow |
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
968 |
]. |
2863
c0585cbcd922
argument order when using write-store-blocks
Claus Gittinger <cg@exept.de>
parents:
2862
diff
changeset
|
969 |
^ writeSelector value:newValue value:aRow value:columnNumber |
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
970 |
]. |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
971 |
|
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
972 |
columnAdaptor notNil ifTrue:[ |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
973 |
numArgs == 2 ifTrue:[ |
2419
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
974 |
columnAdaptor perform:writeSelector with:aRow with:newValue. |
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
975 |
^ self |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
976 |
]. |
2419
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
977 |
columnAdaptor perform:writeSelector with:aRow with:columnNumber with:newValue. |
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
978 |
^ self |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
979 |
]. |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
980 |
|
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
981 |
numArgs == 1 ifTrue:[ |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
982 |
aRow perform:writeSelector with:newValue |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
983 |
] ifFalse:[ |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
984 |
aRow perform:writeSelector with:columnNumber with:newValue |
1059 | 985 |
]. |
621 | 986 |
! ! |
987 |
||
542 | 988 |
!DataSetColumn methodsFor:'queries'! |
989 |
||
1492 | 990 |
canResize |
991 |
||
1496 | 992 |
containsText ifTrue:[ |
2017
5cbe1d46c01d
isReal -> isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents:
1984
diff
changeset
|
993 |
^ descWidth == 0 or:[self hasRelativeWidth] |
1492 | 994 |
]. |
995 |
^ false |
|
996 |
! |
|
997 |
||
607 | 998 |
canSelect:aRowNr |
2067
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
999 |
"returns true if the cell in column is selectable |
607 | 1000 |
" |
2067
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
1001 |
|s row| |
607 | 1002 |
|
2067
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
1003 |
description canSelect ifFalse:[^ false]. |
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
1004 |
s := description selectSelector. |
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
1005 |
s isNil ifTrue:[^ true]. |
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
1006 |
|
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
1007 |
row := dataSet at:aRowNr. |
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
1008 |
columnAdaptor notNil ifTrue:[ |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
1009 |
^ columnAdaptor perform:s withOptionalArgument:row and:columnNumber and:aRowNr and:dataSet |
607 | 1010 |
]. |
1011 |
||
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
1012 |
^ row perform:s withOptionalArgument:columnNumber and:aRowNr and:dataSet |
607 | 1013 |
! |
1014 |
||
647 | 1015 |
containsText |
1016 |
"returns true if text might exist |
|
1017 |
" |
|
1496 | 1018 |
^ containsText |
647 | 1019 |
! |
1020 |
||
2074 | 1021 |
doubleClickOn:aRowNr |
2694 | 1022 |
|sel row| |
2074 | 1023 |
|
1024 |
(sel := self doubleClickedSelector) notNil ifTrue:[ |
|
2694 | 1025 |
row := dataSet at:aRowNr. |
2074 | 1026 |
columnAdaptor notNil ifTrue:[ |
2694 | 1027 |
^ columnAdaptor perform:sel withOptionalArgument:row and:columnNumber and:aRowNr and:dataSet |
2074 | 1028 |
]. |
2694 | 1029 |
^ row perform:sel withOptionalArgument:columnNumber and:aRowNr and:dataSet |
2074 | 1030 |
]. |
1031 |
! |
|
1032 |
||
833 | 1033 |
hasChoices:aRowNr |
1034 |
^ (description choicesFor:(dataSet at:aRowNr)) notNil |
|
1035 |
! |
|
1036 |
||
1950 | 1037 |
hasPotentialNonConstantBackground |
1038 |
(backgroundColor notNil and:[backgroundColor isImageOrForm]) ifTrue:[^ true]. |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1039 |
description backgroundSelector notNil ifTrue:[^ true]. |
1950 | 1040 |
^ false. |
1041 |
! |
|
1042 |
||
1484 | 1043 |
hasRelativeWidth |
1044 |
"returns true if width is relative |
|
1045 |
" |
|
2017
5cbe1d46c01d
isReal -> isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents:
1984
diff
changeset
|
1046 |
^ descWidth isLimitedPrecisionReal |
1484 | 1047 |
! |
1048 |
||
542 | 1049 |
heightOfHighestRow |
1725
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
1050 |
"returns the height of the highest row in pixels. |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
1051 |
Warning: |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
1052 |
only the first numberOfRowsProbedForColumnSize are probed, |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
1053 |
in case the access is expensive (dataBase apps) |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
1054 |
If the descriptor defines a height, that is used, and the items |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
1055 |
are not probed at all. |
542 | 1056 |
" |
1559
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
1057 |
|h end bE editor| |
542 | 1058 |
|
1496 | 1059 |
(h := description height) == 0 ifTrue:[ |
1060 |
containsText ifTrue:[ |
|
542 | 1061 |
"/ search first none empty drawable object |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1062 |
end := description numberOfRowsProbedForColumnSize min:dataSet size. |
542 | 1063 |
|
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
1064 |
1 to:end do:[:rowNr| |row| |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
1065 |
row := dataSet at:rowNr. |
2444 | 1066 |
h := h max:(self heightOfLabel:(self shownValueForRow:row rowNr:rowNr)) |
542 | 1067 |
] |
1068 |
] |
|
1069 |
]. |
|
1559
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
1070 |
(bE := buttonExtent y) = 0 ifTrue:[ |
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
1071 |
((editor := description editorType) == #ComboList |
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
1072 |
or:[ editor == #ComboBox]) ifTrue:[ |
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
1073 |
bE := dataSet comboButtonExtent y. |
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
1074 |
]. |
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
1075 |
]. |
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
1076 |
^ h max:bE |
1725
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
1077 |
|
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
1078 |
"Modified: / 25.2.2000 / 14:29:20 / cg" |
1113 | 1079 |
! |
1080 |
||
1147 | 1081 |
heightOfLabel:aLabel |
1082 |
"returns the height of the label |
|
1083 |
" |
|
1496 | 1084 |
|h| |
1147 | 1085 |
|
1496 | 1086 |
(aLabel isString or:[aLabel isImageOrForm]) ifTrue:[ |
1087 |
^ aLabel heightOn:dataSet |
|
1088 |
]. |
|
1147 | 1089 |
aLabel isNil ifTrue:[ ^ 0 ]. |
1090 |
||
1496 | 1091 |
aLabel isSequenceable ifFalse:[ |
1092 |
^ aLabel perform:#heightOn: with:dataSet ifNotUnderstood:[ |
|
1093 |
aLabel displayString heightOn:dataSet |
|
1094 |
] |
|
1147 | 1095 |
]. |
1096 |
||
1496 | 1097 |
h := 0. |
1098 |
aLabel do:[:el|h := h + (el heightOn:dataSet)]. |
|
1099 |
^ h |
|
1147 | 1100 |
|
1101 |
! |
|
1102 |
||
1937 | 1103 |
isResizeable |
1104 |
"returns true if the row is resizeable |
|
1105 |
" |
|
1106 |
^ description isResizeable |
|
1107 |
! |
|
1108 |
||
2542 | 1109 |
isRowVisible:rowNr |
1110 |
^ description rowIsVisible:(dataSet at:rowNr) |
|
1111 |
! |
|
1112 |
||
1113 | 1113 |
showColSeparator |
1114 |
"returns true if column separator is on |
|
1115 |
" |
|
1116 |
^ showColSeparator |
|
1133 | 1117 |
! |
1118 |
||
1119 |
showSelectionHighLighted |
|
1120 |
"returns true if selection is highLighted |
|
1121 |
" |
|
1122 |
^ description showSelectionHighLighted ~~ false |
|
1147 | 1123 |
! |
1124 |
||
1125 |
widthOfLabel:aLabel |
|
1126 |
"returns the width of the label |
|
1127 |
" |
|
1496 | 1128 |
|w| |
1147 | 1129 |
|
1496 | 1130 |
(aLabel isString or:[aLabel isImageOrForm]) ifTrue:[ |
1131 |
^ aLabel widthOn:dataSet |
|
1132 |
]. |
|
1147 | 1133 |
aLabel isNil ifTrue:[ ^ 0 ]. |
1134 |
||
1496 | 1135 |
aLabel isSequenceable ifFalse:[ |
1136 |
^ aLabel perform:#widthOn: with:dataSet ifNotUnderstood:[ |
|
1137 |
aLabel displayString widthOn:dataSet |
|
1138 |
] |
|
1147 | 1139 |
]. |
1140 |
||
1496 | 1141 |
w := 0. |
1142 |
aLabel do:[:el|w := w max:(el widthOn:dataSet)]. |
|
1143 |
^ w |
|
542 | 1144 |
! ! |
1145 |
||
1146 |
!DataSetColumn methodsFor:'searching'! |
|
1147 |
||
1148 |
findRowNrStartingWithChar:aChar start:start stop:stop |
|
1149 |
"find the first row starting at start to stop, which drawable label |
|
1150 |
starts with the character, aChar. The index of the detected row is |
|
1151 |
returned or if no row is found 0. |
|
1152 |
" |
|
1153 |
|char| |
|
1154 |
||
1496 | 1155 |
containsText ifTrue:[ |
542 | 1156 |
char := aChar asLowercase. |
1157 |
||
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
1158 |
start to:stop do:[:eachNr| |row lbl| |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1159 |
(dataSet isRowSelectable:eachNr) ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1160 |
row := dataSet at:eachNr. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1161 |
lbl := self shownValueForRow:row rowNr:eachNr. |
1147 | 1162 |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1163 |
(lbl isSequenceable and:[lbl isString not]) ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1164 |
lbl := lbl at:1 ifAbsent:nil |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1165 |
]. |
542 | 1166 |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1167 |
(lbl respondsTo:#string) ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1168 |
lbl := lbl string. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1169 |
(lbl size ~~ 0 and:[(lbl at:1) asLowercase == char]) ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1170 |
^ eachNr |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1171 |
] |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1172 |
] ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1173 |
lbl isNil ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1174 |
^ 0 |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1175 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1176 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1177 |
]. |
542 | 1178 |
] |
1179 |
]. |
|
1180 |
^ 0 |
|
1181 |
! ! |
|
1182 |
||
1183 |
!DataSetColumn class methodsFor:'documentation'! |
|
1184 |
||
1185 |
version |
|
2863
c0585cbcd922
argument order when using write-store-blocks
Claus Gittinger <cg@exept.de>
parents:
2862
diff
changeset
|
1186 |
^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.100 2005-11-18 14:56:28 cg Exp $' |
542 | 1187 |
! ! |