ScrollBar.st
author Claus Gittinger <cg@exept.de>
Wed, 28 May 1997 15:59:46 +0200
changeset 1229 19be2e822d45
parent 1214 fbcbebac06ec
child 1230 9d052df857b8
permissions -rw-r--r--
merged common code from scrollBar & horizontalScrollBar
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
855
e89107448535 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
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
855
e89107448535 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
    73
!ScrollBar class methodsFor:'style changes'!
0
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
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   142
scrollDownAction
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   143
    "return the action which is performed on scroll-down.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   144
     (vertical scrollBars)"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   145
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   146
    ^ button2 action
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   147
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   148
    "Created: 28.5.1997 / 15:52:39 / cg"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   149
    "Modified: 28.5.1997 / 15:53:56 / cg"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   150
!
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   151
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   152
scrollDownAction:aBlock
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   153
    "set the action, aBlock to be performed when the down-button is pressed.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   154
     (for vertical scrollBars)"
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   155
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   156
    button2 action:aBlock
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   157
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   158
    "Modified: 28.5.1997 / 15:51:39 / cg"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   159
!
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   160
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   161
scrollLeftAction
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   162
    "return the action which is performed on scroll-left
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   163
     (for horizontal scrollBars)"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   164
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   165
    ^ button1 action
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   166
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   167
    "Created: 28.5.1997 / 15:51:22 / cg"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   168
!
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   169
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   170
scrollLeftAction:aBlock
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   171
    "set the action to be performed on scroll-left.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   172
     (for horizontal scrollBars)"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   173
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   174
    button1 action:aBlock
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   175
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   176
    "Created: 28.5.1997 / 15:52:55 / cg"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   177
!
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   178
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   179
scrollRightAction
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   180
    "return the action which is performed on scroll-right.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   181
     (for horizontal scrollBars)"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   182
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   183
    ^ button2 action
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   184
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   185
    "Created: 28.5.1997 / 15:53:15 / cg"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   186
!
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   187
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   188
scrollRightAction:aBlock
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   189
    "set the action  to be performed on scroll-right.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   190
     (for horizontal scrollBars)"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   191
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   192
    button2 action:aBlock
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   193
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   194
    "Created: 28.5.1997 / 15:53:30 / cg"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   195
!
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   196
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   197
scrollUpAction
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   198
    "return the action which is performed on scroll-up.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   199
     (for vertical scrollBars)"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   200
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   201
    ^ button1 action
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   202
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   203
    "Created: 28.5.1997 / 15:53:51 / cg"
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   204
!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   205
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   206
scrollUpAction:aBlock
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   207
    "set the action, aBlock to be performed when the up-button is pressed.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   208
     (for vertical scrollBars)"
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
    button1 action:aBlock
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   211
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   212
    "Modified: 28.5.1997 / 15:51:33 / cg"
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   213
!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   214
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   215
synchronousOperation
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   216
    "set synchronous-mode - scroll action is performed for every movement
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   217
     of scroller.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   218
     This is forwarded to the scroller here."
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
    thumb synchronousOperation
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   221
! !
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
!ScrollBar methodsFor:'accessing-components'!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   224
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   225
downButton
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   226
    "return the down-button
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   227
     (Please: only use this direct access for special applications)"
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   228
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   229
    ^ button2
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   230
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   231
    "
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   232
     |v|
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   233
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   234
     v := ScrollableView for:EditTextView.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   235
     v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile).
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   236
     v scrollBar upButton activeForegroundColor:Color red.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   237
     v scrollBar downButton activeForegroundColor:Color red.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   238
     v open
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   239
    "
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   240
!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   241
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   242
thumb 
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   243
    "return the thumb (i.e. the scroller subview)
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   244
     (Please: only use this direct access for special applications)"
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   245
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   246
    ^ thumb
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   247
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   248
    "
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   249
     |v|
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   250
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   251
     v := ScrollableView for:EditTextView.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   252
     v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile).
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   253
     v scrollBar thumb thumbColor:(Color red).
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   254
     v open
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   255
    "
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   256
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   257
    "Modified: 1.3.1996 / 19:15:50 / cg"
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   258
!
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   259
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   260
upButton
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   261
    "return the up-button
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   262
     (Please: only use this direct access for special applications)"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   263
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   264
    ^ button1
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   265
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   266
    "
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   267
     |v|
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   268
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   269
     v := ScrollableView for:EditTextView.
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   270
     v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile).
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   271
     v scrollBar upButton foregroundColor:(Color red).
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   272
     v scrollBar upButton enteredForegroundColor:(Color red lightened).
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   273
     v scrollBar downButton foregroundColor:(Color green).
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   274
     v scrollBar downButton enteredForegroundColor:(Color green lightened).
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   275
     v open
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   276
    "
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   277
! !
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   278
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   279
!ScrollBar methodsFor:'accessing-look'!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   280
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   281
thumbColor:aColor
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   282
    "set the thumbs color"
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   283
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   284
    thumb thumbColor:aColor
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   285
!
128
claus
parents: 119
diff changeset
   286
133
claus
parents: 130
diff changeset
   287
upButtonLabel:label1 downButtonLabel:label2
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   288
    "set the labels shown in the buttons.
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   289
     Because of the fixed button sizes, this only makes sense with 
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   290
     single-character strings or small bitmaps."
133
claus
parents: 130
diff changeset
   291
claus
parents: 130
diff changeset
   292
    button1 label:label1.
claus
parents: 130
diff changeset
   293
    button2 label:label2.
claus
parents: 130
diff changeset
   294
    self setElementPositions.
claus
parents: 130
diff changeset
   295
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   296
    "not bad:
133
claus
parents: 130
diff changeset
   297
     |v|
claus
parents: 130
diff changeset
   298
claus
parents: 130
diff changeset
   299
     v := ScrollableView for:EditTextView.
claus
parents: 130
diff changeset
   300
     v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile).
claus
parents: 130
diff changeset
   301
     v scrollBar upButtonLabel:'+' downButtonLabel:'-'.
claus
parents: 130
diff changeset
   302
     v open
claus
parents: 130
diff changeset
   303
    "
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   304
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   305
    "also possible :
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   306
     |v|
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   307
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   308
     v := ScrollableView for:EditTextView.
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   309
     v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile).
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   310
     v scrollBar upButtonLabel:'u' downButtonLabel:'d'.
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   311
     v open
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   312
    "
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   313
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   314
    "BAD example:
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   315
     |v|
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   316
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   317
     v := ScrollableView for:EditTextView.
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   318
     v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile).
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   319
     v scrollBar upButtonLabel:'up' downButtonLabel:'down'.
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   320
     v open
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   321
    "
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   322
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   323
    "Modified: 1.3.1996 / 19:06:50 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   324
! !
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   325
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   326
!ScrollBar methodsFor:'change & update'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   327
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   328
update:something with:aParameter from:changedObject
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   329
    changedObject == thumb ifTrue:[
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   330
	self enableDisableButtons
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   331
    ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   332
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   333
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   334
!ScrollBar methodsFor:'events'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   335
482
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   336
keyPress:key x:x y:y
491
7b376aaa06d5 resources
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   337
7b376aaa06d5 resources
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   338
    <resource: #keyboard (#BeginOfText #EndOfText)>
7b376aaa06d5 resources
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   339
482
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   340
    (key == #BeginOfText) ifTrue:[
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   341
        self scrollToBeginning.
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   342
        ^ self
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   343
    ].
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   344
    (key == #EndOfText) ifTrue:[
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   345
        self scrollToEnd.
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   346
        ^ self
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   347
    ].
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   348
    super keyPress:key x:x y:y
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   349
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   350
    "Created: 6.3.1996 / 17:58:02 / cg"
491
7b376aaa06d5 resources
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   351
    "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
   352
!
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   353
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   354
sizeChanged:how
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   355
    "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
   356
     Also, if I became too small, hide thumb/buttons."
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   357
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   358
    |upHeight downHeight thumbHeight upAndDownHeight bwn sep2
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   359
     thumbWidth w style b1Hidden b2Hidden thumbHidden bY|
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
    button1 isNil ifTrue:[^ self].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   362
    thumb isNil ifTrue:[^ self].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   363
    button2 isNil ifTrue:[^ self].
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
    style := styleSheet name.
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
    upHeight := button1 height + borderWidth.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   368
    downHeight := button2 height + borderWidth.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   369
    upAndDownHeight := upHeight + downHeight.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   370
    bwn := borderWidth negated + margin.
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
    thumbHeight := height - upAndDownHeight - borderWidth - (elementSpacing * 3).
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
    ((buttonLayout ~~ #top) and:[buttonLayout ~~ #bottom]) ifTrue:[
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   375
        thumbHeight := thumbHeight - borderWidth
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   376
    ].
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
    buttonLayout == #around ifTrue:[
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   379
        thumbHeight := thumbHeight + borderWidth
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   380
    ].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   381
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   382
    "if I become too small, hide buttons and thumb"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   383
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   384
    height < upAndDownHeight ifTrue:[
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   385
        b1Hidden := b2Hidden := thumbHidden := true.
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   386
    ] ifFalse:[
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   387
        b1Hidden := b2Hidden := thumbHidden := false.
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
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   390
    (thumbHeight < 10) ifTrue:[
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   391
        thumbHidden := true.
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   392
    ] ifFalse:[
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   393
        thumbHidden := false.
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   394
    ].
130
claus
parents: 128
diff changeset
   395
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   396
    button1 hiddenOnRealize:b1Hidden.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   397
    b1Hidden ifTrue:[
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   398
        button1 unmap
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   399
    ] ifFalse:[
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   400
        shown ifTrue:[button1 realize]
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   401
    ].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   402
    button2 hiddenOnRealize:b1Hidden.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   403
    b2Hidden ifTrue:[
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   404
        button2 unmap
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   405
    ] ifFalse:[
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   406
        shown ifTrue:[button2 realize]
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   407
    ].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   408
    thumb hiddenOnRealize:thumbHidden.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   409
    thumbHidden ifTrue:[
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   410
        thumb unmap
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   411
    ] ifFalse:[
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   412
        shown ifTrue:[thumb realize]
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   413
    ].
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
    "width of buttons is always my width"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   416
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   417
    w := width - (margin * 2).
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   418
    (w ~~ button1 width) ifTrue:[
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   419
        button1 width:w.
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   420
        button2 width:w
453
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
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   423
    thumbWidth := w.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   424
    style == #next ifTrue:[
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   425
        thumbWidth := thumbWidth - (thumb borderWidth * 2).
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   426
        thumbHeight := thumbHeight - 1
453
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
    style == #motif ifTrue:[
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   429
        thumbHeight := thumbHeight - margin
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   430
    ].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   431
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   432
    "
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   433
     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
   434
     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
   435
    "
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   436
    thumbHeight <= 0 ifTrue:[
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   437
        thumbHeight := 1
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   438
    ].
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
    (buttonLayout == #top) ifTrue:[
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   441
        "buttons at top"
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   442
        thumb extent:(thumbWidth @ thumbHeight).
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   443
        ^ self
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   444
    ].
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
    sep2 := elementSpacing * 2.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   447
    (buttonLayout == #bottom) ifTrue:[
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   448
        "buttons at bottom"
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   449
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   450
        thumbHeight := thumbHeight + borderWidth.
855
e89107448535 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   451
        
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   452
            bY := thumbHeight + sep2.
855
e89107448535 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   453
            (bY + upAndDownHeight) >= height ifTrue:[
e89107448535 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   454
                bY := height - margin - upAndDownHeight
e89107448535 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   455
            ].
e89107448535 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   456
e89107448535 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   457
            button1 viewGravity:#North. 
e89107448535 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   458
            button2 viewGravity:#North. 
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   459
        (how == #smaller) ifTrue:[
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   460
            thumb extent:(thumbWidth @ thumbHeight).
855
e89107448535 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   461
        
e89107448535 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   462
            button1 origin:(bwn @ bY).
e89107448535 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   463
            button2 origin:(bwn @ (bY + upHeight))
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   464
        ] ifFalse:[
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   465
            button1 origin:(bwn @ bY).
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   466
            button2 origin:(bwn @ (bY + upHeight)).
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   467
            thumb extent:(thumbWidth @ thumbHeight)
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   468
        ].
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   469
        ^ self
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   470
    ].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   471
    "buttons around thumb"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   472
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   473
    style == #motif ifTrue:[
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   474
        sep2 := sep2 + 1
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   475
    ].
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   476
    button1 origin:(bwn @ bwn).
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   477
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   478
    style == #os2 ifTrue:[
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   479
        button2 origin:(bwn @ (upHeight + thumbHeight + sep2 - margin "+ borderWidth")).
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   480
        thumb extent:(thumbWidth @ (thumbHeight - margin - margin "+ margin - (margin // 2)")).
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   481
        thumb origin:(bwn @ (upHeight - borderWidth + elementSpacing + margin))
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   482
    ] ifFalse:[
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   483
        button2 origin:(bwn @ (upHeight + thumbHeight + sep2 - (margin // 2) "+ borderWidth")).
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   484
        thumb extent:(thumbWidth @ (thumbHeight + margin - (margin // 2))).
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   485
        thumb origin:(bwn @ (upHeight - borderWidth + elementSpacing))
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   486
    ].
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   487
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   488
    "Modified: 3.5.1996 / 23:49:02 / stefan"
855
e89107448535 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   489
    "Modified: 26.10.1996 / 14:18:29 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   490
! !
110
eb59f6e31e84 *** empty log message ***
claus
parents: 77
diff changeset
   491
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   492
!ScrollBar methodsFor:'forced scroll'!
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   493
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   494
pageDown
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   495
    "page down/right"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   496
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   497
    thumb pageDown
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   498
!
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   499
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   500
pageUp
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   501
    "page up/left"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   502
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   503
    thumb pageUp
482
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   504
!
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   505
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   506
scrollToBeginning
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   507
    "to top"
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   508
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   509
    thumb scrollToBeginning
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   510
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   511
    "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
   512
!
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   513
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   514
scrollToEnd
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   515
    "to end"
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   516
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   517
    thumb scrollToEnd
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   518
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   519
    "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
   520
    "Modified: 6.3.1996 / 17:54:49 / cg"
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   521
! !
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   522
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   523
!ScrollBar methodsFor:'initialization'!
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   524
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   525
createElements
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   526
    "private: create my elements"
1041
976147f19ad7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   527
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   528
    self orientation == #horizontal ifTrue:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   529
        button1 := ArrowButton leftIn:self.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   530
        button1 name:'leftButton'.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   531
        button2 := ArrowButton rightIn:self.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   532
        button2 name:'rightButton'.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   533
        thumb := HorizontalScroller in:self.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   534
    ] ifFalse:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   535
        button1 := ArrowButton upIn:self.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   536
        button1 name:'upButton'.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   537
        button2 := ArrowButton downIn:self.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   538
        button2 name:'downButton'.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   539
        thumb := Scroller in:self.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   540
    ].
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   541
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   542
    "Modified: 28.5.1997 / 15:49:05 / cg"
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   543
!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   544
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   545
defaultExtent
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   546
    "compute my extent from sub-components"
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
    ^ self preferredExtent
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   549
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   550
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   551
    "Created: 1.3.1996 / 19:22:11 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   552
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   553
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   554
initStyle
968
ba32bbfb7aad commentary
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   555
    "setup viewStyle specifics"
ba32bbfb7aad commentary
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   556
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   557
    super initStyle.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   558
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   559
    buttonLayout := DefaultButtonPositions.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   560
    DefaultLevel notNil ifTrue:[
968
ba32bbfb7aad commentary
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   561
        self level:DefaultLevel
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   562
    ].
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   563
    elementSpacing := DefaultElementSpacing
968
ba32bbfb7aad commentary
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   564
ba32bbfb7aad commentary
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   565
    "Modified: 22.1.1997 / 11:57:41 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   566
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   567
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   568
initialize
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   569
    "setup; create the 2 buttons and a scroller"
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
    |clr style|
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   572
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   573
    super initialize.
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
    self createElements.
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
    (styleSheet at:'scrollBarDisableButtons' default:false) ifTrue:[
706
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   578
        thumb addDependent:self
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   579
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   580
345
00abc00e73a9 use #autoRepeat:
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   581
    button1 autoRepeat:true.
00abc00e73a9 use #autoRepeat:
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   582
    button2 autoRepeat:true.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   583
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   584
    button1 borderWidth:borderWidth.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   585
    DefaultScrollerBordered ifFalse:[
706
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   586
        thumb borderWidth:borderWidth.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   587
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   588
    button2 borderWidth:borderWidth.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   589
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   590
    style := styleSheet name.
744
8d84193ca610 use 'Screen current' instead of 'Display'
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   591
    ((style = #iris) and:[Screen current hasGrayscales]) ifTrue:[
706
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   592
        "have to change some of Buttons defaults"
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   593
        clr := (Color gray:25) on:device.
710
4e1f1023d9ae checkin from browser
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
   594
        button1 passiveLevel:2.
4e1f1023d9ae checkin from browser
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
   595
        button2 passiveLevel:2.
706
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   596
        button1 foregroundColor:clr.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   597
        button1 activeForegroundColor:clr.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   598
        button1 enteredForegroundColor:clr.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   599
        button2 foregroundColor:clr.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   600
        button2 activeForegroundColor:clr.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   601
        button2 enteredForegroundColor:clr.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   602
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   603
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   604
    self setElementPositions.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   605
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   606
    style = #motif ifTrue:[
706
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   607
        clr := thumb thumbColor.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   608
        button1 foregroundColor:clr.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   609
        button2 foregroundColor:clr.
345
00abc00e73a9 use #autoRepeat:
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   610
706
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   611
        clr := thumb viewBackground.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   612
        button1 viewBackground:clr.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   613
        button2 viewBackground:clr.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   614
        button1 backgroundColor:clr.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   615
        button2 backgroundColor:clr.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   616
        button1 activeBackgroundColor:clr.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   617
        button2 activeBackgroundColor:clr.
709
a738bd76ace4 grey vs. gray
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
   618
        device hasGrayscales ifFalse:[
706
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   619
            button1 activeForegroundColor:Black.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   620
            button2 activeForegroundColor:Black.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   621
        ]
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   622
    ]
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   623
744
8d84193ca610 use 'Screen current' instead of 'Display'
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   624
    "Modified: 3.6.1996 / 17:53:32 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   625
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   626
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   627
reinitialize
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   628
    super reinitialize.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   629
    self setElementPositions.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   630
!
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   631
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   632
setElementPositions
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   633
    "position sub-components"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   634
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   635
    |bwn|
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   636
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   637
    bwn := borderWidth negated + margin.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   638
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   639
    self orientation == #horizontal ifTrue:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   640
        (buttonLayout == #bottom) ifTrue:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   641
            "buttons at left"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   642
            button1 origin:(bwn @ bwn).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   643
            button1 viewGravity:#West.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   644
            button2 origin:(button1 width @ bwn).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   645
            button2 viewGravity:#West.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   646
            thumb origin:((button1 width 
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   647
                           + borderWidth 
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   648
                           + button2 width 
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   649
                           + elementSpacing + elementSpacing) @ bwn).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   650
            thumb viewGravity:#West.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   651
            ^ self
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   652
        ].
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   653
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   654
        (buttonLayout == #top) ifTrue:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   655
            "buttons at right"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   656
            button1 viewGravity:#West.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   657
            button2 viewGravity:#West.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   658
            thumb origin:(bwn @ bwn).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   659
            thumb viewGravity:#West
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   660
        ].
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   661
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   662
        "buttonLayout == #around "
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   663
        button1 origin:(bwn @ bwn).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   664
        button1 viewGravity:#West.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   665
        button2 viewGravity:#West.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   666
        thumb origin:((button1 width + elementSpacing) @ bwn).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   667
        thumb viewGravity:#West
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   668
    ] ifFalse:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   669
        (buttonLayout == #top) ifTrue:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   670
            button1 origin:(bwn @ bwn).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   671
            button1 viewGravity:#North.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   672
            button2 origin:(bwn @ (button1 height)).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   673
            button2 viewGravity:#North.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   674
            thumb origin:(bwn @ (button1 height 
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   675
                                 + borderWidth 
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   676
                                 + button2 height 
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   677
                                 + elementSpacing 
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   678
                                 + elementSpacing)).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   679
            thumb viewGravity:#North.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   680
            ^ self
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   681
        ].
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   682
        (buttonLayout == #bottom) ifTrue:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   683
            device supportsViewGravity ifTrue:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   684
                button1 viewGravity:#South. 
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   685
                button2 viewGravity:#South. 
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   686
                thumb viewGravity:#North.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   687
            ].
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   688
            thumb origin:(bwn @ bwn).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   689
            ^ self
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   690
        ].
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   691
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   692
        "buttonLayout == #around"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   693
        button1 origin:(bwn @ bwn).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   694
        button1 viewGravity:#North.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   695
    "/    button2 viewGravity:#North.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   696
        thumb origin:(bwn @ (button1 height + elementSpacing)).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   697
        thumb viewGravity:#North
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   698
    ]
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   699
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   700
    "Modified: 28.5.1997 / 15:50:27 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   701
! !
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   702
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   703
!ScrollBar methodsFor:'private'!
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   704
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   705
enableDisableButtons
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   706
    "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
   707
     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
   708
     as appropriate."
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   709
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   710
    |e1 e2 th to|
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   711
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   712
    (styleSheet at:'scrollBarDisableButtons' default:false) ifFalse:[^ self].
110
eb59f6e31e84 *** empty log message ***
claus
parents: 77
diff changeset
   713
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   714
    e1 := e2 := true.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   715
    (th := thumb thumbHeight) notNil ifTrue:[
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   716
	(th >= (thumb stop)) ifTrue:[
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   717
	    e1 := false.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   718
	    e2 := false
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   719
	]
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   720
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   721
    ((to := thumb thumbOrigin) <= thumb start) ifTrue:[
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   722
	e1 := false
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   723
    ] ifFalse:[
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   724
	th isNil ifTrue:[th := 0].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   725
	(to + th) >= thumb stop ifTrue:[
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   726
	    e2 := false
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   727
	]
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   728
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   729
    e1 ifTrue:[button1 enable] ifFalse:[button1 disable].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   730
    e2 ifTrue:[button2 enable] ifFalse:[button2 disable].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   731
! !
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   732
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   733
!ScrollBar methodsFor:'private scrollview interface'!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   734
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   735
setThumbFor:aView
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   736
    "adjust thumb for aView 
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   737
     (i.e. adjust thumbs origin & size for views size & views contents).
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   738
     This is forwarded to the scroller here."
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   739
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   740
    thumb setThumbFor:aView.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   741
    self enableDisableButtons
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   742
!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   743
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   744
setThumbHeightFor:aView
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   745
    "adjust thumbs height for aViews size & contents.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   746
     This is forwarded to the scroller here."
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   747
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   748
    thumb setThumbHeightFor:aView.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   749
    self enableDisableButtons
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   750
!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   751
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   752
setThumbOriginFor:aView
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   753
    "adjust thumbs origin for aViews size & contents.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   754
     This is forwarded to the scroller here."
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   755
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   756
    thumb setThumbOriginFor:aView.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   757
    self enableDisableButtons
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   758
! !
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   759
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   760
!ScrollBar methodsFor:'queries'!
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   761
1117
004465264731 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1041
diff changeset
   762
isMiniScroller
004465264731 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1041
diff changeset
   763
    ^ false
004465264731 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1041
diff changeset
   764
004465264731 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1041
diff changeset
   765
    "Created: 7.3.1997 / 16:20:12 / cg"
004465264731 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1041
diff changeset
   766
!
004465264731 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1041
diff changeset
   767
1006
4c2020b04ffd added query for orientation
ca
parents: 968
diff changeset
   768
orientation
4c2020b04ffd added query for orientation
ca
parents: 968
diff changeset
   769
    "for ST-80 compatibility, answer this query"
4c2020b04ffd added query for orientation
ca
parents: 968
diff changeset
   770
4c2020b04ffd added query for orientation
ca
parents: 968
diff changeset
   771
    ^ #vertical
4c2020b04ffd added query for orientation
ca
parents: 968
diff changeset
   772
!
4c2020b04ffd added query for orientation
ca
parents: 968
diff changeset
   773
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   774
preferredExtent
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   775
    "compute my extent from sub-components"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   776
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   777
    <resource: #style (#name)>
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   778
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   779
    |w h form1 form2
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   780
     height1   "{ Class: SmallInteger }"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   781
     height2 "{ Class: SmallInteger }"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   782
     width1 width2 style|
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   783
797
2f9cd56f48ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
   784
    "/ If I have an explicit preferredExtent ..
2f9cd56f48ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
   785
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 710
diff changeset
   786
    preferredExtent notNil ifTrue:[
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 710
diff changeset
   787
        ^ preferredExtent
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 710
diff changeset
   788
    ].
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 710
diff changeset
   789
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   790
    "
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   791
     need fix - this is a kludge;
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   792
     the if should not be needed ...
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   793
    "
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   794
    style := styleSheet name.
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   795
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   796
    self orientation == #horizontal ifTrue:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   797
        form1 := ArrowButton leftArrowButtonForm:style on:device.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   798
        form2 := ArrowButton rightArrowButtonForm:style on:device.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   799
    ] ifFalse:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   800
        form1 := ArrowButton upArrowButtonForm:style on:device.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   801
        form2 := ArrowButton downArrowButtonForm:style on:device.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   802
    ].
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   803
    form1 isNil ifTrue:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   804
        height1 := width1 := 16.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   805
    ] ifFalse:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   806
        height1 := form1 height.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   807
        width1 := form1 width
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   808
    ].
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   809
    form2 isNil ifTrue:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   810
        height2 := width2 := 16
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   811
    ] ifFalse:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   812
        height2 := form2 height.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   813
        width2 := form2 width
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   814
    ].
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   815
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   816
    self orientation == #horizontal ifTrue:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   817
        w := width1 + width2 + (1 * 2) + (HorizontalScroller defaultExtent x).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   818
        h := height1 max:height2.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   819
    ] ifFalse:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   820
        h := height1 + height2 + (1 * 2) + (Scroller defaultExtent y).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   821
        w := width1 max:width2.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   822
    ].
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   823
    style ~~ #normal ifTrue:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   824
        h := h + 4.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   825
        w := w + 4
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   826
    ].
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   827
786
8b301af1cdcc remember and do not recompute the preferredExtent;
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   828
    preferredExtent := w @ h.
8b301af1cdcc remember and do not recompute the preferredExtent;
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   829
    ^ preferredExtent
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 710
diff changeset
   830
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   831
    "Modified: 28.5.1997 / 15:16:56 / cg"
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   832
! !
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   833
1213
8839c02cd7ad preps for native window support
Claus Gittinger <cg@exept.de>
parents: 1118
diff changeset
   834
!ScrollBar methodsFor:'queries - internal'!
8839c02cd7ad preps for native window support
Claus Gittinger <cg@exept.de>
parents: 1118
diff changeset
   835
8839c02cd7ad preps for native window support
Claus Gittinger <cg@exept.de>
parents: 1118
diff changeset
   836
nativeWindowType
8839c02cd7ad preps for native window support
Claus Gittinger <cg@exept.de>
parents: 1118
diff changeset
   837
    "return a symbol describing my native window type 
8839c02cd7ad preps for native window support
Claus Gittinger <cg@exept.de>
parents: 1118
diff changeset
   838
     (may be used internally by the device as a native window creation hint)"
8839c02cd7ad preps for native window support
Claus Gittinger <cg@exept.de>
parents: 1118
diff changeset
   839
1214
fbcbebac06ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
   840
    self orientation == #vertical ifTrue:[
fbcbebac06ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
   841
	^ #VerticalScrollBar
fbcbebac06ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
   842
    ].
fbcbebac06ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
   843
    ^ #HorizontalScrollBar
1213
8839c02cd7ad preps for native window support
Claus Gittinger <cg@exept.de>
parents: 1118
diff changeset
   844
! !
8839c02cd7ad preps for native window support
Claus Gittinger <cg@exept.de>
parents: 1118
diff changeset
   845
855
e89107448535 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   846
!ScrollBar class methodsFor:'documentation'!
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   847
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   848
version
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   849
    ^ '$Header: /cvs/stx/stx/libwidg/ScrollBar.st,v 1.47 1997-05-28 13:59:30 cg Exp $'
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   850
! !