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