HorizontalScrollBar.st
author Claus Gittinger <cg@exept.de>
Thu, 23 Nov 1995 19:19:24 +0100
changeset 205 6814c0bf8df8
parent 174 d80a6cc3f9b2
child 585 8f395aba0173
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     1
"
5
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
     3
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     4
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    12
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    13
ScrollBar subclass:#HorizontalScrollBar
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    14
	 instanceVariableNames:''
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    15
	 classVariableNames:''
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    16
	 poolDictionaries:''
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    17
	 category:'Views-Interactors'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    18
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    19
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    20
!HorizontalScrollBar class methodsFor:'documentation'!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    21
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    22
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    23
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    24
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    25
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    26
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    27
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    28
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    30
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    31
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    32
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    33
"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    34
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    35
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    36
documentation
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    37
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    38
    this class implements horizontal scrollbars with scroller and
116
claus
parents: 70
diff changeset
    39
    2 step-scroll buttons. When moved or stepped, it performs a
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    40
    predefined action.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    41
"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    42
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    43
127
claus
parents: 116
diff changeset
    44
!HorizontalScrollBar methodsFor:'accessing-behavior'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    45
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    46
scrollLeftAction
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    47
    "return the action which is performed on scroll-left"
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    48
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    49
    ^ button1 action
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    50
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    51
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    52
scrollLeftAction:aBlock
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    53
    "set the action to be performed on scroll-left"
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    54
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    55
    button1 action:aBlock
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    56
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    57
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    58
scrollRightAction
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    59
    "return the action which is performed on scroll-right"
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    60
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    61
    ^ button2 action
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    62
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    63
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    64
scrollRightAction:aBlock
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    65
    "set the action  to be performed on scroll-right"
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    66
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    67
    button2 action:aBlock
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    68
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    69
70
14443a9ea4ec *** empty log message ***
claus
parents: 63
diff changeset
    70
!HorizontalScrollBar methodsFor:'event handling'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    71
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    72
sizeChanged:how
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    73
    "handle changed size - reposition elements"
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    74
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    75
    |leftWidth rightWidth thumbWidth leftAndRightWidth bwn sep2 
130
claus
parents: 128
diff changeset
    76
     thumbHeight h style b1Hidden b2Hidden thumbHidden bX|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    77
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    78
    button1 isNil ifTrue:[^ self].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    79
    button2 isNil ifTrue:[^ self].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    80
    thumb isNil ifTrue:[^ self].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    81
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    82
    leftWidth := button1 width + borderWidth.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    83
    rightWidth := button2 width + borderWidth.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    84
    leftAndRightWidth := leftWidth + rightWidth.
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
    85
    bwn := borderWidth negated + margin.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    86
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    87
    thumbWidth := width - leftAndRightWidth - borderWidth - (elementSpacing * 3).
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
    88
"
130
claus
parents: 128
diff changeset
    89
    ((buttonLayout ~~ #top) and:[buttonLayout ~~ #bottom]) ifTrue:[
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    90
	thumbWidth := thumbWidth - borderWidth
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    91
    ].
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
    92
"
130
claus
parents: 128
diff changeset
    93
    buttonLayout == #around ifTrue:[
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    94
	thumbWidth := thumbWidth + borderWidth
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
    95
    ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    96
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    97
    "if I become too small, hide buttons"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    98
130
claus
parents: 128
diff changeset
    99
    width < leftAndRightWidth ifTrue:[
claus
parents: 128
diff changeset
   100
	b1Hidden := b2Hidden := thumbHidden := true.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   101
    ] ifFalse:[
130
claus
parents: 128
diff changeset
   102
	b1Hidden := b2Hidden := thumbHidden := false.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   103
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   104
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   105
    (thumbWidth < 10) ifTrue:[
130
claus
parents: 128
diff changeset
   106
	thumbHidden := true.
claus
parents: 128
diff changeset
   107
    ] ifFalse:[
claus
parents: 128
diff changeset
   108
	thumbHidden := false.
claus
parents: 128
diff changeset
   109
    ].
claus
parents: 128
diff changeset
   110
claus
parents: 128
diff changeset
   111
    button1 hiddenOnRealize:b1Hidden.
claus
parents: 128
diff changeset
   112
    b1Hidden ifTrue:[
claus
parents: 128
diff changeset
   113
	button1 unrealize
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   114
    ] ifFalse:[
130
claus
parents: 128
diff changeset
   115
	shown ifTrue:[button1 realize]
claus
parents: 128
diff changeset
   116
    ].
claus
parents: 128
diff changeset
   117
    button2 hiddenOnRealize:b1Hidden.
claus
parents: 128
diff changeset
   118
    b2Hidden ifTrue:[
claus
parents: 128
diff changeset
   119
	button2 unrealize
claus
parents: 128
diff changeset
   120
    ] ifFalse:[
claus
parents: 128
diff changeset
   121
	shown ifTrue:[button2 realize]
claus
parents: 128
diff changeset
   122
    ].
claus
parents: 128
diff changeset
   123
    thumb hiddenOnRealize:thumbHidden.
claus
parents: 128
diff changeset
   124
    thumbHidden ifTrue:[
claus
parents: 128
diff changeset
   125
	thumb unrealize
claus
parents: 128
diff changeset
   126
    ] ifFalse:[
claus
parents: 128
diff changeset
   127
	shown ifTrue:[thumb realize]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   128
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   129
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   130
    "height of buttons is always my width"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   131
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   132
    h := height - (margin * 2).
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   133
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   134
    (h ~~ button1 height) ifTrue:[
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   135
	button1 height:h.
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   136
	button2 height:h
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   137
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   138
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   139
    thumbHeight := h.
130
claus
parents: 128
diff changeset
   140
    style := styleSheet name.
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   141
    style == #next ifTrue:[
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   142
	thumbHeight := thumbHeight - (thumb borderWidth * 2).
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   143
	thumbWidth := thumbWidth - 1
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   144
    ].
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   145
    style == #motif ifTrue:[
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   146
	thumbWidth := thumbWidth - margin
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   147
    ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   148
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   149
    "
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   150
     a kludge: views with width or height of 0 are illegal
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   151
     avoid error from view-creation (it will be hidden anyway)
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   152
    "
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   153
    thumbWidth <= 0 ifTrue:[
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   154
	thumbWidth := 1
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   155
    ].
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
   156
130
claus
parents: 128
diff changeset
   157
    (buttonLayout == #bottom) ifTrue:[
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   158
	"buttons at left"
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   159
	thumb extent:(thumbWidth @ thumbHeight).
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   160
	^ self
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   161
    ].
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   162
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   163
    sep2 := elementSpacing * 2.
130
claus
parents: 128
diff changeset
   164
    (buttonLayout == #top) ifTrue:[
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   165
	"buttons at right"
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   166
	thumbWidth := thumbWidth + borderWidth.
130
claus
parents: 128
diff changeset
   167
	thumbHidden ifTrue:[
claus
parents: 128
diff changeset
   168
	    bX := elementSpacing
claus
parents: 128
diff changeset
   169
	] ifFalse:[
claus
parents: 128
diff changeset
   170
	    bX := thumbWidth + sep2.
claus
parents: 128
diff changeset
   171
	].
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   172
	(how == #smaller) ifTrue:[
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   173
	    thumb extent:(thumbWidth @ thumbHeight).
130
claus
parents: 128
diff changeset
   174
	    button1 origin:(bX @ bwn).
claus
parents: 128
diff changeset
   175
	    button2 origin:((bX + leftWidth) @ bwn)
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   176
	] ifFalse:[
130
claus
parents: 128
diff changeset
   177
	    button1 origin:(bX @ bwn).
claus
parents: 128
diff changeset
   178
	    button2 origin:((bX + leftWidth) @ bwn).
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   179
	    thumb extent:(thumbWidth @ thumbHeight)
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   180
	].
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   181
	^ self
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   182
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   183
    "button around thumb"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   184
128
claus
parents: 127
diff changeset
   185
    style == #motif ifTrue:[
claus
parents: 127
diff changeset
   186
	sep2 := sep2 + 1
claus
parents: 127
diff changeset
   187
    ].
claus
parents: 127
diff changeset
   188
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   189
    button1 origin:(bwn @ bwn).
128
claus
parents: 127
diff changeset
   190
    style == #os2 ifTrue:[
claus
parents: 127
diff changeset
   191
	button2 origin:((leftWidth + thumbWidth + sep2 - margin) @ bwn).
claus
parents: 127
diff changeset
   192
	thumb extent:((thumbWidth - margin - margin) @ thumbHeight).
claus
parents: 127
diff changeset
   193
	thumb origin:((leftWidth - borderWidth + elementSpacing + margin) @ bwn)
claus
parents: 127
diff changeset
   194
    ] ifFalse:[
claus
parents: 127
diff changeset
   195
	button2 origin:((leftWidth + thumbWidth + sep2 - (margin // 2)) @ bwn).
claus
parents: 127
diff changeset
   196
	thumb extent:((thumbWidth + margin - (margin // 2)) @ thumbHeight).
claus
parents: 127
diff changeset
   197
	thumb origin:((leftWidth - borderWidth + elementSpacing) @ bwn)
claus
parents: 127
diff changeset
   198
    ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   199
! !
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   200
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   201
!HorizontalScrollBar methodsFor:'initialization'!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   202
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   203
createElements
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   204
    "private: create my elements"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   206
    button1 := ArrowButton leftIn:self.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   207
    button2 := ArrowButton rightIn:self.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   208
    thumb := HorizontalScroller in:self.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   209
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   210
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   211
setElementPositions
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   212
    "position sub-components"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   213
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   214
    |bwn|
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   215
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   216
    bwn := borderWidth negated + margin.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   217
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   218
    (buttonLayout == #bottom) ifTrue:[
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   219
	"buttons at left"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   220
	button1 origin:(bwn @ bwn).
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   221
	button1 viewGravity:#West.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   222
	button2 origin:(button1 width @ bwn).
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   223
	button2 viewGravity:#West.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   224
	thumb origin:((button1 width 
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   225
		       + borderWidth 
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   226
		       + button2 width 
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   227
		       + elementSpacing + elementSpacing) @ bwn).
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   228
	thumb viewGravity:#West.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   229
	^ self
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   230
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   231
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   232
    (buttonLayout == #top) ifTrue:[
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   233
	"buttons at right"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   234
	button1 viewGravity:#West.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   235
	button2 viewGravity:#West.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   236
	thumb origin:(bwn @ bwn).
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   237
	thumb viewGravity:#West
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   238
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   239
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   240
    "buttonLayout == #around "
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   241
    button1 origin:(bwn @ bwn).
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   242
    button1 viewGravity:#West.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   243
    button2 viewGravity:#West.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   244
    thumb origin:((button1 width + elementSpacing) @ bwn).
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   245
    thumb viewGravity:#West
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   246
! !
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   247
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   248
!HorizontalScrollBar methodsFor:'queries'!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   249
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   250
preferredExtent
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   251
    "compute my extent from sub-components"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   252
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   253
    |w h leftForm rightForm wLeft hLeft wRight hRight style|
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   254
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   255
    "need fix - this is a kludge;
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   256
     the if should not be needed ..."
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   257
    style := styleSheet name.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   258
    style == #mswindows ifTrue:[
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   259
	h := button1 height max:button2 height.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   260
	w := button1 width + button2 width + (Scroller defaultExtent x).
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   261
    ] ifFalse:[
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   262
	leftForm  := ArrowButton leftArrowButtonForm:style on:device.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   263
	rightForm := ArrowButton rightArrowButtonForm:style on:device.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   264
	"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   265
	 just in case ...
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   266
	"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   267
	leftForm isNil ifTrue:[
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   268
	    wLeft := hLeft := 16
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   269
	] ifFalse:[
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   270
	    wLeft := leftForm width.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   271
	    hLeft := leftForm height
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   272
	].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   273
	rightForm isNil ifTrue:[
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   274
	    wRight := hRight := 16
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   275
	] ifFalse:[
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   276
	    wRight := rightForm width.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   277
	    hRight := rightForm height
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   278
	].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   279
	w := wLeft + wRight + (1 * 2) + (HorizontalScroller defaultExtent x).
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   280
	h := hLeft max:hRight.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   281
	(style ~~ #normal) ifTrue:[
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   282
	    h := h + 4.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   283
	    w := w + 4
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   284
	].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   285
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   286
    ^ w @ h.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   287
! !
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   288
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   289
!HorizontalScrollBar class methodsFor:'documentation'!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   290
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   291
version
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   292
    ^ '$Header: /cvs/stx/stx/libwidg/HorizontalScrollBar.st,v 1.16 1995-11-23 18:18:49 cg Exp $'
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   293
! !