author | Stefan Vogel <sv@exept.de> |
Wed, 31 Mar 1999 07:53:11 +0200 | |
changeset 1296 | ab26ea632b56 |
parent 1118 | a49afa5a9f10 |
child 1329 | e0dff849cf82 |
permissions | -rw-r--r-- |
343 | 1 |
" |
2 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
3 |
All Rights Reserved |
343 | 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 |
View subclass:#TabView |
|
550 | 15 |
instanceVariableNames:'list listHolder selection enabled action tabStyle useIndex |
1296 | 16 |
maxRawNr direction fitLastRow moveSelectedRow |
697 | 17 |
selectConditionBlock oldExtent oneTabPerLine fontAscent |
18 |
fontDescent' |
|
550 | 19 |
classVariableNames:'' |
20 |
poolDictionaries:'' |
|
21 |
category:'Views-Interactors' |
|
343 | 22 |
! |
23 |
||
24 |
!TabView class methodsFor:'documentation'! |
|
25 |
||
26 |
copyright |
|
27 |
" |
|
28 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
29 |
All Rights Reserved |
343 | 30 |
|
31 |
This software is furnished under a license and may be used |
|
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
38 |
||
39 |
! |
|
40 |
||
41 |
documentation |
|
42 |
" |
|
43 |
implements the tabs-view component of a noteBook. |
|
44 |
May also be used on its own (without a surrounding noteBook). |
|
45 |
||
46 |
The functionality is basically the same as provided by a |
|
47 |
PopUpList or SelectionInListView, in that a valueHolder |
|
48 |
gets a value assigned corresponding to the selected tab |
|
49 |
from a list of possible tabs. |
|
50 |
||
51 |
[author:] |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
52 |
Claus Atzkern |
343 | 53 |
|
54 |
[see also:] |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
55 |
NoteBookView |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
56 |
SelectionInListView PopUpList ValueHolder TabWidget |
343 | 57 |
" |
58 |
||
59 |
! |
|
60 |
||
61 |
examples |
|
62 |
" |
|
367 | 63 |
tabs at top of a view |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
64 |
[exBegin] |
367 | 65 |
|top tab view inset| |
66 |
||
67 |
top := StandardSystemView new label:'tabs at top'; extent:250@100. |
|
499 | 68 |
tab := TabView origin:0.0 @ 0.0 corner:1.0 @ 0.0 in:top. |
69 |
view := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
|
367 | 70 |
|
71 |
view viewBackground:(tab styleAt:#selectedColor). |
|
72 |
tab direction:#top. |
|
73 |
tab list:#( 'Foo' 'Bar' 'Baz' ). |
|
74 |
inset := tab preferredSizeXorY. |
|
75 |
tab bottomInset:(inset negated). |
|
76 |
view topInset:inset. |
|
77 |
tab action:[:aName|Transcript showCR:aName]. |
|
78 |
top open. |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
79 |
[exEnd] |
343 | 80 |
|
367 | 81 |
tabs at bottom of a view; changing widget to MAC style |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
82 |
[exBegin] |
367 | 83 |
|top tab view inset| |
84 |
||
85 |
top := StandardSystemView new label:'tabs at bottom'; extent:250@100. |
|
499 | 86 |
view := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
87 |
tab := TabView origin:0.0 @ 1.0 corner:1.0 @ 1.0 in:top. |
|
343 | 88 |
|
367 | 89 |
view viewBackground:(tab styleAt:#selectedColor). |
90 |
tab direction:#bottom. |
|
91 |
tab tabWidget:#Mac. |
|
343 | 92 |
|
367 | 93 |
tab list:#( 'Foo' 'Bar' 'Baz' ). |
94 |
inset := tab preferredSizeXorY. |
|
95 |
tab topInset:(inset negated). |
|
96 |
view bottomInset:inset. |
|
97 |
tab action:[:aName|Transcript showCR:aName]. |
|
98 |
top open. |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
99 |
[exEnd] |
343 | 100 |
|
367 | 101 |
tabs at right of a view |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
102 |
[exBegin] |
367 | 103 |
|top tab view inset| |
104 |
||
105 |
top := StandardSystemView new label:'tabs at right'; extent:100@250. |
|
499 | 106 |
view := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
107 |
tab := TabView origin:1.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
|
367 | 108 |
|
109 |
view viewBackground:(tab styleAt:#selectedColor). |
|
110 |
tab direction:#right. |
|
111 |
tab list:#( 'Foo' 'Bar' 'Baz' ). |
|
112 |
inset := tab preferredSizeXorY. |
|
113 |
tab leftInset:(inset negated). |
|
114 |
view rightInset:inset. |
|
115 |
tab action:[:aName|Transcript showCR:aName]. |
|
343 | 116 |
top open. |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
117 |
[exEnd] |
343 | 118 |
|
367 | 119 |
tabs at left of a view |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
120 |
[exBegin] |
367 | 121 |
|top tab view inset| |
122 |
||
123 |
top := StandardSystemView new label:'tabs at left'; extent:100@250. |
|
499 | 124 |
tab := TabView origin:0.0 @ 0.0 corner:0.0 @ 1.0 in:top. |
125 |
view := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
|
343 | 126 |
|
367 | 127 |
view viewBackground:(tab styleAt:#selectedColor). |
128 |
tab direction:#left. |
|
129 |
tab list:#( 'Foo' 'Bar' 'Baz' ). |
|
130 |
inset := tab preferredSizeXorY. |
|
131 |
tab rightInset:(inset negated). |
|
132 |
view leftInset:inset. |
|
133 |
tab action:[:aName|Transcript showCR:aName]. |
|
134 |
top open. |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
135 |
[exEnd] |
343 | 136 |
|
367 | 137 |
changing default style( see TabWidget class ); useing index |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
138 |
[exBegin] |
367 | 139 |
|top tab view| |
140 |
||
141 |
top := StandardSystemView new label:'example'; extent:450@300. |
|
499 | 142 |
tab := TabView origin:0.0 @ 0.0 corner:1.0 @ 40 in:top. |
367 | 143 |
tab horizontalInset:10. |
144 |
view := NoteBookFrameView origin:0.0 @ 40 corner:1.0 @ 1.0 in:top. |
|
343 | 145 |
view horizontalInset:10. |
146 |
view bottomInset:10. |
|
147 |
view level:2. |
|
148 |
view viewBackground:(Image fromFile:'bitmaps/gifImages/garfield.gif'). |
|
149 |
||
367 | 150 |
tab styleAt:#selectedColor put:(view viewBackground). |
151 |
tab styleAt:#unselectedColor put:(Color grey:60). |
|
152 |
tab styleAt:#expandSelection put:9@7. |
|
343 | 153 |
|
367 | 154 |
tab list:#( 'Foo' 'Bar' 'Baz'). |
155 |
tab useIndex:true. |
|
156 |
tab action:[:aName| Transcript showCR:aName ]. |
|
352 | 157 |
|
343 | 158 |
top open. |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
159 |
[exEnd] |
343 | 160 |
|
161 |
||
367 | 162 |
using images and text |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
163 |
[exBegin] |
367 | 164 |
|top tab view list| |
165 |
||
166 |
top := StandardSystemView new label:'example'. |
|
499 | 167 |
tab := TabView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
367 | 168 |
list := #( 'SBrowser' 'FBrowser' 'Debugger' ). |
169 |
list := list collect:[:n | Image fromFile:'bitmaps/' , n , '.xbm']. |
|
170 |
list add:'A Text'. |
|
171 |
tab list:list. |
|
172 |
tab action:[:indexOrNil| Transcript showCR:indexOrNil ]. |
|
173 |
top extent:(tab preferredExtent). |
|
174 |
top open. |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
175 |
[exEnd] |
343 | 176 |
|
367 | 177 |
using images and text; MAC style |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
178 |
[exBegin] |
367 | 179 |
|top tab view list| |
180 |
||
181 |
top := StandardSystemView new label:'example'. |
|
499 | 182 |
tab := TabView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
367 | 183 |
tab tabWidget:#Mac. |
184 |
list := #( 'SBrowser' 'FBrowser' 'Debugger' ). |
|
185 |
list := list collect:[:n | Image fromFile:'bitmaps/' , n , '.xbm']. |
|
186 |
list add:'A Text'. |
|
187 |
tab list:list. |
|
188 |
tab action:[:indexOrNil| Transcript showCR:indexOrNil ]. |
|
189 |
top extent:(tab preferredExtent). |
|
343 | 190 |
top open. |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
191 |
[exEnd] |
343 | 192 |
|
367 | 193 |
tabs at top of view dealing with other models |
194 |
||
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
195 |
[exBegin] |
352 | 196 |
|top sel view l top2 s top3 p| |
343 | 197 |
|
198 |
l := SelectionInList new. |
|
199 |
l list:#('foo' 'bar' 'baz'). |
|
200 |
l selectionIndex:1. |
|
201 |
||
202 |
top2 := StandardSystemView new. |
|
367 | 203 |
top2 extent:100@100. |
343 | 204 |
s := SelectionInListView origin:0.0@0.0 corner:1.0@1.0 in:top2. |
205 |
s model:l. |
|
206 |
top2 open. |
|
207 |
||
208 |
top3 := StandardSystemView new. |
|
367 | 209 |
top3 extent:100@100. |
343 | 210 |
s := PopUpList in:top3. |
211 |
s model:l. |
|
212 |
top3 open. |
|
213 |
||
499 | 214 |
top := StandardSystemView new label:'example'; extent:200@50. |
215 |
sel := TabView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
|
367 | 216 |
sel useIndex:true. |
343 | 217 |
sel model:(l selectionIndexHolder). |
218 |
sel listHolder:(l listHolder). |
|
367 | 219 |
sel action:[:indexOrNil|Transcript showCR:indexOrNil]. |
343 | 220 |
top open. |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
221 |
[exEnd] |
343 | 222 |
" |
223 |
! ! |
|
224 |
||
225 |
!TabView class methodsFor:'defaults'! |
|
226 |
||
227 |
defaultTabWidget |
|
367 | 228 |
^ #Window |
343 | 229 |
! ! |
230 |
||
231 |
!TabView methodsFor:'accessing'! |
|
232 |
||
233 |
action:oneArgBlock |
|
234 |
"set the action block to be performed on select; the argument to |
|
235 |
the block is the selected index or nil in case of no selection. |
|
236 |
" |
|
237 |
action := oneArgBlock. |
|
238 |
||
239 |
! |
|
240 |
||
418 | 241 |
backgroundColor |
242 |
^ viewBackground |
|
243 |
! |
|
244 |
||
697 | 245 |
fontAscent |
246 |
fontAscent isNil ifTrue:[ |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
247 |
fontAscent := self font ascent |
697 | 248 |
]. |
249 |
^ fontAscent |
|
250 |
! |
|
251 |
||
252 |
fontDescent |
|
253 |
fontDescent isNil ifTrue:[ |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
254 |
fontDescent := self font descent |
697 | 255 |
]. |
256 |
^ fontDescent |
|
257 |
! |
|
258 |
||
343 | 259 |
list |
260 |
"return the list |
|
261 |
" |
|
262 |
^ list |
|
263 |
! |
|
264 |
||
265 |
list:aList |
|
266 |
"set the list |
|
267 |
" |
|
697 | 268 |
|hasChanged newSel model| |
376 | 269 |
|
270 |
aList size == list size ifTrue:[ |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
271 |
list notNil ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
272 |
list keysAndValuesDo:[:aKey :aTab| |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
273 |
(aTab label) = (aList at:aKey) ifFalse:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
274 |
hasChanged := true |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
275 |
] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
276 |
] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
277 |
]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
278 |
hasChanged == true ifFalse:[^ self ]. |
376 | 279 |
]. |
343 | 280 |
|
697 | 281 |
self removeListDependencies. |
282 |
||
343 | 283 |
aList size ~~ 0 ifTrue:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
284 |
(newSel := self tabAt:selection) notNil ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
285 |
newSel := newSel printableLabel |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
286 |
]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
287 |
list := (tabStyle at:#widget) labels:aList for:self. |
499 | 288 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
289 |
list do:[:aTab| |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
290 |
(model := aTab model) notNil ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
291 |
model addDependent:self |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
292 |
] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
293 |
]. |
697 | 294 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
295 |
newSel notNil ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
296 |
(newSel := list findFirst:[:aTab| aTab printableLabel = newSel]) == 0 ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
297 |
newSel := nil |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
298 |
] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
299 |
]. |
499 | 300 |
] ifFalse:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
301 |
list := nil. |
343 | 302 |
]. |
499 | 303 |
selection := newSel. |
304 |
||
343 | 305 |
self shown ifTrue:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
306 |
self recomputeList. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
307 |
self invalidateRepairNow:true. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
308 |
self changed:#preferredExtent |
376 | 309 |
]. |
343 | 310 |
! |
311 |
||
508 | 312 |
oneTabPerLine |
313 |
^ oneTabPerLine |
|
314 |
! |
|
315 |
||
316 |
oneTabPerLine:aBool |
|
317 |
oneTabPerLine := aBool. |
|
318 |
! |
|
319 |
||
387 | 320 |
useIndex |
321 |
"use index instead of name |
|
322 |
" |
|
323 |
^ useIndex |
|
324 |
||
325 |
||
326 |
! |
|
327 |
||
328 |
useIndex:aBoolean |
|
329 |
"set/clear the useIndex flag. If set, both actionBlock and change-messages |
|
330 |
are passed the index(indices) of the selection as argument. |
|
331 |
If clear, the value(s) (i.e. the selected string) is passed. |
|
332 |
Default is false." |
|
333 |
||
334 |
useIndex := aBoolean |
|
335 |
||
336 |
||
418 | 337 |
! |
338 |
||
339 |
viewBackground:aColor |
|
340 |
"update colors |
|
341 |
" |
|
342 |
super viewBackground:aColor. |
|
343 |
TabWidget computeColorsOn:self style:tabStyle. |
|
913 | 344 |
shown ifTrue:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
345 |
self invalidate. |
913 | 346 |
] |
347 |
||
348 |
"Modified: / 6.6.1998 / 19:55:59 / cg" |
|
387 | 349 |
! ! |
350 |
||
391 | 351 |
!TabView methodsFor:'accessing behavior'! |
352 |
||
353 |
enabled |
|
354 |
"returns true if tabs are enabled |
|
355 |
" |
|
356 |
^ enabled |
|
357 |
! |
|
358 |
||
359 |
enabled:aState |
|
360 |
"set enabled state |
|
361 |
" |
|
362 |
|state| |
|
363 |
||
364 |
state := aState ? true. |
|
365 |
||
366 |
enabled ~~ state ifTrue:[ |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
367 |
enabled := state. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
368 |
self redrawLabels. |
391 | 369 |
] |
397 | 370 |
! |
371 |
||
670 | 372 |
selectConditionBlock |
373 |
"get the conditionBlock; this block is evaluated before a selection |
|
374 |
change is performed; the change will not be done, if the evaluation |
|
375 |
returns false. The argument to the block is the selection index |
|
376 |
" |
|
377 |
^ selectConditionBlock |
|
378 |
! |
|
379 |
||
380 |
selectConditionBlock:aOneArgBlock |
|
381 |
"get the conditionBlock; this block is evaluated before a selection |
|
382 |
change is performed; the change will not be done, if the evaluation |
|
383 |
returns false. The argument to the block is the selection index |
|
384 |
" |
|
385 |
selectConditionBlock := aOneArgBlock |
|
391 | 386 |
! ! |
387 |
||
387 | 388 |
!TabView methodsFor:'accessing channels/holders'! |
389 |
||
343 | 390 |
listHolder |
391 |
"returns the list holder |
|
392 |
" |
|
393 |
^ listHolder |
|
394 |
! |
|
395 |
||
396 |
listHolder:aValueHolder |
|
397 |
"change the list holder |
|
398 |
" |
|
399 |
listHolder notNil ifTrue:[ |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
400 |
listHolder removeDependent:self. |
343 | 401 |
]. |
387 | 402 |
|
343 | 403 |
listHolder := aValueHolder. |
404 |
listHolder notNil ifTrue:[ |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
405 |
listHolder addDependent:self. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
406 |
self list:listHolder value. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
407 |
self selection:model value. |
343 | 408 |
]. |
409 |
! |
|
410 |
||
411 |
model:aValueHolder |
|
412 |
super model:aValueHolder. |
|
500 | 413 |
|
343 | 414 |
model notNil ifTrue:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
415 |
self selection:(model value) |
343 | 416 |
] |
417 |
! ! |
|
418 |
||
367 | 419 |
!TabView methodsFor:'accessing dimension'! |
420 |
||
421 |
preferredExtent |
|
422 |
"compute max extent x/y based on one line |
|
423 |
" |
|
508 | 424 |
|x y ovl size maxY| |
425 |
||
426 |
(size := list size) == 0 ifTrue:[^ 0 @ 0 ]. |
|
367 | 427 |
|
508 | 428 |
maxY := tabStyle at:#maxY. |
429 |
y := maxY + self viewSpacing. |
|
367 | 430 |
|
508 | 431 |
oneTabPerLine ifTrue:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
432 |
y := y + ((size - 1) * maxY). |
367 | 433 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
434 |
(self isHorizontalDirection) ifTrue:[x := super extent x] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
435 |
ifFalse:[x := super extent y] |
508 | 436 |
] ifFalse:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
437 |
x := ovl := tabStyle at:#rightCovered. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
438 |
list do:[:aTab|x := x - ovl + aTab preferredExtentX] |
367 | 439 |
]. |
440 |
||
508 | 441 |
(self isHorizontalDirection) ifTrue:[^ x @ y] |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
442 |
ifFalse:[^ y @ x] |
367 | 443 |
! |
444 |
||
445 |
preferredSizeXorY |
|
446 |
"returns preferred size dependant on the current view layout and |
|
447 |
the direction of the tabs |
|
448 |
" |
|
449 |
list size == 0 ifFalse:[ |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
450 |
maxRawNr isNil ifTrue:[self recomputeList]. |
367 | 451 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
452 |
oneTabPerLine ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
453 |
self isHorizontalDirection ifTrue:[^ super extent y] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
454 |
ifFalse:[^ super extent x] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
455 |
]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
456 |
^ ((maxRawNr * (tabStyle at:#maxY)) + self viewSpacing). |
367 | 457 |
]. |
458 |
^ 0 |
|
508 | 459 |
! |
460 |
||
461 |
viewSpacing |
|
462 |
"returns my view spacing |
|
463 |
" |
|
464 |
^ ((tabStyle at:#expandSelection) y) + (self class viewSpacing) |
|
367 | 465 |
! ! |
466 |
||
343 | 467 |
!TabView methodsFor:'accessing style'! |
468 |
||
367 | 469 |
direction |
369 | 470 |
"returns the direction of tabs as symbol. On default the value is |
471 |
set to #top. Valid symbols are: |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
472 |
#top arrange tabs to be on top of a view |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
473 |
#bottom arrange tabs to be on bottom of a view |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
474 |
#left arrange tabs to be on left of a view |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
475 |
#right arrange tabs to be on right of a view |
367 | 476 |
" |
477 |
^ direction |
|
478 |
||
479 |
! |
|
480 |
||
481 |
direction:aDirection |
|
369 | 482 |
"change the direction of tabs. On default the value is set to #top. |
483 |
Valid symbols are: |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
484 |
#top arrange tabs to be on top of a view |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
485 |
#bottom arrange tabs to be on bottom of a view |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
486 |
#left arrange tabs to be on left of a view |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
487 |
#right arrange tabs to be on right of a view |
367 | 488 |
" |
374 | 489 |
direction ~~ aDirection ifTrue:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
490 |
direction := aDirection. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
491 |
self changed:#direction |
374 | 492 |
]. |
367 | 493 |
! |
494 |
||
369 | 495 |
fitLastRow |
496 |
"in case of true, the last row is expanded to the view size like all |
|
497 |
other raws. In case of false all the tabs in the last raw keep their |
|
498 |
preferred extent (x or y) dependant on the direction. |
|
499 |
" |
|
500 |
^ fitLastRow |
|
501 |
! |
|
502 |
||
503 |
fitLastRow:aBool |
|
504 |
"in case of true, the last row is expanded to the view size like all |
|
505 |
other raws. In case of false all the tabs in the last raw keep their |
|
506 |
preferred extent (x or y) dependant on the direction. |
|
507 |
" |
|
508 |
fitLastRow := aBool |
|
509 |
! |
|
510 |
||
697 | 511 |
font:aFont |
512 |
(aFont ~= font) ifTrue:[ |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
513 |
super font:aFont. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
514 |
fontAscent := fontDescent := nil |
697 | 515 |
] |
516 |
||
517 |
! |
|
518 |
||
369 | 519 |
moveSelectedRow |
520 |
"in case of true, the raw assigned to the tab will be moved |
|
521 |
to the first line (to the view). Otherwise the position of |
|
522 |
the view will be kept. |
|
523 |
" |
|
524 |
^ moveSelectedRow |
|
525 |
! |
|
526 |
||
527 |
moveSelectedRow:aBool |
|
528 |
"in case of true, the raw assigned to the tab will be moved |
|
529 |
to the first line (to the view). Otherwise the position of |
|
530 |
the view will be kept. |
|
531 |
" |
|
532 |
moveSelectedRow := aBool |
|
533 |
! |
|
534 |
||
367 | 535 |
style |
369 | 536 |
"returns the style sheet derived from the current widget class |
367 | 537 |
" |
538 |
^ tabStyle |
|
539 |
! |
|
540 |
||
343 | 541 |
styleAt:anIdentifier |
369 | 542 |
"returns a specific entry into the widget description. For more information |
543 |
see the specific widget class ( TabWidget ... ). |
|
343 | 544 |
" |
545 |
^ tabStyle at:anIdentifier |
|
546 |
! |
|
547 |
||
548 |
styleAt:anIdentifier put:something |
|
369 | 549 |
"change a specific entry from the widget description. For more information |
550 |
see the specific widget class ( TabWidget ... ). |
|
343 | 551 |
" |
352 | 552 |
tabStyle at:anIdentifier put:something. |
343 | 553 |
! |
554 |
||
352 | 555 |
tabWidget |
369 | 556 |
"returns the current widget class as symbol |
352 | 557 |
" |
558 |
|widget| |
|
559 |
||
560 |
widget := tabStyle at:#widget. |
|
561 |
widget := widget nameWithoutPrefix asSymbol. |
|
562 |
^ widget |
|
563 |
! |
|
564 |
||
343 | 565 |
tabWidget:aWidget |
369 | 566 |
"change the current widget class. An existing list will be |
567 |
recomputed and redrawn |
|
343 | 568 |
" |
369 | 569 |
|widget labels| |
570 |
||
571 |
(self tabWidget) ~~ aWidget ifTrue:[ |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
572 |
widget := TabWidget widgetClass:aWidget. |
343 | 573 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
574 |
widget notNil ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
575 |
tabStyle := widget tabStyleOn:self. |
369 | 576 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
577 |
list notNil ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
578 |
labels := list collect:[:aTab| aTab label]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
579 |
list := widget labels:labels for:self. |
369 | 580 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
581 |
self shown ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
582 |
self recomputeList. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
583 |
self invalidate. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
584 |
] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
585 |
] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
586 |
] |
367 | 587 |
] |
913 | 588 |
|
589 |
"Modified: / 6.6.1998 / 19:56:26 / cg" |
|
343 | 590 |
! ! |
591 |
||
418 | 592 |
!TabView methodsFor:'accessing tabs'! |
593 |
||
594 |
tabAt:anIndex |
|
595 |
"get tab at an index or nil |
|
596 |
" |
|
697 | 597 |
^ anIndex notNil ifTrue:[list at:anIndex ifAbsent:nil] ifFalse:[nil] |
418 | 598 |
! ! |
599 |
||
343 | 600 |
!TabView methodsFor:'change & update'! |
601 |
||
602 |
update:something with:aParameter from:changedObject |
|
369 | 603 |
"one of my models changed its value |
343 | 604 |
" |
697 | 605 |
|idx tab| |
606 |
||
391 | 607 |
changedObject == model ifTrue:[^ self selection:model value]. |
608 |
changedObject == listHolder ifTrue:[^ self list:(listHolder value)]. |
|
697 | 609 |
|
610 |
( list isNil |
|
611 |
or:[(idx := list findFirst:[:aTab| aTab model == changedObject]) == 0] |
|
612 |
) ifTrue:[ |
|
1296 | 613 |
^ self |
697 | 614 |
]. |
615 |
||
616 |
self shown ifTrue:[ |
|
1296 | 617 |
tab := list at:idx. |
697 | 618 |
|
1296 | 619 |
something == #foregroundColor ifTrue:[ |
620 |
^ self redrawLabelOfTab:tab |
|
621 |
]. |
|
697 | 622 |
|
1296 | 623 |
something == #enabled ifTrue:[ |
624 |
idx == selection ifTrue:[ |
|
625 |
^ self selection:nil |
|
626 |
]. |
|
627 |
^ self redrawLabelOfTab:tab |
|
628 |
]. |
|
629 |
tab labelChanged. |
|
630 |
self recomputeList. |
|
631 |
self invalidate. |
|
632 |
self changed:#preferredExtent |
|
697 | 633 |
] |
913 | 634 |
|
635 |
"Modified: / 6.6.1998 / 19:56:16 / cg" |
|
1296 | 636 |
"Modified: / 30.3.1999 / 14:28:43 / stefan" |
343 | 637 |
! ! |
638 |
||
639 |
!TabView methodsFor:'drawing'! |
|
640 |
||
641 |
paintColor:aColorSymbol |
|
369 | 642 |
"set the paint color derived from the symbol used as key into the current |
643 |
style sheet to access the color |
|
343 | 644 |
" |
645 |
self paint:(tabStyle at:aColorSymbol) |
|
646 |
! |
|
647 |
||
550 | 648 |
redraw |
649 |
"redraw" |
|
650 |
||
651 |
self redrawX:0 y:0 width:width height:height. |
|
652 |
||
653 |
! |
|
654 |
||
697 | 655 |
redrawLabelOfTab:aTab |
656 |
"redraw only the label of the tab |
|
657 |
" |
|
658 |
shown ifTrue:[ |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
659 |
aTab == (self tabAt:selection) ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
660 |
self selectedTab:aTab redrawBlock:[aTab redrawLabel] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
661 |
] ifFalse:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
662 |
aTab redrawLabel |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
663 |
] |
697 | 664 |
]. |
665 |
! |
|
666 |
||
499 | 667 |
redrawLabels |
668 |
"redraw all the labels |
|
669 |
" |
|
670 |
|selectedTab| |
|
671 |
||
697 | 672 |
(shown and:[list size ~~ 0]) ifTrue:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
673 |
selectedTab := self tabAt:selection. |
499 | 674 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
675 |
list reverseDo:[:aTab| |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
676 |
aTab ~~ selectedTab ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
677 |
aTab redrawLabel |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
678 |
] ifFalse:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
679 |
self selectedTab:aTab redrawBlock:[aTab redrawLabel] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
680 |
] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
681 |
] |
499 | 682 |
]. |
683 |
! |
|
684 |
||
369 | 685 |
redrawRawAt:aRawNr |
686 |
"redraw raw at a number; all contained tabs are drawn unselected |
|
367 | 687 |
" |
372 | 688 |
list reverseDo:[:aTab|aTab lineNr == aRawNr ifTrue:[aTab redraw:false]]. |
367 | 689 |
! |
690 |
||
548 | 691 |
redrawRawAt:aRawNr in:aRectangle |
692 |
"redraw raw at a number; all contained tabs are drawn unselected |
|
693 |
" |
|
694 |
list reverseDo:[:aTab| |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
695 |
aTab lineNr == aRawNr ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
696 |
(aTab intersects:aRectangle) ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
697 |
aTab redraw:false |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
698 |
] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
699 |
] |
548 | 700 |
]. |
701 |
! |
|
702 |
||
367 | 703 |
redrawSelection |
704 |
"redraw current selection |
|
705 |
" |
|
499 | 706 |
|tab idx| |
343 | 707 |
|
499 | 708 |
(selection notNil and:[self shown and:[list size ~~ 0]]) ifTrue:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
709 |
tab := list at:selection. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
710 |
idx := tab lineNr. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
711 |
self selectedTab:tab redrawBlock:[tab redraw:true]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
712 |
[(idx := idx - 1) ~~ 0] whileTrue:[self redrawRawAt:idx]. |
499 | 713 |
]. |
714 |
! |
|
715 |
||
716 |
redrawX:x y:y width:w height:h |
|
717 |
"a region must be redrawn |
|
718 |
" |
|
548 | 719 |
|rectangle oldSelect prevClipArea| |
720 |
||
721 |
self shown ifFalse:[ |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
722 |
^ self |
548 | 723 |
]. |
499 | 724 |
|
548 | 725 |
self paint:(self viewBackground). |
726 |
self clearRectangleX:x y:y width:w height:h. |
|
727 |
||
728 |
list size == 0 ifTrue:[^ self]. |
|
729 |
||
730 |
prevClipArea := clipRect. |
|
731 |
clipRect := nil. |
|
732 |
device setClipX:x y:y width:w height:h in:drawableId gc:gcId. |
|
733 |
rectangle := Rectangle left:x top:y width:w height:h. |
|
734 |
||
735 |
maxRawNr to:1 by:-1 do:[:i| self redrawRawAt:i in:rectangle]. |
|
499 | 736 |
|
548 | 737 |
selection notNil ifTrue:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
738 |
oldSelect := selection. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
739 |
selection := nil. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
740 |
self setSelection:oldSelect. |
548 | 741 |
]. |
742 |
||
743 |
prevClipArea isNil ifTrue:[device noClipIn:drawableId gc:gcId] |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
744 |
ifFalse:[self clippingRectangle:prevClipArea]. |
499 | 745 |
|
867 | 746 |
"Modified: / 18.4.1998 / 16:19:58 / cg" |
499 | 747 |
! |
748 |
||
749 |
selectedTab:aTab redrawBlock:aRedrawBlock |
|
750 |
"calculate extent of selection and evaluate the block which will |
|
751 |
perform a redraw action |
|
752 |
" |
|
545 | 753 |
|tab oldAnc newAnc oldExt newExt expSel expDlt x y| |
343 | 754 |
|
367 | 755 |
tab := list at:selection. |
756 |
oldAnc := tab anchor. |
|
757 |
oldExt := tab extent. |
|
758 |
expSel := tabStyle at:#expandSelection. |
|
759 |
expDlt := expSel x. |
|
760 |
||
369 | 761 |
(self isHorizontalDirection) ifTrue:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
762 |
newExt := oldExt + ( expDlt @ 0 ). |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
763 |
newAnc := oldAnc - ((expDlt//2) @ ((expSel y) negated)). |
343 | 764 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
765 |
(x := newAnc x) < 0 ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
766 |
newExt x:(newExt x + x). |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
767 |
newAnc x:0. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
768 |
x := 0. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
769 |
]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
770 |
(x + newExt x) > (super extent x) ifTrue:[newExt x:((super extent x) - x)]. |
367 | 771 |
] ifFalse:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
772 |
newExt := oldExt + ( 0 @ expDlt ). |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
773 |
newAnc := oldAnc - (((expSel y) negated) @ (expDlt//2)). |
343 | 774 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
775 |
(y := newAnc y) < 0 ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
776 |
newExt y:(newExt y + y). |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
777 |
newAnc y:0. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
778 |
y := 0. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
779 |
]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
780 |
(y + newExt y) > (super extent y) ifTrue:[newExt y:((super extent y) - y)]. |
343 | 781 |
]. |
782 |
||
367 | 783 |
tab anchor:newAnc extent:newExt. |
499 | 784 |
aRedrawBlock value. |
367 | 785 |
tab anchor:oldAnc extent:oldExt. |
352 | 786 |
|
343 | 787 |
! ! |
788 |
||
789 |
!TabView methodsFor:'event handling'! |
|
790 |
||
791 |
buttonPress:button x:x y:y |
|
369 | 792 |
"a button is pressed; find tab under point and set the selection |
343 | 793 |
" |
499 | 794 |
|idx| |
795 |
||
796 |
( self isEnabled |
|
797 |
and:[list notNil |
|
798 |
and:[(idx := list findFirst:[:aTab|aTab containsPoint:(x@y)]) ~~ 0]] |
|
799 |
) ifTrue:[ |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
800 |
self selection:idx |
499 | 801 |
]. |
343 | 802 |
! |
803 |
||
346 | 804 |
keyPress:aKey x:x y:y |
805 |
"selection might change; look for corresponding list entry |
|
806 |
" |
|
670 | 807 |
|size index n| |
808 |
||
809 |
(self isEnabled and:[(size := list size) > 1]) ifFalse:[ |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
810 |
^ self |
670 | 811 |
]. |
346 | 812 |
|
670 | 813 |
(aKey == #CursorRight or:[aKey == #CursorDown]) ifTrue:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
814 |
n := selection ? 0. |
697 | 815 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
816 |
(size - 1) timesRepeat:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
817 |
(n := n + 1) > size ifTrue:[n := 1]. |
670 | 818 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
819 |
(self canSelectTabAtIndex:n) ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
820 |
^ self selection:n |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
821 |
] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
822 |
]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
823 |
^ self |
670 | 824 |
]. |
825 |
||
826 |
(aKey == #CursorLeft or:[aKey == #CursorUp]) ifTrue:[ |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
827 |
n := selection ? size. |
697 | 828 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
829 |
(size - 1) timesRepeat:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
830 |
(n := n - 1) < 1 ifTrue:[n := size]. |
670 | 831 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
832 |
(self canSelectTabAtIndex:n) ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
833 |
^ self selection:n |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
834 |
] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
835 |
]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
836 |
^ self |
670 | 837 |
]. |
838 |
||
839 |
aKey isCharacter ifTrue:[ |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
840 |
(selection isNil or:[selection == size]) ifTrue:[index := 1] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
841 |
ifFalse:[index := selection + 1]. |
670 | 842 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
843 |
n := index - 1. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
844 |
[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
845 |
n := self findTabStartingWithKey:aKey startingAt:n + 1. |
670 | 846 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
847 |
(n ~~ 0 and:[self canSelectTabAtIndex:n]) ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
848 |
^ self selection:n |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
849 |
]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
850 |
n ~~ 0 |
418 | 851 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
852 |
] whileTrue. |
670 | 853 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
854 |
index ~~ 1 ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
855 |
(n := self findTabStartingWithKey:aKey startingAt:1) ~~ 0 ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
856 |
^ self selection:n |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
857 |
] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
858 |
] |
346 | 859 |
]. |
860 |
||
670 | 861 |
super keyPress:aKey x:x y:y |
867 | 862 |
! |
863 |
||
864 |
sizeChanged:how |
|
865 |
"size of view changed |
|
866 |
" |
|
867 |
|extent delta dX dY| |
|
868 |
||
873 | 869 |
super sizeChanged:how. |
870 |
||
867 | 871 |
list size ~~ 0 ifTrue:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
872 |
shown ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
873 |
self invalidate |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
874 |
]. |
873 | 875 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
876 |
extent := super extent. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
877 |
delta := oldExtent - extent. |
867 | 878 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
879 |
((dX := delta x) > 1 or:[dX < -1 |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
880 |
or:[(dY := delta y) > 1 or:[dY < -1]]]) ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
881 |
oldExtent := extent. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
882 |
self recomputeList. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
883 |
self changed:#preferredExtent. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
884 |
]. |
867 | 885 |
]. |
886 |
||
873 | 887 |
"Modified: / 22.4.1998 / 14:20:31 / cg" |
343 | 888 |
! ! |
889 |
||
890 |
!TabView methodsFor:'initialization'! |
|
891 |
||
387 | 892 |
destroy |
893 |
listHolder notNil ifTrue:[ |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
894 |
listHolder removeDependent:self. |
387 | 895 |
]. |
896 |
enableChannel notNil ifTrue:[ |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
897 |
enableChannel removeDependent:self. |
387 | 898 |
]. |
697 | 899 |
self removeListDependencies. |
387 | 900 |
super destroy. |
901 |
! |
|
902 |
||
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
903 |
initStyle |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
904 |
"setup style attributes |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
905 |
" |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
906 |
|
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
907 |
super initStyle. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
908 |
self font:(MenuView defaultFont on:device). |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
909 |
|
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
910 |
"Created: / 5.9.1998 / 17:36:37 / cg" |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
911 |
"Modified: / 5.9.1998 / 17:37:38 / cg" |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
912 |
! |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
913 |
|
343 | 914 |
initialize |
915 |
"setup default attributes |
|
916 |
" |
|
917 |
|widget| |
|
918 |
||
919 |
super initialize. |
|
369 | 920 |
|
576 | 921 |
self cursor:Cursor hand. |
922 |
||
369 | 923 |
widget := TabWidget widgetClass:(self class defaultTabWidget). |
924 |
tabStyle := widget tabStyleOn:self. |
|
925 |
useIndex := false. |
|
508 | 926 |
oneTabPerLine := false. |
369 | 927 |
direction := #top. |
928 |
fitLastRow := true. |
|
929 |
moveSelectedRow := true. |
|
391 | 930 |
enabled := true. |
418 | 931 |
oldExtent := 0@0. |
576 | 932 |
|
933 |
"Modified: 23.10.1997 / 03:28:02 / cg" |
|
343 | 934 |
! ! |
935 |
||
936 |
!TabView methodsFor:'layout'! |
|
937 |
||
369 | 938 |
changeRaw:aRawA with:aRawB |
939 |
"exchange positions of two raws |
|
940 |
" |
|
941 |
|tabB tabA ancA ancB hrz| |
|
942 |
||
372 | 943 |
tabA := list at:(list findFirst:[:aTab|aTab lineNr == aRawA]). |
944 |
tabB := list at:(list findFirst:[:aTab|aTab lineNr == aRawB]). |
|
369 | 945 |
hrz := (self isHorizontalDirection). |
946 |
||
947 |
hrz ifTrue:[ |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
948 |
ancA := tabA anchor y. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
949 |
ancB := tabB anchor y. |
369 | 950 |
] ifFalse:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
951 |
ancA := tabA anchor x. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
952 |
ancB := tabB anchor x. |
369 | 953 |
]. |
954 |
||
955 |
list do:[:aTab||ln| |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
956 |
(ln := aTab lineNr) == aRawB ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
957 |
aTab lineNr:aRawA. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
958 |
hrz ifTrue:[aTab anchor y:ancA] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
959 |
ifFalse:[aTab anchor x:ancA] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
960 |
] ifFalse:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
961 |
ln == aRawA ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
962 |
aTab lineNr:aRawB. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
963 |
hrz ifTrue:[aTab anchor y:ancB] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
964 |
ifFalse:[aTab anchor x:ancB] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
965 |
] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
966 |
] |
369 | 967 |
]. |
968 |
||
508 | 969 |
oneTabPerLine ifFalse:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
970 |
aRawB == maxRawNr ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
971 |
self fitRawAt:aRawA. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
972 |
self unfitLastRaw. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
973 |
] ifFalse:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
974 |
aRawA == maxRawNr ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
975 |
self fitRawAt:aRawB. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
976 |
self unfitLastRaw. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
977 |
] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
978 |
] |
369 | 979 |
] |
980 |
! |
|
981 |
||
982 |
fitRawAt:aRawNr |
|
983 |
"fit raw to view's size |
|
984 |
" |
|
985 |
|last first tab ext org max size| |
|
986 |
||
508 | 987 |
(aRawNr ~~ maxRawNr or:[fitLastRow]) ifFalse:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
988 |
^ self |
508 | 989 |
]. |
369 | 990 |
|
991 |
last := list findLast:[:aTab| aTab lineNr == aRawNr ]. |
|
992 |
first := list findFirst:[:aTab| aTab lineNr == aRawNr ]. |
|
372 | 993 |
tab := list at:last. |
369 | 994 |
size := last - first + 1. |
995 |
org := 0. |
|
996 |
||
997 |
(self isHorizontalDirection) ifTrue:[ |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
998 |
max := super extent x. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
999 |
ext := (max - ((tab anchor x) + (tab extent x))) // size. |
369 | 1000 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1001 |
ext > 1 ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1002 |
first to:last do:[:i| |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1003 |
tab := list at:i. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1004 |
tab extent x:((tab extent x) + ext). |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1005 |
tab anchor x:((tab anchor x) + org). |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1006 |
org := org + ext. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1007 |
]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1008 |
tab := list at:last. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1009 |
]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1010 |
tab extent x:(max - tab anchor x). |
369 | 1011 |
] ifFalse:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1012 |
max := super extent y. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1013 |
ext := (max - ((tab anchor y) + (tab extent y))) // size. |
369 | 1014 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1015 |
ext > 1 ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1016 |
first to:last do:[:i| |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1017 |
tab := list at:i. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1018 |
tab extent y:((tab extent y) + ext). |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1019 |
tab anchor y:((tab anchor y) + org). |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1020 |
org := org + ext. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1021 |
]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1022 |
tab := list at:last. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1023 |
]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1024 |
tab extent y:(max - tab anchor y). |
369 | 1025 |
] |
1026 |
! |
|
1027 |
||
343 | 1028 |
recomputeList |
369 | 1029 |
"recompute list |
343 | 1030 |
" |
545 | 1031 |
|maxY x y maxSz ovl| |
343 | 1032 |
|
508 | 1033 |
list size == 0 ifTrue:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1034 |
^ self |
508 | 1035 |
]. |
369 | 1036 |
|
508 | 1037 |
maxY := tabStyle at:#maxY. |
1038 |
ovl := tabStyle at:#rightCovered. |
|
1039 |
maxRawNr := 1. |
|
369 | 1040 |
|
508 | 1041 |
(self isHorizontalDirection) ifTrue:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1042 |
maxSz := super extent x. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1043 |
x := 0. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1044 |
y := maxY. |
508 | 1045 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1046 |
oneTabPerLine ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1047 |
list do:[:aTab| |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1048 |
aTab lineNr:maxRawNr. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1049 |
aTab anchor:x@y extent:(maxSz @ maxY). |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1050 |
maxRawNr := maxRawNr + 1. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1051 |
y := y + maxY. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1052 |
]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1053 |
^ self |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1054 |
]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1055 |
list do:[:aTab||eX n| |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1056 |
eX := aTab preferredExtentX. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1057 |
n := eX + x - ovl. |
369 | 1058 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1059 |
(n > maxSz and:[x ~~ 0]) ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1060 |
maxRawNr := maxRawNr + 1. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1061 |
x := 0. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1062 |
y := y + maxY. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1063 |
n := eX - ovl. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1064 |
]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1065 |
aTab lineNr:maxRawNr. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1066 |
aTab anchor:x@y extent:(eX @ maxY). |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1067 |
x := n. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1068 |
] |
508 | 1069 |
] ifFalse:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1070 |
maxSz := super extent y. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1071 |
x := maxY. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1072 |
y := 0. |
369 | 1073 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1074 |
oneTabPerLine ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1075 |
list do:[:aTab| |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1076 |
aTab lineNr:maxRawNr. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1077 |
aTab anchor:x@y extent:(maxY @ maxSz). |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1078 |
maxRawNr := maxRawNr + 1. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1079 |
x := x + maxY. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1080 |
]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1081 |
^ self |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1082 |
]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1083 |
list do:[:aTab||eY n| |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1084 |
eY := aTab preferredExtentX. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1085 |
n := eY + y - ovl. |
508 | 1086 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1087 |
(n > maxSz and:[y ~~ 0]) ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1088 |
maxRawNr := maxRawNr + 1. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1089 |
y := 0. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1090 |
x := x + maxY. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1091 |
n := eY - ovl. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1092 |
]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1093 |
aTab lineNr:maxRawNr. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1094 |
aTab anchor:x@y extent:(maxY @ eY). |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1095 |
y := n. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1096 |
] |
367 | 1097 |
]. |
508 | 1098 |
"/ fit raws to view |
1099 |
1 to:maxRawNr do:[:aLnNr|self fitRawAt:aLnNr]. |
|
367 | 1100 |
! |
1101 |
||
369 | 1102 |
unfitLastRaw |
1103 |
"use the preferred extent for all tabs in the last raw |
|
367 | 1104 |
" |
369 | 1105 |
|last first tab ovl anchor extent pos offset hrz| |
343 | 1106 |
|
508 | 1107 |
fitLastRow ifTrue:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1108 |
^ self |
508 | 1109 |
]. |
369 | 1110 |
last := list findLast:[:aTab| aTab lineNr == maxRawNr ]. |
1111 |
first := list findFirst:[:aTab| aTab lineNr == maxRawNr ]. |
|
367 | 1112 |
ovl := tabStyle at:#rightCovered. |
369 | 1113 |
pos := 0. |
1114 |
hrz := (self isHorizontalDirection). |
|
367 | 1115 |
|
372 | 1116 |
first to:last do:[:i| |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1117 |
tab := list at:i. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1118 |
anchor := tab anchor. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1119 |
extent := tab extent. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1120 |
offset := tab preferredExtentX. |
367 | 1121 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1122 |
hrz ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1123 |
extent x:offset. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1124 |
anchor x:pos |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1125 |
] ifFalse:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1126 |
extent y:offset. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1127 |
anchor y:pos. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1128 |
]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1129 |
tab anchor:anchor extent:extent. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1130 |
pos := pos + offset - ovl. |
349 | 1131 |
]. |
369 | 1132 |
! ! |
343 | 1133 |
|
373 | 1134 |
!TabView methodsFor:'private'! |
1135 |
||
418 | 1136 |
findTabStartingWithKey:aKey startingAt:anIndex |
697 | 1137 |
"get index of tab starting its printableLabel with a key or 0 |
418 | 1138 |
" |
697 | 1139 |
|upper lower| |
418 | 1140 |
|
1141 |
(aKey isCharacter and:[anIndex <= list size]) ifFalse:[ ^ 0 ]. |
|
1142 |
||
1143 |
upper := aKey asUppercase. |
|
1144 |
lower := aKey asLowercase. |
|
1145 |
||
697 | 1146 |
^ list findFirst:[:aTab||l c| |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1147 |
( (l := aTab printableLabel) isString |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1148 |
and:[((c := l first) == lower or:[c == upper])] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1149 |
) |
418 | 1150 |
] startingAt:anIndex |
1151 |
! |
|
1152 |
||
373 | 1153 |
listIndexOf:something |
1154 |
"convert something to an index into list or nil. |
|
1155 |
" |
|
1156 |
|index| |
|
1157 |
||
697 | 1158 |
something isNil ifTrue:[^ nil ]. |
1159 |
||
1160 |
something isNumber ifTrue:[ |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1161 |
index := something |
697 | 1162 |
] ifFalse:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1163 |
index := list findFirst:[:aTab|aTab label = something]. |
697 | 1164 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1165 |
index == 0 ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1166 |
index := list findFirst:[:aTab|aTab printableLabel = something]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1167 |
] |
373 | 1168 |
]. |
697 | 1169 |
^ index ~~ 0 ifTrue:[index] ifFalse:[nil] |
1170 |
! |
|
1171 |
||
1172 |
removeListDependencies |
|
1173 |
|model| |
|
1174 |
||
1175 |
list notNil ifTrue:[ |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1176 |
list do:[:aTab| |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1177 |
(model := aTab model) notNil ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1178 |
model removeDependent:self |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1179 |
] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1180 |
] |
697 | 1181 |
] |
373 | 1182 |
! ! |
1183 |
||
369 | 1184 |
!TabView methodsFor:'queries'! |
343 | 1185 |
|
697 | 1186 |
canSelectTabAtIndex:anIndex |
1187 |
"returns true if tab at an index is selectable |
|
1188 |
" |
|
1189 |
(list at:anIndex) isEnabled ifTrue:[ |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1190 |
^ selectConditionBlock isNil ifTrue:[true] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1191 |
ifFalse:[selectConditionBlock value:anIndex] |
697 | 1192 |
]. |
1193 |
^ false |
|
1194 |
! |
|
1195 |
||
703 | 1196 |
getBackgroundPaintForTab:aTab |
1197 |
"returns background color of the tab |
|
1198 |
" |
|
1199 |
|key| |
|
1200 |
||
1201 |
key := aTab == (self tabAt:selection) ifFalse:[#unselectedColor] |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1202 |
ifTrue:[#selectedColor]. |
703 | 1203 |
|
1204 |
^ tabStyle at:key |
|
1205 |
! |
|
1206 |
||
387 | 1207 |
isEnabled |
391 | 1208 |
"returns enabled state |
1209 |
" |
|
1210 |
^ enabled |
|
387 | 1211 |
! |
1212 |
||
369 | 1213 |
isHorizontalDirection |
1214 |
"returns true in case of direction is #top or #bottom |
|
1215 |
" |
|
1216 |
^ (direction == #top or:[direction == #bottom]) |
|
1217 |
||
367 | 1218 |
! |
343 | 1219 |
|
369 | 1220 |
isVerticalDirection |
1221 |
"returns true in case of direction is #left or #right |
|
367 | 1222 |
" |
369 | 1223 |
^ (direction == #left or:[direction == #right]) |
367 | 1224 |
|
343 | 1225 |
! ! |
1226 |
||
1227 |
!TabView methodsFor:'selection'! |
|
1228 |
||
703 | 1229 |
isTabSelected:aTab |
1230 |
"returns true if tab is selected |
|
1231 |
" |
|
1232 |
^ aTab == (self tabAt:selection) |
|
1233 |
! |
|
1234 |
||
343 | 1235 |
selection |
1236 |
"return the selection index or nil |
|
1237 |
" |
|
697 | 1238 |
|tab| |
1239 |
||
352 | 1240 |
useIndex ifTrue:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1241 |
^ selection ? 0 |
352 | 1242 |
]. |
697 | 1243 |
tab := self tabAt:selection. |
1244 |
^ tab notNil ifTrue:[tab label] ifFalse:[nil] |
|
343 | 1245 |
! |
1246 |
||
1247 |
selection:anIndexOrNil |
|
1248 |
"change the selection to index or nil. The model and/or actionBlock is notified |
|
1249 |
" |
|
499 | 1250 |
|oldSel| |
1251 |
||
1252 |
oldSel := selection. |
|
1253 |
self setSelection:anIndexOrNil. |
|
1254 |
oldSel ~~ selection ifTrue:[self selectionHasChanged]. |
|
1255 |
! |
|
1256 |
||
1257 |
selectionHasChanged |
|
1258 |
"selection might change; raise notification |
|
1259 |
" |
|
352 | 1260 |
|sel| |
343 | 1261 |
|
499 | 1262 |
sel := self selection. |
343 | 1263 |
|
499 | 1264 |
model notNil ifTrue:[model value:sel]. |
1265 |
action notNil ifTrue:[action value:sel] |
|
343 | 1266 |
|
1267 |
! |
|
1268 |
||
373 | 1269 |
setSelection:something |
343 | 1270 |
"change the selection to index or nil. No notifications are raised |
1271 |
" |
|
373 | 1272 |
|newSel lnNr tab last first exp x y w h| |
343 | 1273 |
|
418 | 1274 |
list size == 0 ifTrue:[^ self]. |
373 | 1275 |
newSel := self listIndexOf:something. |
1276 |
selection == newSel ifTrue:[^ self]. |
|
670 | 1277 |
|
591 | 1278 |
newSel notNil ifTrue:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1279 |
(self tabAt:newSel) isNil ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1280 |
newSel := nil |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1281 |
] ifFalse:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1282 |
(self canSelectTabAtIndex:newSel) ifFalse:[^ self ]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1283 |
] |
591 | 1284 |
]. |
372 | 1285 |
|
352 | 1286 |
self shown ifFalse:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1287 |
selection := newSel. |
352 | 1288 |
^ self |
1289 |
]. |
|
1290 |
||
445 | 1291 |
maxRawNr isNil ifTrue:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1292 |
selection := newSel. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1293 |
self recomputeList. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1294 |
self invalidate. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1295 |
^ self. |
445 | 1296 |
]. |
1297 |
||
591 | 1298 |
(newSel notNil |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1299 |
and:[moveSelectedRow |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1300 |
and:[(lnNr := (list at:newSel) lineNr) > 1]] |
591 | 1301 |
) ifTrue:[ |
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1302 |
self changeRaw:1 with:lnNr. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1303 |
selection := 1. "/ force a redraw |
352 | 1304 |
]. |
1305 |
||
1306 |
selection notNil ifTrue:[ |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1307 |
maxRawNr > 1 ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1308 |
self paint:(self viewBackground). "/ total redraw |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1309 |
self clear. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1310 |
selection := nil. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1311 |
maxRawNr to:1 by:-1 do:[:i| self redrawRawAt:i ]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1312 |
] ifFalse:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1313 |
first := 1. |
373 | 1314 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1315 |
(selection ~~ 1 and:[(tabStyle at:#rightCovered) == 0]) ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1316 |
first := selection - 1 |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1317 |
]. |
373 | 1318 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1319 |
(last := selection + 1) > list size ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1320 |
last := selection |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1321 |
]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1322 |
exp := (tabStyle at:#expandSelection) x. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1323 |
tab := list at:selection. |
373 | 1324 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1325 |
self isHorizontalDirection ifTrue:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1326 |
(x := tab anchor x - (exp // 2)) < 0 ifTrue:[x := 0]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1327 |
w := tab extent x + exp. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1328 |
h := super extent y. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1329 |
y := 0. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1330 |
] ifFalse:[ |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1331 |
(y := tab anchor y - (exp // 2)) < 0 ifTrue:[y := 0]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1332 |
h := tab extent y + exp. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1333 |
w := super extent x. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1334 |
x := 0. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1335 |
]. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1336 |
self paint:(self viewBackground). |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1337 |
self clearRectangleX:x y:y width:w height:h. |
373 | 1338 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1339 |
last to:first by:-1 do:[:i| |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1340 |
tab := list at:i. |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1341 |
tab redraw:false |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1342 |
] |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
1343 |
] |
352 | 1344 |
]. |
373 | 1345 |
selection := newSel. |
367 | 1346 |
self redrawSelection. |
591 | 1347 |
|
913 | 1348 |
"Modified: / 6.6.1998 / 19:56:45 / cg" |
343 | 1349 |
! ! |
1350 |
||
1351 |
!TabView class methodsFor:'documentation'! |
|
1352 |
||
1353 |
version |
|
1296 | 1354 |
^ '$Header: /cvs/stx/stx/libwidg2/TabView.st,v 1.38 1999-03-31 05:53:11 stefan Exp $' |
343 | 1355 |
! ! |