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