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