ScrollBar.st
author ca
Thu, 07 Mar 1996 10:33:53 +0100
changeset 487 4ee60598df58
parent 482 f4d7344ae396
child 491 7b376aaa06d5
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
119
claus
parents: 110
diff changeset
    13
SimpleView subclass:#ScrollBar
345
00abc00e73a9 use #autoRepeat:
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    14
	instanceVariableNames:'thumb button1 button2 buttonLayout elementSpacing'
00abc00e73a9 use #autoRepeat:
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    15
	classVariableNames:'DefaultButtonPositions DefaultLevel DefaultElementSpacing
00abc00e73a9 use #autoRepeat:
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    16
		DefaultScrollerBordered'
00abc00e73a9 use #autoRepeat:
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    17
	poolDictionaries:''
00abc00e73a9 use #autoRepeat:
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    18
	category:'Views-Interactors'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    19
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    20
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    21
!ScrollBar class methodsFor:'documentation'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    22
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    23
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    24
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    25
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    26
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    27
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    28
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    29
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    31
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    32
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    33
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    34
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    35
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    36
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    37
documentation
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    38
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    39
    this class implements vertical scrollbars with scroller and
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    40
    2 step-scroll buttons. when moved or stepped, it performs a
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    41
    predefined action.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    42
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    43
    The action is specified by:                 the block to be evaluated for step-up
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    44
	aScrollBar scrollUpAction:aBlock 
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    45
	(scrollLeftAction for hor-Scrollbars)
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    46
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    47
	aScrollBar scrollDownAction:aBlock      the block to be evaluated for step-down
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    48
	(scrollRightAction for hor-Scrollbars)
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    49
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    50
	aScrollbar scrollAction:aBlock          the block to be evaluated for scroll
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    51
						passing percentage as argument.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    52
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    53
    Scrollbars can scroll syncronous (i.e. every movement is notified immediately via the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    54
    scrollAction) or asynchronous (i.e. only one notification takes place at the end of the movement).
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    55
    The choice is up to the user of the scrollbar (typically, views which are complicated to redraw,
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    56
    will set it to asynchronous.)
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    57
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    58
    Most often scrollbars are used hidden with ScrollableView or HVScrollableView (i.e. you
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    59
    dont have to care for all the details).
128
claus
parents: 119
diff changeset
    60
claus
parents: 119
diff changeset
    61
    The scrollBars and scrollers protocols have been made similar enough to
claus
parents: 119
diff changeset
    62
    allow transparent use of either a scroller or a scrollBar in applications.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    63
"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    64
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    65
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    66
!ScrollBar class methodsFor:'style changes'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    67
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    68
updateStyleCache
440
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
    69
    "extract values from the styleSheet and cache them in class variables"
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
    70
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
    71
    <resource: #style (#scrollBarButtonPositions #scrollBarLevel
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
    72
		       #scrollBarScrollerBordered #scrollBarElementSpacing)>
440
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
    73
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    74
    DefaultButtonPositions := StyleSheet at:'scrollBarButtonPositions' default:#bottom.
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    75
    DefaultLevel := StyleSheet at:'scrollBarLevel'.
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    76
    DefaultScrollerBordered := StyleSheet at:'scrollBarScrollerBordered' default:false.
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    77
    DefaultElementSpacing := StyleSheet at:'scrollBarElementSpacing' 
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
    78
					default:(StyleSheet is3D ifTrue:[1] ifFalse:[0]).
440
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
    79
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
    80
    "Modified: 1.3.1996 / 13:46:29 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    81
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    82
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    83
!ScrollBar methodsFor:'accessing'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    84
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
    85
thumbHeight
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
    86
    "return height of thumb in percent"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
    87
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
    88
    ^ thumb thumbHeight
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
    89
!
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
    90
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
    91
thumbHeight:newHeight
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
    92
    "set height of thumb in percent"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
    93
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
    94
    thumb thumbHeight:newHeight.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
    95
    self enableDisableButtons
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
    96
!
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
    97
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
    98
thumbOrigin
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
    99
    "return position of (top of) thumb in percent"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   100
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   101
    ^ thumb thumbOrigin
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   102
!
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   103
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   104
thumbOrigin:newOrigin
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   105
    "set position of (top of) thumb in percent"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   106
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   107
    thumb thumbOrigin:newOrigin.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   108
    self enableDisableButtons
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   109
!
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   110
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   111
thumbOrigin:newOrigin thumbHeight:newHeight
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   112
    "set origin and height of thumb (both in percent)"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   113
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   114
    thumb thumbOrigin:newOrigin thumbHeight:newHeight.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   115
    self enableDisableButtons
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   116
! !
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   117
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   118
!ScrollBar methodsFor:'accessing-behavior'!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   119
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   120
asynchronousOperation
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   121
    "set asynchronous-mode - scroll action is performed after movement
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   122
     of scroller (i.e. when mouse-button is finally released).
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   123
     This is forwarded to the scroller here."
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   124
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   125
    thumb asynchronousOperation
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   126
!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   127
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   128
scrollAction:aBlock
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   129
    "set the action, aBlock to be performed when the scroller is moved.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   130
     This is forwarded to the scroller here."
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   131
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   132
    thumb scrollAction:aBlock
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   133
!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   134
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   135
scrollDownAction:aBlock
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   136
    "set the action, aBlock to be performed when the down-button is pressed."
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   137
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   138
    button2 action:aBlock
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   139
!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   140
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   141
scrollUpAction:aBlock
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   142
    "set the action, aBlock to be performed when the up-button is pressed."
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   143
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   144
    button1 action:aBlock
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   145
!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   146
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   147
synchronousOperation
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   148
    "set synchronous-mode - scroll action is performed for every movement
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   149
     of scroller.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   150
     This is forwarded to the scroller here."
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   151
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   152
    thumb synchronousOperation
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   153
! !
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   154
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   155
!ScrollBar methodsFor:'accessing-components'!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   156
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   157
downButton
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   158
    "return the down-button
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   159
     (Please: only use this direct access for special applications)"
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   160
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   161
    ^ button2
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   162
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   163
    "
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   164
     |v|
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   165
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   166
     v := ScrollableView for:EditTextView.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   167
     v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile).
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   168
     v scrollBar upButton activeForegroundColor:Color red.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   169
     v scrollBar downButton activeForegroundColor:Color red.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   170
     v open
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   171
    "
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   172
!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   173
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   174
thumb 
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   175
    "return the thumb (i.e. the scroller subview)
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   176
     (Please: only use this direct access for special applications)"
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   177
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   178
    ^ thumb
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   179
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   180
    "
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   181
     |v|
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   182
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   183
     v := ScrollableView for:EditTextView.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   184
     v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile).
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   185
     v scrollBar thumb thumbColor:(Color red).
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   186
     v open
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   187
    "
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   188
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   189
    "Modified: 1.3.1996 / 19:15:50 / cg"
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   190
!
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   191
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   192
upButton
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   193
    "return the up-button
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   194
     (Please: only use this direct access for special applications)"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   195
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   196
    ^ button1
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   197
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   198
    "
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   199
     |v|
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   200
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   201
     v := ScrollableView for:EditTextView.
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   202
     v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile).
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   203
     v scrollBar upButton foregroundColor:(Color red).
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   204
     v scrollBar upButton enteredForegroundColor:(Color red lightened).
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   205
     v scrollBar downButton foregroundColor:(Color green).
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   206
     v scrollBar downButton enteredForegroundColor:(Color green lightened).
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   207
     v open
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   208
    "
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   209
! !
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   210
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   211
!ScrollBar methodsFor:'accessing-look'!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   212
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   213
thumbColor:aColor
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   214
    "set the thumbs color"
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   215
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   216
    thumb thumbColor:aColor
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   217
!
128
claus
parents: 119
diff changeset
   218
133
claus
parents: 130
diff changeset
   219
upButtonLabel:label1 downButtonLabel:label2
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   220
    "set the labels shown in the buttons.
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   221
     Because of the fixed button sizes, this only makes sense with 
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   222
     single-character strings or small bitmaps."
133
claus
parents: 130
diff changeset
   223
claus
parents: 130
diff changeset
   224
    button1 label:label1.
claus
parents: 130
diff changeset
   225
    button2 label:label2.
claus
parents: 130
diff changeset
   226
    self setElementPositions.
claus
parents: 130
diff changeset
   227
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   228
    "not bad:
133
claus
parents: 130
diff changeset
   229
     |v|
claus
parents: 130
diff changeset
   230
claus
parents: 130
diff changeset
   231
     v := ScrollableView for:EditTextView.
claus
parents: 130
diff changeset
   232
     v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile).
claus
parents: 130
diff changeset
   233
     v scrollBar upButtonLabel:'+' downButtonLabel:'-'.
claus
parents: 130
diff changeset
   234
     v open
claus
parents: 130
diff changeset
   235
    "
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   236
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   237
    "also possible :
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   238
     |v|
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   239
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   240
     v := ScrollableView for:EditTextView.
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   241
     v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile).
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   242
     v scrollBar upButtonLabel:'u' downButtonLabel:'d'.
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   243
     v open
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   244
    "
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   245
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   246
    "BAD example:
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   247
     |v|
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   248
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   249
     v := ScrollableView for:EditTextView.
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   250
     v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile).
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   251
     v scrollBar upButtonLabel:'up' downButtonLabel:'down'.
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   252
     v open
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   253
    "
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   254
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   255
    "Modified: 1.3.1996 / 19:06:50 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   256
! !
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   257
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   258
!ScrollBar methodsFor:'change & update'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   259
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   260
update:something with:aParameter from:changedObject
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   261
    changedObject == thumb ifTrue:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   262
	self enableDisableButtons
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   263
    ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   264
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   265
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   266
!ScrollBar methodsFor:'events'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   267
482
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   268
keyPress:key x:x y:y
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   269
    (key == #BeginOfText) ifTrue:[
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   270
        self scrollToBeginning.
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   271
        ^ self
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   272
    ].
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   273
    (key == #EndOfText) ifTrue:[
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   274
        self scrollToEnd.
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   275
        ^ self
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   276
    ].
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   277
    super keyPress:key x:x y:y
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   278
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   279
    "Created: 6.3.1996 / 17:58:02 / cg"
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   280
    "Modified: 6.3.1996 / 17:59:05 / cg"
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   281
!
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   282
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   283
sizeChanged:how
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   284
    "when my size changes, I have to resize/reposition the subviews.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   285
     Also, if I became too small, hide thumb/buttons."
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   286
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   287
    |upHeight downHeight thumbHeight upAndDownHeight bwn sep2
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   288
     thumbWidth w style b1Hidden b2Hidden thumbHidden bY|
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   289
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   290
    button1 isNil ifTrue:[^ self].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   291
    thumb isNil ifTrue:[^ self].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   292
    button2 isNil ifTrue:[^ self].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   293
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   294
    style := styleSheet name.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   295
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   296
    upHeight := button1 height + borderWidth.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   297
    downHeight := button2 height + borderWidth.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   298
    upAndDownHeight := upHeight + downHeight.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   299
    bwn := borderWidth negated + margin.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   300
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   301
    thumbHeight := height - upAndDownHeight - borderWidth - (elementSpacing * 3).
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   302
"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   303
    ((buttonLayout ~~ #top) and:[buttonLayout ~~ #bottom]) ifTrue:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   304
	thumbHeight := thumbHeight - borderWidth
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   305
    ].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   306
"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   307
    buttonLayout == #around ifTrue:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   308
	thumbHeight := thumbHeight + borderWidth
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   309
    ].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   310
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   311
    "if I become too small, hide buttons and thumb"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   312
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   313
    height < upAndDownHeight ifTrue:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   314
	b1Hidden := b2Hidden := thumbHidden := true.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   315
    ] ifFalse:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   316
	b1Hidden := b2Hidden := thumbHidden := false.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   317
    ].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   318
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   319
    (thumbHeight < 10) ifTrue:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   320
	thumbHidden := true.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   321
    ] ifFalse:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   322
	thumbHidden := false.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   323
    ].
130
claus
parents: 128
diff changeset
   324
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   325
    button1 hiddenOnRealize:b1Hidden.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   326
    b1Hidden ifTrue:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   327
	button1 unrealize
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   328
    ] ifFalse:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   329
	shown ifTrue:[button1 realize]
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   330
    ].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   331
    button2 hiddenOnRealize:b1Hidden.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   332
    b2Hidden ifTrue:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   333
	button2 unrealize
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   334
    ] ifFalse:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   335
	shown ifTrue:[button2 realize]
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   336
    ].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   337
    thumb hiddenOnRealize:thumbHidden.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   338
    thumbHidden ifTrue:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   339
	thumb unrealize
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   340
    ] ifFalse:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   341
	shown ifTrue:[thumb realize]
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   342
    ].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   343
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   344
    "width of buttons is always my width"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   345
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   346
    w := width - (margin * 2).
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   347
    (w ~~ button1 width) ifTrue:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   348
	button1 width:w.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   349
	button2 width:w
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   350
    ].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   351
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   352
    thumbWidth := w.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   353
    style == #next ifTrue:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   354
	thumbWidth := thumbWidth - (thumb borderWidth * 2).
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   355
	thumbHeight := thumbHeight - 1
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   356
    ].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   357
    style == #motif ifTrue:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   358
	thumbHeight := thumbHeight - margin
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   359
    ].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   360
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   361
    "
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   362
     a kludge: views with width or height of 0 are illegal
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   363
     avoid error from view-creation (it will be hidden anyway)
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   364
    "
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   365
    thumbHeight <= 0 ifTrue:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   366
	thumbHeight := 1
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   367
    ].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   368
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   369
    (buttonLayout == #top) ifTrue:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   370
	"buttons at top"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   371
	thumb extent:(thumbWidth @ thumbHeight).
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   372
	^ self
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   373
    ].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   374
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   375
    sep2 := elementSpacing * 2.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   376
    (buttonLayout == #bottom) ifTrue:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   377
	"buttons at bottom"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   378
"/
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   379
"/ XX: I thought, that viewGravity shuld fix things automatically
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   380
"/ XX: it seems not to do it (or I misused it ;-)
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   381
"/ XX: anyway, viewGravity is an X special feature which is probably
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   382
"/ XX: not available with other windowing systems. Therefore,
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   383
"/ XX: the viewGravity depending code below is disabled.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   384
"/ XX: resize is somewhat slower, though.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   385
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   386
	thumbHeight := thumbHeight + borderWidth.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   387
"/ XX        thumbHidden ifTrue:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   388
"/ XX           bY := elementSpacing
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   389
"/ XX       ] ifFalse:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   390
	    bY := thumbHeight + sep2.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   391
"/ XX       ].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   392
"XX"            button1 viewGravity:#North. 
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   393
"XX"            button2 viewGravity:#North. 
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   394
	(how == #smaller) ifTrue:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   395
	    thumb extent:(thumbWidth @ thumbHeight).
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   396
"XX"            button1 origin:(bwn @ (thumbHeight + sep2)).
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   397
"XX"            button2 origin:(bwn @ (thumbHeight + sep2 + upHeight))
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   398
	] ifFalse:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   399
	    button1 origin:(bwn @ bY).
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   400
	    button2 origin:(bwn @ (bY + upHeight)).
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   401
	    thumb extent:(thumbWidth @ thumbHeight)
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   402
	].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   403
	^ self
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   404
    ].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   405
    "buttons around thumb"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   406
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   407
    style == #motif ifTrue:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   408
	sep2 := sep2 + 1
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   409
    ].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   410
    button1 origin:(bwn @ bwn).
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   411
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   412
    style == #os2 ifTrue:[
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   413
	button2 origin:(bwn @ (upHeight + thumbHeight + sep2 - margin "+ borderWidth")).
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   414
	thumb extent:(thumbWidth @ (thumbHeight - margin - margin "+ margin - (margin // 2)")).
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   415
	thumb origin:(bwn @ (upHeight - borderWidth + elementSpacing + margin))
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   416
    ] ifFalse:[
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   417
	button2 origin:(bwn @ (upHeight + thumbHeight + sep2 - (margin // 2) "+ borderWidth")).
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   418
	thumb extent:(thumbWidth @ (thumbHeight + margin - (margin // 2))).
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   419
	thumb origin:(bwn @ (upHeight - borderWidth + elementSpacing))
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   420
    ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   421
! !
110
eb59f6e31e84 *** empty log message ***
claus
parents: 77
diff changeset
   422
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   423
!ScrollBar methodsFor:'forced scroll'!
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   424
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   425
pageDown
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   426
    "page down/right"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   427
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   428
    thumb pageDown
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   429
!
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   430
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   431
pageUp
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   432
    "page up/left"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   433
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   434
    thumb pageUp
482
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   435
!
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   436
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   437
scrollToBeginning
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   438
    "to top"
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   439
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   440
    thumb scrollToBeginning
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   441
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   442
    "Modified: 6.3.1996 / 17:54:45 / cg"
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   443
!
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   444
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   445
scrollToEnd
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   446
    "to end"
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   447
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   448
    thumb scrollToEnd
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   449
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   450
    "Created: 6.3.1996 / 17:54:28 / cg"
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   451
    "Modified: 6.3.1996 / 17:54:49 / cg"
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   452
! !
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   454
!ScrollBar methodsFor:'initialization'!
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   455
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   456
createElements
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   457
    button1 := ArrowButton upIn:self.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   458
    button2 := ArrowButton downIn:self.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   459
    thumb := Scroller in:self.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   460
!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   461
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   462
defaultExtent
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   463
    "compute my extent from sub-components"
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   464
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   465
    ^ self preferredExtent
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   466
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   467
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   468
    "Created: 1.3.1996 / 19:22:11 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   469
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   470
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   471
initStyle
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   472
    super initStyle.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   473
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   474
    buttonLayout := DefaultButtonPositions.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   475
    DefaultLevel notNil ifTrue:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   476
	self level:DefaultLevel
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   477
    ].
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   478
    elementSpacing := DefaultElementSpacing
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   479
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   480
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   481
initialize
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   482
    "setup; create the 2 buttons and a scroller"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   483
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   484
    |clr style|
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   485
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   486
    super initialize.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   487
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   488
    self createElements.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   489
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   490
    (styleSheet at:'scrollBarDisableButtons' default:false) ifTrue:[
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   491
	thumb addDependent:self
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   492
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   493
345
00abc00e73a9 use #autoRepeat:
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   494
    button1 autoRepeat:true.
00abc00e73a9 use #autoRepeat:
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   495
    button2 autoRepeat:true.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   496
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   497
    button1 borderWidth:borderWidth.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   498
    DefaultScrollerBordered ifFalse:[
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   499
	thumb borderWidth:borderWidth.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   500
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   501
    button2 borderWidth:borderWidth.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   502
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   503
    style := styleSheet name.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   504
    ((style = #iris) and:[Display hasGreyscales]) ifTrue:[
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   505
	"have to change some of Buttons defaults"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   506
	clr := (Color grey:25) on:device.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   507
	button1 offLevel:2.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   508
	button2 offLevel:2.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   509
	button1 foregroundColor:clr.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   510
	button1 activeForegroundColor:clr.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   511
	button1 enteredForegroundColor:clr.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   512
	button2 foregroundColor:clr.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   513
	button2 activeForegroundColor:clr.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   514
	button2 enteredForegroundColor:clr.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   515
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   516
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   517
    self setElementPositions.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   518
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   519
    style = #motif ifTrue:[
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   520
	clr := thumb thumbColor.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   521
	button1 foregroundColor:clr.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   522
	button2 foregroundColor:clr.
345
00abc00e73a9 use #autoRepeat:
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   523
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   524
	clr := thumb viewBackground.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   525
	button1 viewBackground:clr.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   526
	button2 viewBackground:clr.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   527
	button1 backgroundColor:clr.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   528
	button2 backgroundColor:clr.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   529
	button1 activeBackgroundColor:clr.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   530
	button2 activeBackgroundColor:clr.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   531
	device hasGreyscales ifFalse:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   532
	    button1 activeForegroundColor:Black.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   533
	    button2 activeForegroundColor:Black.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   534
	]
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   535
    ]
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   536
345
00abc00e73a9 use #autoRepeat:
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   537
    "Modified: 9.2.1996 / 22:42:16 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   538
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   539
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   540
reinitialize
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   541
    super reinitialize.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   542
    self setElementPositions.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   543
!
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   544
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   545
setElementPositions
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   546
    "position sub-components"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   547
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   548
    |bwn|
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   549
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   550
    bwn := borderWidth negated + margin.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   551
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   552
    (buttonLayout == #top) ifTrue:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   553
	button1 origin:(bwn @ bwn).
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   554
	button1 viewGravity:#North.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   555
	button2 origin:(bwn @ (button1 height)).
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   556
	button2 viewGravity:#North.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   557
	thumb origin:(bwn @ (button1 height 
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   558
			     + borderWidth 
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   559
			     + button2 height 
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   560
			     + elementSpacing 
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   561
			     + elementSpacing)).
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   562
	thumb viewGravity:#North.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   563
	^ self
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   564
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   565
    (buttonLayout == #bottom) ifTrue:[
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   566
	device supportsViewGravity ifTrue:[
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   567
	    button1 viewGravity:#South. 
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   568
	    button2 viewGravity:#South. 
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   569
	    thumb viewGravity:#North.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   570
	].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   571
	thumb origin:(bwn @ bwn).
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   572
	^ self
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   573
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   574
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   575
    "buttonLayout == #around"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   576
    button1 origin:(bwn @ bwn).
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   577
    button1 viewGravity:#North.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   578
"/    button2 viewGravity:#North.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   579
    thumb origin:(bwn @ (button1 height + elementSpacing)).
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   580
    thumb viewGravity:#North
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   581
! !
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   582
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   583
!ScrollBar methodsFor:'private'!
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   584
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   585
enableDisableButtons
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   586
    "only used with styles which disable their buttons if the
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   587
     thumb is at either end. Check where the thumb is and enable/disable
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   588
     as appropriate."
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   589
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   590
    |e1 e2 th to|
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   591
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   592
    (styleSheet at:'scrollBarDisableButtons' default:false) ifFalse:[^ self].
110
eb59f6e31e84 *** empty log message ***
claus
parents: 77
diff changeset
   593
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   594
    e1 := e2 := true.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   595
    (th := thumb thumbHeight) notNil ifTrue:[
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   596
	(th >= (thumb stop)) ifTrue:[
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   597
	    e1 := false.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   598
	    e2 := false
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   599
	]
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   600
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   601
    ((to := thumb thumbOrigin) <= thumb start) ifTrue:[
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   602
	e1 := false
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   603
    ] ifFalse:[
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   604
	th isNil ifTrue:[th := 0].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   605
	(to + th) >= thumb stop ifTrue:[
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   606
	    e2 := false
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   607
	]
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   608
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   609
    e1 ifTrue:[button1 enable] ifFalse:[button1 disable].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   610
    e2 ifTrue:[button2 enable] ifFalse:[button2 disable].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   611
! !
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   612
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   613
!ScrollBar methodsFor:'private scrollview interface'!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   614
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   615
setThumbFor:aView
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   616
    "adjust thumb for aView 
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   617
     (i.e. adjust thumbs origin & size for views size & views contents).
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   618
     This is forwarded to the scroller here."
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   619
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   620
    thumb setThumbFor:aView.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   621
    self enableDisableButtons
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   622
!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   623
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   624
setThumbHeightFor:aView
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   625
    "adjust thumbs height for aViews size & contents.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   626
     This is forwarded to the scroller here."
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   627
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   628
    thumb setThumbHeightFor:aView.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   629
    self enableDisableButtons
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   630
!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   631
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   632
setThumbOriginFor:aView
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   633
    "adjust thumbs origin for aViews size & contents.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   634
     This is forwarded to the scroller here."
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   635
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   636
    thumb setThumbOriginFor:aView.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   637
    self enableDisableButtons
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   638
! !
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   639
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   640
!ScrollBar methodsFor:'queries'!
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   641
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   642
preferredExtent
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   643
    "compute my extent from sub-components"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   644
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   645
    |w h upForm downForm
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   646
     upHeight   "{ Class: SmallInteger }"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   647
     downHeight "{ Class: SmallInteger }"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   648
     upWidth downWidth style|
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   649
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   650
    "
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   651
     need fix - this is a kludge;
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   652
     the if should not be needed ...
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   653
    "
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   654
    style := styleSheet name.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   655
    style == #mswindows ifTrue:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   656
	w := button1 width max:button2 width.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   657
	h := button1 height + button2 height + (Scroller defaultExtent y).
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   658
    ] ifFalse:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   659
	upForm  := ArrowButton upArrowButtonForm:style on:device.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   660
	downForm := ArrowButton downArrowButtonForm:style on:device.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   661
	upForm isNil ifTrue:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   662
	    upHeight := upWidth := 16.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   663
	] ifFalse:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   664
	    upHeight := upForm height.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   665
	    upWidth := upForm width
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   666
	].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   667
	downForm isNil ifTrue:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   668
	    downHeight := downWidth := 16
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   669
	] ifFalse:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   670
	    downHeight := downForm height.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   671
	    downWidth := downForm width
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   672
	].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   673
	h := upHeight + downHeight + (1 * 2) + (Scroller defaultExtent y).
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   674
	w := upWidth max:downWidth.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   675
	style ~~ #normal ifTrue:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   676
	    h := h + 4.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   677
	    w := w + 4
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   678
	].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   679
    ].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   680
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   681
    ^ w @ h.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   682
! !
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   683
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   684
!ScrollBar class methodsFor:'documentation'!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   685
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   686
version
482
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   687
    ^ '$Header: /cvs/stx/stx/libwidg/ScrollBar.st,v 1.27 1996-03-06 17:02:39 cg Exp $'
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   688
! !