TabWidget.st
author ca
Sat, 24 May 1997 05:10:39 +0200
changeset 392 de153c1428c2
parent 370 008888fdfc32
child 409 556e276e308a
permissions -rw-r--r--
handle enable notification draw label dependant on enabled state of tabView
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
392
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
    22
TabWidget subclass:#Window
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
392
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
    29
TabWidget subclass:#Mac
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.
369
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   100
    maxY := style at:#maxY.
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   101
    maxX := style at:#maxX.
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   102
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   103
 "/ caused by vertical layout for images
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   104
    maxX < maxY ifTrue:[style at:#maxX put:maxY].
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   105
  ^ list
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   106
!
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   107
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   108
validateDimensions:aStyle
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   109
    "validate dimensions for a style; could be redifined
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   110
    "
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   111
! !
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   112
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   113
!TabWidget class methodsFor:'accessing'!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   114
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   115
tabStyleOn:aView
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   116
    "returns default tab style
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   117
    "
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   118
    |style selectedColor unselectedColor|
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   119
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   120
    style    := IdentityDictionary new.
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   121
    selectedColor   := Color gray:90.
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   122
    unselectedColor := Color gray:75.
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   123
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   124
    style at:#widget put:self.
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   125
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   126
    style at:#shadowColorSelected
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   127
         put:((selectedColor averageColorIn:(0@0 corner:7@7)) darkened  on:aView device).
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   128
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   129
    style at:#lightColorSelected
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   130
         put:((selectedColor averageColorIn:(0@0 corner:7@7)) lightened on:aView device).
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   131
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   132
    style at:#shadowColorUnselected
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   133
         put:((unselectedColor averageColorIn:(0@0 corner:7@7)) darkened  on:aView device).
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   134
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   135
    style at:#lightColorUnselected
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   136
         put:((unselectedColor averageColorIn:(0@0 corner:7@7)) lightened on:aView device).
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   137
351
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   138
    style at:#unselectedColor    put:unselectedColor.
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   139
    style at:#selectedColor      put:selectedColor.
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   140
    style at:#labelColor         put:(Color black).
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   141
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   142
    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
   143
    style at:#tabLevel           put:0.      "/ level
351
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   144
    style at:#lableTopInset      put:4.      "/ additional top label inset
6c46f186d84f make selected line to bottom line if
ca
parents: 350
diff changeset
   145
    style at:#labelBottomInset   put:4.      "/ additional bottom inset
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   146
    style at:#labelLeftInset     put:4.      "/ label left  inset
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   147
    style at:#labelRightInset    put:4.      "/ label right inset
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   148
    style at:#rightCovered       put:0.      "/ covers right tab for n pixels
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   149
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   150
  ^ style
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   151
!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   152
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   153
widgetClass:aWidget
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   154
    |wdgt name|
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   155
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   156
    name := aWidget asString.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   157
    wdgt := Smalltalk classNamed:( self name asString, '::', name ).
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   158
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   159
    wdgt notNil ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   160
        ^ wdgt
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   161
    ].
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   162
    ^ Smalltalk classNamed:name
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   163
! !
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   164
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   165
!TabWidget methodsFor:'accessing'!
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
label
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   168
    ^ label
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
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   171
lineNr
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   172
    "returns line number
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   173
    "
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   174
    ^ lineNr
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
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   177
lineNr:aLineNr
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   178
    "change line number
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   179
    "
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   180
    lineNr := aLineNr
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   181
! !
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   182
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   183
!TabWidget methodsFor:'accessing dimensions'!
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   184
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   185
anchor
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   186
    "returns the tab origin
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
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   189
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
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   192
anchor:anAnchor
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   193
    "change the tab anchor; no redraw
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
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   196
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
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   199
anchor:anAnchor extent:anExtent
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   200
    "change anchor and extent; no redraw
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   201
    "
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   202
    anchor := anAnchor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   203
    extent := anExtent.
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   204
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   205
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   206
!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   207
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   208
extent
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   209
    "return the tab extent
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   210
    "
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   211
    ^ extent
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   212
!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   213
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   214
extent:anExtent
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   215
    "change the tab extent; no redraw
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   216
    "
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   217
    extent := anExtent
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   218
!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   219
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   220
preferredExtentX
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   221
    "returns my preferred extent x
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   222
    "
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   223
    ^    (tabView styleAt:#maxX)
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   224
       - (tabView styleAt:#labelMaxX)
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   225
       + (label  widthOn:tabView).
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   226
!
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   227
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   228
preferredExtentY
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   229
    "returns my preferred extent y
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   230
    "
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   231
    ^    (tabView styleAt:#maxY)
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   232
       - (tabView styleAt:#labelMaxY)
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   233
       + (label  heightOn:tabView).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   234
! !
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   235
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   236
!TabWidget methodsFor:'basic drawing'!
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   237
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   238
redrawAtBottom:isSelected
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   239
    "redraw tab at bottom of view
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   240
    "
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   241
    ^ self subclassResponsibility
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   242
!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   243
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   244
redrawAtLeft:isSelected
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   245
    "redraw tab at left of view
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   246
    "
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   247
    ^ self subclassResponsibility
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   248
!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   249
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   250
redrawAtRight:isSelected
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   251
    "redraw tab at right of view
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   252
    "
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   253
    ^ self subclassResponsibility
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   254
!
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   255
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   256
redrawAtTop:isSelected
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   257
    "redraw tab at top of view
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   258
    "
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   259
    ^ self subclassResponsibility
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   260
! !
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   261
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   262
!TabWidget methodsFor:'drawing'!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   263
369
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   264
redraw:isSelected
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   265
    "redraw tab
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   266
    "
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   267
    |direction origin anchor x y|
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   268
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   269
    direction := tabView direction.
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   270
    anchor    := tabView styleAt:#labelAnchor.
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   271
    origin    := self computeOrigin.
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   272
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   273
    (direction == #top or:[direction == #bottom]) ifTrue:[
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   274
        y := origin y.
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   275
        x := origin x + anchor x.
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   276
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   277
        direction == #top ifTrue:[
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   278
            self redrawAtTop:isSelected.
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   279
            y := y + anchor y.
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   280
        ] ifFalse:[
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   281
            self redrawAtBottom:isSelected.
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   282
            y := y - anchor y - (label heightOn:tabView).
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   283
        ].
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   284
        label isString ifTrue:[y := y + tabView font ascent].
392
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   285
        self setLabelColor.
369
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   286
    ] ifFalse:[
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   287
        direction == #right ifTrue:[
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   288
            self redrawAtRight:isSelected.
370
008888fdfc32 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
   289
            x := origin x - anchor y - (label heightOn:tabView).
369
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   290
        ] ifFalse:[
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   291
            self redrawAtLeft:isSelected.
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   292
            x := origin x + anchor y.
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   293
        ].
392
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   294
        self setLabelColor.
369
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   295
        y := origin y + anchor x.
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   296
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   297
        label isString ifTrue:[
370
008888fdfc32 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
   298
            x := x + tabView font descent.
369
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   299
            tabView displayString:label x:x y:y angle:90.
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   300
          ^ self.
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   301
        ].
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   302
    ].
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   303
    label displayOn:tabView x:x y:y.
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   304
370
008888fdfc32 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
   305
    "Modified: 23.4.1997 / 17:28:49 / cg"
392
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   306
!
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   307
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   308
setLabelColor
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   309
    "set the label color dependant on the enabled state of the tabView
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   310
    "
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   311
    tabView isEnabled ifTrue:[
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   312
        tabView paintColor:#labelColor.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   313
    ] ifFalse:[
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   314
        tabView paintColor:#shadowColorUnselected.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   315
    ]
369
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   316
! !
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   317
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   318
!TabWidget methodsFor:'initialization'!
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   319
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   320
label:aLabel for:aTabView
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   321
    "initialize attributes
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   322
    "
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   323
    tabView := aTabView.
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   324
    label   := aLabel.
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   325
! !
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   326
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   327
!TabWidget methodsFor:'private'!
8f003e44d5ef added directions ...
ca
parents: 367
diff changeset
   328
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   329
computeCorner
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   330
    "compute corner
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   331
    "
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   332
    |d c|
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   333
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   334
    c := anchor + extent.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   335
    d := tabView direction.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   336
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   337
    d == #top    ifTrue:[^ ( c x @ (tabView extent y) )].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   338
    d == #left   ifTrue:[^ ( (tabView extent x) @ c y ) ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   339
    d == #right  ifTrue:[^ ( 0 @ c y )].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   340
    d == #bottom ifTrue:[^ ( c x @ 0 )].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   341
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   342
    self error.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   343
!
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   344
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   345
computeOrigin
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   346
    "compute origin
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|
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   349
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   350
    d := tabView direction.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   351
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   352
    d == #top    ifTrue:[ ^ anchor x @ ((tabView extent y) - anchor y) ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   353
    d == #left   ifTrue:[ ^ ((tabView extent x) - anchor x) @ anchor y ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   354
    d == #right  ifTrue:[ ^ anchor ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   355
    d == #bottom ifTrue:[ ^ anchor ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   356
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   357
    self error
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   358
! !
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   359
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   360
!TabWidget methodsFor:'queries'!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   361
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   362
containsPoint:aPoint
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   363
    "return true, if a point is contained in the tab
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   364
    "
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   365
    |d x y top bot origin|
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   366
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   367
    d := tabView direction.
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   368
    x := aPoint x.
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   369
    y := aPoint y.
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   370
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   371
    origin := self computeOrigin.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   372
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   373
    (d == #top or:[d == #bottom]) ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   374
        ((x >= origin x) and:[x <= (origin x + extent x)]) ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   375
            d == #top ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   376
                ^ ((y >=  origin y) and:[y <= (origin y + extent y)])
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   377
            ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   378
            ^ ((y <=  origin y) and:[y >= (origin y - extent y)])
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   379
        ]
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   380
    ] ifFalse:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   381
        ((y >= origin y) and:[y <= (origin y + extent y)]) ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   382
            d == #right ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   383
                ^ ((x <= origin x) and:[x >= (origin x - extent x)])
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   384
            ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   385
            ^ ((x >= origin x) and:[x <= (origin x + extent x)])
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   386
        ]
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   387
    ].
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   388
    ^ false
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   389
! !
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   390
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   391
!TabWidget::Window class methodsFor:'accessing'!
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   392
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   393
tabStyleOn:aView
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   394
    |style col|
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   395
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   396
    style := super tabStyleOn:aView.
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   397
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   398
    style at:#expandSelection    put:4@4.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   399
    style at:#tabLevel           put:2.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   400
    style at:#lableTopInset      put:2.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   401
    style at:#labelBottomInset   put:2.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   402
    style at:#roundedEdges       put:true.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   403
  ^ style
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   404
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   405
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   406
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   407
! !
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   408
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   409
!TabWidget::Window class methodsFor:'calculate dimensions'!
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
validateDimensions:aStyle
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   412
    "validate dimensions for a style; could be redifined
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   413
    "
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   414
    |maxY anchor|
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   415
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   416
    (aStyle at:#roundedEdges) ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   417
        maxY := aStyle at:#maxY.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   418
        aStyle at:#maxY put:(maxY + 3).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   419
        anchor := aStyle at:#labelAnchor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   420
        anchor y:(anchor y + 1).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   421
        aStyle at:#labelAnchor put:anchor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   422
    ]
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   423
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
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   426
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   427
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   428
! !
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   429
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   430
!TabWidget::Window methodsFor:'drawing'!
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   431
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   432
redrawAtBottom:isSelected
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   433
    "redraw tab at bottom of view
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   434
    "
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   435
    |origin corner y x xR yB tabLevel light roundedEdges shadowColor lightColor|
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   436
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   437
    origin := self computeOrigin.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   438
    corner := self computeCorner.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   439
    x   := origin x.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   440
    y   := origin y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   441
    xR  := corner x - 1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   442
    yB  := 0.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   443
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   444
    roundedEdges := tabView styleAt:#roundedEdges.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   445
    tabLevel     := (tabView styleAt:#tabLevel) - 1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   446
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   447
    isSelected ifFalse:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   448
        tabView paint:(tabView styleAt:#unselectedColor).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   449
        shadowColor := tabView styleAt:#shadowColorUnselected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   450
        lightColor  := tabView styleAt:#lightColorUnselected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   451
    ] ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   452
        tabView paint:(tabView styleAt:#selectedColor).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   453
        shadowColor := tabView styleAt:#shadowColorSelected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   454
        lightColor  := tabView styleAt:#lightColorSelected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   455
    ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   456
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   457
    roundedEdges ifTrue:[y := y - 2].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   458
    tabView fillRectangle:(Rectangle left:x top:yB extent:(extent x @ y)).
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   459
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   460
    roundedEdges ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   461
        tabView displayLineFromX:x-1 y:y toX:xR y:y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   462
        y := y - 1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   463
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   464
        tabView paint:lightColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   465
        tabView displayPointX:x   y:y+1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   466
        tabView displayPointX:x+1 y:y+1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   467
        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
   468
        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
   469
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   470
        tabView paint:shadowColor.
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   471
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   472
        0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   473
            tabView displayPointX:xR-i   y:y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   474
            tabView displayPointX:xR-i   y:y+1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   475
            tabView displayPointX:xR-1-i y:y+2.
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
        tabView displayPointX:xR-2 y:y+3.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   478
        tabView displayPointX:xR-3 y:y+3.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   479
    ].
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
    tabView paint:lightColor.
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
    0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   484
        roundedEdges ifFalse:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   485
            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
   486
        ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   487
        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
   488
    ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   489
    y := y + 1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   490
    tabView paint:shadowColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   491
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   492
    0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   493
        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
   494
    ].
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   495
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   496
!
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   497
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   498
redrawAtLeft:isSelected
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   499
    "redraw tab at left of view
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   500
    "
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   501
    |origin corner y x xR yB tabLevel light roundedEdges shadowColor lightColor|
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   502
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   503
    origin := self computeOrigin.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   504
    corner := self computeCorner.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   505
    x   := origin x.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   506
    y   := origin y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   507
    xR  := corner x.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   508
    yB  := corner y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   509
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   510
    roundedEdges := tabView styleAt:#roundedEdges.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   511
    tabLevel     := (tabView styleAt:#tabLevel) - 1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   512
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   513
    isSelected ifFalse:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   514
        tabView paint:(tabView styleAt:#unselectedColor).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   515
        shadowColor := tabView styleAt:#shadowColorUnselected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   516
        lightColor  := tabView styleAt:#lightColorUnselected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   517
    ] ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   518
        tabView paint:(tabView styleAt:#selectedColor).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   519
        shadowColor := tabView styleAt:#shadowColorSelected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   520
        lightColor  := tabView styleAt:#lightColorSelected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   521
    ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   522
    tabView fillRectangle:(Rectangle left:x top:y extent:(xR @ extent y)).
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
    roundedEdges ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   525
        tabView displayLineFromX:x y:y toX:x y:yB.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   526
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   527
        tabView paint:lightColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   528
        tabView displayPointX:x y:y+1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   529
        tabView displayPointX:x y:y+2.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   530
        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
   531
        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
   532
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   533
        tabView paint:shadowColor.
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   534
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   535
        0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   536
            tabView displayPointX:x   y:yB-i.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   537
            tabView displayPointX:x-1 y:yB-i-1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   538
            tabView displayPointX:x-2 y:yB-i-2.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   539
        ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   540
    ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   541
    tabView paint:lightColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   542
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   543
    0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   544
        roundedEdges ifFalse:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   545
            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
   546
        ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   547
        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
   548
    ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   549
    tabView paint:shadowColor.
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   550
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   551
    0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   552
        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
   553
    ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   554
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   555
!
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   556
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   557
redrawAtRight:isSelected
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   558
    "redraw tab at right of view
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   559
    "
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   560
    |origin corner y x xR yB tabLevel light roundedEdges shadowColor lightColor|
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   561
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   562
    origin := self computeOrigin.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   563
    corner := self computeCorner.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   564
    x   := origin x.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   565
    y   := origin y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   566
    xR  := corner x - 1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   567
    yB  := corner y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   568
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   569
    roundedEdges := tabView styleAt:#roundedEdges.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   570
    tabLevel     := (tabView styleAt:#tabLevel) - 1.
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   571
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   572
    isSelected ifFalse:[
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   573
        tabView paint:(tabView styleAt:#unselectedColor).
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   574
        shadowColor := tabView styleAt:#shadowColorUnselected.
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   575
        lightColor  := tabView styleAt:#lightColorUnselected.
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   576
    ] ifTrue:[
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   577
        tabView paint:(tabView styleAt:#selectedColor).
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   578
        shadowColor := tabView styleAt:#shadowColorSelected.
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   579
        lightColor  := tabView styleAt:#lightColorSelected.
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   580
    ].
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   581
    tabView fillRectangle:(Rectangle left:0 top:y extent:(x @ extent y)).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   582
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   583
    roundedEdges ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   584
        tabView displayLineFromX:x y:y toX:x y:yB.
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   585
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   586
        tabView paint:lightColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   587
        tabView displayPointX:x y:y+1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   588
        tabView displayPointX:x y:y+2.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   589
        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
   590
        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
   591
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   592
        tabView paint:shadowColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   593
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   594
        0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   595
            tabView displayPointX:x   y:yB-i.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   596
            tabView displayPointX:x+1 y:yB-i-1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   597
            tabView displayPointX:x+2 y:yB-i-2.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   598
        ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   599
    ].
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   600
    tabView paint:lightColor.
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   601
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   602
    0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   603
        roundedEdges ifFalse:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   604
            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
   605
        ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   606
        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
   607
    ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   608
    tabView paint:shadowColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   609
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   610
    0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   611
        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
   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
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   615
redrawAtTop:isSelected
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   616
    "redraw tab at top of view
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   617
    "
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   618
    |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
   619
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   620
    origin := self computeOrigin.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   621
    corner := self computeCorner.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   622
    x   := origin x.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   623
    y   := origin y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   624
    xR  := corner x - 1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   625
    yB  := corner y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   626
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   627
    roundedEdges := tabView styleAt:#roundedEdges.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   628
    tabLevel     := (tabView styleAt:#tabLevel) - 1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   629
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   630
    isSelected ifFalse:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   631
        tabView paint:(tabView styleAt:#unselectedColor).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   632
        shadowColor := tabView styleAt:#shadowColorUnselected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   633
        lightColor  := tabView styleAt:#lightColorUnselected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   634
    ] ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   635
        tabView paint:(tabView styleAt:#selectedColor).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   636
        shadowColor := tabView styleAt:#shadowColorSelected.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   637
        lightColor  := tabView styleAt:#lightColorSelected.
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   638
    ].
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   639
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   640
    roundedEdges ifTrue:[ y :=  y + 2].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   641
    tabView fillRectangle:(Rectangle left:x top:y extent:((extent x) @ yB)).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   642
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   643
    roundedEdges ifTrue:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   644
        y :=  y + 1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   645
        tabView displayLineFromX:x y:y-1   toX:xR y:y-1.          
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   646
        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
   647
        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
   648
        
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   649
        tabView paint:lightColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   650
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   651
        0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   652
            tabView displayPointX:x+i y:y-1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   653
            tabView displayPointX:x+1+i y:y-1-1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   654
            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
   655
        ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   656
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   657
        tabView paint:shadowColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   658
        0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   659
            tabView displayPointX:xR-i y:y.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   660
            tabView displayPointX:xR-i y:y-1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   661
            tabView displayPointX:xR-1-i y:y-1-1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   662
        ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   663
        tabView displayPointX:xR-2 y:y-1-1-1.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   664
        tabView displayPointX:xR-3 y:y-1-1-1.
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   665
    ].
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   666
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   667
    tabView paint:lightColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   668
    0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   669
        roundedEdges ifFalse:[
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   670
            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
   671
        ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   672
        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
   673
    ].
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   674
    tabView paint:shadowColor.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   675
    0 to:tabLevel do:[:i |
cff1a140978f tabs at top, bottom, left and right
ca
parents: 351
diff changeset
   676
        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
   677
    ].
350
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   678
! !
cb420d4899ab labelRightInset
ca
parents: 343
diff changeset
   679
392
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   680
!TabWidget::Mac class methodsFor:'accessing'!
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   681
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   682
tabStyleOn:aView
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   683
    |style|
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   684
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   685
    style := super tabStyleOn:aView.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   686
    style at:#tabLevel put:2.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   687
  ^ style.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   688
! !
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   689
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   690
!TabWidget::Mac class methodsFor:'calculate dimensions'!
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   691
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   692
validateDimensions:aStyle
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   693
    "validate dimensions for a style; could be redifined
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   694
    "
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   695
    |maxY maxX anchor lftIns|
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   696
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   697
    maxY   := aStyle at:#maxY.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   698
    maxX   := (aStyle at:#maxX) - (aStyle at:#labelLeftInset).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   699
    anchor := aStyle at:#labelAnchor.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   700
    lftIns := maxY // 2.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   701
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   702
    anchor x:lftIns.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   703
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   704
    aStyle at:#maxX         put:(maxX + lftIns + maxY).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   705
    aStyle at:#rightCovered put:(maxY // 2).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   706
! !
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   707
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   708
!TabWidget::Mac methodsFor:'drawing'!
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   709
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   710
redrawAtBottom:isSelected
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   711
    "redraw tab at bottom of view
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   712
    "
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   713
    |origin corner level polygon x y x1 eX eY shadowColor lightColor|
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   714
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   715
    isSelected ifFalse:[
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   716
        lightColor  := tabView styleAt:#lightColorUnselected.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   717
        shadowColor := tabView styleAt:#shadowColorUnselected.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   718
        tabView paint:(tabView styleAt:#unselectedColor).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   719
    ] ifTrue:[
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   720
        lightColor  := tabView styleAt:#lightColorSelected.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   721
        shadowColor := tabView styleAt:#shadowColorSelected.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   722
        tabView paint:(tabView styleAt:#selectedColor).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   723
    ].
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   724
    polygon := Array new:5.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   725
    origin  := self computeOrigin.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   726
    corner  := self computeCorner.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   727
    level   := tabView styleAt:#tabLevel.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   728
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   729
    x  := origin x.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   730
    y  := origin y.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   731
    eX := corner x.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   732
    eY := corner y.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   733
    x1 := eX - (tabView styleAt:#maxY).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   734
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   735
    polygon at:1 put:(Point x:x  y:eY).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   736
    polygon at:2 put:(Point x:x  y:y).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   737
    polygon at:3 put:(Point x:x1 y:y).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   738
    polygon at:4 put:(Point x:eX y:(y-extent y)).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   739
    polygon at:5 put:(Point x:eX y:eY).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   740
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   741
    tabView fillPolygon:polygon.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   742
    tabView paint:lightColor.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   743
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   744
    1 to:level do:[:i|
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   745
        tabView displayLineFromX:x+1 y:y-i toX:x1+i y:y-i.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   746
        tabView displayLineFromX:x+i y:y-1 toX:x+i  y:1.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   747
    ].
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   748
    tabView paint:shadowColor.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   749
    tabView displayPolygon:polygon.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   750
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   751
    isSelected ifFalse:[
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   752
        tabView displayLineFromX:x y:eY toX:eX y:eY.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   753
    ]
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   754
!
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   755
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   756
redrawAtLeft:isSelected
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   757
    "redraw tab at left of view
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   758
    "
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   759
    |origin corner polygon level x y y1 eX eY shadowColor lightColor|
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   760
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   761
    isSelected ifFalse:[
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   762
        lightColor  := tabView styleAt:#lightColorUnselected.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   763
        shadowColor := tabView styleAt:#shadowColorUnselected.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   764
        tabView paint:(tabView styleAt:#unselectedColor).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   765
    ] ifTrue:[
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   766
        lightColor  := tabView styleAt:#lightColorSelected.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   767
        shadowColor := tabView styleAt:#shadowColorSelected.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   768
        tabView paint:(tabView styleAt:#selectedColor).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   769
    ].
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   770
    polygon := Array new:5.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   771
    origin  := self computeOrigin.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   772
    corner  := self computeCorner.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   773
    level   := tabView styleAt:#tabLevel.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   774
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   775
    x  := origin x.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   776
    y  := origin y.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   777
    eX := corner x.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   778
    eY := corner y.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   779
    y1 := eY - (tabView styleAt:#maxY).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   780
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   781
    polygon at:1 put:(Point x:eX           y:y).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   782
    polygon at:2 put:(Point x:x            y:y).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   783
    polygon at:3 put:(Point x:x            y:y1).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   784
    polygon at:4 put:(Point x:(x+extent x) y:eY).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   785
    polygon at:5 put:(Point x:eX           y:eY).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   786
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   787
    tabView fillPolygon:polygon.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   788
    tabView paint:lightColor.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   789
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   790
    1 to:level do:[:i|
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   791
        tabView displayLineFromX:eX  y:y+i toX:x+2  y:y+i.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   792
        tabView displayLineFromX:x+i y:y+1 toX:x+i  y:y1+i.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   793
    ].
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   794
    tabView paint:shadowColor.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   795
    tabView displayPolygon:polygon.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   796
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   797
    isSelected ifFalse:[
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   798
        tabView displayLineFromX:eX-1 y:y toX:eX-1 y:eY.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   799
    ]
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   800
!
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   801
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   802
redrawAtRight:isSelected
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   803
    "redraw tab at right of view
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   804
    "
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   805
    |origin corner level polygon x y y1 eY shadowColor lightColor|
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   806
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   807
    isSelected ifFalse:[
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   808
        lightColor  := tabView styleAt:#lightColorUnselected.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   809
        shadowColor := tabView styleAt:#shadowColorUnselected.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   810
        tabView paint:(tabView styleAt:#unselectedColor).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   811
    ] ifTrue:[
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   812
        lightColor  := tabView styleAt:#lightColorSelected.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   813
        shadowColor := tabView styleAt:#shadowColorSelected.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   814
        tabView paint:(tabView styleAt:#selectedColor).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   815
    ].
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   816
    polygon := Array new:5.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   817
    origin  := self computeOrigin.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   818
    corner  := self computeCorner.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   819
    level   := tabView styleAt:#tabLevel.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   820
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   821
    x  := origin x.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   822
    y  := origin y.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   823
    eY := corner y.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   824
    y1 := eY - (tabView styleAt:#maxY).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   825
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   826
    polygon at:1 put:(Point x:0            y:y).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   827
    polygon at:2 put:(Point x:x            y:y).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   828
    polygon at:3 put:(Point x:x            y:y1).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   829
    polygon at:4 put:(Point x:(x-extent x) y:eY).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   830
    polygon at:5 put:(Point x:0            y:eY).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   831
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   832
    tabView fillPolygon:polygon.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   833
    tabView paint:lightColor.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   834
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   835
    1 to:level do:[:i|
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   836
        tabView displayLineFromX:0   y:y+i toX:x-1  y:y+i.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   837
        tabView displayLineFromX:x-i y:y+1 toX:x-i  y:y1+i.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   838
    ].
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   839
    tabView paint:shadowColor.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   840
    tabView displayPolygon:polygon.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   841
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   842
    isSelected ifFalse:[
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   843
        tabView displayLineFromX:0 y:y toX:0 y:eY.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   844
    ]
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   845
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   846
!
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   847
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   848
redrawAtTop:isSelected
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   849
    "redraw tab at top of view
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   850
    "
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   851
    |origin corner level polygon x y x1 eX eY color shadowColor lightColor|
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   852
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   853
    isSelected ifFalse:[
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   854
        lightColor  := tabView styleAt:#lightColorUnselected.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   855
        shadowColor := tabView styleAt:#shadowColorUnselected.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   856
        tabView paint:(tabView styleAt:#unselectedColor).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   857
    ] ifTrue:[
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   858
        lightColor  := tabView styleAt:#lightColorSelected.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   859
        shadowColor := tabView styleAt:#shadowColorSelected.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   860
        tabView paint:(tabView styleAt:#selectedColor).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   861
    ].
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   862
    polygon := Array new:5.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   863
    origin  := self computeOrigin.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   864
    corner  := self computeCorner.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   865
    level   := tabView styleAt:#tabLevel.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   866
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   867
    x  := origin x.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   868
    y  := origin y.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   869
    eX := corner x - 1.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   870
    eY := corner y.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   871
    x1 := eX - (tabView styleAt:#maxY).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   872
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   873
    polygon at:1 put:(Point x:x  y:eY).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   874
    polygon at:2 put:(Point x:x  y:y).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   875
    polygon at:3 put:(Point x:x1 y:y).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   876
    polygon at:4 put:(Point x:eX y:(y+extent y)).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   877
    polygon at:5 put:(Point x:eX y:eY).
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   878
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   879
    tabView fillPolygon:polygon.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   880
    tabView paint:lightColor.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   881
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   882
    1 to:level do:[:i|
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   883
        tabView displayLineFromX:x+i y:eY  toX:x+i  y:y+1.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   884
        tabView displayLineFromX:x+1 y:y+i toX:x1+i y:y+i.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   885
    ].
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   886
    tabView paint:shadowColor.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   887
    tabView displayPolygon:polygon.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   888
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   889
    isSelected ifFalse:[
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   890
        tabView displayLineFromX:x y:eY-1 toX:eX y:eY-1.
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   891
    ]
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   892
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   893
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   894
! !
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   895
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   896
!TabWidget class methodsFor:'documentation'!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   897
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   898
version
392
de153c1428c2 handle enable notification
ca
parents: 370
diff changeset
   899
    ^ '$Header: /cvs/stx/stx/libwidg2/TabWidget.st,v 1.7 1997-05-24 03:10:39 ca Exp $'
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   900
! !