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