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