TabWidget.st
author ca
Tue, 22 Apr 1997 18:56:29 +0200
changeset 367 cff1a140978f
parent 351 6c46f186d84f
child 369 8f003e44d5ef
permissions -rw-r--r--
tabs at top, bottom, left and right

"
 COPYRIGHT (c) 1997 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"



Object subclass:#TabWidget
	instanceVariableNames:'tabView label anchor extent lineNr'
	classVariableNames:''
	poolDictionaries:''
	category:'Views-Interactors'
!

TabWidget subclass:#Mac
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	privateIn:TabWidget
!

TabWidget subclass:#Window
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	privateIn:TabWidget
!

!TabWidget class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1997 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"


!

documentation
"
    instances represent (& draw) the tabs of a tabWidget.

    [author:]
        Claus Atzkern

    [see also:]
        TabView
"
! !

!TabWidget class methodsFor:'instance creation'!

labels:aList for:aTabView
    "create tabs based on labels for a tabview
    "
    |list maxX maxY lftIns topIns level style|

    maxX   := 0.
    maxY   := 0.
    style  := aTabView style.
    lftIns := style at:#labelLeftInset.
    topIns := style at:#lableTopInset.
    level  := style at:#tabLevel.

    list := aList collect:[:aLabel||y x|
        (y := aLabel heightOn:aTabView) > maxY ifTrue:[maxY := y].
        (x := aLabel  widthOn:aTabView) > maxX ifTrue:[maxX := x].
        self new label:aLabel for:aTabView
    ].

    style at:#labelMaxX put:maxX.
    style at:#labelMaxY put:maxY.

    maxY  := maxY + topIns
                  + (style at:#labelBottomInset)
                  + (2 * level).

    maxX := maxX + lftIns + (style at:#labelRightInset).

    style at:#maxX put:maxX.
    style at:#maxY put:maxY.
    style at:#labelAnchor put:( lftIns @ (topIns +level) ).

    self validateDimensions:style.
  ^ list
!

validateDimensions:aStyle
    "validate dimensions for a style; could be redifined
    "
! !

!TabWidget class methodsFor:'accessing'!

tabStyleOn:aView
    "returns default tab style
    "
    |style selectedColor unselectedColor|

    style    := IdentityDictionary new.
    selectedColor   := Color gray:90.
    unselectedColor := Color gray:75.

    style at:#widget put:self.

    style at:#shadowColorSelected
         put:((selectedColor averageColorIn:(0@0 corner:7@7)) darkened  on:aView device).

    style at:#lightColorSelected
         put:((selectedColor averageColorIn:(0@0 corner:7@7)) lightened on:aView device).

    style at:#shadowColorUnselected
         put:((unselectedColor averageColorIn:(0@0 corner:7@7)) darkened  on:aView device).

    style at:#lightColorUnselected
         put:((unselectedColor averageColorIn:(0@0 corner:7@7)) lightened on:aView device).

    style at:#unselectedColor    put:unselectedColor.
    style at:#selectedColor      put:selectedColor.
    style at:#labelColor         put:(Color black).
    style at:#selectionAtBottom  put:true.  "/ true: selected tab always moved to bottom

    style at:#expandSelection    put:0@0.    "/ expand selection extent x y when raised
    style at:#tabLevel           put:0.      "/ level
    style at:#lableTopInset      put:4.      "/ additional top label inset
    style at:#labelBottomInset   put:4.      "/ additional bottom inset
    style at:#labelLeftInset     put:4.      "/ label left  inset
    style at:#labelRightInset    put:4.      "/ label right inset
    style at:#rightCovered       put:0.      "/ covers right tab for n pixels

  ^ style
!

widgetClass:aWidget
    |wdgt name|

    name := aWidget asString.
    wdgt := Smalltalk classNamed:( self name asString, '::', name ).

    wdgt notNil ifTrue:[
        ^ wdgt
    ].
    ^ Smalltalk classNamed:name
! !

!TabWidget methodsFor:'accessing'!

label
    ^ label
!

lineNr
    "returns line number
    "
    ^ lineNr
!

lineNr:aLineNr
    "change line number
    "
    lineNr := aLineNr
! !

!TabWidget methodsFor:'accessing dimensions'!

anchor
    "returns the tab origin
    "
    ^ anchor

!

anchor:anAnchor
    "change the tab anchor; no redraw
    "
    anchor := anAnchor

!

anchor:anAnchor extent:anExtent
    "change anchor and extent; no redraw
    "
    anchor := anAnchor.
    extent := anExtent.


!

extent
    "return the tab extent
    "
    ^ extent
!

extent:anExtent
    "change the tab extent; no redraw
    "
    extent := anExtent
!

preferredExtentX
    "returns my preferred extent x
    "
    ^    (tabView styleAt:#maxX)
       - (tabView styleAt:#labelMaxX)
       + (label  widthOn:tabView).
!

preferredExtentY
    "returns my preferred extent y
    "
    ^    (tabView styleAt:#maxY)
       - (tabView styleAt:#labelMaxY)
       + (label  heightOn:tabView).
! !

!TabWidget methodsFor:'basic drawing'!

redrawAtBottom:isSelected
    "redraw tab at bottom of view
    "
    ^ self subclassResponsibility
!

redrawAtLeft:isSelected
    "redraw tab at left of view
    "
    ^ self subclassResponsibility
!

redrawAtRight:isSelected
    "redraw tab at right of view
    "
    ^ self subclassResponsibility
!

redrawAtTop:isSelected
    "redraw tab at top of view
    "
    ^ self subclassResponsibility
! !

!TabWidget methodsFor:'drawing'!

computeCorner
    "compute corner
    "
    |d c|

    c := anchor + extent.
    d := tabView direction.

    d == #top    ifTrue:[^ ( c x @ (tabView extent y) )].
    d == #left   ifTrue:[^ ( (tabView extent x) @ c y ) ].
    d == #right  ifTrue:[^ ( 0 @ c y )].
    d == #bottom ifTrue:[^ ( c x @ 0 )].

    self error.
!

computeOrigin
    "compute origin
    "
    |d|

    d := tabView direction.

    d == #top    ifTrue:[ ^ anchor x @ ((tabView extent y) - anchor y) ].
    d == #left   ifTrue:[ ^ ((tabView extent x) - anchor x) @ anchor y ].
    d == #right  ifTrue:[ ^ anchor ].
    d == #bottom ifTrue:[ ^ anchor ].

    self error
!

redraw:isSelected
    "full redraw
    "
    |x y p a d|

    d := tabView direction.

    (d == #top or:[d == #bottom]) ifTrue:[
        p := self computeOrigin.
        a := tabView styleAt:#labelAnchor.
        x := p x + a x.
        
        d == #top ifTrue:[
            self redrawAtTop:isSelected.
            y := p y + a y.
        ] ifFalse:[
            self redrawAtBottom:isSelected.
            y := p y - (tabView styleAt:#labelBottomInset)
                     - (tabView styleAt:#tabLevel)
                     - (label heightOn:tabView).
        ].
        tabView paintColor:#labelColor.
        label isString ifTrue:[y := y + tabView font ascent].
        label displayOn:tabView x:x y:y.
      ^ self
    ].

    d == #right ifTrue:[
        ^ self redrawAtRight:isSelected
    ].
    d == #left ifTrue:[
        ^ self redrawAtLeft:isSelected
    ].
! !

!TabWidget methodsFor:'initialization'!

label:aLabel for:aTabView
    "initialize attributes
    "
    tabView := aTabView.
    label   := aLabel.
! !

!TabWidget methodsFor:'queries'!

containsPoint:aPoint
    "return true, if a point is contained in the tab
    "
    |d x y top bot origin|

    d := tabView direction.
    x := aPoint x.
    y := aPoint y.

    origin := self computeOrigin.

    (d == #top or:[d == #bottom]) ifTrue:[
        ((x >= origin x) and:[x <= (origin x + extent x)]) ifTrue:[
            d == #top ifTrue:[
                ^ ((y >=  origin y) and:[y <= (origin y + extent y)])
            ].
            ^ ((y <=  origin y) and:[y >= (origin y - extent y)])
        ]
    ] ifFalse:[
        ((y >= origin y) and:[y <= (origin y + extent y)]) ifTrue:[
            d == #right ifTrue:[
                ^ ((x <= origin x) and:[x >= (origin x - extent x)])
            ].
            ^ ((x >= origin x) and:[x <= (origin x + extent x)])
        ]
    ].
    ^ false
! !

!TabWidget::Mac class methodsFor:'calculate dimensions'!

validateDimensions:aStyle
    "validate dimensions for a style; could be redifined
    "
    |maxY maxX anchor lftIns|

    maxY   := aStyle at:#maxY.
    maxX   := (aStyle at:#maxX) - (aStyle at:#labelLeftInset).
    anchor := aStyle at:#labelAnchor.
    lftIns := maxY // 2.

    anchor x:lftIns.

    aStyle at:#maxX         put:(maxX + lftIns + maxY).
    aStyle at:#rightCovered put:(maxY // 2).
! !

!TabWidget::Mac methodsFor:'drawing'!

redrawAtBottom:isSelected
    "redraw tab at bottom of view
    "
    |origin corner polygon x y x1 eX eY color shadowColor lightColor|

    isSelected ifFalse:[
        color       := tabView styleAt:#unselectedColor.
        shadowColor := tabView styleAt:#shadowColorUnselected.
        lightColor  := tabView styleAt:#lightColorUnselected.
    ] ifTrue:[
        color       := tabView styleAt:#selectedColor.
        shadowColor := tabView styleAt:#shadowColorSelected.
        lightColor  := tabView styleAt:#lightColorSelected.
    ].

    polygon := Array new:5.
    origin  := self computeOrigin.
    corner  := self computeCorner.

    x  := origin x.
    y  := origin y.
    eX := corner x.
    eY := corner y.
    x1 := eX - (tabView styleAt:#maxY).

    polygon at:1 put:(Point x:x      y:eY).
    polygon at:2 put:(Point x:x      y:y).
    polygon at:3 put:(Point x:x1     y:y).
    polygon at:4 put:(Point x:eX     y:(y-extent y)).
    polygon at:5 put:(Point x:eX     y:eY).

    tabView paint:color.
    tabView fillPolygon:polygon.

    tabView paint:lightColor.
    tabView displayLineFromX:x+1 y:eY toX:x+1 y:y-1.
    tabView displayLineFromX:x+1 y:y-1 toX:x1-1 y:y-1.
    tabView displayLineFromX:x+1 y:y-1 toX:x1+1 y:y-1.

    tabView paintColor:#labelColor.
    tabView displayPolygon:polygon.

    isSelected ifFalse:[
        tabView paint:shadowColor.
        tabView displayLineFromX:x y:eY toX:eX y:eY.
    ]


!

redrawAtLeft:isSelected
    "redraw tab at left of view
    "
    |origin corner polygon x y y1 eX eY color shadowColor lightColor|

    isSelected ifFalse:[
        color       := tabView styleAt:#unselectedColor.
        shadowColor := tabView styleAt:#shadowColorUnselected.
        lightColor  := tabView styleAt:#lightColorUnselected.
    ] ifTrue:[
        color       := tabView styleAt:#selectedColor.
        shadowColor := tabView styleAt:#shadowColorSelected.
        lightColor  := tabView styleAt:#lightColorSelected.
    ].

    polygon := Array new:5.
    origin  := self computeOrigin.
    corner  := self computeCorner.

    x  := origin x.
    y  := origin y.
    eX := corner x.
    eY := corner y.
    y1 := eY - (tabView styleAt:#maxY).

    polygon at:1 put:(Point x:eX           y:y).
    polygon at:2 put:(Point x:x            y:y).
    polygon at:3 put:(Point x:x            y:y1).
    polygon at:4 put:(Point x:(x+extent x) y:eY).
    polygon at:5 put:(Point x:eX           y:eY).

    tabView paint:color.
    tabView fillPolygon:polygon.

    tabView paint:lightColor.
    tabView displayLineFromX:eX  y:y+1 toX:x+2  y:y+1.
    tabView displayLineFromX:x+1 y:y+1 toX:x+1  y:y1+1.

    tabView paintColor:#labelColor.
    tabView displayPolygon:polygon.
"
    isSelected ifFalse:[
        tabView paint:shadowColor.
        tabView displayLineFromX:0 y:y toX:0 y:eY.
    ]
"
!

redrawAtRight:isSelected
    "redraw tab at right of view
    "
    |origin corner polygon x y y1 eY color shadowColor lightColor|

    isSelected ifFalse:[
        color       := tabView styleAt:#unselectedColor.
        shadowColor := tabView styleAt:#shadowColorUnselected.
        lightColor  := tabView styleAt:#lightColorUnselected.
    ] ifTrue:[
        color       := tabView styleAt:#selectedColor.
        shadowColor := tabView styleAt:#shadowColorSelected.
        lightColor  := tabView styleAt:#lightColorSelected.
    ].

    polygon := Array new:5.
    origin  := self computeOrigin.
    corner  := self computeCorner.

    x  := origin x.
    y  := origin y.
    eY := corner y.
    y1 := eY - (tabView styleAt:#maxY).

    polygon at:1 put:(Point x:0            y:y).
    polygon at:2 put:(Point x:x            y:y).
    polygon at:3 put:(Point x:x            y:y1).
    polygon at:4 put:(Point x:(x-extent x) y:eY).
    polygon at:5 put:(Point x:0            y:eY).

    tabView paint:color.
    tabView fillPolygon:polygon.

    tabView paint:lightColor.
    tabView displayLineFromX:0   y:y+1 toX:x-1  y:y+1.
    tabView displayLineFromX:x-1 y:y+1 toX:x-1  y:y1+1.

    tabView paintColor:#labelColor.
    tabView displayPolygon:polygon.

    isSelected ifFalse:[
        tabView paint:shadowColor.
        tabView displayLineFromX:0 y:y toX:0 y:eY.
    ]

!

redrawAtTop:isSelected
    "redraw tab at top of view
    "
    |origin corner polygon x y x1 eX eY color shadowColor lightColor|

    isSelected ifFalse:[
        color       := tabView styleAt:#unselectedColor.
        shadowColor := tabView styleAt:#shadowColorUnselected.
        lightColor  := tabView styleAt:#lightColorUnselected.
    ] ifTrue:[
        color       := tabView styleAt:#selectedColor.
        shadowColor := tabView styleAt:#shadowColorSelected.
        lightColor  := tabView styleAt:#lightColorSelected.
    ].

    polygon := Array new:5.
    origin  := self computeOrigin.
    corner  := self computeCorner.

    x  := origin x.
    y  := origin y.
    eX := corner x - 1.
    eY := corner y.
    x1 := eX - (tabView styleAt:#maxY).

    polygon at:1 put:(Point x:x      y:eY).
    polygon at:2 put:(Point x:x      y:y).
    polygon at:3 put:(Point x:x1     y:y).
    polygon at:4 put:(Point x:eX     y:(y+extent y)).
    polygon at:5 put:(Point x:eX     y:eY).

    tabView paint:color.
    tabView fillPolygon:polygon.

    tabView paint:lightColor.
    tabView displayLineFromX:x+1 y:eY toX:x+1 y:y+1.
    tabView displayLineFromX:x+1 y:y+1 toX:x1+1 y:y+1.

    tabView paintColor:#labelColor.
    tabView displayPolygon:polygon.

    isSelected ifFalse:[
        tabView paint:shadowColor.
        tabView displayLineFromX:x y:eY-1 toX:eX y:eY-1.
    ]


! !

!TabWidget::Window class methodsFor:'accessing'!

tabStyleOn:aView
    |style col|

    style := super tabStyleOn:aView.

    style at:#expandSelection    put:4@4.
    style at:#tabLevel           put:2.
    style at:#lableTopInset      put:2.
    style at:#labelBottomInset   put:2.
    style at:#roundedEdges       put:true.
  ^ style



! !

!TabWidget::Window class methodsFor:'calculate dimensions'!

validateDimensions:aStyle
    "validate dimensions for a style; could be redifined
    "
    |maxY anchor|

    (aStyle at:#roundedEdges) ifTrue:[
        maxY := aStyle at:#maxY.
        aStyle at:#maxY put:(maxY + 3).
        anchor := aStyle at:#labelAnchor.
        anchor y:(anchor y + 1).
        aStyle at:#labelAnchor put:anchor.
    ]





! !

!TabWidget::Window methodsFor:'drawing'!

redrawAtBottom:isSelected
    "redraw tab at bottom of view
    "
    |origin corner y x xR yB tabLevel light roundedEdges shadowColor lightColor|

    origin := self computeOrigin.
    corner := self computeCorner.
    x   := origin x.
    y   := origin y.
    xR  := corner x - 1.
    yB  := 0.

    roundedEdges := tabView styleAt:#roundedEdges.
    tabLevel     := (tabView styleAt:#tabLevel) - 1.

    isSelected ifFalse:[
        tabView paint:(tabView styleAt:#unselectedColor).
        shadowColor := tabView styleAt:#shadowColorUnselected.
        lightColor  := tabView styleAt:#lightColorUnselected.
    ] ifTrue:[
        tabView paint:(tabView styleAt:#selectedColor).
        shadowColor := tabView styleAt:#shadowColorSelected.
        lightColor  := tabView styleAt:#lightColorSelected.
    ].

    roundedEdges ifTrue:[y := y - 2].
    tabView fillRectangle:(Rectangle left:x top:yB extent:(extent x @ y)).

    roundedEdges ifTrue:[
        tabView displayLineFromX:x-1 y:y toX:xR y:y.
        y := y - 1.

        tabView paint:lightColor.
        tabView displayPointX:x   y:y+1.
        tabView displayPointX:x+1 y:y+1.
        tabView displayLineFromX:x+1 y:y+2 toX:xR-1 y:y+2.
        tabView displayLineFromX:x+2 y:y+3 toX:xR-2 y:y+3.

        tabView paint:shadowColor.

        0 to:tabLevel do:[:i |
            tabView displayPointX:xR-i   y:y.
            tabView displayPointX:xR-i   y:y+1.
            tabView displayPointX:xR-1-i y:y+2.
        ].
        tabView displayPointX:xR-2 y:y+3.
        tabView displayPointX:xR-3 y:y+3.
    ].

    tabView paint:lightColor.

    0 to:tabLevel do:[:i |
        roundedEdges ifFalse:[
            tabView displayLineFromX:x y:y-i toX:xR y:y-i   "/ upper edge
        ].
        tabView displayLineFromX:x+i y:y+1 toX:x+i y:yB.    "/ left edge
    ].
    y := y + 1.
    tabView paint:shadowColor.

    0 to:tabLevel do:[:i |
        tabView displayLineFromX:xR-i y:y-i toX:xR-i y:yB.  "/ right edge
    ].

!

redrawAtLeft:isSelected
    "redraw tab at left of view
    "
    |origin corner y x xR yB tabLevel light roundedEdges shadowColor lightColor|

    origin := self computeOrigin.
    corner := self computeCorner.
    x   := origin x.
    y   := origin y.
    xR  := corner x.
    yB  := corner y.

    roundedEdges := tabView styleAt:#roundedEdges.
    tabLevel     := (tabView styleAt:#tabLevel) - 1.

    isSelected ifFalse:[
        tabView paint:(tabView styleAt:#unselectedColor).
        shadowColor := tabView styleAt:#shadowColorUnselected.
        lightColor  := tabView styleAt:#lightColorUnselected.
    ] ifTrue:[
        tabView paint:(tabView styleAt:#selectedColor).
        shadowColor := tabView styleAt:#shadowColorSelected.
        lightColor  := tabView styleAt:#lightColorSelected.
    ].
    tabView fillRectangle:(Rectangle left:x top:y extent:(xR @ extent y)).

    roundedEdges ifTrue:[
        tabView displayLineFromX:x y:y toX:x y:yB.

        tabView paint:lightColor.
        tabView displayPointX:x y:y+1.
        tabView displayPointX:x y:y+2.
        tabView displayLineFromX:x-1 y:y+2 toX:x-1 y:yB-1.
        tabView displayLineFromX:x-2 y:y+3 toX:x-2 y:yB-1.

        tabView paint:shadowColor.

        0 to:tabLevel do:[:i |
            tabView displayPointX:x   y:yB-i.
            tabView displayPointX:x-1 y:yB-i-1.
            tabView displayPointX:x-2 y:yB-i-2.
        ].
    ].
    tabView paint:lightColor.

    0 to:tabLevel do:[:i |
        roundedEdges ifFalse:[
            tabView displayLineFromX:x+i y:y+i toX:x+i y:yB.    "/ upper edge
        ].
        tabView displayLineFromX:x y:y+i toX:xR y:y+i.          "/ left edge
    ].
    tabView paint:shadowColor.

    0 to:tabLevel do:[:i |
        tabView displayLineFromX:x+i y:yB-i toX:xR y:yB-i.       
    ].

!

redrawAtRight:isSelected
    "redraw tab at right of view
    "
    |origin corner y x xR yB tabLevel light roundedEdges shadowColor lightColor|

    origin := self computeOrigin.
    corner := self computeCorner.
    x   := origin x.
    y   := origin y.
    xR  := corner x - 1.
    yB  := corner y.

    roundedEdges := tabView styleAt:#roundedEdges.
    tabLevel     := (tabView styleAt:#tabLevel) - 1.

    isSelected ifFalse:[
        tabView paint:(tabView styleAt:#unselectedColor).
        shadowColor := tabView styleAt:#shadowColorUnselected.
        lightColor  := tabView styleAt:#lightColorUnselected.
    ] ifTrue:[
        tabView paint:(tabView styleAt:#selectedColor).
        shadowColor := tabView styleAt:#shadowColorSelected.
        lightColor  := tabView styleAt:#lightColorSelected.
    ].
    tabView fillRectangle:(Rectangle left:0 top:y extent:(x @ extent y)).

    roundedEdges ifTrue:[
        tabView displayLineFromX:x y:y toX:x y:yB.

        tabView paint:lightColor.
        tabView displayPointX:x y:y+1.
        tabView displayPointX:x y:y+2.
        tabView displayLineFromX:x+1 y:y+2 toX:x+1 y:yB-1.
        tabView displayLineFromX:x+2 y:y+3 toX:x+2 y:yB-1.

        tabView paint:shadowColor.

        0 to:tabLevel do:[:i |
            tabView displayPointX:x   y:yB-i.
            tabView displayPointX:x+1 y:yB-i-1.
            tabView displayPointX:x+2 y:yB-i-2.
        ].
    ].
    tabView paint:lightColor.

    0 to:tabLevel do:[:i |
        roundedEdges ifFalse:[
            tabView displayLineFromX:x-i y:y+i toX:x-i y:yB.    "/ upper edge
        ].
        tabView displayLineFromX:x y:y+i+1 toX:0 y:y+i+1.       "/ left edge
    ].
    tabView paint:shadowColor.

    0 to:tabLevel do:[:i |
        tabView displayLineFromX:x-i+1 y:yB-i toX:1 y:yB-i.       
    ].
!

redrawAtTop:isSelected
    "redraw tab at top of view
    "
    |polygon origin corner y x xR yB tabLevel light roundedEdges shadowColor lightColor|

    origin := self computeOrigin.
    corner := self computeCorner.
    x   := origin x.
    y   := origin y.
    xR  := corner x - 1.
    yB  := corner y.

    roundedEdges := tabView styleAt:#roundedEdges.
    tabLevel     := (tabView styleAt:#tabLevel) - 1.

    isSelected ifFalse:[
        tabView paint:(tabView styleAt:#unselectedColor).
        shadowColor := tabView styleAt:#shadowColorUnselected.
        lightColor  := tabView styleAt:#lightColorUnselected.
    ] ifTrue:[
        tabView paint:(tabView styleAt:#selectedColor).
        shadowColor := tabView styleAt:#shadowColorSelected.
        lightColor  := tabView styleAt:#lightColorSelected.
    ].

    roundedEdges ifTrue:[ y :=  y + 2].
    tabView fillRectangle:(Rectangle left:x top:y extent:((extent x) @ yB)).

    roundedEdges ifTrue:[
        y :=  y + 1.
        tabView displayLineFromX:x y:y-1   toX:xR y:y-1.          
        tabView displayLineFromX:x+1 y:y-2 toX:xR-1 y:y-2.
        tabView displayLineFromX:x+2 y:y-3 toX:xR-2 y:y-3.
        
        tabView paint:lightColor.

        0 to:tabLevel do:[:i |
            tabView displayPointX:x+i y:y-1.
            tabView displayPointX:x+1+i y:y-1-1.
            tabView displayLineFromX:x+2+i y:y-3-i toX:xR-1-i y:y-3-i.  "/ top
        ].

        tabView paint:shadowColor.
        0 to:tabLevel do:[:i |
            tabView displayPointX:xR-i y:y.
            tabView displayPointX:xR-i y:y-1.
            tabView displayPointX:xR-1-i y:y-1-1.
        ].
        tabView displayPointX:xR-2 y:y-1-1-1.
        tabView displayPointX:xR-3 y:y-1-1-1.
    ].

    tabView paint:lightColor.
    0 to:tabLevel do:[:i |
        roundedEdges ifFalse:[
            tabView displayLineFromX:x y:y+i toX:xR y:y+i.    "/ upper edge
        ].
        tabView displayLineFromX:x+i y:y toX:x+i y:yB.    "/ left edge
    ].
    tabView paint:shadowColor.
    0 to:tabLevel do:[:i |
        tabView displayLineFromX:xR-i y:y+i toX:xR-i y:yB.  "/ right edge
    ].
! !

!TabWidget class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libwidg2/TabWidget.st,v 1.4 1997-04-22 16:56:29 ca Exp $'
! !