author | Claus Gittinger <cg@exept.de> |
Wed, 26 Jun 2019 23:31:24 +0200 | |
changeset 6076 | e32451ae0577 |
parent 5620 | 86c569016e90 |
permissions | -rw-r--r-- |
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 |
" |
|
4988 | 12 |
"{ Package: 'stx:libwidg2' }" |
343 | 13 |
|
4988 | 14 |
"{ NameSpace: Smalltalk }" |
1818 | 15 |
|
343 | 16 |
Object subclass:#TabWidget |
697 | 17 |
instanceVariableNames:'model tabView label disabledLabel printableLabel anchor extent |
18 |
lineNr fgColor labelType' |
|
343 | 19 |
classVariableNames:'' |
20 |
poolDictionaries:'' |
|
21 |
category:'Views-Interactors' |
|
22 |
! |
|
23 |
||
1818 | 24 |
TabWidget subclass:#Mac |
343 | 25 |
instanceVariableNames:'' |
26 |
classVariableNames:'' |
|
27 |
poolDictionaries:'' |
|
28 |
privateIn:TabWidget |
|
29 |
! |
|
30 |
||
1818 | 31 |
TabWidget subclass:#Window |
343 | 32 |
instanceVariableNames:'' |
33 |
classVariableNames:'' |
|
34 |
poolDictionaries:'' |
|
35 |
privateIn:TabWidget |
|
36 |
! |
|
37 |
||
38 |
!TabWidget class methodsFor:'documentation'! |
|
39 |
||
40 |
copyright |
|
41 |
" |
|
42 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
43 |
All Rights Reserved |
|
44 |
||
45 |
This software is furnished under a license and may be used |
|
46 |
only in accordance with the terms of that license and with the |
|
47 |
inclusion of the above copyright notice. This software may not |
|
48 |
be provided or otherwise made available to, or used by, any |
|
49 |
other person. No title to or ownership of the software is |
|
50 |
hereby transferred. |
|
51 |
" |
|
52 |
||
53 |
||
54 |
! |
|
55 |
||
56 |
documentation |
|
57 |
" |
|
58 |
instances represent (& draw) the tabs of a tabWidget. |
|
59 |
||
60 |
[author:] |
|
61 |
Claus Atzkern |
|
62 |
||
63 |
[see also:] |
|
64 |
TabView |
|
65 |
" |
|
66 |
! ! |
|
67 |
||
68 |
!TabWidget class methodsFor:'instance creation'! |
|
69 |
||
367 | 70 |
labels:aList for:aTabView |
71 |
"create tabs based on labels for a tabview |
|
343 | 72 |
" |
367 | 73 |
|list maxX maxY lftIns topIns level style| |
74 |
||
75 |
maxX := 0. |
|
76 |
maxY := 0. |
|
77 |
style := aTabView style. |
|
78 |
lftIns := style at:#labelLeftInset. |
|
1350 | 79 |
topIns := style at:#labelTopInset. |
367 | 80 |
level := style at:#tabLevel. |
81 |
||
409 | 82 |
aTabView device isNil ifTrue:[ |
2567 | 83 |
self error:'Tabview has no device' |
409 | 84 |
]. |
697 | 85 |
|
86 |
list := aList collect:[:anEntry||y x tab lbl| |
|
87 |
tab := self new label:anEntry for:aTabView. |
|
88 |
lbl := tab printableLabel. |
|
89 |
||
90 |
(y := lbl heightOn:aTabView) > maxY ifTrue:[maxY := y]. |
|
91 |
(x := lbl widthOn:aTabView) > maxX ifTrue:[maxX := x]. |
|
92 |
||
93 |
tab |
|
367 | 94 |
]. |
95 |
||
96 |
style at:#labelMaxX put:maxX. |
|
97 |
style at:#labelMaxY put:maxY. |
|
98 |
||
99 |
maxY := maxY + topIns |
|
100 |
+ (style at:#labelBottomInset) |
|
101 |
+ (2 * level). |
|
102 |
||
103 |
maxX := maxX + lftIns + (style at:#labelRightInset). |
|
104 |
||
105 |
style at:#maxX put:maxX. |
|
106 |
style at:#maxY put:maxY. |
|
107 |
style at:#labelAnchor put:( lftIns @ (topIns +level) ). |
|
108 |
||
109 |
self validateDimensions:style. |
|
369 | 110 |
maxY := style at:#maxY. |
111 |
maxX := style at:#maxX. |
|
112 |
||
113 |
"/ caused by vertical layout for images |
|
114 |
maxX < maxY ifTrue:[style at:#maxX put:maxY]. |
|
367 | 115 |
^ list |
1350 | 116 |
|
117 |
"Modified: / 4.5.1999 / 02:15:33 / cg" |
|
367 | 118 |
! |
119 |
||
120 |
validateDimensions:aStyle |
|
5620 | 121 |
"validate dimensions for a style; could be redefined |
367 | 122 |
" |
5620 | 123 |
|
124 |
"Modified (comment): / 09-10-2017 / 14:33:43 / mawalch" |
|
343 | 125 |
! ! |
126 |
||
127 |
!TabWidget class methodsFor:'accessing'! |
|
128 |
||
419 | 129 |
computeColorsOn:aView style:aStyle |
130 |
"set colors dependent on selection color |
|
131 |
" |
|
4988 | 132 |
|viewsDevice unselectedColor selectedColor avgSelectedColor avgUnSelectedColor| |
1476 | 133 |
|
4988 | 134 |
viewsDevice := aView device. |
419 | 135 |
|
136 |
selectedColor := aView viewBackground. |
|
137 |
unselectedColor := selectedColor lightened. |
|
1335 | 138 |
avgSelectedColor := selectedColor averageColorIn:(0@0 corner:7@7). |
139 |
avgUnSelectedColor := unselectedColor averageColorIn:(0@0 corner:7@7). |
|
419 | 140 |
|
4988 | 141 |
aStyle at:#shadowColorSelected put:(avgSelectedColor darkened onDevice:viewsDevice). |
142 |
aStyle at:#lightColorSelected put:(avgSelectedColor lightened onDevice:viewsDevice). |
|
143 |
aStyle at:#shadowColorUnselected put:(avgUnSelectedColor darkened onDevice:viewsDevice). |
|
144 |
aStyle at:#lightColorUnselected put:(avgUnSelectedColor lightened onDevice:viewsDevice). |
|
419 | 145 |
|
146 |
aStyle at:#unselectedColor put:unselectedColor. |
|
147 |
aStyle at:#selectedColor put:selectedColor. |
|
148 |
aStyle at:#labelColor put:Color black. |
|
1350 | 149 |
|
150 |
"Modified: / 4.5.1999 / 02:16:32 / cg" |
|
419 | 151 |
! |
152 |
||
153 |
computeColorsOn:aView style:aStyle selectionColor:aSelectedColor |
|
154 |
"set colors dependent on selection color |
|
155 |
" |
|
4988 | 156 |
|viewsDevice unselectedColor selectedColor avgSelectedColor avgUnSelectedColor| |
1335 | 157 |
|
158 |
"/ CG: this seems to be no longer needed ... |
|
419 | 159 |
|
4988 | 160 |
viewsDevice := aView device. |
1476 | 161 |
|
419 | 162 |
unselectedColor := aView viewBackground. |
163 |
selectedColor := unselectedColor lightened. |
|
164 |
||
1335 | 165 |
avgSelectedColor := selectedColor averageColorIn:(0@0 corner:7@7). |
166 |
avgUnSelectedColor := unselectedColor averageColorIn:(0@0 corner:7@7). |
|
419 | 167 |
|
4988 | 168 |
aStyle at:#shadowColorSelected put:(avgSelectedColor darkened onDevice:viewsDevice). |
169 |
aStyle at:#lightColorSelected put:(avgSelectedColor lightened onDevice:viewsDevice). |
|
170 |
aStyle at:#shadowColorUnselected put:(avgUnSelectedColor darkened onDevice:viewsDevice). |
|
171 |
aStyle at:#lightColorUnselected put:(avgUnSelectedColor lightened onDevice:viewsDevice). |
|
419 | 172 |
|
173 |
aStyle at:#unselectedColor put:unselectedColor. |
|
174 |
aStyle at:#selectedColor put:selectedColor. |
|
175 |
aStyle at:#labelColor put:Color black. |
|
176 |
! |
|
177 |
||
343 | 178 |
tabStyleOn:aView |
179 |
"returns default tab style |
|
180 |
" |
|
419 | 181 |
|style| |
343 | 182 |
|
419 | 183 |
style := IdentityDictionary new. |
343 | 184 |
|
185 |
style at:#widget put:self. |
|
419 | 186 |
self computeColorsOn:aView style:style. |
343 | 187 |
|
367 | 188 |
style at:#expandSelection put:0@0. "/ expand selection extent x y when raised |
189 |
style at:#tabLevel put:0. "/ level |
|
1350 | 190 |
style at:#labelTopInset put:4. "/ additional top label inset |
351 | 191 |
style at:#labelBottomInset put:4. "/ additional bottom inset |
367 | 192 |
style at:#labelLeftInset put:4. "/ label left inset |
193 |
style at:#labelRightInset put:4. "/ label right inset |
|
194 |
style at:#rightCovered put:0. "/ covers right tab for n pixels |
|
343 | 195 |
|
196 |
^ style |
|
1350 | 197 |
|
198 |
"Modified: / 4.5.1999 / 02:15:50 / cg" |
|
343 | 199 |
! |
200 |
||
201 |
widgetClass:aWidget |
|
367 | 202 |
|wdgt name| |
343 | 203 |
|
367 | 204 |
name := aWidget asString. |
205 |
wdgt := Smalltalk classNamed:( self name asString, '::', name ). |
|
343 | 206 |
|
367 | 207 |
wdgt notNil ifTrue:[ |
208 |
^ wdgt |
|
343 | 209 |
]. |
367 | 210 |
^ Smalltalk classNamed:name |
343 | 211 |
! ! |
212 |
||
367 | 213 |
!TabWidget methodsFor:'accessing'! |
214 |
||
215 |
label |
|
216 |
^ label |
|
217 |
! |
|
218 |
||
219 |
lineNr |
|
220 |
"returns line number |
|
221 |
" |
|
222 |
^ lineNr |
|
223 |
! |
|
224 |
||
225 |
lineNr:aLineNr |
|
226 |
"change line number |
|
227 |
" |
|
228 |
lineNr := aLineNr |
|
697 | 229 |
! |
230 |
||
231 |
printableLabel |
|
232 |
||
233 |
|lbl dev| |
|
234 |
||
235 |
printableLabel notNil ifTrue:[ |
|
236 |
^ printableLabel |
|
237 |
]. |
|
238 |
||
239 |
model isNil ifTrue:[ |
|
240 |
lbl := label |
|
241 |
] ifFalse:[ |
|
242 |
lbl := model rawLabel |
|
243 |
]. |
|
244 |
||
245 |
dev := tabView device. |
|
246 |
||
247 |
lbl isImage ifTrue:[ |
|
248 |
labelType := #image. |
|
249 |
printableLabel := lbl onDevice:dev. |
|
250 |
disabledLabel := printableLabel lightened onDevice:dev. |
|
251 |
] ifFalse:[ |
|
252 |
labelType := #string. |
|
253 |
||
254 |
printableLabel := lbl ? ''. |
|
255 |
disabledLabel := printableLabel copy. |
|
256 |
||
5438 | 257 |
lbl isLabelAndIcon ifTrue:[ |
697 | 258 |
lbl := printableLabel icon onDevice:dev. |
259 |
printableLabel icon:lbl. |
|
260 |
disabledLabel icon:(lbl lightened onDevice:dev). |
|
261 |
] |
|
262 |
]. |
|
263 |
^ printableLabel |
|
5438 | 264 |
|
265 |
"Modified: / 04-02-2017 / 22:12:08 / cg" |
|
367 | 266 |
! ! |
267 |
||
1818 | 268 |
!TabWidget methodsFor:'accessing-dimensions'! |
343 | 269 |
|
367 | 270 |
anchor |
271 |
"returns the tab origin |
|
272 |
" |
|
273 |
^ anchor |
|
274 |
||
275 |
! |
|
276 |
||
277 |
anchor:anAnchor |
|
278 |
"change the tab anchor; no redraw |
|
279 |
" |
|
280 |
anchor := anAnchor |
|
281 |
||
282 |
! |
|
283 |
||
284 |
anchor:anAnchor extent:anExtent |
|
285 |
"change anchor and extent; no redraw |
|
286 |
" |
|
287 |
anchor := anAnchor. |
|
288 |
extent := anExtent. |
|
343 | 289 |
|
290 |
||
291 |
! |
|
292 |
||
293 |
extent |
|
294 |
"return the tab extent |
|
295 |
" |
|
296 |
^ extent |
|
297 |
! |
|
298 |
||
299 |
extent:anExtent |
|
300 |
"change the tab extent; no redraw |
|
301 |
" |
|
302 |
extent := anExtent |
|
303 |
! |
|
304 |
||
367 | 305 |
preferredExtentX |
306 |
"returns my preferred extent x |
|
343 | 307 |
" |
367 | 308 |
^ (tabView styleAt:#maxX) |
309 |
- (tabView styleAt:#labelMaxX) |
|
697 | 310 |
+ (self printableLabel widthOn:tabView). |
350 | 311 |
! |
312 |
||
367 | 313 |
preferredExtentY |
314 |
"returns my preferred extent y |
|
343 | 315 |
" |
367 | 316 |
^ (tabView styleAt:#maxY) |
317 |
- (tabView styleAt:#labelMaxY) |
|
697 | 318 |
+ (self printableLabel heightOn:tabView). |
367 | 319 |
! ! |
343 | 320 |
|
367 | 321 |
!TabWidget methodsFor:'basic drawing'! |
343 | 322 |
|
367 | 323 |
redrawAtBottom:isSelected |
324 |
"redraw tab at bottom of view |
|
343 | 325 |
" |
367 | 326 |
^ self subclassResponsibility |
343 | 327 |
! |
328 |
||
367 | 329 |
redrawAtLeft:isSelected |
330 |
"redraw tab at left of view |
|
343 | 331 |
" |
367 | 332 |
^ self subclassResponsibility |
343 | 333 |
! |
334 |
||
367 | 335 |
redrawAtRight:isSelected |
336 |
"redraw tab at right of view |
|
343 | 337 |
" |
367 | 338 |
^ self subclassResponsibility |
339 |
! |
|
343 | 340 |
|
367 | 341 |
redrawAtTop:isSelected |
342 |
"redraw tab at top of view |
|
343 |
" |
|
344 |
^ self subclassResponsibility |
|
343 | 345 |
! ! |
346 |
||
697 | 347 |
!TabWidget methodsFor:'change & update'! |
348 |
||
349 |
labelChanged |
|
350 |
printableLabel := nil |
|
351 |
! ! |
|
352 |
||
343 | 353 |
!TabWidget methodsFor:'drawing'! |
354 |
||
369 | 355 |
redraw:isSelected |
5412 | 356 |
"redraw the receiver tab" |
357 |
||
697 | 358 |
|direction| |
369 | 359 |
|
360 |
direction := tabView direction. |
|
361 |
||
697 | 362 |
direction == #top ifTrue:[ |
363 |
self redrawAtTop:isSelected |
|
369 | 364 |
] ifFalse:[ |
697 | 365 |
direction == #bottom ifTrue:[ |
366 |
self redrawAtBottom:isSelected |
|
369 | 367 |
] ifFalse:[ |
697 | 368 |
direction == #right ifTrue:[ self redrawAtRight:isSelected ] |
369 |
ifFalse:[ self redrawAtLeft:isSelected ] |
|
370 |
] |
|
369 | 371 |
]. |
697 | 372 |
self redrawLabel |
392 | 373 |
! |
374 |
||
419 | 375 |
redrawLabel |
376 |
"redraw label only |
|
377 |
" |
|
703 | 378 |
|fg direction origin originX originY anchor anchorX anchorY x y label| |
419 | 379 |
|
697 | 380 |
label := self printableLabel. |
419 | 381 |
direction := tabView direction. |
382 |
anchor := tabView styleAt:#labelAnchor. |
|
703 | 383 |
anchorX := anchor x. |
384 |
anchorY := anchor y. |
|
419 | 385 |
origin := self computeOrigin. |
703 | 386 |
originX := origin x. |
387 |
originY := origin y. |
|
419 | 388 |
|
697 | 389 |
"/ set label color |
390 |
||
391 |
self printableLabel. |
|
392 |
||
393 |
self isEnabled ifTrue:[ |
|
394 |
label := printableLabel. |
|
395 |
(model notNil and:[(fg := model foregroundColor) notNil]) ifTrue:[ |
|
396 |
fgColor = fg ifFalse:[ |
|
1476 | 397 |
fgColor := fg onDevice:(tabView device) |
697 | 398 |
]. |
399 |
tabView paint:fgColor |
|
400 |
] ifFalse:[ |
|
401 |
tabView paintColor:#labelColor |
|
402 |
] |
|
403 |
] ifFalse:[ |
|
404 |
label := disabledLabel. |
|
405 |
tabView paintColor:#shadowColorUnselected. |
|
406 |
]. |
|
419 | 407 |
|
408 |
(direction == #top or:[direction == #bottom]) ifTrue:[ |
|
703 | 409 |
y := originY. |
410 |
x := originX + anchorX. |
|
419 | 411 |
|
412 |
direction == #top ifTrue:[ |
|
703 | 413 |
y := y + anchorY. |
419 | 414 |
] ifFalse:[ |
703 | 415 |
y := y - anchorY - (label heightOn:tabView). |
419 | 416 |
]. |
697 | 417 |
labelType == #string ifTrue:[ |
418 |
y := y + tabView fontAscent |
|
419 |
]. |
|
419 | 420 |
] ifFalse:[ |
421 |
direction == #right ifTrue:[ |
|
703 | 422 |
x := originX - anchorY - (label heightOn:tabView). |
419 | 423 |
] ifFalse:[ |
703 | 424 |
x := originX + anchorY. |
419 | 425 |
]. |
703 | 426 |
y := originY + anchorX. |
419 | 427 |
|
697 | 428 |
labelType == #string ifTrue:[ |
429 |
x := x + tabView fontDescent. |
|
703 | 430 |
"/ workaround for a bug in display-with-angle, |
431 |
"/ iff displayed string is a labelAndIcon. |
|
432 |
"/ (In this case, display is always opaque, and the current |
|
433 |
"/ backgroundPaint color is used to fill the underlying rectangle) |
|
434 |
"/ |
|
435 |
tabView backgroundPaint:(tabView getBackgroundPaintForTab:self). |
|
419 | 436 |
tabView displayString:label x:x y:y angle:90. |
437 |
^ self. |
|
438 |
]. |
|
439 |
]. |
|
440 |
label displayOn:tabView x:x y:y. |
|
369 | 441 |
! ! |
442 |
||
443 |
!TabWidget methodsFor:'initialization'! |
|
444 |
||
445 |
label:aLabel for:aTabView |
|
446 |
"initialize attributes |
|
447 |
" |
|
448 |
tabView := aTabView. |
|
449 |
label := aLabel. |
|
697 | 450 |
model := (label isKindOf:TabItem) ifTrue:[label] ifFalse:[nil] |
451 |
||
369 | 452 |
! ! |
453 |
||
454 |
!TabWidget methodsFor:'private'! |
|
455 |
||
367 | 456 |
computeCorner |
2567 | 457 |
"compute corner" |
458 |
||
367 | 459 |
|d c| |
460 |
||
461 |
c := anchor + extent. |
|
462 |
d := tabView direction. |
|
463 |
||
464 |
d == #top ifTrue:[^ ( c x @ (tabView extent y) )]. |
|
465 |
d == #left ifTrue:[^ ( (tabView extent x) @ c y ) ]. |
|
466 |
d == #right ifTrue:[^ ( 0 @ c y )]. |
|
467 |
d == #bottom ifTrue:[^ ( c x @ 0 )]. |
|
468 |
||
2567 | 469 |
self error:'unknown direction'. |
367 | 470 |
! |
471 |
||
472 |
computeOrigin |
|
2567 | 473 |
"compute origin" |
474 |
||
367 | 475 |
|d| |
476 |
||
477 |
d := tabView direction. |
|
478 |
||
479 |
d == #top ifTrue:[ ^ anchor x @ ((tabView extent y) - anchor y) ]. |
|
480 |
d == #left ifTrue:[ ^ ((tabView extent x) - anchor x) @ anchor y ]. |
|
481 |
d == #right ifTrue:[ ^ anchor ]. |
|
482 |
d == #bottom ifTrue:[ ^ anchor ]. |
|
483 |
||
2567 | 484 |
self error:'unknown direction'. |
343 | 485 |
! ! |
486 |
||
487 |
!TabWidget methodsFor:'queries'! |
|
488 |
||
489 |
containsPoint:aPoint |
|
367 | 490 |
"return true, if a point is contained in the tab |
343 | 491 |
" |
1220 | 492 |
|d origin |
493 |
originX "{ Class: SmallInteger }" |
|
494 |
originY "{ Class: SmallInteger }" |
|
495 |
w "{ Class: SmallInteger }" |
|
496 |
h "{ Class: SmallInteger }" |
|
497 |
x "{ Class: SmallInteger }" |
|
498 |
y "{ Class: SmallInteger }"| |
|
343 | 499 |
|
367 | 500 |
d := tabView direction. |
343 | 501 |
x := aPoint x. |
367 | 502 |
y := aPoint y. |
343 | 503 |
|
367 | 504 |
origin := self computeOrigin. |
1220 | 505 |
originX := origin x. |
506 |
originY := origin y. |
|
507 |
w := extent x. |
|
508 |
h := extent y. |
|
367 | 509 |
|
510 |
(d == #top or:[d == #bottom]) ifTrue:[ |
|
1220 | 511 |
((x >= originX) and:[x <= (originX + w)]) ifTrue:[ |
367 | 512 |
d == #top ifTrue:[ |
1220 | 513 |
^ ((y >= originY) and:[y <= (originY + h)]) |
367 | 514 |
]. |
1220 | 515 |
^ ((y <= originY) and:[y >= (originY - h)]) |
367 | 516 |
] |
517 |
] ifFalse:[ |
|
1220 | 518 |
((y >= originY) and:[y <= (originY + h)]) ifTrue:[ |
367 | 519 |
d == #right ifTrue:[ |
1220 | 520 |
^ ((x <= originX) and:[x >= (originX - w)]) |
367 | 521 |
]. |
1220 | 522 |
^ ((x >= originX) and:[x <= (originX + w)]) |
367 | 523 |
] |
343 | 524 |
]. |
367 | 525 |
^ false |
549 | 526 |
! |
527 |
||
528 |
intersects:aRectangle |
|
529 |
"return true, if the intersection between the tab widget and |
|
530 |
the argument, aRectangle is not empty |
|
531 |
" |
|
551 | 532 |
|origin corner direction irect| |
549 | 533 |
|
534 |
origin := self computeOrigin. |
|
535 |
corner := self computeCorner. |
|
536 |
||
537 |
direction := tabView direction. |
|
538 |
||
539 |
direction == #top ifTrue:[ |
|
551 | 540 |
irect := (Rectangle origin:origin corner:corner) |
541 |
] ifFalse:[ |
|
542 |
direction == #bottom ifTrue:[ |
|
543 |
irect := (Rectangle origin:(origin x @ corner y) corner:(corner x @ origin y)) |
|
544 |
] ifFalse:[ |
|
545 |
direction == #right ifTrue:[ |
|
546 |
irect := (Rectangle origin:(corner x @ origin y) corner:(origin x @ corner y)) |
|
547 |
] ifFalse:[ |
|
548 |
irect := (Rectangle origin:origin corner:corner) |
|
549 |
] |
|
550 |
] |
|
549 | 551 |
]. |
552 |
||
551 | 553 |
^ aRectangle intersects:irect |
697 | 554 |
! |
555 |
||
556 |
isEnabled |
|
557 |
||
558 |
^ (tabView isEnabled and:[(model isNil or:[model isEnabled])]) |
|
559 |
||
560 |
! |
|
561 |
||
562 |
model |
|
563 |
^ model |
|
564 |
||
549 | 565 |
! ! |
566 |
||
1818 | 567 |
!TabWidget::Mac class methodsFor:'accessing'! |
568 |
||
569 |
tabStyleOn:aView |
|
570 |
|style| |
|
571 |
||
572 |
style := super tabStyleOn:aView. |
|
573 |
style at:#tabLevel put:2. |
|
574 |
^ style. |
|
575 |
! ! |
|
576 |
||
577 |
!TabWidget::Mac class methodsFor:'calculate dimensions'! |
|
578 |
||
579 |
validateDimensions:aStyle |
|
5620 | 580 |
"validate dimensions for a style; could be redefined |
1818 | 581 |
" |
582 |
|maxY maxX anchor lftIns| |
|
583 |
||
584 |
maxY := aStyle at:#maxY. |
|
585 |
maxX := (aStyle at:#maxX) - (aStyle at:#labelLeftInset). |
|
586 |
anchor := aStyle at:#labelAnchor. |
|
587 |
lftIns := maxY // 2. |
|
588 |
||
589 |
anchor x:lftIns. |
|
590 |
||
591 |
aStyle at:#maxX put:(maxX + lftIns + maxY). |
|
592 |
aStyle at:#rightCovered put:(maxY // 2). |
|
5620 | 593 |
|
594 |
"Modified (comment): / 09-10-2017 / 14:33:53 / mawalch" |
|
1818 | 595 |
! ! |
596 |
||
597 |
!TabWidget::Mac methodsFor:'drawing'! |
|
598 |
||
599 |
redrawAtBottom:isSelected |
|
600 |
"redraw tab at bottom of view |
|
601 |
" |
|
602 |
|origin corner level polygon x y x1 eX eY shadowColor lightColor| |
|
603 |
||
604 |
isSelected ifFalse:[ |
|
605 |
lightColor := tabView styleAt:#lightColorUnselected. |
|
606 |
shadowColor := tabView styleAt:#shadowColorUnselected. |
|
607 |
tabView paint:(tabView styleAt:#unselectedColor). |
|
608 |
] ifTrue:[ |
|
609 |
lightColor := tabView styleAt:#lightColorSelected. |
|
610 |
shadowColor := tabView styleAt:#shadowColorSelected. |
|
611 |
tabView paint:(tabView styleAt:#selectedColor). |
|
612 |
]. |
|
613 |
polygon := Array new:5. |
|
614 |
origin := self computeOrigin. |
|
615 |
corner := self computeCorner. |
|
616 |
level := tabView styleAt:#tabLevel. |
|
617 |
||
618 |
x := origin x. |
|
619 |
y := origin y. |
|
620 |
eX := corner x. |
|
621 |
eY := corner y. |
|
622 |
x1 := eX - (tabView styleAt:#maxY). |
|
623 |
||
624 |
polygon at:1 put:(Point x:x y:eY). |
|
625 |
polygon at:2 put:(Point x:x y:y). |
|
626 |
polygon at:3 put:(Point x:x1 y:y). |
|
627 |
polygon at:4 put:(Point x:eX y:(y-extent y)). |
|
628 |
polygon at:5 put:(Point x:eX y:eY). |
|
629 |
||
630 |
tabView fillPolygon:polygon. |
|
631 |
tabView paint:lightColor. |
|
632 |
||
633 |
1 to:level do:[:i| |
|
634 |
"/ removed: cg |
|
635 |
"/ tabView displayLineFromX:x+1 y:y-i toX:x1+i y:y-i. |
|
636 |
tabView displayLineFromX:x+i y:y-1 toX:x+i y:1. |
|
637 |
]. |
|
638 |
tabView paint:shadowColor. |
|
639 |
||
640 |
"/ added: cg |
|
641 |
1 to:(level-2) do:[:i| |
|
642 |
tabView displayLineFromX:x+1 y:y-i toX:x1+i y:y-i. |
|
643 |
]. |
|
644 |
tabView displayPolygon:polygon. |
|
645 |
||
646 |
isSelected ifFalse:[ |
|
647 |
tabView displayLineFromX:x y:eY toX:eX y:eY. |
|
648 |
] |
|
649 |
||
650 |
"Modified: / 21.5.1998 / 01:16:32 / cg" |
|
651 |
! |
|
652 |
||
653 |
redrawAtLeft:isSelected |
|
654 |
"redraw tab at left of view |
|
655 |
" |
|
656 |
|origin corner polygon level x y y1 eX eY shadowColor lightColor| |
|
657 |
||
658 |
isSelected ifFalse:[ |
|
659 |
lightColor := tabView styleAt:#lightColorUnselected. |
|
660 |
shadowColor := tabView styleAt:#shadowColorUnselected. |
|
661 |
tabView paint:(tabView styleAt:#unselectedColor). |
|
662 |
] ifTrue:[ |
|
663 |
lightColor := tabView styleAt:#lightColorSelected. |
|
664 |
shadowColor := tabView styleAt:#shadowColorSelected. |
|
665 |
tabView paint:(tabView styleAt:#selectedColor). |
|
666 |
]. |
|
667 |
polygon := Array new:5. |
|
668 |
origin := self computeOrigin. |
|
669 |
corner := self computeCorner. |
|
670 |
level := tabView styleAt:#tabLevel. |
|
671 |
||
672 |
x := origin x. |
|
673 |
y := origin y. |
|
674 |
eX := corner x. |
|
675 |
eY := corner y. |
|
676 |
y1 := eY - (tabView styleAt:#maxY). |
|
677 |
||
678 |
polygon at:1 put:(Point x:eX y:y). |
|
679 |
polygon at:2 put:(Point x:x y:y). |
|
680 |
polygon at:3 put:(Point x:x y:y1). |
|
681 |
polygon at:4 put:(Point x:(x+extent x) y:eY). |
|
682 |
polygon at:5 put:(Point x:eX y:eY). |
|
683 |
||
684 |
tabView fillPolygon:polygon. |
|
685 |
tabView paint:lightColor. |
|
686 |
||
687 |
1 to:level do:[:i| |
|
688 |
tabView displayLineFromX:eX y:y+i toX:x+2 y:y+i. |
|
689 |
tabView displayLineFromX:x+i y:y+1 toX:x+i y:y1+i. |
|
690 |
]. |
|
691 |
tabView paint:shadowColor. |
|
692 |
tabView displayPolygon:polygon. |
|
693 |
||
694 |
isSelected ifFalse:[ |
|
695 |
tabView displayLineFromX:eX-1 y:y toX:eX-1 y:eY. |
|
696 |
] |
|
697 |
! |
|
698 |
||
699 |
redrawAtRight:isSelected |
|
700 |
"redraw tab at right of view |
|
701 |
" |
|
702 |
|origin corner level polygon x y y1 eY shadowColor lightColor| |
|
703 |
||
704 |
isSelected ifFalse:[ |
|
705 |
lightColor := tabView styleAt:#lightColorUnselected. |
|
706 |
shadowColor := tabView styleAt:#shadowColorUnselected. |
|
707 |
tabView paint:(tabView styleAt:#unselectedColor). |
|
708 |
] ifTrue:[ |
|
709 |
lightColor := tabView styleAt:#lightColorSelected. |
|
710 |
shadowColor := tabView styleAt:#shadowColorSelected. |
|
711 |
tabView paint:(tabView styleAt:#selectedColor). |
|
712 |
]. |
|
713 |
polygon := Array new:5. |
|
714 |
origin := self computeOrigin. |
|
715 |
corner := self computeCorner. |
|
716 |
level := tabView styleAt:#tabLevel. |
|
717 |
||
718 |
x := origin x. |
|
719 |
y := origin y. |
|
720 |
eY := corner y. |
|
721 |
y1 := eY - (tabView styleAt:#maxY). |
|
722 |
||
723 |
polygon at:1 put:(Point x:0 y:y). |
|
724 |
polygon at:2 put:(Point x:x y:y). |
|
725 |
polygon at:3 put:(Point x:x y:y1). |
|
726 |
polygon at:4 put:(Point x:(x-extent x) y:eY). |
|
727 |
polygon at:5 put:(Point x:0 y:eY). |
|
728 |
||
729 |
tabView fillPolygon:polygon. |
|
730 |
tabView paint:lightColor. |
|
731 |
||
732 |
1 to:level do:[:i| |
|
733 |
tabView displayLineFromX:0 y:y+i toX:x-1 y:y+i. |
|
734 |
"/ removed: cg |
|
735 |
"/ tabView displayLineFromX:x-i y:y+1 toX:x-i y:y1+i. |
|
736 |
]. |
|
737 |
tabView paint:shadowColor. |
|
738 |
tabView displayPolygon:polygon. |
|
739 |
||
740 |
"/ added: cg |
|
741 |
1 to:level-2 do:[:i| |
|
742 |
tabView displayLineFromX:x-i y:y+1 toX:x-i y:y1+i. |
|
743 |
]. |
|
744 |
||
745 |
isSelected ifFalse:[ |
|
746 |
tabView displayLineFromX:0 y:y toX:0 y:eY. |
|
747 |
] |
|
748 |
||
749 |
"Modified: / 21.5.1998 / 01:16:24 / cg" |
|
750 |
! |
|
751 |
||
752 |
redrawAtTop:isSelected |
|
753 |
"redraw tab at top of view |
|
754 |
" |
|
755 |
|origin corner level polygon x y x1 eX eY shadowColor lightColor| |
|
756 |
||
757 |
isSelected ifFalse:[ |
|
758 |
lightColor := tabView styleAt:#lightColorUnselected. |
|
759 |
shadowColor := tabView styleAt:#shadowColorUnselected. |
|
760 |
tabView paint:(tabView styleAt:#unselectedColor). |
|
761 |
] ifTrue:[ |
|
762 |
lightColor := tabView styleAt:#lightColorSelected. |
|
763 |
shadowColor := tabView styleAt:#shadowColorSelected. |
|
764 |
tabView paint:(tabView styleAt:#selectedColor). |
|
765 |
]. |
|
766 |
polygon := Array new:5. |
|
767 |
origin := self computeOrigin. |
|
768 |
corner := self computeCorner. |
|
769 |
level := tabView styleAt:#tabLevel. |
|
770 |
||
771 |
x := origin x. |
|
772 |
y := origin y. |
|
773 |
eX := corner x - 1. |
|
774 |
eY := corner y. |
|
775 |
x1 := eX - (tabView styleAt:#maxY). |
|
776 |
||
777 |
polygon at:1 put:(Point x:x y:eY). |
|
778 |
polygon at:2 put:(Point x:x y:y). |
|
779 |
polygon at:3 put:(Point x:x1 y:y). |
|
780 |
polygon at:4 put:(Point x:eX y:(y+extent y)). |
|
781 |
polygon at:5 put:(Point x:eX y:eY). |
|
782 |
||
783 |
tabView fillPolygon:polygon. |
|
784 |
tabView paint:lightColor. |
|
785 |
||
786 |
1 to:level do:[:i| |
|
787 |
tabView displayLineFromX:x+i y:eY toX:x+i y:y+1. |
|
788 |
tabView displayLineFromX:x+1 y:y+i toX:x1+i y:y+i. |
|
789 |
]. |
|
790 |
tabView paint:shadowColor. |
|
791 |
tabView displayPolygon:polygon. |
|
792 |
||
793 |
isSelected ifFalse:[ |
|
794 |
tabView displayLineFromX:x y:eY-1 toX:eX y:eY-1. |
|
795 |
] |
|
796 |
||
797 |
||
798 |
! ! |
|
799 |
||
367 | 800 |
!TabWidget::Window class methodsFor:'accessing'! |
350 | 801 |
|
802 |
tabStyleOn:aView |
|
474 | 803 |
|style| |
350 | 804 |
|
805 |
style := super tabStyleOn:aView. |
|
806 |
||
367 | 807 |
style at:#expandSelection put:4@4. |
808 |
style at:#tabLevel put:2. |
|
1381 | 809 |
style at:#labelTopInset put:0. |
810 |
style at:#labelBottomInset put:0. |
|
367 | 811 |
style at:#roundedEdges put:true. |
812 |
^ style |
|
350 | 813 |
|
1381 | 814 |
"Modified: / 20.5.1999 / 19:18:04 / cg" |
350 | 815 |
! ! |
816 |
||
367 | 817 |
!TabWidget::Window class methodsFor:'calculate dimensions'! |
818 |
||
819 |
validateDimensions:aStyle |
|
5620 | 820 |
"validate dimensions for a style; could be redefined |
367 | 821 |
" |
822 |
|maxY anchor| |
|
350 | 823 |
|
367 | 824 |
(aStyle at:#roundedEdges) ifTrue:[ |
825 |
maxY := aStyle at:#maxY. |
|
826 |
aStyle at:#maxY put:(maxY + 3). |
|
827 |
anchor := aStyle at:#labelAnchor. |
|
828 |
anchor y:(anchor y + 1). |
|
829 |
aStyle at:#labelAnchor put:anchor. |
|
830 |
] |
|
831 |
||
5620 | 832 |
"Modified (comment): / 09-10-2017 / 14:33:59 / mawalch" |
350 | 833 |
! ! |
834 |
||
367 | 835 |
!TabWidget::Window methodsFor:'drawing'! |
836 |
||
837 |
redrawAtBottom:isSelected |
|
838 |
"redraw tab at bottom of view |
|
839 |
" |
|
474 | 840 |
|origin corner y x xR yB tabLevel roundedEdges shadowColor lightColor| |
367 | 841 |
|
842 |
origin := self computeOrigin. |
|
843 |
corner := self computeCorner. |
|
844 |
x := origin x. |
|
845 |
y := origin y. |
|
846 |
xR := corner x - 1. |
|
847 |
yB := 0. |
|
848 |
||
849 |
roundedEdges := tabView styleAt:#roundedEdges. |
|
850 |
tabLevel := (tabView styleAt:#tabLevel) - 1. |
|
851 |
||
852 |
isSelected ifFalse:[ |
|
853 |
tabView paint:(tabView styleAt:#unselectedColor). |
|
854 |
shadowColor := tabView styleAt:#shadowColorUnselected. |
|
855 |
lightColor := tabView styleAt:#lightColorUnselected. |
|
856 |
] ifTrue:[ |
|
857 |
tabView paint:(tabView styleAt:#selectedColor). |
|
858 |
shadowColor := tabView styleAt:#shadowColorSelected. |
|
859 |
lightColor := tabView styleAt:#lightColorSelected. |
|
860 |
]. |
|
861 |
||
862 |
roundedEdges ifTrue:[y := y - 2]. |
|
863 |
tabView fillRectangle:(Rectangle left:x top:yB extent:(extent x @ y)). |
|
350 | 864 |
|
367 | 865 |
roundedEdges ifTrue:[ |
866 |
tabView displayLineFromX:x-1 y:y toX:xR y:y. |
|
867 |
y := y - 1. |
|
868 |
||
869 |
tabView paint:lightColor. |
|
870 |
tabView displayPointX:x y:y+1. |
|
871 |
tabView displayPointX:x+1 y:y+1. |
|
894
d5a703c21f7a
fixed shadow/light colors in tab-drawing
Claus Gittinger <cg@exept.de>
parents:
703
diff
changeset
|
872 |
|
d5a703c21f7a
fixed shadow/light colors in tab-drawing
Claus Gittinger <cg@exept.de>
parents:
703
diff
changeset
|
873 |
tabView paint:shadowColor. |
367 | 874 |
tabView displayLineFromX:x+1 y:y+2 toX:xR-1 y:y+2. |
875 |
tabView displayLineFromX:x+2 y:y+3 toX:xR-2 y:y+3. |
|
876 |
||
877 |
0 to:tabLevel do:[:i | |
|
878 |
tabView displayPointX:xR-i y:y. |
|
879 |
tabView displayPointX:xR-i y:y+1. |
|
880 |
tabView displayPointX:xR-1-i y:y+2. |
|
881 |
]. |
|
882 |
tabView displayPointX:xR-2 y:y+3. |
|
883 |
tabView displayPointX:xR-3 y:y+3. |
|
884 |
]. |
|
885 |
||
886 |
tabView paint:lightColor. |
|
887 |
||
888 |
0 to:tabLevel do:[:i | |
|
889 |
roundedEdges ifFalse:[ |
|
890 |
tabView displayLineFromX:x y:y-i toX:xR y:y-i "/ upper edge |
|
891 |
]. |
|
892 |
tabView displayLineFromX:x+i y:y+1 toX:x+i y:yB. "/ left edge |
|
893 |
]. |
|
894 |
y := y + 1. |
|
895 |
tabView paint:shadowColor. |
|
896 |
||
897 |
0 to:tabLevel do:[:i | |
|
898 |
tabView displayLineFromX:xR-i y:y-i toX:xR-i y:yB. "/ right edge |
|
899 |
]. |
|
350 | 900 |
|
894
d5a703c21f7a
fixed shadow/light colors in tab-drawing
Claus Gittinger <cg@exept.de>
parents:
703
diff
changeset
|
901 |
"Modified: / 21.5.1998 / 01:07:01 / cg" |
350 | 902 |
! |
903 |
||
367 | 904 |
redrawAtLeft:isSelected |
905 |
"redraw tab at left of view |
|
350 | 906 |
" |
474 | 907 |
|origin corner y x xR yB tabLevel roundedEdges shadowColor lightColor| |
367 | 908 |
|
909 |
origin := self computeOrigin. |
|
910 |
corner := self computeCorner. |
|
911 |
x := origin x. |
|
912 |
y := origin y. |
|
913 |
xR := corner x. |
|
914 |
yB := corner y. |
|
915 |
||
916 |
roundedEdges := tabView styleAt:#roundedEdges. |
|
917 |
tabLevel := (tabView styleAt:#tabLevel) - 1. |
|
918 |
||
919 |
isSelected ifFalse:[ |
|
920 |
tabView paint:(tabView styleAt:#unselectedColor). |
|
921 |
shadowColor := tabView styleAt:#shadowColorUnselected. |
|
922 |
lightColor := tabView styleAt:#lightColorUnselected. |
|
923 |
] ifTrue:[ |
|
924 |
tabView paint:(tabView styleAt:#selectedColor). |
|
925 |
shadowColor := tabView styleAt:#shadowColorSelected. |
|
926 |
lightColor := tabView styleAt:#lightColorSelected. |
|
927 |
]. |
|
928 |
tabView fillRectangle:(Rectangle left:x top:y extent:(xR @ extent y)). |
|
929 |
||
930 |
roundedEdges ifTrue:[ |
|
931 |
tabView displayLineFromX:x y:y toX:x y:yB. |
|
932 |
||
933 |
tabView paint:lightColor. |
|
934 |
tabView displayPointX:x y:y+1. |
|
935 |
tabView displayPointX:x y:y+2. |
|
936 |
tabView displayLineFromX:x-1 y:y+2 toX:x-1 y:yB-1. |
|
937 |
tabView displayLineFromX:x-2 y:y+3 toX:x-2 y:yB-1. |
|
938 |
||
939 |
tabView paint:shadowColor. |
|
350 | 940 |
|
367 | 941 |
0 to:tabLevel do:[:i | |
942 |
tabView displayPointX:x y:yB-i. |
|
943 |
tabView displayPointX:x-1 y:yB-i-1. |
|
944 |
tabView displayPointX:x-2 y:yB-i-2. |
|
945 |
]. |
|
946 |
]. |
|
947 |
tabView paint:lightColor. |
|
948 |
||
949 |
0 to:tabLevel do:[:i | |
|
950 |
roundedEdges ifFalse:[ |
|
951 |
tabView displayLineFromX:x+i y:y+i toX:x+i y:yB. "/ upper edge |
|
952 |
]. |
|
953 |
tabView displayLineFromX:x y:y+i toX:xR y:y+i. "/ left edge |
|
954 |
]. |
|
955 |
tabView paint:shadowColor. |
|
350 | 956 |
|
367 | 957 |
0 to:tabLevel do:[:i | |
958 |
tabView displayLineFromX:x+i y:yB-i toX:xR y:yB-i. |
|
959 |
]. |
|
960 |
||
961 |
! |
|
962 |
||
963 |
redrawAtRight:isSelected |
|
964 |
"redraw tab at right of view |
|
965 |
" |
|
474 | 966 |
|origin corner y x xR yB tabLevel roundedEdges shadowColor lightColor| |
367 | 967 |
|
968 |
origin := self computeOrigin. |
|
969 |
corner := self computeCorner. |
|
970 |
x := origin x. |
|
971 |
y := origin y. |
|
972 |
xR := corner x - 1. |
|
973 |
yB := corner y. |
|
974 |
||
975 |
roundedEdges := tabView styleAt:#roundedEdges. |
|
976 |
tabLevel := (tabView styleAt:#tabLevel) - 1. |
|
350 | 977 |
|
978 |
isSelected ifFalse:[ |
|
367 | 979 |
tabView paint:(tabView styleAt:#unselectedColor). |
350 | 980 |
shadowColor := tabView styleAt:#shadowColorUnselected. |
367 | 981 |
lightColor := tabView styleAt:#lightColorUnselected. |
350 | 982 |
] ifTrue:[ |
367 | 983 |
tabView paint:(tabView styleAt:#selectedColor). |
350 | 984 |
shadowColor := tabView styleAt:#shadowColorSelected. |
367 | 985 |
lightColor := tabView styleAt:#lightColorSelected. |
350 | 986 |
]. |
367 | 987 |
tabView fillRectangle:(Rectangle left:0 top:y extent:(x @ extent y)). |
988 |
||
989 |
roundedEdges ifTrue:[ |
|
990 |
tabView displayLineFromX:x y:y toX:x y:yB. |
|
350 | 991 |
|
367 | 992 |
tabView paint:lightColor. |
993 |
tabView displayPointX:x y:y+1. |
|
994 |
tabView displayPointX:x y:y+2. |
|
894
d5a703c21f7a
fixed shadow/light colors in tab-drawing
Claus Gittinger <cg@exept.de>
parents:
703
diff
changeset
|
995 |
|
d5a703c21f7a
fixed shadow/light colors in tab-drawing
Claus Gittinger <cg@exept.de>
parents:
703
diff
changeset
|
996 |
tabView paint:shadowColor. |
367 | 997 |
tabView displayLineFromX:x+1 y:y+2 toX:x+1 y:yB-1. |
998 |
tabView displayLineFromX:x+2 y:y+3 toX:x+2 y:yB-1. |
|
999 |
||
1000 |
0 to:tabLevel do:[:i | |
|
1001 |
tabView displayPointX:x y:yB-i. |
|
1002 |
tabView displayPointX:x+1 y:yB-i-1. |
|
1003 |
tabView displayPointX:x+2 y:yB-i-2. |
|
1004 |
]. |
|
1005 |
]. |
|
350 | 1006 |
tabView paint:lightColor. |
1007 |
||
367 | 1008 |
0 to:tabLevel do:[:i | |
1009 |
roundedEdges ifFalse:[ |
|
1010 |
tabView displayLineFromX:x-i y:y+i toX:x-i y:yB. "/ upper edge |
|
1011 |
]. |
|
1012 |
tabView displayLineFromX:x y:y+i+1 toX:0 y:y+i+1. "/ left edge |
|
1013 |
]. |
|
1014 |
tabView paint:shadowColor. |
|
1015 |
||
1016 |
0 to:tabLevel do:[:i | |
|
1017 |
tabView displayLineFromX:x-i+1 y:yB-i toX:1 y:yB-i. |
|
1018 |
]. |
|
894
d5a703c21f7a
fixed shadow/light colors in tab-drawing
Claus Gittinger <cg@exept.de>
parents:
703
diff
changeset
|
1019 |
|
d5a703c21f7a
fixed shadow/light colors in tab-drawing
Claus Gittinger <cg@exept.de>
parents:
703
diff
changeset
|
1020 |
"Modified: / 21.5.1998 / 01:04:41 / cg" |
367 | 1021 |
! |
1022 |
||
1023 |
redrawAtTop:isSelected |
|
1024 |
"redraw tab at top of view |
|
1025 |
" |
|
474 | 1026 |
|origin corner y x xR yB tabLevel roundedEdges shadowColor lightColor| |
367 | 1027 |
|
1028 |
origin := self computeOrigin. |
|
1029 |
corner := self computeCorner. |
|
1030 |
x := origin x. |
|
1031 |
y := origin y. |
|
1032 |
xR := corner x - 1. |
|
1033 |
yB := corner y. |
|
1034 |
||
1035 |
roundedEdges := tabView styleAt:#roundedEdges. |
|
1036 |
tabLevel := (tabView styleAt:#tabLevel) - 1. |
|
1037 |
||
1038 |
isSelected ifFalse:[ |
|
1039 |
tabView paint:(tabView styleAt:#unselectedColor). |
|
1040 |
shadowColor := tabView styleAt:#shadowColorUnselected. |
|
1041 |
lightColor := tabView styleAt:#lightColorUnselected. |
|
1042 |
] ifTrue:[ |
|
1043 |
tabView paint:(tabView styleAt:#selectedColor). |
|
1044 |
shadowColor := tabView styleAt:#shadowColorSelected. |
|
1045 |
lightColor := tabView styleAt:#lightColorSelected. |
|
350 | 1046 |
]. |
1047 |
||
367 | 1048 |
roundedEdges ifTrue:[ y := y + 2]. |
1049 |
tabView fillRectangle:(Rectangle left:x top:y extent:((extent x) @ yB)). |
|
1050 |
||
1051 |
roundedEdges ifTrue:[ |
|
1052 |
y := y + 1. |
|
1053 |
tabView displayLineFromX:x y:y-1 toX:xR y:y-1. |
|
1054 |
tabView displayLineFromX:x+1 y:y-2 toX:xR-1 y:y-2. |
|
1055 |
tabView displayLineFromX:x+2 y:y-3 toX:xR-2 y:y-3. |
|
1056 |
||
1057 |
tabView paint:lightColor. |
|
1058 |
||
1059 |
0 to:tabLevel do:[:i | |
|
1060 |
tabView displayPointX:x+i y:y-1. |
|
1061 |
tabView displayPointX:x+1+i y:y-1-1. |
|
1062 |
tabView displayLineFromX:x+2+i y:y-3-i toX:xR-1-i y:y-3-i. "/ top |
|
1063 |
]. |
|
1064 |
||
1065 |
tabView paint:shadowColor. |
|
1066 |
0 to:tabLevel do:[:i | |
|
1067 |
tabView displayPointX:xR-i y:y. |
|
1068 |
tabView displayPointX:xR-i y:y-1. |
|
1069 |
tabView displayPointX:xR-1-i y:y-1-1. |
|
1070 |
]. |
|
1071 |
tabView displayPointX:xR-2 y:y-1-1-1. |
|
1072 |
tabView displayPointX:xR-3 y:y-1-1-1. |
|
350 | 1073 |
]. |
1074 |
||
367 | 1075 |
tabView paint:lightColor. |
1076 |
0 to:tabLevel do:[:i | |
|
1077 |
roundedEdges ifFalse:[ |
|
1078 |
tabView displayLineFromX:x y:y+i toX:xR y:y+i. "/ upper edge |
|
1079 |
]. |
|
1080 |
tabView displayLineFromX:x+i y:y toX:x+i y:yB. "/ left edge |
|
1081 |
]. |
|
1082 |
tabView paint:shadowColor. |
|
1083 |
0 to:tabLevel do:[:i | |
|
1084 |
tabView displayLineFromX:xR-i y:y+i toX:xR-i y:yB. "/ right edge |
|
1085 |
]. |
|
350 | 1086 |
! ! |
1087 |
||
343 | 1088 |
!TabWidget class methodsFor:'documentation'! |
1089 |
||
1090 |
version |
|
4988 | 1091 |
^ '$Header$' |
343 | 1092 |
! ! |
4988 | 1093 |