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