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