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