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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
     1
"
dd49faa984ce intitial checkin
ca
parents:
diff changeset
     2
 COPYRIGHT (c) 1997 by eXept Software AG
dd49faa984ce intitial checkin
ca
parents:
diff changeset
     3
              All Rights Reserved
dd49faa984ce intitial checkin
ca
parents:
diff changeset
     4
dd49faa984ce intitial checkin
ca
parents:
diff changeset
     5
 This software is furnished under a license and may be used
dd49faa984ce intitial checkin
ca
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
dd49faa984ce intitial checkin
ca
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
dd49faa984ce intitial checkin
ca
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
dd49faa984ce intitial checkin
ca
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    10
 hereby transferred.
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    11
"
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    12
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    13
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    14
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    15
Object subclass:#TabWidget
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    16
	instanceVariableNames:'tabView label anchor extent lineNr'
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    17
	classVariableNames:''
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    18
	poolDictionaries:''
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    19
	category:'Views-Interactors'
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    20
!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    21
351
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
    22
TabWidget subclass:#Mac
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    23
	instanceVariableNames:''
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    24
	classVariableNames:''
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    25
	poolDictionaries:''
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    26
	privateIn:TabWidget
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    27
!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    28
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    29
TabWidget subclass:#Window
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    30
	instanceVariableNames:''
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    31
	classVariableNames:''
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    32
	poolDictionaries:''
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    33
	privateIn:TabWidget
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    34
!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    35
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    36
!TabWidget class methodsFor:'documentation'!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    37
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    38
copyright
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    39
"
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    40
 COPYRIGHT (c) 1997 by eXept Software AG
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    41
              All Rights Reserved
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    42
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    43
 This software is furnished under a license and may be used
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    44
 only in accordance with the terms of that license and with the
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    45
 inclusion of the above copyright notice.   This software may not
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    46
 be provided or otherwise made available to, or used by, any
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    47
 other person.  No title to or ownership of the software is
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    48
 hereby transferred.
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    49
"
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    50
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    51
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    52
!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    53
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    54
documentation
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    55
"
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    56
    instances represent (& draw) the tabs of a tabWidget.
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    57
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    58
    [author:]
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    59
        Claus Atzkern
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    60
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    61
    [see also:]
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    62
        TabView
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    63
"
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    64
! !
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    65
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    66
!TabWidget class methodsFor:'instance creation'!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    67
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    68
labels:aList for:aTabView
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    69
    "create tabs based on labels for a tabview
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    70
    "
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    71
    |list maxX maxY lftIns topIns level style|
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    72
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    73
    maxX   := 0.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    74
    maxY   := 0.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    75
    style  := aTabView style.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    76
    lftIns := style at:#labelLeftInset.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    77
    topIns := style at:#lableTopInset.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    78
    level  := style at:#tabLevel.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    79
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    80
    list := aList collect:[:aLabel||y x|
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    81
        (y := aLabel heightOn:aTabView) > maxY ifTrue:[maxY := y].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    82
        (x := aLabel  widthOn:aTabView) > maxX ifTrue:[maxX := x].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    83
        self new label:aLabel for:aTabView
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    84
    ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    85
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    86
    style at:#labelMaxX put:maxX.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    87
    style at:#labelMaxY put:maxY.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    88
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    89
    maxY  := maxY + topIns
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    90
                  + (style at:#labelBottomInset)
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    91
                  + (2 * level).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    92
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    93
    maxX := maxX + lftIns + (style at:#labelRightInset).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    94
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    95
    style at:#maxX put:maxX.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    96
    style at:#maxY put:maxY.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    97
    style at:#labelAnchor put:( lftIns @ (topIns +level) ).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    98
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
    99
    self validateDimensions:style.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   100
  ^ list
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   101
!
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   102
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   103
validateDimensions:aStyle
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   104
    "validate dimensions for a style; could be redifined
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   105
    "
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   106
! !
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   107
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   108
!TabWidget class methodsFor:'accessing'!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   109
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   110
tabStyleOn:aView
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   111
    "returns default tab style
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   112
    "
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   113
    |style selectedColor unselectedColor|
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   114
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   115
    style    := IdentityDictionary new.
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   116
    selectedColor   := Color gray:90.
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   117
    unselectedColor := Color gray:75.
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   118
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   119
    style at:#widget put:self.
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   120
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   121
    style at:#shadowColorSelected
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   122
         put:((selectedColor averageColorIn:(0@0 corner:7@7)) darkened  on:aView device).
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   123
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   124
    style at:#lightColorSelected
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   125
         put:((selectedColor averageColorIn:(0@0 corner:7@7)) lightened on:aView device).
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   126
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   127
    style at:#shadowColorUnselected
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   128
         put:((unselectedColor averageColorIn:(0@0 corner:7@7)) darkened  on:aView device).
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   129
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   130
    style at:#lightColorUnselected
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   131
         put:((unselectedColor averageColorIn:(0@0 corner:7@7)) lightened on:aView device).
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   132
351
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   133
    style at:#unselectedColor    put:unselectedColor.
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   134
    style at:#selectedColor      put:selectedColor.
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   135
    style at:#labelColor         put:(Color black).
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   136
    style at:#selectionAtBottom  put:true.  "/ true: selected tab always moved to bottom
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   137
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   138
    style at:#expandSelection    put:0@0.    "/ expand selection extent x y when raised
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   139
    style at:#tabLevel           put:0.      "/ level
351
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   140
    style at:#lableTopInset      put:4.      "/ additional top label inset
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   141
    style at:#labelBottomInset   put:4.      "/ additional bottom inset
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   142
    style at:#labelLeftInset     put:4.      "/ label left  inset
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   143
    style at:#labelRightInset    put:4.      "/ label right inset
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   144
    style at:#rightCovered       put:0.      "/ covers right tab for n pixels
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   145
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   146
  ^ style
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   147
!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   148
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   149
widgetClass:aWidget
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   150
    |wdgt name|
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   151
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   152
    name := aWidget asString.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   153
    wdgt := Smalltalk classNamed:( self name asString, '::', name ).
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   154
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   155
    wdgt notNil ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   156
        ^ wdgt
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   157
    ].
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   158
    ^ Smalltalk classNamed:name
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   159
! !
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   160
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   161
!TabWidget methodsFor:'accessing'!
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   162
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   163
label
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   164
    ^ label
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   165
!
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   166
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   167
lineNr
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   168
    "returns line number
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   169
    "
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   170
    ^ lineNr
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   171
!
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   172
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   173
lineNr:aLineNr
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   174
    "change line number
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   175
    "
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   176
    lineNr := aLineNr
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   177
! !
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   178
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   179
!TabWidget methodsFor:'accessing dimensions'!
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   180
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   181
anchor
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   182
    "returns the tab origin
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   183
    "
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   184
    ^ anchor
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   185
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   186
!
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   187
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   188
anchor:anAnchor
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   189
    "change the tab anchor; no redraw
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   190
    "
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   191
    anchor := anAnchor
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   192
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   193
!
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   194
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   195
anchor:anAnchor extent:anExtent
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   196
    "change anchor and extent; no redraw
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   197
    "
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   198
    anchor := anAnchor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   199
    extent := anExtent.
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   200
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   201
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   202
!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   203
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   204
extent
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   205
    "return the tab extent
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   206
    "
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   207
    ^ extent
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   208
!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   209
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   210
extent:anExtent
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   211
    "change the tab extent; no redraw
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   212
    "
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   213
    extent := anExtent
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   214
!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   215
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   216
preferredExtentX
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   217
    "returns my preferred extent x
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   218
    "
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   219
    ^    (tabView styleAt:#maxX)
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   220
       - (tabView styleAt:#labelMaxX)
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   221
       + (label  widthOn:tabView).
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   222
!
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   223
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   224
preferredExtentY
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   225
    "returns my preferred extent y
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   226
    "
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   227
    ^    (tabView styleAt:#maxY)
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   228
       - (tabView styleAt:#labelMaxY)
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   229
       + (label  heightOn:tabView).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   230
! !
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   231
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   232
!TabWidget methodsFor:'basic drawing'!
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   233
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   234
redrawAtBottom:isSelected
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   235
    "redraw tab at bottom of view
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   236
    "
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   237
    ^ self subclassResponsibility
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   238
!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   239
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   240
redrawAtLeft:isSelected
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   241
    "redraw tab at left of view
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   242
    "
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   243
    ^ self subclassResponsibility
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   244
!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   245
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   246
redrawAtRight:isSelected
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   247
    "redraw tab at right of view
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   248
    "
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   249
    ^ self subclassResponsibility
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   250
!
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   251
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   252
redrawAtTop:isSelected
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   253
    "redraw tab at top of view
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   254
    "
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   255
    ^ self subclassResponsibility
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   256
! !
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   257
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   258
!TabWidget methodsFor:'drawing'!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   259
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   260
computeCorner
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   261
    "compute corner
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   262
    "
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   263
    |d c|
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   264
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   265
    c := anchor + extent.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   266
    d := tabView direction.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   267
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   268
    d == #top    ifTrue:[^ ( c x @ (tabView extent y) )].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   269
    d == #left   ifTrue:[^ ( (tabView extent x) @ c y ) ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   270
    d == #right  ifTrue:[^ ( 0 @ c y )].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   271
    d == #bottom ifTrue:[^ ( c x @ 0 )].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   272
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   273
    self error.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   274
!
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   275
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   276
computeOrigin
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   277
    "compute origin
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   278
    "
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   279
    |d|
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   280
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   281
    d := tabView direction.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   282
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   283
    d == #top    ifTrue:[ ^ anchor x @ ((tabView extent y) - anchor y) ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   284
    d == #left   ifTrue:[ ^ ((tabView extent x) - anchor x) @ anchor y ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   285
    d == #right  ifTrue:[ ^ anchor ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   286
    d == #bottom ifTrue:[ ^ anchor ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   287
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   288
    self error
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   289
!
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   290
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   291
redraw:isSelected
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   292
    "full redraw
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   293
    "
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   294
    |x y p a d|
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   295
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   296
    d := tabView direction.
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   297
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   298
    (d == #top or:[d == #bottom]) ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   299
        p := self computeOrigin.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   300
        a := tabView styleAt:#labelAnchor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   301
        x := p x + a x.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   302
        
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   303
        d == #top ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   304
            self redrawAtTop:isSelected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   305
            y := p y + a y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   306
        ] ifFalse:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   307
            self redrawAtBottom:isSelected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   308
            y := p y - (tabView styleAt:#labelBottomInset)
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   309
                     - (tabView styleAt:#tabLevel)
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   310
                     - (label heightOn:tabView).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   311
        ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   312
        tabView paintColor:#labelColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   313
        label isString ifTrue:[y := y + tabView font ascent].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   314
        label displayOn:tabView x:x y:y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   315
      ^ self
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   316
    ].
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   317
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   318
    d == #right ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   319
        ^ self redrawAtRight:isSelected
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   320
    ].
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   321
    d == #left ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   322
        ^ self redrawAtLeft:isSelected
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   323
    ].
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   324
! !
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   325
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   326
!TabWidget methodsFor:'initialization'!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   327
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   328
label:aLabel for:aTabView
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   329
    "initialize attributes
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   330
    "
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   331
    tabView := aTabView.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   332
    label   := aLabel.
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   333
! !
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   334
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   335
!TabWidget methodsFor:'queries'!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   336
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   337
containsPoint:aPoint
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   338
    "return true, if a point is contained in the tab
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   339
    "
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   340
    |d x y top bot origin|
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   341
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   342
    d := tabView direction.
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   343
    x := aPoint x.
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   344
    y := aPoint y.
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   345
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   346
    origin := self computeOrigin.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   347
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   348
    (d == #top or:[d == #bottom]) ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   349
        ((x >= origin x) and:[x <= (origin x + extent x)]) ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   350
            d == #top ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   351
                ^ ((y >=  origin y) and:[y <= (origin y + extent y)])
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   352
            ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   353
            ^ ((y <=  origin y) and:[y >= (origin y - extent y)])
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   354
        ]
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   355
    ] ifFalse:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   356
        ((y >= origin y) and:[y <= (origin y + extent y)]) ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   357
            d == #right ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   358
                ^ ((x <= origin x) and:[x >= (origin x - extent x)])
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   359
            ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   360
            ^ ((x >= origin x) and:[x <= (origin x + extent x)])
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   361
        ]
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   362
    ].
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   363
    ^ false
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   364
! !
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   365
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   366
!TabWidget::Mac class methodsFor:'calculate dimensions'!
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   367
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   368
validateDimensions:aStyle
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   369
    "validate dimensions for a style; could be redifined
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   370
    "
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   371
    |maxY maxX anchor lftIns|
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   372
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   373
    maxY   := aStyle at:#maxY.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   374
    maxX   := (aStyle at:#maxX) - (aStyle at:#labelLeftInset).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   375
    anchor := aStyle at:#labelAnchor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   376
    lftIns := maxY // 2.
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   377
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   378
    anchor x:lftIns.
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   379
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   380
    aStyle at:#maxX         put:(maxX + lftIns + maxY).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   381
    aStyle at:#rightCovered put:(maxY // 2).
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   382
! !
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   383
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   384
!TabWidget::Mac methodsFor:'drawing'!
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   385
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   386
redrawAtBottom:isSelected
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   387
    "redraw tab at bottom of view
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   388
    "
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   389
    |origin corner polygon x y x1 eX eY color shadowColor lightColor|
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   390
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   391
    isSelected ifFalse:[
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   392
        color       := tabView styleAt:#unselectedColor.
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   393
        shadowColor := tabView styleAt:#shadowColorUnselected.
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   394
        lightColor  := tabView styleAt:#lightColorUnselected.
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   395
    ] ifTrue:[
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   396
        color       := tabView styleAt:#selectedColor.
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   397
        shadowColor := tabView styleAt:#shadowColorSelected.
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   398
        lightColor  := tabView styleAt:#lightColorSelected.
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   399
    ].
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   400
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   401
    polygon := Array new:5.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   402
    origin  := self computeOrigin.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   403
    corner  := self computeCorner.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   404
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   405
    x  := origin x.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   406
    y  := origin y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   407
    eX := corner x.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   408
    eY := corner y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   409
    x1 := eX - (tabView styleAt:#maxY).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   410
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   411
    polygon at:1 put:(Point x:x      y:eY).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   412
    polygon at:2 put:(Point x:x      y:y).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   413
    polygon at:3 put:(Point x:x1     y:y).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   414
    polygon at:4 put:(Point x:eX     y:(y-extent y)).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   415
    polygon at:5 put:(Point x:eX     y:eY).
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   416
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   417
    tabView paint:color.
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   418
    tabView fillPolygon:polygon.
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   419
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   420
    tabView paint:lightColor.
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   421
    tabView displayLineFromX:x+1 y:eY toX:x+1 y:y-1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   422
    tabView displayLineFromX:x+1 y:y-1 toX:x1-1 y:y-1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   423
    tabView displayLineFromX:x+1 y:y-1 toX:x1+1 y:y-1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   424
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   425
    tabView paintColor:#labelColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   426
    tabView displayPolygon:polygon.
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   427
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   428
    isSelected ifFalse:[
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   429
        tabView paint:shadowColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   430
        tabView displayLineFromX:x y:eY toX:eX y:eY.
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   431
    ]
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   432
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   433
351
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   434
!
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   435
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   436
redrawAtLeft:isSelected
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   437
    "redraw tab at left of view
351
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   438
    "
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   439
    |origin corner polygon x y y1 eX eY color shadowColor lightColor|
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   440
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   441
    isSelected ifFalse:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   442
        color       := tabView styleAt:#unselectedColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   443
        shadowColor := tabView styleAt:#shadowColorUnselected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   444
        lightColor  := tabView styleAt:#lightColorUnselected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   445
    ] ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   446
        color       := tabView styleAt:#selectedColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   447
        shadowColor := tabView styleAt:#shadowColorSelected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   448
        lightColor  := tabView styleAt:#lightColorSelected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   449
    ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   450
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   451
    polygon := Array new:5.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   452
    origin  := self computeOrigin.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   453
    corner  := self computeCorner.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   454
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   455
    x  := origin x.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   456
    y  := origin y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   457
    eX := corner x.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   458
    eY := corner y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   459
    y1 := eY - (tabView styleAt:#maxY).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   460
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   461
    polygon at:1 put:(Point x:eX           y:y).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   462
    polygon at:2 put:(Point x:x            y:y).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   463
    polygon at:3 put:(Point x:x            y:y1).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   464
    polygon at:4 put:(Point x:(x+extent x) y:eY).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   465
    polygon at:5 put:(Point x:eX           y:eY).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   466
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   467
    tabView paint:color.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   468
    tabView fillPolygon:polygon.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   469
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   470
    tabView paint:lightColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   471
    tabView displayLineFromX:eX  y:y+1 toX:x+2  y:y+1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   472
    tabView displayLineFromX:x+1 y:y+1 toX:x+1  y:y1+1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   473
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   474
    tabView paintColor:#labelColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   475
    tabView displayPolygon:polygon.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   476
"
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   477
    isSelected ifFalse:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   478
        tabView paint:shadowColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   479
        tabView displayLineFromX:0 y:y toX:0 y:eY.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   480
    ]
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   481
"
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   482
!
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   483
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   484
redrawAtRight:isSelected
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   485
    "redraw tab at right of view
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   486
    "
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   487
    |origin corner polygon x y y1 eY color shadowColor lightColor|
351
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   488
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   489
    isSelected ifFalse:[
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   490
        color       := tabView styleAt:#unselectedColor.
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   491
        shadowColor := tabView styleAt:#shadowColorUnselected.
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   492
        lightColor  := tabView styleAt:#lightColorUnselected.
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   493
    ] ifTrue:[
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   494
        color       := tabView styleAt:#selectedColor.
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   495
        shadowColor := tabView styleAt:#shadowColorSelected.
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   496
        lightColor  := tabView styleAt:#lightColorSelected.
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   497
    ].
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   498
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   499
    polygon := Array new:5.
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   500
    origin  := self computeOrigin.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   501
    corner  := self computeCorner.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   502
351
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   503
    x  := origin x.
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   504
    y  := origin y.
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   505
    eY := corner y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   506
    y1 := eY - (tabView styleAt:#maxY).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   507
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   508
    polygon at:1 put:(Point x:0            y:y).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   509
    polygon at:2 put:(Point x:x            y:y).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   510
    polygon at:3 put:(Point x:x            y:y1).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   511
    polygon at:4 put:(Point x:(x-extent x) y:eY).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   512
    polygon at:5 put:(Point x:0            y:eY).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   513
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   514
    tabView paint:color.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   515
    tabView fillPolygon:polygon.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   516
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   517
    tabView paint:lightColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   518
    tabView displayLineFromX:0   y:y+1 toX:x-1  y:y+1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   519
    tabView displayLineFromX:x-1 y:y+1 toX:x-1  y:y1+1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   520
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   521
    tabView paintColor:#labelColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   522
    tabView displayPolygon:polygon.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   523
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   524
    isSelected ifFalse:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   525
        tabView paint:shadowColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   526
        tabView displayLineFromX:0 y:y toX:0 y:eY.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   527
    ]
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   528
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   529
!
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   530
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   531
redrawAtTop:isSelected
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   532
    "redraw tab at top of view
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   533
    "
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   534
    |origin corner polygon x y x1 eX eY color shadowColor lightColor|
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   535
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   536
    isSelected ifFalse:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   537
        color       := tabView styleAt:#unselectedColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   538
        shadowColor := tabView styleAt:#shadowColorUnselected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   539
        lightColor  := tabView styleAt:#lightColorUnselected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   540
    ] ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   541
        color       := tabView styleAt:#selectedColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   542
        shadowColor := tabView styleAt:#shadowColorSelected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   543
        lightColor  := tabView styleAt:#lightColorSelected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   544
    ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   545
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   546
    polygon := Array new:5.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   547
    origin  := self computeOrigin.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   548
    corner  := self computeCorner.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   549
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   550
    x  := origin x.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   551
    y  := origin y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   552
    eX := corner x - 1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   553
    eY := corner y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   554
    x1 := eX - (tabView styleAt:#maxY).
351
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   555
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   556
    polygon at:1 put:(Point x:x      y:eY).
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   557
    polygon at:2 put:(Point x:x      y:y).
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   558
    polygon at:3 put:(Point x:x1     y:y).
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   559
    polygon at:4 put:(Point x:eX     y:(y+extent y)).
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   560
    polygon at:5 put:(Point x:eX     y:eY).
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   561
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   562
    tabView paint:color.
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   563
    tabView fillPolygon:polygon.
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   564
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   565
    tabView paint:lightColor.
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   566
    tabView displayLineFromX:x+1 y:eY toX:x+1 y:y+1.
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   567
    tabView displayLineFromX:x+1 y:y+1 toX:x1+1 y:y+1.
351
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   568
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   569
    tabView paintColor:#labelColor.
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   570
    tabView displayPolygon:polygon.
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   571
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   572
    isSelected ifFalse:[
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   573
        tabView paint:shadowColor.
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   574
        tabView displayLineFromX:x y:eY-1 toX:eX y:eY-1.
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   575
    ]
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   576
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   577
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   578
! !
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   579
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   580
!TabWidget::Window class methodsFor:'accessing'!
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   581
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   582
tabStyleOn:aView
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   583
    |style col|
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   584
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   585
    style := super tabStyleOn:aView.
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   586
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   587
    style at:#expandSelection    put:4@4.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   588
    style at:#tabLevel           put:2.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   589
    style at:#lableTopInset      put:2.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   590
    style at:#labelBottomInset   put:2.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   591
    style at:#roundedEdges       put:true.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   592
  ^ style
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   593
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   594
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   595
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   596
! !
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   597
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   598
!TabWidget::Window class methodsFor:'calculate dimensions'!
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   599
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   600
validateDimensions:aStyle
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   601
    "validate dimensions for a style; could be redifined
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   602
    "
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   603
    |maxY anchor|
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   604
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   605
    (aStyle at:#roundedEdges) ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   606
        maxY := aStyle at:#maxY.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   607
        aStyle at:#maxY put:(maxY + 3).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   608
        anchor := aStyle at:#labelAnchor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   609
        anchor y:(anchor y + 1).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   610
        aStyle at:#labelAnchor put:anchor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   611
    ]
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   612
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   613
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   614
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   615
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   616
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   617
! !
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   618
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   619
!TabWidget::Window methodsFor:'drawing'!
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   620
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   621
redrawAtBottom:isSelected
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   622
    "redraw tab at bottom of view
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   623
    "
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   624
    |origin corner y x xR yB tabLevel light roundedEdges shadowColor lightColor|
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   625
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   626
    origin := self computeOrigin.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   627
    corner := self computeCorner.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   628
    x   := origin x.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   629
    y   := origin y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   630
    xR  := corner x - 1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   631
    yB  := 0.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   632
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   633
    roundedEdges := tabView styleAt:#roundedEdges.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   634
    tabLevel     := (tabView styleAt:#tabLevel) - 1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   635
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   636
    isSelected ifFalse:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   637
        tabView paint:(tabView styleAt:#unselectedColor).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   638
        shadowColor := tabView styleAt:#shadowColorUnselected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   639
        lightColor  := tabView styleAt:#lightColorUnselected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   640
    ] ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   641
        tabView paint:(tabView styleAt:#selectedColor).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   642
        shadowColor := tabView styleAt:#shadowColorSelected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   643
        lightColor  := tabView styleAt:#lightColorSelected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   644
    ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   645
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   646
    roundedEdges ifTrue:[y := y - 2].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   647
    tabView fillRectangle:(Rectangle left:x top:yB extent:(extent x @ y)).
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   648
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   649
    roundedEdges ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   650
        tabView displayLineFromX:x-1 y:y toX:xR y:y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   651
        y := y - 1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   652
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   653
        tabView paint:lightColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   654
        tabView displayPointX:x   y:y+1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   655
        tabView displayPointX:x+1 y:y+1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   656
        tabView displayLineFromX:x+1 y:y+2 toX:xR-1 y:y+2.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   657
        tabView displayLineFromX:x+2 y:y+3 toX:xR-2 y:y+3.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   658
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   659
        tabView paint:shadowColor.
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   660
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   661
        0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   662
            tabView displayPointX:xR-i   y:y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   663
            tabView displayPointX:xR-i   y:y+1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   664
            tabView displayPointX:xR-1-i y:y+2.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   665
        ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   666
        tabView displayPointX:xR-2 y:y+3.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   667
        tabView displayPointX:xR-3 y:y+3.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   668
    ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   669
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   670
    tabView paint:lightColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   671
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   672
    0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   673
        roundedEdges ifFalse:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   674
            tabView displayLineFromX:x y:y-i toX:xR y:y-i   "/ upper edge
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   675
        ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   676
        tabView displayLineFromX:x+i y:y+1 toX:x+i y:yB.    "/ left edge
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   677
    ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   678
    y := y + 1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   679
    tabView paint:shadowColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   680
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   681
    0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   682
        tabView displayLineFromX:xR-i y:y-i toX:xR-i y:yB.  "/ right edge
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   683
    ].
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   684
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   685
!
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   686
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   687
redrawAtLeft:isSelected
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   688
    "redraw tab at left of view
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   689
    "
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   690
    |origin corner y x xR yB tabLevel light roundedEdges shadowColor lightColor|
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   691
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   692
    origin := self computeOrigin.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   693
    corner := self computeCorner.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   694
    x   := origin x.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   695
    y   := origin y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   696
    xR  := corner x.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   697
    yB  := corner y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   698
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   699
    roundedEdges := tabView styleAt:#roundedEdges.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   700
    tabLevel     := (tabView styleAt:#tabLevel) - 1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   701
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   702
    isSelected ifFalse:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   703
        tabView paint:(tabView styleAt:#unselectedColor).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   704
        shadowColor := tabView styleAt:#shadowColorUnselected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   705
        lightColor  := tabView styleAt:#lightColorUnselected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   706
    ] ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   707
        tabView paint:(tabView styleAt:#selectedColor).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   708
        shadowColor := tabView styleAt:#shadowColorSelected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   709
        lightColor  := tabView styleAt:#lightColorSelected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   710
    ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   711
    tabView fillRectangle:(Rectangle left:x top:y extent:(xR @ extent y)).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   712
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   713
    roundedEdges ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   714
        tabView displayLineFromX:x y:y toX:x y:yB.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   715
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   716
        tabView paint:lightColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   717
        tabView displayPointX:x y:y+1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   718
        tabView displayPointX:x y:y+2.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   719
        tabView displayLineFromX:x-1 y:y+2 toX:x-1 y:yB-1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   720
        tabView displayLineFromX:x-2 y:y+3 toX:x-2 y:yB-1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   721
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   722
        tabView paint:shadowColor.
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   723
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   724
        0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   725
            tabView displayPointX:x   y:yB-i.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   726
            tabView displayPointX:x-1 y:yB-i-1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   727
            tabView displayPointX:x-2 y:yB-i-2.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   728
        ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   729
    ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   730
    tabView paint:lightColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   731
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   732
    0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   733
        roundedEdges ifFalse:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   734
            tabView displayLineFromX:x+i y:y+i toX:x+i y:yB.    "/ upper edge
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   735
        ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   736
        tabView displayLineFromX:x y:y+i toX:xR y:y+i.          "/ left edge
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   737
    ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   738
    tabView paint:shadowColor.
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   739
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   740
    0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   741
        tabView displayLineFromX:x+i y:yB-i toX:xR y:yB-i.       
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   742
    ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   743
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   744
!
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   745
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   746
redrawAtRight:isSelected
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   747
    "redraw tab at right of view
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   748
    "
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   749
    |origin corner y x xR yB tabLevel light roundedEdges shadowColor lightColor|
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   750
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   751
    origin := self computeOrigin.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   752
    corner := self computeCorner.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   753
    x   := origin x.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   754
    y   := origin y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   755
    xR  := corner x - 1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   756
    yB  := corner y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   757
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   758
    roundedEdges := tabView styleAt:#roundedEdges.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   759
    tabLevel     := (tabView styleAt:#tabLevel) - 1.
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   760
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   761
    isSelected ifFalse:[
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   762
        tabView paint:(tabView styleAt:#unselectedColor).
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   763
        shadowColor := tabView styleAt:#shadowColorUnselected.
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   764
        lightColor  := tabView styleAt:#lightColorUnselected.
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   765
    ] ifTrue:[
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   766
        tabView paint:(tabView styleAt:#selectedColor).
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   767
        shadowColor := tabView styleAt:#shadowColorSelected.
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   768
        lightColor  := tabView styleAt:#lightColorSelected.
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   769
    ].
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   770
    tabView fillRectangle:(Rectangle left:0 top:y extent:(x @ extent y)).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   771
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   772
    roundedEdges ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   773
        tabView displayLineFromX:x y:y toX:x y:yB.
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   774
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   775
        tabView paint:lightColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   776
        tabView displayPointX:x y:y+1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   777
        tabView displayPointX:x y:y+2.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   778
        tabView displayLineFromX:x+1 y:y+2 toX:x+1 y:yB-1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   779
        tabView displayLineFromX:x+2 y:y+3 toX:x+2 y:yB-1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   780
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   781
        tabView paint:shadowColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   782
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   783
        0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   784
            tabView displayPointX:x   y:yB-i.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   785
            tabView displayPointX:x+1 y:yB-i-1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   786
            tabView displayPointX:x+2 y:yB-i-2.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   787
        ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   788
    ].
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   789
    tabView paint:lightColor.
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   790
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   791
    0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   792
        roundedEdges ifFalse:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   793
            tabView displayLineFromX:x-i y:y+i toX:x-i y:yB.    "/ upper edge
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   794
        ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   795
        tabView displayLineFromX:x y:y+i+1 toX:0 y:y+i+1.       "/ left edge
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   796
    ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   797
    tabView paint:shadowColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   798
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   799
    0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   800
        tabView displayLineFromX:x-i+1 y:yB-i toX:1 y:yB-i.       
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   801
    ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   802
!
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   803
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   804
redrawAtTop:isSelected
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   805
    "redraw tab at top of view
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   806
    "
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   807
    |polygon origin corner y x xR yB tabLevel light roundedEdges shadowColor lightColor|
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   808
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   809
    origin := self computeOrigin.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   810
    corner := self computeCorner.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   811
    x   := origin x.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   812
    y   := origin y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   813
    xR  := corner x - 1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   814
    yB  := corner y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   815
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   816
    roundedEdges := tabView styleAt:#roundedEdges.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   817
    tabLevel     := (tabView styleAt:#tabLevel) - 1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   818
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   819
    isSelected ifFalse:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   820
        tabView paint:(tabView styleAt:#unselectedColor).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   821
        shadowColor := tabView styleAt:#shadowColorUnselected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   822
        lightColor  := tabView styleAt:#lightColorUnselected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   823
    ] ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   824
        tabView paint:(tabView styleAt:#selectedColor).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   825
        shadowColor := tabView styleAt:#shadowColorSelected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   826
        lightColor  := tabView styleAt:#lightColorSelected.
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   827
    ].
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   828
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   829
    roundedEdges ifTrue:[ y :=  y + 2].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   830
    tabView fillRectangle:(Rectangle left:x top:y extent:((extent x) @ yB)).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   831
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   832
    roundedEdges ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   833
        y :=  y + 1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   834
        tabView displayLineFromX:x y:y-1   toX:xR y:y-1.          
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   835
        tabView displayLineFromX:x+1 y:y-2 toX:xR-1 y:y-2.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   836
        tabView displayLineFromX:x+2 y:y-3 toX:xR-2 y:y-3.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   837
        
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   838
        tabView paint:lightColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   839
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   840
        0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   841
            tabView displayPointX:x+i y:y-1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   842
            tabView displayPointX:x+1+i y:y-1-1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   843
            tabView displayLineFromX:x+2+i y:y-3-i toX:xR-1-i y:y-3-i.  "/ top
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   844
        ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   845
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   846
        tabView paint:shadowColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   847
        0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   848
            tabView displayPointX:xR-i y:y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   849
            tabView displayPointX:xR-i y:y-1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   850
            tabView displayPointX:xR-1-i y:y-1-1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   851
        ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   852
        tabView displayPointX:xR-2 y:y-1-1-1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   853
        tabView displayPointX:xR-3 y:y-1-1-1.
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   854
    ].
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   855
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   856
    tabView paint:lightColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   857
    0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   858
        roundedEdges ifFalse:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   859
            tabView displayLineFromX:x y:y+i toX:xR y:y+i.    "/ upper edge
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   860
        ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   861
        tabView displayLineFromX:x+i y:y toX:x+i y:yB.    "/ left edge
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   862
    ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   863
    tabView paint:shadowColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   864
    0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   865
        tabView displayLineFromX:xR-i y:y+i toX:xR-i y:yB.  "/ right edge
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   866
    ].
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   867
! !
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   868
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   869
!TabWidget class methodsFor:'documentation'!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   870
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   871
version
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   872
    ^ '$Header: /cvs/stx/stx/libwidg2/TabWidget.st,v 1.4 1997-04-22 16:56:29 ca Exp $'
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   873
! !