ScrollBar.st
author Claus Gittinger <cg@exept.de>
Thu, 09 Nov 2017 20:09:30 +0100
changeset 6225 0122e4e6c587
parent 6159 5507566304af
child 6491 b493c7621a50
permissions -rw-r--r--
#FEATURE by cg class: GenericToolbarIconLibrary class added: #hideFilter16x16Icon
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
"
2230
4511c7f30161 category change
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
    12
"{ Package: 'stx:libwidg' }"
4511c7f30161 category change
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
    13
5419
Claus Gittinger <cg@exept.de>
parents: 5127
diff changeset
    14
"{ NameSpace: Smalltalk }"
Claus Gittinger <cg@exept.de>
parents: 5127
diff changeset
    15
119
claus
parents: 110
diff changeset
    16
SimpleView subclass:#ScrollBar
1950
4c19ae381920 made orientation an instVar
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
    17
	instanceVariableNames:'thumb button1 button2 buttonLayout elementSpacing orientation'
345
00abc00e73a9 use #autoRepeat:
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    18
	classVariableNames:'DefaultButtonPositions DefaultLevel DefaultElementSpacing
1887
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
    19
		DefaultScrollerBordered DefaultHScrollBarHeight
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
    20
		DefaultVScrollBarWidth'
345
00abc00e73a9 use #autoRepeat:
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    21
	poolDictionaries:''
00abc00e73a9 use #autoRepeat:
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    22
	category:'Views-Interactors'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    23
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    24
855
e89107448535 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
    25
!ScrollBar class methodsFor:'documentation'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    26
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    27
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    28
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    29
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    30
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    31
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    32
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    33
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    34
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    35
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    36
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    37
 hereby transferred.
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
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    40
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    41
documentation
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
    this class implements vertical scrollbars with scroller and
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    44
    2 step-scroll buttons. when moved or stepped, it performs a
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    45
    predefined action.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    46
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    47
    The action is specified by:                 the block to be evaluated for step-up
6159
5507566304af #DOCUMENTATION by mawalch
mawalch
parents: 5950
diff changeset
    48
        aScrollBar scrollUpAction:aBlock
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 491
diff changeset
    49
        (scrollLeftAction for hor-Scrollbars)
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    50
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 491
diff changeset
    51
        aScrollBar scrollDownAction:aBlock      the block to be evaluated for step-down
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 491
diff changeset
    52
        (scrollRightAction for hor-Scrollbars)
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    53
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 491
diff changeset
    54
        aScrollbar scrollAction:aBlock          the block to be evaluated for scroll
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 491
diff changeset
    55
                                                passing percentage as argument.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    56
6159
5507566304af #DOCUMENTATION by mawalch
mawalch
parents: 5950
diff changeset
    57
    Scrollbars can scroll synchronous (i.e. every movement is notified immediately via the
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    58
    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
    59
    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
    60
    will set it to asynchronous.)
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    61
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    62
    Most often scrollbars are used hidden with ScrollableView or HVScrollableView (i.e. you
5950
cfa9615f0a9b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5623
diff changeset
    63
    don't have to care for all the details).
128
claus
parents: 119
diff changeset
    64
claus
parents: 119
diff changeset
    65
    The scrollBars and scrollers protocols have been made similar enough to
claus
parents: 119
diff changeset
    66
    allow transparent use of either a scroller or a scrollBar in applications.
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 491
diff changeset
    67
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 491
diff changeset
    68
    [author:]
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 491
diff changeset
    69
        Claus Gittinger
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 491
diff changeset
    70
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 491
diff changeset
    71
    [see also:]
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 491
diff changeset
    72
        Scroller Slider
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 491
diff changeset
    73
        ScrollableView
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 21
diff changeset
    74
"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    75
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    76
855
e89107448535 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
    77
!ScrollBar class methodsFor:'style changes'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    78
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    79
updateStyleCache
440
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
    80
    "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
    81
1538
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
    82
    <resource: #style (#'scrollBar.buttonPositions' 
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
    83
                       #'scrollBar.level'
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
    84
                       #'scrollBar.scrollerBordered' 
1887
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
    85
                       #'scrollBar.elementSpacing'
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
    86
                       #'scrollBar.vScrollBarWidth'
5419
Claus Gittinger <cg@exept.de>
parents: 5127
diff changeset
    87
                       #'scrollBar.hScrollBarHeight' 
1887
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
    88
                      )>
440
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
    89
1887
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
    90
    DefaultButtonPositions := StyleSheet at:#'scrollBar.buttonPositions' default:#bottom.
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
    91
    DefaultLevel := StyleSheet at:#'scrollBar.level'.
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
    92
    DefaultScrollerBordered := StyleSheet at:#'scrollBar.scrollerBordered' default:false.
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
    93
    DefaultElementSpacing := StyleSheet 
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
    94
                                at:#'scrollBar.elementSpacing' 
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
    95
                                default:(StyleSheet is3D ifTrue:[1] ifFalse:[0]).
440
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 345
diff changeset
    96
1887
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
    97
    DefaultVScrollBarWidth  := StyleSheet at:#'scrollBar.vScrollBarWidth' default:nil.
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
    98
    DefaultHScrollBarHeight := StyleSheet at:#'scrollBar.hScrollBarHeight' default:nil.
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
    99
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
   100
    "Modified: / 28.4.1999 / 19:27:53 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   101
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   102
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   103
!ScrollBar methodsFor:'accessing'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   104
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   105
thumbHeight
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   106
    "return height of thumb in percent"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   107
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   108
    ^ thumb thumbHeight
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
thumbHeight:newHeight
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   112
    "set height 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 thumbHeight:newHeight.
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
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   119
    "return position of (top of) thumb in percent"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   120
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   121
    ^ thumb thumbOrigin
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   122
!
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   123
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   124
thumbOrigin:newOrigin
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   125
    "set position of (top of) thumb in percent"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   126
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   127
    thumb thumbOrigin:newOrigin.
3018
6c642cab7019 *** empty log message ***
ca
parents: 3017
diff changeset
   128
    self enableDisableButtons.
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   129
!
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   130
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   131
thumbOrigin:newOrigin thumbHeight:newHeight
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   132
    "set origin and height of thumb (both in percent)"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   133
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   134
    thumb thumbOrigin:newOrigin thumbHeight:newHeight.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   135
    self enableDisableButtons
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   136
! !
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   137
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   138
!ScrollBar methodsFor:'accessing-behavior'!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   139
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   140
asynchronousOperation
3846
158fdc10bba9 Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3763
diff changeset
   141
    <resource: #obsolete>
3017
8acd72001dd6 *** empty log message ***
ca
parents: 3016
diff changeset
   142
    self obsoleteMethodWarning:'use #beAsynchronous'.
8acd72001dd6 *** empty log message ***
ca
parents: 3016
diff changeset
   143
    self beAsynchronous
8acd72001dd6 *** empty log message ***
ca
parents: 3016
diff changeset
   144
!
8acd72001dd6 *** empty log message ***
ca
parents: 3016
diff changeset
   145
8acd72001dd6 *** empty log message ***
ca
parents: 3016
diff changeset
   146
beAsynchronous
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   147
    "set asynchronous-mode - scroll action is performed after movement
3017
8acd72001dd6 *** empty log message ***
ca
parents: 3016
diff changeset
   148
     of scroller when mouse-button is finally released (no tracking).
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   149
     This is forwarded to the scroller here."
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   150
3017
8acd72001dd6 *** empty log message ***
ca
parents: 3016
diff changeset
   151
    thumb beAsynchronous
8acd72001dd6 *** empty log message ***
ca
parents: 3016
diff changeset
   152
!
8acd72001dd6 *** empty log message ***
ca
parents: 3016
diff changeset
   153
8acd72001dd6 *** empty log message ***
ca
parents: 3016
diff changeset
   154
beSynchronous
8acd72001dd6 *** empty log message ***
ca
parents: 3016
diff changeset
   155
    "set synchronous-mode - scroll action is performed for every movement
8acd72001dd6 *** empty log message ***
ca
parents: 3016
diff changeset
   156
     of scroller (tracking).
8acd72001dd6 *** empty log message ***
ca
parents: 3016
diff changeset
   157
     This is forwarded to the scroller here."
8acd72001dd6 *** empty log message ***
ca
parents: 3016
diff changeset
   158
8acd72001dd6 *** empty log message ***
ca
parents: 3016
diff changeset
   159
    thumb beSynchronous
8acd72001dd6 *** empty log message ***
ca
parents: 3016
diff changeset
   160
!
8acd72001dd6 *** empty log message ***
ca
parents: 3016
diff changeset
   161
8acd72001dd6 *** empty log message ***
ca
parents: 3016
diff changeset
   162
isSynchronous
8acd72001dd6 *** empty log message ***
ca
parents: 3016
diff changeset
   163
    "return true if the scroll-mode is synchronous.
8acd72001dd6 *** empty log message ***
ca
parents: 3016
diff changeset
   164
     If true, the scroll action is performed for every movement of the thumb (tracking).
8acd72001dd6 *** empty log message ***
ca
parents: 3016
diff changeset
   165
     If false, the scroll action is only performed at the end."
8acd72001dd6 *** empty log message ***
ca
parents: 3016
diff changeset
   166
8acd72001dd6 *** empty log message ***
ca
parents: 3016
diff changeset
   167
    ^ thumb isSynchronous
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   168
!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   169
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   170
scrollAction:aBlock
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   171
    "set the action, aBlock to be performed when the scroller is moved.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   172
     This is forwarded to the scroller here."
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   173
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   174
    thumb scrollAction:aBlock
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   175
!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   176
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   177
scrollDownAction
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   178
    "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
   179
     (vertical scrollBars)"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   180
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   181
    ^ button2 action
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
    "Created: 28.5.1997 / 15:52:39 / cg"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   184
    "Modified: 28.5.1997 / 15:53:56 / cg"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   185
!
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   186
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   187
scrollDownAction:aBlock
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   188
    "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
   189
     (for vertical scrollBars)"
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   190
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   191
    button2 action:aBlock
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   192
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   193
    "Modified: 28.5.1997 / 15:51:39 / cg"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   194
!
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
scrollLeftAction
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   197
    "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
   198
     (for horizontal scrollBars)"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   199
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   200
    ^ button1 action
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   201
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   202
    "Created: 28.5.1997 / 15:51:22 / cg"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   203
!
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   204
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   205
scrollLeftAction:aBlock
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   206
    "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
   207
     (for horizontal scrollBars)"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   208
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   209
    button1 action:aBlock
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   210
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   211
    "Created: 28.5.1997 / 15:52:55 / cg"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   212
!
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   213
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   214
scrollRightAction
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   215
    "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
   216
     (for horizontal scrollBars)"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   217
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   218
    ^ button2 action
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   219
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   220
    "Created: 28.5.1997 / 15:53:15 / cg"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   221
!
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   222
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   223
scrollRightAction:aBlock
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   224
    "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
   225
     (for horizontal scrollBars)"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   226
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   227
    button2 action:aBlock
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   228
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   229
    "Created: 28.5.1997 / 15:53:30 / cg"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   230
!
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   231
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   232
scrollUpAction
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   233
    "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
   234
     (for vertical scrollBars)"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   235
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   236
    ^ button1 action
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   237
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   238
    "Created: 28.5.1997 / 15:53:51 / cg"
455
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
scrollUpAction:aBlock
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   242
    "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
   243
     (for vertical scrollBars)"
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   244
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   245
    button1 action:aBlock
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   246
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   247
    "Modified: 28.5.1997 / 15:51:33 / cg"
455
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
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   250
synchronousOperation
3846
158fdc10bba9 Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3763
diff changeset
   251
    <resource: #obsolete>
3017
8acd72001dd6 *** empty log message ***
ca
parents: 3016
diff changeset
   252
    self obsoleteMethodWarning:'use #beSynchronous'.
8acd72001dd6 *** empty log message ***
ca
parents: 3016
diff changeset
   253
    self beSynchronous
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   254
! !
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
!ScrollBar methodsFor:'accessing-components'!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   257
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   258
downButton
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   259
    "return the down-button
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   260
     (Please: only use this direct access for special applications)"
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   261
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   262
    ^ button2
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   263
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   264
    "
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   265
     |v|
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   266
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   267
     v := ScrollableView for:EditTextView.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   268
     v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile).
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   269
     v scrollBar upButton activeForegroundColor:Color red.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   270
     v scrollBar downButton activeForegroundColor:Color red.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   271
     v open
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   272
    "
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   273
!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   274
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   275
thumb 
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   276
    "return the thumb (i.e. the scroller subview)
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   277
     (Please: only use this direct access for special applications)"
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
    ^ thumb
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
    "
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   282
     |v|
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
     v := ScrollableView for:EditTextView.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   285
     v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile).
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   286
     v scrollBar thumb thumbColor:(Color red).
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   287
     v open
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   288
    "
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   289
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   290
    "Modified: 1.3.1996 / 19:15:50 / cg"
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   291
!
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   292
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   293
upButton
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   294
    "return the up-button
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   295
     (Please: only use this direct access for special applications)"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   296
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   297
    ^ button1
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   298
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   299
    "
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   300
     |v|
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   301
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   302
     v := ScrollableView for:EditTextView.
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   303
     v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile).
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   304
     v scrollBar upButton foregroundColor:(Color red).
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   305
     v scrollBar upButton enteredForegroundColor:(Color red lightened).
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   306
     v scrollBar downButton foregroundColor:(Color green).
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   307
     v scrollBar downButton enteredForegroundColor:(Color green lightened).
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   308
     v open
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   309
    "
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   310
! !
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   311
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   312
!ScrollBar methodsFor:'accessing-look'!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   313
3602
bec76402b9c2 allViewBackground: with optional condition
sr
parents: 3036
diff changeset
   314
allViewBackground:something if:condition
2456
042817ef96be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   315
    "blocked for all scrollBars (I want my own background)"
1958
9d53df393af1 allViewBackground stuff
Claus Gittinger <cg@exept.de>
parents: 1952
diff changeset
   316
2456
042817ef96be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   317
    "/ ^ super allViewBackground:something
1958
9d53df393af1 allViewBackground stuff
Claus Gittinger <cg@exept.de>
parents: 1952
diff changeset
   318
!
9d53df393af1 allViewBackground stuff
Claus Gittinger <cg@exept.de>
parents: 1952
diff changeset
   319
1950
4c19ae381920 made orientation an instVar
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   320
orientation
4c19ae381920 made orientation an instVar
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   321
    "for ST-80 compatibility, answer this query"
4c19ae381920 made orientation an instVar
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   322
4c19ae381920 made orientation an instVar
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   323
    ^ orientation
4c19ae381920 made orientation an instVar
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   324
!
4c19ae381920 made orientation an instVar
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   325
4c19ae381920 made orientation an instVar
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   326
orientation:aSymbol
4c19ae381920 made orientation an instVar
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   327
    "set the orientation; either #horizontal or #vertical"
4c19ae381920 made orientation an instVar
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   328
1952
Claus Gittinger <cg@exept.de>
parents: 1950
diff changeset
   329
    aSymbol ~~ orientation ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1950
diff changeset
   330
        orientation := aSymbol.
Claus Gittinger <cg@exept.de>
parents: 1950
diff changeset
   331
    ]
1950
4c19ae381920 made orientation an instVar
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   332
!
4c19ae381920 made orientation an instVar
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   333
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   334
thumbColor:aColor
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   335
    "set the thumbs color"
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   336
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   337
    thumb thumbColor:aColor
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   338
!
128
claus
parents: 119
diff changeset
   339
133
claus
parents: 130
diff changeset
   340
upButtonLabel:label1 downButtonLabel:label2
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   341
    "set the labels shown in the buttons.
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   342
     Because of the fixed button sizes, this only makes sense with 
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   343
     single-character strings or small bitmaps."
133
claus
parents: 130
diff changeset
   344
claus
parents: 130
diff changeset
   345
    button1 label:label1.
claus
parents: 130
diff changeset
   346
    button2 label:label2.
claus
parents: 130
diff changeset
   347
    self setElementPositions.
claus
parents: 130
diff changeset
   348
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   349
    "not bad:
133
claus
parents: 130
diff changeset
   350
     |v|
claus
parents: 130
diff changeset
   351
claus
parents: 130
diff changeset
   352
     v := ScrollableView for:EditTextView.
claus
parents: 130
diff changeset
   353
     v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile).
claus
parents: 130
diff changeset
   354
     v scrollBar upButtonLabel:'+' downButtonLabel:'-'.
claus
parents: 130
diff changeset
   355
     v open
claus
parents: 130
diff changeset
   356
    "
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   357
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   358
    "also possible :
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   359
     |v|
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   360
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   361
     v := ScrollableView for:EditTextView.
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   362
     v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile).
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   363
     v scrollBar upButtonLabel:'u' downButtonLabel:'d'.
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   364
     v open
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   365
    "
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   366
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   367
    "BAD example:
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   368
     |v|
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   369
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   370
     v := ScrollableView for:EditTextView.
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   371
     v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile).
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   372
     v scrollBar upButtonLabel:'up' downButtonLabel:'down'.
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   373
     v open
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   374
    "
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   375
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   376
    "Modified: 1.3.1996 / 19:06:50 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   377
! !
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   378
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   379
!ScrollBar methodsFor:'change & update'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   380
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   381
update:something with:aParameter from:changedObject
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   382
    changedObject == thumb ifTrue:[
3032
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   383
        self enableDisableButtons.
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   384
        ^ self.
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   385
    ].
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   386
    super update:something with:aParameter from:changedObject.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   387
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   388
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   389
!ScrollBar methodsFor:'events'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   390
482
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   391
keyPress:key x:x y:y
491
7b376aaa06d5 resources
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   392
7b376aaa06d5 resources
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   393
    <resource: #keyboard (#BeginOfText #EndOfText)>
7b376aaa06d5 resources
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   394
482
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   395
    (key == #BeginOfText) ifTrue:[
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   396
        self scrollToBeginning.
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   397
        ^ self
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   398
    ].
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   399
    (key == #EndOfText) ifTrue:[
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   400
        self scrollToEnd.
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   401
        ^ self
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   402
    ].
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   403
    super keyPress:key x:x y:y
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   404
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   405
    "Created: 6.3.1996 / 17:58:02 / cg"
491
7b376aaa06d5 resources
Claus Gittinger <cg@exept.de>
parents: 482
diff changeset
   406
    "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
   407
!
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   408
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   409
sizeChanged:how
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   410
    "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
   411
     Also, if I became too small, hide thumb/buttons."
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   412
1538
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
   413
    <resource: #style (#name)>
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
   414
1383
b6541bec0b4f minSize computation
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   415
    |upHeight "{ Class: SmallInteger }"
b6541bec0b4f minSize computation
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   416
     downHeight "{ Class: SmallInteger }"
b6541bec0b4f minSize computation
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   417
     thumbHeight "{ Class: SmallInteger }"
b6541bec0b4f minSize computation
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   418
     upAndDownHeight "{ Class: SmallInteger }"
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   419
     bw   "{ Class: SmallInteger }" 
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   420
     bwn  "{ Class: SmallInteger }"
1383
b6541bec0b4f minSize computation
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   421
     sep2 "{ Class: SmallInteger }"
1443
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   422
     sep3 "{ Class: SmallInteger }"
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   423
     m2   "{ Class: SmallInteger }"
3010
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   424
     thumbWidth w h style b1Visible b2Visible thumbVisible 
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   425
     b1WasVisible b2WasVisible thumbWasVisible bX bY
1443
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   426
     leftWidth rightWidth leftAndRightWidth isHorizontal
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   427
     tX tY tW tH tExt bOrg|
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   428
3676
ee14ed5d72f0 sizeChanged: dont forget to tell others
Claus Gittinger <cg@exept.de>
parents: 3602
diff changeset
   429
    super sizeChanged:how.
ee14ed5d72f0 sizeChanged: dont forget to tell others
Claus Gittinger <cg@exept.de>
parents: 3602
diff changeset
   430
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   431
    (button1 isNil or:[thumb isNil or:[button2 isNil]]) ifTrue:[^ self].
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   432
4016
ee6484f9cdb2 changed:
Claus Gittinger <cg@exept.de>
parents: 3846
diff changeset
   433
    bw := self borderWidth.
1383
b6541bec0b4f minSize computation
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   434
    bwn := bw negated + margin.
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   435
    m2 := margin * 2.
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   436
3010
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   437
    b1WasVisible := button1 realized.
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   438
    b2WasVisible := button2 realized.
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   439
    thumbWasVisible := thumb realized.
1265
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   440
1950
4c19ae381920 made orientation an instVar
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   441
    (isHorizontal := (orientation == #horizontal)) ifTrue:[
1383
b6541bec0b4f minSize computation
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   442
        leftWidth := button1 width + bw.
b6541bec0b4f minSize computation
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   443
        rightWidth := button2 width + bw.
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   444
        leftAndRightWidth := leftWidth + rightWidth.
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   445
1383
b6541bec0b4f minSize computation
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   446
        thumbWidth := width - leftAndRightWidth - bw - (elementSpacing * 3).
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   447
    "
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   448
        ((buttonLayout ~~ #top) and:[buttonLayout ~~ #bottom]) ifTrue:[
1383
b6541bec0b4f minSize computation
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   449
            thumbWidth := thumbWidth - bw
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   450
        ].
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   451
    "
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   452
        buttonLayout == #around ifTrue:[
1383
b6541bec0b4f minSize computation
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   453
            thumbWidth := thumbWidth + bw
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   454
        ].
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   455
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   456
        "if I become too small, hide buttons"
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   457
1724
b437f36e7e3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1603
diff changeset
   458
        width <= (leftAndRightWidth + m2) ifTrue:[
3010
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   459
            b1Visible := b2Visible := thumbVisible := false.  
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   460
        ] ifFalse:[
3010
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   461
            b1Visible := b2Visible := thumbVisible := true.  
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   462
        ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   463
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   464
        (thumbWidth < 10) ifTrue:[
3010
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   465
            thumbVisible := false.
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   466
        ] ifFalse:[
3010
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   467
            thumbVisible := true.
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   468
        ].
1265
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   469
    ] ifFalse:[
1383
b6541bec0b4f minSize computation
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   470
        upHeight := button1 height + bw.
b6541bec0b4f minSize computation
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   471
        downHeight := button2 height + bw.
1265
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   472
        upAndDownHeight := upHeight + downHeight.
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   473
1383
b6541bec0b4f minSize computation
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   474
        thumbHeight := height - upAndDownHeight - bw - (elementSpacing * 3).
1265
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   475
"
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   476
        ((buttonLayout ~~ #top) and:[buttonLayout ~~ #bottom]) ifTrue:[
1383
b6541bec0b4f minSize computation
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   477
            thumbHeight := thumbHeight - bw
1265
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   478
        ].
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   479
"
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   480
        buttonLayout == #around ifTrue:[
1383
b6541bec0b4f minSize computation
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   481
            thumbHeight := thumbHeight + bw
1265
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   482
        ].
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   483
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   484
        "if I become too small, hide buttons and thumb"
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   485
1724
b437f36e7e3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1603
diff changeset
   486
        height <= (upAndDownHeight + (m2)) ifTrue:[
3010
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   487
            b1Visible := b2Visible := thumbVisible := false.  
1265
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   488
        ] ifFalse:[
3010
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   489
            b1Visible := b2Visible := thumbVisible := true.  
1265
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   490
        ].
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   491
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   492
        (thumbHeight < 10) ifTrue:[
3010
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   493
            thumbVisible := false.
1265
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   494
        ] ifFalse:[
3010
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   495
            thumbVisible := true.
1265
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   496
        ].
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   497
    ].
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   498
3010
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   499
    b1Visible ~~ b1WasVisible ifTrue:[
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   500
        self changeVisibilityOf:button1 to:b1Visible.
1265
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   501
    ].
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   502
3010
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   503
    b2Visible ~~ b2WasVisible ifTrue:[
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   504
        self changeVisibilityOf:button2 to:b2Visible.
1265
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   505
    ].
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   506
3010
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   507
    thumbVisible ~~ thumbWasVisible ifTrue:[
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   508
        self changeVisibilityOf:thumb to:thumbVisible.
1265
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   509
    ].
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   510
1443
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   511
    sep2 := elementSpacing * 2.
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   512
1538
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
   513
    style := styleSheet name.
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
   514
1265
6899d60add7b avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   515
    isHorizontal ifTrue:[
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   516
        "height of buttons is always my width"
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   517
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   518
        h := height - m2.
130
claus
parents: 128
diff changeset
   519
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   520
        (h ~~ button1 height) ifTrue:[
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   521
            button1 height:h.
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   522
            button2 height:h
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   523
        ].
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   524
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   525
        thumbHeight := h.
1538
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
   526
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   527
        style == #next ifTrue:[
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   528
            thumbHeight := thumbHeight - (thumb borderWidth * 2).
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   529
            thumbWidth := thumbWidth - 1
1538
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
   530
        ] ifFalse:[
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
   531
            style == #motif ifTrue:[
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
   532
                thumbWidth := thumbWidth - margin
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
   533
            ]
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   534
        ].
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   535
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   536
        "
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   537
         a kludge: views with width or height of 0 are illegal
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   538
         avoid error from view-creation (it will be hidden anyway)
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   539
        "
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   540
        thumbWidth <= 0 ifTrue:[
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   541
            thumbWidth := 1
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   542
        ].
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   543
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   544
        (buttonLayout == #bottom) ifTrue:[
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   545
            "buttons at left"
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   546
            thumb extent:(thumbWidth @ thumbHeight).
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   547
            ^ self
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   548
        ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   549
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   550
        (buttonLayout == #top) ifTrue:[
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   551
            "buttons at right"
1383
b6541bec0b4f minSize computation
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   552
            thumbWidth := thumbWidth + bw.
3010
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   553
            thumbVisible ifFalse:[
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   554
                bX := elementSpacing
3010
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   555
            ] ifTrue:[
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   556
                bX := thumbWidth + sep2.
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   557
            ].
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   558
            tExt := (thumbWidth @ thumbHeight).
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   559
            (how == #smaller) ifTrue:[
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   560
                "/ resize thumb first
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   561
                thumb extent:tExt.
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   562
            ].
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   563
            button1 origin:(bX @ bwn).
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   564
            button2 origin:((bX + leftWidth) @ bwn).
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   565
            (how == #smaller) ifFalse:[
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   566
                "/ resize thumb last
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   567
                thumb extent:tExt
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   568
            ].
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   569
            ^ self
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   570
        ].
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   571
        "button around thumb"
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   572
1443
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   573
        sep3 := 0.
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   574
        style == #motif ifTrue:[
1847
acd644fef86e geometry of motif arrowButtons fixed
Claus Gittinger <cg@exept.de>
parents: 1821
diff changeset
   575
"/            sep2 := sep2 + 1.
1443
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   576
            sep3 := 1.
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   577
        ].
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   578
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   579
        button1 origin:(bwn @ bwn).
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   580
        bX := leftWidth + thumbWidth + sep2.
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   581
        tX := leftWidth - bw + elementSpacing.
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   582
        style == #os2 ifTrue:[
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   583
            bX := bX - margin.
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   584
            tW := thumbWidth - m2.
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   585
            tX := tX + margin.
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   586
        ] ifFalse:[
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   587
            bX := bX - (margin // 2).
1443
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   588
            tW := thumbWidth + margin - sep3 - (margin // 2).
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   589
            tX := tX + sep3.
1443
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   590
        ].
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   591
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   592
        "/ if made smaller, shrink thumb first, then move lower button.
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   593
        "/ otherwise, move lower button first, then make thumb larger.
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   594
        "/ this avoids a need to redraw the button2.
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   595
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   596
        bOrg := (bX @ bwn).
1443
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   597
        how ~~ #smaller ifTrue:[
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   598
            button2 origin:bOrg.
1443
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   599
        ].
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   600
        thumb extent:(tW @ thumbHeight).
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   601
        thumb origin:(tX @ bwn).
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   602
        how == #smaller ifTrue:[
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   603
            button2 origin:bOrg.
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   604
        ].
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   605
    ] ifFalse:[
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   606
        "width of buttons is always my width"
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   607
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   608
        w := width - m2.
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   609
        (w ~~ button1 width) ifTrue:[
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   610
            button1 width:w.
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   611
            button2 width:w
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   612
        ].
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   613
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   614
        thumbWidth := w.
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   615
        style == #next ifTrue:[
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   616
            thumbWidth := thumbWidth - (thumb borderWidth * 2).
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   617
            thumbHeight := thumbHeight - 1
1538
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
   618
        ] ifFalse:[
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
   619
            style == #motif ifTrue:[
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
   620
                thumbHeight := thumbHeight - margin
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
   621
            ]
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   622
        ].
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   623
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   624
        "
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   625
         a kludge: views with width or height of 0 are illegal
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   626
         avoid error from view-creation (it will be hidden anyway)
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   627
        "
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   628
        thumbHeight <= 0 ifTrue:[
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   629
            thumbHeight := 1
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   630
        ].
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   631
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   632
        (buttonLayout == #top) ifTrue:[
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   633
            "buttons at top"
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   634
            thumb extent:(thumbWidth @ thumbHeight).
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   635
            ^ self
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   636
        ].
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   637
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   638
        (buttonLayout == #bottom) ifTrue:[
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   639
            "buttons at bottom"
855
e89107448535 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   640
1383
b6541bec0b4f minSize computation
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   641
            thumbHeight := thumbHeight + bw.
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   642
            
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   643
            bY := thumbHeight + sep2.
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   644
            (bY + upAndDownHeight) >= height ifTrue:[
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   645
                bY := height - margin - upAndDownHeight
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   646
            ].
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   647
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   648
            button1 viewGravity:#North. 
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   649
            button2 viewGravity:#North. 
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   650
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   651
            tExt := (thumbWidth @ thumbHeight).
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   652
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   653
            (how == #smaller) ifTrue:[
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   654
                "/ resize thumb first
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   655
                thumb extent:tExt.
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   656
            ].
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   657
            button1 origin:(bwn @ bY).
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   658
            button2 origin:(bwn @ (bY + upHeight)).
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   659
            (how == #smaller) ifFalse:[
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   660
                "/ resize thumb last
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   661
                thumb extent:tExt
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   662
            ].
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   663
            ^ self
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   664
        ].
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   665
        "buttons around thumb"
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   666
1443
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   667
        sep3 := 0.
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   668
        style == #motif ifTrue:[
1847
acd644fef86e geometry of motif arrowButtons fixed
Claus Gittinger <cg@exept.de>
parents: 1821
diff changeset
   669
"/            sep2 := sep2 + 1.
1443
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   670
            sep3 := 1.
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   671
        ].
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   672
        button1 origin:(bwn @ bwn).
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   673
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   674
        bY := upHeight + thumbHeight + sep2.
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   675
        tY := upHeight - bw + elementSpacing.
1230
9d052df857b8 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   676
        style == #os2 ifTrue:[
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   677
            bY := bY - margin "+ bw".
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   678
            tH := thumbHeight - m2 "+ margin - (margin // 2)".
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   679
            tY := tY + margin.
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   680
        ] ifFalse:[
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   681
            bY := bY - (margin // 2) "+ bw".
1443
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   682
            tH := thumbHeight + margin - sep3 - (margin // 2).
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   683
            tY := tY + sep3.
1443
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   684
        ].
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   685
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   686
        "/ if made smaller, shrink thumb first, then move lower button.
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   687
        "/ otherwise, move lower button first, then make thumb larger.
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   688
        "/ this avoids a need to redraw the button2.
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   689
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   690
        bOrg := (bwn @ bY).
1443
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   691
        how ~~ #smaller ifTrue:[
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   692
            button2 origin:bOrg.
1443
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   693
        ].
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   694
        thumb extent:(thumbWidth @ tH).
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   695
        thumb origin:(bwn @ tY).
f6ff48dfde38 faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
   696
        how == #smaller ifTrue:[
1603
9089f7bdf62a some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   697
            button2 origin:bOrg.
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   698
        ].
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   699
    ].
613
7afeb510ce56 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 585
diff changeset
   700
1383
b6541bec0b4f minSize computation
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   701
    "Modified: / 3.5.1996 / 23:49:02 / stefan"
1724
b437f36e7e3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1603
diff changeset
   702
    "Modified: / 2.12.1998 / 00:02:14 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   703
! !
110
eb59f6e31e84 *** empty log message ***
claus
parents: 77
diff changeset
   704
1821
b57cc9dc2c08 changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents: 1724
diff changeset
   705
!ScrollBar methodsFor:'focus handling'!
b57cc9dc2c08 changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents: 1724
diff changeset
   706
b57cc9dc2c08 changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents: 1724
diff changeset
   707
wantsFocusWithButtonPress
b57cc9dc2c08 changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents: 1724
diff changeset
   708
    "no, do not catch the keyboard focus on button click"
b57cc9dc2c08 changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents: 1724
diff changeset
   709
b57cc9dc2c08 changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents: 1724
diff changeset
   710
    ^ false
b57cc9dc2c08 changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents: 1724
diff changeset
   711
b57cc9dc2c08 changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents: 1724
diff changeset
   712
b57cc9dc2c08 changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents: 1724
diff changeset
   713
! !
b57cc9dc2c08 changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents: 1724
diff changeset
   714
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   715
!ScrollBar methodsFor:'forced scroll'!
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   716
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   717
pageDown
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   718
    "page down/right"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   719
3033
a226bdba0d03 *** empty log message ***
ca
parents: 3032
diff changeset
   720
    thumb pageDown.
a226bdba0d03 *** empty log message ***
ca
parents: 3032
diff changeset
   721
    self updateNativeWidget.
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   722
!
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   723
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   724
pageUp
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   725
    "page up/left"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   726
3033
a226bdba0d03 *** empty log message ***
ca
parents: 3032
diff changeset
   727
    thumb pageUp.
a226bdba0d03 *** empty log message ***
ca
parents: 3032
diff changeset
   728
    self updateNativeWidget.
482
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   729
!
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   730
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   731
scrollToBeginning
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   732
    "to top"
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   733
3033
a226bdba0d03 *** empty log message ***
ca
parents: 3032
diff changeset
   734
    thumb scrollToBeginning.
a226bdba0d03 *** empty log message ***
ca
parents: 3032
diff changeset
   735
    self updateNativeWidget.
482
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   736
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   737
    "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
   738
!
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   739
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   740
scrollToEnd
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   741
    "to end"
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   742
3033
a226bdba0d03 *** empty log message ***
ca
parents: 3032
diff changeset
   743
    thumb scrollToEnd.
a226bdba0d03 *** empty log message ***
ca
parents: 3032
diff changeset
   744
    self updateNativeWidget.
482
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   745
f4d7344ae396 added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   746
    "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
   747
    "Modified: 6.3.1996 / 17:54:49 / cg"
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   748
! !
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   749
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   750
!ScrollBar methodsFor:'initialization'!
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   751
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   752
createElements
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   753
    "private: create my elements"
1041
976147f19ad7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   754
5623
7ad855aa8093 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5541
diff changeset
   755
    (device supportsNativeWidgetType:#Scrollbar) ifTrue:[
5126
ad71b20ca516 class: ScrollBar
Claus Gittinger <cg@exept.de>
parents: 4916
diff changeset
   756
        "/ native widget contains all I need.
5127
fcd696f9f401 Access device and drawableId via message sends
Stefan Vogel <sv@exept.de>
parents: 5126
diff changeset
   757
        "/ but I need a thumb from the model
5126
ad71b20ca516 class: ScrollBar
Claus Gittinger <cg@exept.de>
parents: 4916
diff changeset
   758
        thumb := Scroller new.
ad71b20ca516 class: ScrollBar
Claus Gittinger <cg@exept.de>
parents: 4916
diff changeset
   759
        thumb beInvisible.
ad71b20ca516 class: ScrollBar
Claus Gittinger <cg@exept.de>
parents: 4916
diff changeset
   760
        ^ self
ad71b20ca516 class: ScrollBar
Claus Gittinger <cg@exept.de>
parents: 4916
diff changeset
   761
    ].
ad71b20ca516 class: ScrollBar
Claus Gittinger <cg@exept.de>
parents: 4916
diff changeset
   762
1950
4c19ae381920 made orientation an instVar
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   763
    orientation == #horizontal ifTrue:[
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   764
        button1 := ArrowButton leftIn:self.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   765
        button1 name:'leftButton'.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   766
        button2 := ArrowButton rightIn:self.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   767
        button2 name:'rightButton'.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   768
        thumb := HorizontalScroller in:self.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   769
    ] ifFalse:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   770
        button1 := ArrowButton upIn:self.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   771
        button1 name:'upButton'.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   772
        button2 := ArrowButton downIn:self.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   773
        button2 name:'downButton'.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   774
        thumb := Scroller in:self.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   775
    ].
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   776
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   777
    "Modified: 28.5.1997 / 15:49:05 / cg"
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   778
!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   779
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   780
defaultExtent
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   781
    "compute my extent from sub-components"
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   782
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   783
    ^ self preferredExtent
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   784
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   785
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   786
    "Created: 1.3.1996 / 19:22:11 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   787
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   788
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   789
initStyle
968
ba32bbfb7aad commentary
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   790
    "setup viewStyle specifics"
ba32bbfb7aad commentary
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   791
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   792
    super initStyle.
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
    buttonLayout := DefaultButtonPositions.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   795
    DefaultLevel notNil ifTrue:[
968
ba32bbfb7aad commentary
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   796
        self level:DefaultLevel
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   797
    ].
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   798
    elementSpacing := DefaultElementSpacing
968
ba32bbfb7aad commentary
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   799
ba32bbfb7aad commentary
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   800
    "Modified: 22.1.1997 / 11:57:41 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   801
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   802
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   803
initialize
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   804
    "setup; create the 2 buttons and a scroller"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   805
1538
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
   806
    <resource: #style (#'scrollBar.disableButtons')>
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
   807
4016
ee6484f9cdb2 changed:
Claus Gittinger <cg@exept.de>
parents: 3846
diff changeset
   808
    |clr style bw|
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   809
1952
Claus Gittinger <cg@exept.de>
parents: 1950
diff changeset
   810
    orientation isNil ifTrue:[
1950
4c19ae381920 made orientation an instVar
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   811
        orientation := #vertical
4c19ae381920 made orientation an instVar
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   812
    ].
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   813
1952
Claus Gittinger <cg@exept.de>
parents: 1950
diff changeset
   814
    super initialize.
Claus Gittinger <cg@exept.de>
parents: 1950
diff changeset
   815
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   816
    self createElements.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   817
1889
4faa8705e831 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   818
    (styleSheet at:#'scrollBar.disableButtons' default:false) ifTrue:[
706
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   819
        thumb addDependent:self
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   820
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   821
5126
ad71b20ca516 class: ScrollBar
Claus Gittinger <cg@exept.de>
parents: 4916
diff changeset
   822
    button1 isNil ifTrue:[
ad71b20ca516 class: ScrollBar
Claus Gittinger <cg@exept.de>
parents: 4916
diff changeset
   823
        "/ native widget: no buttons
ad71b20ca516 class: ScrollBar
Claus Gittinger <cg@exept.de>
parents: 4916
diff changeset
   824
        ^ self
ad71b20ca516 class: ScrollBar
Claus Gittinger <cg@exept.de>
parents: 4916
diff changeset
   825
    ].
ad71b20ca516 class: ScrollBar
Claus Gittinger <cg@exept.de>
parents: 4916
diff changeset
   826
345
00abc00e73a9 use #autoRepeat:
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   827
    button1 autoRepeat:true.
00abc00e73a9 use #autoRepeat:
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   828
    button2 autoRepeat:true.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   829
4016
ee6484f9cdb2 changed:
Claus Gittinger <cg@exept.de>
parents: 3846
diff changeset
   830
    bw := self borderWidth.
4026
5ce3a000960c border handling
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   831
    button1 borderWidth:bw.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   832
    DefaultScrollerBordered ifFalse:[
4026
5ce3a000960c border handling
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   833
        thumb borderWidth:bw.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   834
    ].
4026
5ce3a000960c border handling
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   835
    button2 borderWidth:bw.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   836
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   837
    style := styleSheet name.
744
8d84193ca610 use 'Screen current' instead of 'Display'
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   838
    ((style = #iris) and:[Screen current hasGrayscales]) ifTrue:[
706
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   839
        "have to change some of Buttons defaults"
5623
7ad855aa8093 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5541
diff changeset
   840
        clr := (Color gray:25) onDevice:device.
710
4e1f1023d9ae checkin from browser
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
   841
        button1 passiveLevel:2.
4e1f1023d9ae checkin from browser
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
   842
        button2 passiveLevel:2.
706
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   843
        button1 foregroundColor:clr.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   844
        button1 activeForegroundColor:clr.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   845
        button1 enteredForegroundColor:clr.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   846
        button2 foregroundColor:clr.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   847
        button2 activeForegroundColor:clr.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   848
        button2 enteredForegroundColor:clr.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   849
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   850
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   851
    self setElementPositions.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   852
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   853
    style = #motif ifTrue:[
706
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   854
        clr := thumb thumbColor.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   855
        button1 foregroundColor:clr.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   856
        button2 foregroundColor:clr.
345
00abc00e73a9 use #autoRepeat:
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   857
706
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   858
        clr := thumb viewBackground.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   859
        button1 viewBackground:clr.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   860
        button2 viewBackground:clr.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   861
        button1 backgroundColor:clr.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   862
        button2 backgroundColor:clr.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   863
        button1 activeBackgroundColor:clr.
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   864
        button2 activeBackgroundColor:clr.
5623
7ad855aa8093 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5541
diff changeset
   865
        device hasGrayscales ifFalse:[
4916
8773e0c05f1b class: ScrollBar
Stefan Vogel <sv@exept.de>
parents: 4907
diff changeset
   866
            button1 activeForegroundColor:self blackColor.
8773e0c05f1b class: ScrollBar
Stefan Vogel <sv@exept.de>
parents: 4907
diff changeset
   867
            button2 activeForegroundColor:self blackColor.
706
54115626d33b gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
   868
        ]
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   869
    ]
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   870
1889
4faa8705e831 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   871
    "Modified: / 29.4.1999 / 08:43:30 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   872
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   873
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   874
reinitialize
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   875
    super reinitialize.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   876
    self setElementPositions.
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   877
!
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   878
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   879
setElementPositions
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   880
    "position sub-components"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   881
4016
ee6484f9cdb2 changed:
Claus Gittinger <cg@exept.de>
parents: 3846
diff changeset
   882
    |bw bwn|
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   883
4016
ee6484f9cdb2 changed:
Claus Gittinger <cg@exept.de>
parents: 3846
diff changeset
   884
    bw := self borderWidth.
ee6484f9cdb2 changed:
Claus Gittinger <cg@exept.de>
parents: 3846
diff changeset
   885
    bwn := bw negated + margin.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   886
1950
4c19ae381920 made orientation an instVar
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   887
    orientation == #horizontal ifTrue:[
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   888
        (buttonLayout == #bottom) ifTrue:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   889
            "buttons at left"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   890
            button1 origin:(bwn @ bwn).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   891
            button1 viewGravity:#West.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   892
            button2 origin:(button1 width @ bwn).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   893
            button2 viewGravity:#West.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   894
            thumb origin:((button1 width 
4016
ee6484f9cdb2 changed:
Claus Gittinger <cg@exept.de>
parents: 3846
diff changeset
   895
                           + bw 
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   896
                           + button2 width 
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   897
                           + elementSpacing + elementSpacing) @ bwn).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   898
            thumb viewGravity:#West.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   899
            ^ self
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   900
        ].
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   901
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   902
        (buttonLayout == #top) ifTrue:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   903
            "buttons at right"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   904
            button1 viewGravity:#West.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   905
            button2 viewGravity:#West.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   906
            thumb origin:(bwn @ bwn).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   907
            thumb viewGravity:#West
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   908
        ].
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   909
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   910
        "buttonLayout == #around "
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   911
        button1 origin:(bwn @ bwn).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   912
        button1 viewGravity:#West.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   913
        button2 viewGravity:#West.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   914
        thumb origin:((button1 width + elementSpacing) @ bwn).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   915
        thumb viewGravity:#West
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   916
    ] ifFalse:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   917
        (buttonLayout == #top) ifTrue:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   918
            button1 origin:(bwn @ bwn).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   919
            button1 viewGravity:#North.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   920
            button2 origin:(bwn @ (button1 height)).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   921
            button2 viewGravity:#North.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   922
            thumb origin:(bwn @ (button1 height 
4016
ee6484f9cdb2 changed:
Claus Gittinger <cg@exept.de>
parents: 3846
diff changeset
   923
                                 + bw 
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   924
                                 + button2 height 
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   925
                                 + elementSpacing 
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   926
                                 + elementSpacing)).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   927
            thumb viewGravity:#North.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   928
            ^ self
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   929
        ].
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   930
        (buttonLayout == #bottom) ifTrue:[
5623
7ad855aa8093 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5541
diff changeset
   931
            device supportsViewGravity ifTrue:[
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   932
                button1 viewGravity:#South. 
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   933
                button2 viewGravity:#South. 
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   934
                thumb viewGravity:#North.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   935
            ].
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   936
            thumb origin:(bwn @ bwn).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   937
            ^ self
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   938
        ].
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   939
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   940
        "buttonLayout == #around"
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   941
        button1 origin:(bwn @ bwn).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   942
        button1 viewGravity:#North.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   943
    "/    button2 viewGravity:#North.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   944
        thumb origin:(bwn @ (button1 height + elementSpacing)).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   945
        thumb viewGravity:#North
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   946
    ]
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   947
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
   948
    "Modified: 28.5.1997 / 15:50:27 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   949
! !
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   950
3030
801adbcb9e01 *** empty log message ***
ca
parents: 3029
diff changeset
   951
!ScrollBar methodsFor:'native widget support'!
801adbcb9e01 *** empty log message ***
ca
parents: 3029
diff changeset
   952
3032
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   953
beNativeWidget
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   954
    super beNativeWidget.
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   955
    self makeElementsInvisible.
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   956
!
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   957
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   958
makeElementsInvisible
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   959
    "when using native widget, my elements are not visible.
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   960
     (they are not destroyed, to keep a place for their attributes,
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   961
      and to allow future dynamic switching and snapshot restore on
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   962
      a non-native system)"
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   963
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   964
    button1 notNil ifTrue:[
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   965
        button1 beInvisible.
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   966
    ].
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   967
    button2 notNil ifTrue:[
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   968
        button2 beInvisible.
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   969
    ].
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   970
    thumb notNil ifTrue:[
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   971
        thumb beInvisible.
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   972
    ].
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   973
!
0c188fd28ebd *** empty log message ***
ca
parents: 3031
diff changeset
   974
3030
801adbcb9e01 *** empty log message ***
ca
parents: 3029
diff changeset
   975
nativeWindowType
801adbcb9e01 *** empty log message ***
ca
parents: 3029
diff changeset
   976
    "return a symbol describing my native window type 
5541
ec84bfd1d612 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5419
diff changeset
   977
     (may be used internally by the device as a native window creation hint,
ec84bfd1d612 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5419
diff changeset
   978
      if the device supports native windows)"
3030
801adbcb9e01 *** empty log message ***
ca
parents: 3029
diff changeset
   979
801adbcb9e01 *** empty log message ***
ca
parents: 3029
diff changeset
   980
    orientation == #vertical ifTrue:[
801adbcb9e01 *** empty log message ***
ca
parents: 3029
diff changeset
   981
        ^ #VerticalScrollBar
801adbcb9e01 *** empty log message ***
ca
parents: 3029
diff changeset
   982
    ].
801adbcb9e01 *** empty log message ***
ca
parents: 3029
diff changeset
   983
    ^ #HorizontalScrollBar
801adbcb9e01 *** empty log message ***
ca
parents: 3029
diff changeset
   984
!
801adbcb9e01 *** empty log message ***
ca
parents: 3029
diff changeset
   985
801adbcb9e01 *** empty log message ***
ca
parents: 3029
diff changeset
   986
updateNativeWidget
5126
ad71b20ca516 class: ScrollBar
Claus Gittinger <cg@exept.de>
parents: 4916
diff changeset
   987
    |id|
ad71b20ca516 class: ScrollBar
Claus Gittinger <cg@exept.de>
parents: 4916
diff changeset
   988
3030
801adbcb9e01 *** empty log message ***
ca
parents: 3029
diff changeset
   989
    self isNativeWidget ifTrue:[
5126
ad71b20ca516 class: ScrollBar
Claus Gittinger <cg@exept.de>
parents: 4916
diff changeset
   990
        (id := self drawableId) notNil ifTrue:[
5623
7ad855aa8093 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5541
diff changeset
   991
            device
3036
6e4ebc78220a *** empty log message ***
ca
parents: 3033
diff changeset
   992
                setScrollRange:0 to:100 
6e4ebc78220a *** empty log message ***
ca
parents: 3033
diff changeset
   993
                redraw:false 
5126
ad71b20ca516 class: ScrollBar
Claus Gittinger <cg@exept.de>
parents: 4916
diff changeset
   994
                in:id.
3036
6e4ebc78220a *** empty log message ***
ca
parents: 3033
diff changeset
   995
5623
7ad855aa8093 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5541
diff changeset
   996
            device
3030
801adbcb9e01 *** empty log message ***
ca
parents: 3029
diff changeset
   997
                setScrollPosition:thumb thumbOrigin rounded 
3036
6e4ebc78220a *** empty log message ***
ca
parents: 3033
diff changeset
   998
                redraw:false 
5126
ad71b20ca516 class: ScrollBar
Claus Gittinger <cg@exept.de>
parents: 4916
diff changeset
   999
                in:id.
3030
801adbcb9e01 *** empty log message ***
ca
parents: 3029
diff changeset
  1000
5623
7ad855aa8093 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5541
diff changeset
  1001
            device
3030
801adbcb9e01 *** empty log message ***
ca
parents: 3029
diff changeset
  1002
                setScrollBarPageSize:thumb thumbHeight rounded 
801adbcb9e01 *** empty log message ***
ca
parents: 3029
diff changeset
  1003
                redraw:true 
5126
ad71b20ca516 class: ScrollBar
Claus Gittinger <cg@exept.de>
parents: 4916
diff changeset
  1004
                in:id.
3030
801adbcb9e01 *** empty log message ***
ca
parents: 3029
diff changeset
  1005
        ]
801adbcb9e01 *** empty log message ***
ca
parents: 3029
diff changeset
  1006
    ].
801adbcb9e01 *** empty log message ***
ca
parents: 3029
diff changeset
  1007
! !
801adbcb9e01 *** empty log message ***
ca
parents: 3029
diff changeset
  1008
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1009
!ScrollBar methodsFor:'private'!
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1010
3010
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  1011
changeVisibilityOf:aComponent to:aBoolean
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  1012
    self isNativeWidget ifTrue:[^ self].
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  1013
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  1014
    aComponent hiddenOnRealize:aBoolean not.
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  1015
    aBoolean ifFalse:[
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  1016
        aComponent unmap
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  1017
    ] ifTrue:[
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  1018
        shown ifTrue:[aComponent realize]
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  1019
    ].
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  1020
!
f920bb8248bd care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  1021
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1022
enableDisableButtons
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1023
    "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
  1024
     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
  1025
     as appropriate."
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1026
1538
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1027
    <resource: #style (#'scrollBar.disableButtons')>
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1028
3019
6cfaf60fd8ea *** empty log message ***
ca
parents: 3018
diff changeset
  1029
    |e1 e2 th to ena|
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1030
1889
4faa8705e831 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
  1031
    (styleSheet at:#'scrollBar.disableButtons' default:false) ifFalse:[^ self].
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1032
    e1 := e2 := true.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1033
    (th := thumb thumbHeight) notNil ifTrue:[
1538
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1034
        (th >= (thumb stop)) ifTrue:[
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1035
            e1 := false.
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1036
            e2 := false
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1037
        ]
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1038
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1039
    ((to := thumb thumbOrigin) <= thumb start) ifTrue:[
1538
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1040
        e1 := false
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1041
    ] ifFalse:[
1538
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1042
        th isNil ifTrue:[th := 0].
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1043
        (to + th) >= thumb stop ifTrue:[
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1044
            e2 := false
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1045
        ]
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1046
    ].
4470
c18deb0cab99 changed: #enableDisableButtons
Claus Gittinger <cg@exept.de>
parents: 4026
diff changeset
  1047
    button1 enabled:e1. "/ e1 ifTrue:[button1 enable] ifFalse:[button1 disable].
c18deb0cab99 changed: #enableDisableButtons
Claus Gittinger <cg@exept.de>
parents: 4026
diff changeset
  1048
    button2 enabled:e2. "/ e2 ifTrue:[button2 enable] ifFalse:[button2 disable].
1538
f0d7b67bcc2b fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
  1049
3019
6cfaf60fd8ea *** empty log message ***
ca
parents: 3018
diff changeset
  1050
    self isNativeWidget ifTrue:[
4907
a1fe72ff16d7 class: ScrollBar
Stefan Vogel <sv@exept.de>
parents: 4628
diff changeset
  1051
        self drawableId notNil ifTrue:[
3019
6cfaf60fd8ea *** empty log message ***
ca
parents: 3018
diff changeset
  1052
            e1 ifTrue:[
6cfaf60fd8ea *** empty log message ***
ca
parents: 3018
diff changeset
  1053
                e2 ifTrue:[
6cfaf60fd8ea *** empty log message ***
ca
parents: 3018
diff changeset
  1054
                    "/ both enabled
6cfaf60fd8ea *** empty log message ***
ca
parents: 3018
diff changeset
  1055
                    ena := #ENABLE_BOTH.
6cfaf60fd8ea *** empty log message ***
ca
parents: 3018
diff changeset
  1056
                ] ifFalse:[
6cfaf60fd8ea *** empty log message ***
ca
parents: 3018
diff changeset
  1057
                    ena := #DISABLE_RTDN.
6cfaf60fd8ea *** empty log message ***
ca
parents: 3018
diff changeset
  1058
                ]
6cfaf60fd8ea *** empty log message ***
ca
parents: 3018
diff changeset
  1059
            ] ifFalse:[
6cfaf60fd8ea *** empty log message ***
ca
parents: 3018
diff changeset
  1060
                e2 ifTrue:[
6cfaf60fd8ea *** empty log message ***
ca
parents: 3018
diff changeset
  1061
                    ena := #DISABLE_LTUP.
6cfaf60fd8ea *** empty log message ***
ca
parents: 3018
diff changeset
  1062
                ] ifFalse:[
6cfaf60fd8ea *** empty log message ***
ca
parents: 3018
diff changeset
  1063
                    ena := #DISABLE_BOTH.
6cfaf60fd8ea *** empty log message ***
ca
parents: 3018
diff changeset
  1064
                ]
6cfaf60fd8ea *** empty log message ***
ca
parents: 3018
diff changeset
  1065
            ].
5623
7ad855aa8093 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5541
diff changeset
  1066
            device enableScrollBar:ena in:self drawableId.
3019
6cfaf60fd8ea *** empty log message ***
ca
parents: 3018
diff changeset
  1067
        ].
6cfaf60fd8ea *** empty log message ***
ca
parents: 3018
diff changeset
  1068
    ].
6cfaf60fd8ea *** empty log message ***
ca
parents: 3018
diff changeset
  1069
1889
4faa8705e831 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
  1070
    "Modified: / 29.4.1999 / 08:44:03 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1071
! !
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1072
2741
2f563c1ab4b7 method category rename
Claus Gittinger <cg@exept.de>
parents: 2456
diff changeset
  1073
!ScrollBar methodsFor:'private-scrollview interface'!
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1074
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1075
setThumbFor:aView
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1076
    "adjust thumb for aView 
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1077
     (i.e. adjust thumbs origin & size for views size & views contents).
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1078
     This is forwarded to the scroller here."
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1079
3018
6c642cab7019 *** empty log message ***
ca
parents: 3017
diff changeset
  1080
    thumb setThumbFor:aView.
3014
bf5e25dd200b *** empty log message ***
ca
parents: 3010
diff changeset
  1081
    self isNativeWidget ifTrue:[
3018
6c642cab7019 *** empty log message ***
ca
parents: 3017
diff changeset
  1082
        self updateNativeWidget.
3014
bf5e25dd200b *** empty log message ***
ca
parents: 3010
diff changeset
  1083
    ].
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1084
    self enableDisableButtons
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1085
!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1086
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1087
setThumbHeightFor:aView
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1088
    "adjust thumbs height for aViews size & contents.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1089
     This is forwarded to the scroller here."
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1090
3018
6c642cab7019 *** empty log message ***
ca
parents: 3017
diff changeset
  1091
    thumb setThumbHeightFor:aView.
3014
bf5e25dd200b *** empty log message ***
ca
parents: 3010
diff changeset
  1092
    self isNativeWidget ifTrue:[
3018
6c642cab7019 *** empty log message ***
ca
parents: 3017
diff changeset
  1093
        self updateNativeWidget.
3014
bf5e25dd200b *** empty log message ***
ca
parents: 3010
diff changeset
  1094
    ].
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1095
    self enableDisableButtons
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1096
!
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1097
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1098
setThumbOriginFor:aView
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1099
    "adjust thumbs origin for aViews size & contents.
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1100
     This is forwarded to the scroller here."
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1101
3018
6c642cab7019 *** empty log message ***
ca
parents: 3017
diff changeset
  1102
    thumb setThumbOriginFor:aView.
3014
bf5e25dd200b *** empty log message ***
ca
parents: 3010
diff changeset
  1103
    self isNativeWidget ifTrue:[
3018
6c642cab7019 *** empty log message ***
ca
parents: 3017
diff changeset
  1104
        self updateNativeWidget.
3014
bf5e25dd200b *** empty log message ***
ca
parents: 3010
diff changeset
  1105
    ].
455
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1106
    self enableDisableButtons
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1107
! !
b95ee13fe6a3 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1108
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1109
!ScrollBar methodsFor:'queries'!
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1110
1117
004465264731 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1041
diff changeset
  1111
isMiniScroller
004465264731 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1041
diff changeset
  1112
    ^ false
004465264731 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1041
diff changeset
  1113
004465264731 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1041
diff changeset
  1114
    "Created: 7.3.1997 / 16:20:12 / cg"
004465264731 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1041
diff changeset
  1115
!
004465264731 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1041
diff changeset
  1116
2358
eadde3a9c586 added #isScrolling query
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
  1117
isScrolling
eadde3a9c586 added #isScrolling query
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
  1118
    "true, if thumb is being moved (by user)"
eadde3a9c586 added #isScrolling query
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
  1119
eadde3a9c586 added #isScrolling query
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
  1120
    ^ thumb isScrolling
eadde3a9c586 added #isScrolling query
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
  1121
!
eadde3a9c586 added #isScrolling query
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
  1122
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1123
preferredExtent
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1124
    "compute my extent from sub-components"
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1125
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1126
    <resource: #style (#name)>
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1127
1887
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
  1128
    |w h form1 form2 style
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1129
     height1   "{ Class: SmallInteger }"
1887
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
  1130
     height2   "{ Class: SmallInteger }"
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
  1131
     width1    "{ Class: SmallInteger }"
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
  1132
     width2    "{ Class: SmallInteger }" |
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1133
3763
446dd5f64d8a changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3676
diff changeset
  1134
    "/ If I have an explicit preferredExtent..
446dd5f64d8a changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3676
diff changeset
  1135
    explicitExtent notNil ifTrue:[
446dd5f64d8a changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3676
diff changeset
  1136
        ^ explicitExtent
446dd5f64d8a changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3676
diff changeset
  1137
    ].
797
2f9cd56f48ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  1138
3763
446dd5f64d8a changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3676
diff changeset
  1139
    "/ If I have a cached preferredExtent value..
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 710
diff changeset
  1140
    preferredExtent notNil ifTrue:[
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 710
diff changeset
  1141
        ^ preferredExtent
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 710
diff changeset
  1142
    ].
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 710
diff changeset
  1143
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1144
    "
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1145
     need fix - this is a kludge;
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1146
     the if should not be needed ...
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1147
    "
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1148
    style := styleSheet name.
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1149
1950
4c19ae381920 made orientation an instVar
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
  1150
    orientation == #horizontal ifTrue:[
5623
7ad855aa8093 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5541
diff changeset
  1151
        form1 := ArrowButton leftArrowButtonForm:style on:device.
7ad855aa8093 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5541
diff changeset
  1152
        form2 := ArrowButton rightArrowButtonForm:style on:device.
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1153
    ] ifFalse:[
5623
7ad855aa8093 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5541
diff changeset
  1154
        form1 := ArrowButton upArrowButtonForm:style on:device.
7ad855aa8093 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5541
diff changeset
  1155
        form2 := ArrowButton downArrowButtonForm:style on:device.
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1156
    ].
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1157
    form1 isNil ifTrue:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1158
        height1 := width1 := 16.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1159
    ] ifFalse:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1160
        height1 := form1 height.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1161
        width1 := form1 width
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1162
    ].
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1163
    form2 isNil ifTrue:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1164
        height2 := width2 := 16
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1165
    ] ifFalse:[
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1166
        height2 := form2 height.
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1167
        width2 := form2 width
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1168
    ].
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1169
1950
4c19ae381920 made orientation an instVar
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
  1170
    orientation == #horizontal ifTrue:[
1887
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
  1171
        DefaultHScrollBarHeight notNil ifTrue:[
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
  1172
            h := DefaultHScrollBarHeight
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
  1173
        ] ifFalse:[
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
  1174
            h := height1 max:height2.
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
  1175
        ].
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1176
        w := width1 + width2 + (1 * 2) + (HorizontalScroller defaultExtent x).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1177
    ] ifFalse:[
1887
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
  1178
        DefaultVScrollBarWidth notNil ifTrue:[
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
  1179
            w := DefaultVScrollBarWidth
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
  1180
        ] ifFalse:[
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
  1181
            w := width1 max:width2.
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
  1182
        ].
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1183
        h := height1 + height2 + (1 * 2) + (Scroller defaultExtent y).
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1184
    ].
1887
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
  1185
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1186
    style ~~ #normal ifTrue:[
1887
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
  1187
        DefaultHScrollBarHeight isNil ifTrue:[h := h + 4].
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
  1188
        DefaultVScrollBarWidth isNil ifTrue:[w := w + 4].
1229
19be2e822d45 merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1189
    ].
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1190
786
8b301af1cdcc remember and do not recompute the preferredExtent;
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1191
    preferredExtent := w @ h.
8b301af1cdcc remember and do not recompute the preferredExtent;
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
  1192
    ^ preferredExtent
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 710
diff changeset
  1193
1887
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
  1194
    "Modified: / 28.4.1999 / 19:33:45 / cg"
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1195
! !
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1196
855
e89107448535 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  1197
!ScrollBar class methodsFor:'documentation'!
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1198
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1199
version
5419
Claus Gittinger <cg@exept.de>
parents: 5127
diff changeset
  1200
    ^ '$Header$'
4016
ee6484f9cdb2 changed:
Claus Gittinger <cg@exept.de>
parents: 3846
diff changeset
  1201
!
ee6484f9cdb2 changed:
Claus Gittinger <cg@exept.de>
parents: 3846
diff changeset
  1202
ee6484f9cdb2 changed:
Claus Gittinger <cg@exept.de>
parents: 3846
diff changeset
  1203
version_CVS
5419
Claus Gittinger <cg@exept.de>
parents: 5127
diff changeset
  1204
    ^ '$Header$'
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1205
! !
4628
a6e909e6328f class: ScrollBar
Claus Gittinger <cg@exept.de>
parents: 4470
diff changeset
  1206