HorizontalScrollBar.st
author claus
Sat, 08 Jan 1994 18:27:56 +0100
changeset 21 9ef599238fea
parent 7 15a9291b9bd0
child 38 4b9b70b2cc87
permissions -rw-r--r--
*** empty log message ***
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
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     3
              All Rights Reserved
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     4
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    12
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    13
ScrollBar subclass:#HorizontalScrollBar
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    14
       instanceVariableNames:''
21
9ef599238fea *** empty log message ***
claus
parents: 7
diff changeset
    15
       classVariableNames:'DefaultScrollRightForm
9ef599238fea *** empty log message ***
claus
parents: 7
diff changeset
    16
                           DefaultScrollLeftForm'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    17
       poolDictionaries:''
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    18
       category:'Views-Interactors'
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    19
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    20
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    21
HorizontalScrollBar comment:'
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    22
5
claus
parents: 3
diff changeset
    23
COPYRIGHT (c) 1989 by Claus Gittinger
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    24
              All Rights Reserved
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    25
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    26
this class implements horizontal scrollbars with scroller and
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    27
2 step-scroll buttons. when moved or stepped, it perform a
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    28
predefined action.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    29
21
9ef599238fea *** empty log message ***
claus
parents: 7
diff changeset
    30
$Header: /cvs/stx/stx/libwidg/HorizontalScrollBar.st,v 1.5 1994-01-08 17:27:18 claus Exp $
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    31
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    32
written spring/summer 89 by claus
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    33
'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    34
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    35
!HorizontalScrollBar class methodsFor:'defaults'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    36
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    37
scrollLeftButtonForm:style
21
9ef599238fea *** empty log message ***
claus
parents: 7
diff changeset
    38
    DefaultScrollLeftForm isNil ifTrue:[
9ef599238fea *** empty log message ***
claus
parents: 7
diff changeset
    39
        DefaultScrollLeftForm := Form fromFile:(self classResources at:'SCROLL_LEFT_BUTTON_FORM_FILE'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    40
                                                     default:(style == #mswindows
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    41
                                                                 ifTrue:['ScrollLt_win.xbm']
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    42
                                                                 ifFalse:['ScrollLt.xbm']))
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    43
                                    resolution:100
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    44
    ].
21
9ef599238fea *** empty log message ***
claus
parents: 7
diff changeset
    45
    DefaultScrollLeftForm isNil ifTrue:[
9ef599238fea *** empty log message ***
claus
parents: 7
diff changeset
    46
        DefaultScrollLeftForm :=
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    47
            Form width:16 height:16 fromArray:#(2r00000000 2r00000000
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    48
                                                2r00000001 2r10000000
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    49
                                                2r00000010 2r10000000
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    50
                                                2r00000100 2r10000000
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    51
                                                2r00001000 2r11111110
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    52
                                                2r00010000 2r00000010
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    53
                                                2r00100000 2r00000010
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    54
                                                2r01000000 2r00000010
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    55
                                                2r01000000 2r00000010
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    56
                                                2r00100000 2r00000010
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    57
                                                2r00010000 2r00000010
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    58
                                                2r00001000 2r11111110
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    59
                                                2r00000100 2r10000000
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    60
                                                2r00000010 2r10000000
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    61
                                                2r00000001 2r10000000
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    62
                                                2r00000000 2r00000000)
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    63
    ].
21
9ef599238fea *** empty log message ***
claus
parents: 7
diff changeset
    64
    ^ DefaultScrollLeftForm
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    65
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    66
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    67
scrollRightButtonForm:style
21
9ef599238fea *** empty log message ***
claus
parents: 7
diff changeset
    68
    DefaultScrollRightForm isNil ifTrue:[
9ef599238fea *** empty log message ***
claus
parents: 7
diff changeset
    69
        DefaultScrollRightForm := Form fromFile:(self classResources at:'SCROLL_RIGHT_BUTTON_FORM_FILE'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    70
                                                      default:(style == #mswindows
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    71
                                                                 ifTrue:['ScrollRt_win.xbm']
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    72
                                                                 ifFalse:['ScrollRt.xbm']))
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    73
                                     resolution:100
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    74
    ].
21
9ef599238fea *** empty log message ***
claus
parents: 7
diff changeset
    75
    DefaultScrollRightForm isNil ifTrue:[
9ef599238fea *** empty log message ***
claus
parents: 7
diff changeset
    76
        DefaultScrollRightForm :=
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    77
            Form width:16 height:16 fromArray:#(2r00000000 2r00000000
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    78
                                                2r00000001 2r10000000
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    79
                                                2r00000001 2r01000000
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    80
                                                2r00000001 2r00100000
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    81
                                                2r01111111 2r00010000
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    82
                                                2r01000000 2r00001000
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    83
                                                2r01000000 2r00000100
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    84
                                                2r01000000 2r00000010
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    85
                                                2r01000000 2r00000010
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    86
                                                2r01000000 2r00000100
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    87
                                                2r01000000 2r00001000
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    88
                                                2r01111111 2r00010000
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    89
                                                2r00000001 2r00100000
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    90
                                                2r00000001 2r01000000
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    91
                                                2r00000001 2r10000000
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    92
                                                2r00000000 2r00000000)
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    93
    ].
21
9ef599238fea *** empty log message ***
claus
parents: 7
diff changeset
    94
    ^ DefaultScrollRightForm
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    95
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    96
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    97
!HorizontalScrollBar methodsFor:'initialization'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    98
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    99
initialize
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   100
    |bwn sep h w leftForm rightForm c|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   101
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   102
    super initialize.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   103
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   104
    "compute my extent from sub-components"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   105
    leftForm  := self class scrollLeftButtonForm:style.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   106
    rightForm := self class scrollRightButtonForm:style.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   107
    w := leftForm width + rightForm width 
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   108
         + (1 "self defaultBorderWidth" * 2) 
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   109
         + (HorizontalScroller defaultExtent x).
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   110
    h := (leftForm height) max:(rightForm height).
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   111
    self is3D ifTrue:[
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   112
        h := h + 4.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   113
        w := w + 4
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   114
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   115
    self extent:w @ h.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   116
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   117
    bwn := borderWidth negated + margin.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   118
    self is3D ifTrue:[
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   119
        sep := 1
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   120
    ] ifFalse:[
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   121
        sep := 0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   122
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   123
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   124
    "poor design - destroy and re-create thumgs"
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   125
    button1 destroy.
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   126
    button2 destroy.
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   127
    thumb destroy.
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   128
3
claus
parents: 0
diff changeset
   129
    button1 := ArrowButton leftIn:self.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   130
    button1 name:'LeftButton'.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   131
    button1 borderWidth:borderWidth.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   132
    button1 autoRepeat.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   133
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   134
    thumb := HorizontalScroller in:self.
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   135
    style ~~ #next ifTrue:[
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   136
        thumb borderWidth:borderWidth.
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   137
    ].
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   138
3
claus
parents: 0
diff changeset
   139
    button2 := ArrowButton rightIn:self.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   140
    button2 name:'RightButton'.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   141
    button2 borderWidth:borderWidth.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   142
    button2 autoRepeat.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   143
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   144
    ((style == #iris) and:[Display hasGreyscales])ifTrue:[
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   145
        "have to change some of Buttons defaults"
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   146
        c := (Color grey:25) on:device.
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   147
        button1 offLevel:2.
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   148
        button2 offLevel:2.
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   149
        button1 foregroundColor:c.
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   150
        button1 activeForegroundColor:c.
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   151
        button1 enteredForegroundColor:c.
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   152
        button2 foregroundColor:c.
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   153
        button2 activeForegroundColor:c.
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   154
        button2 enteredForegroundColor:c.
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   155
    ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   156
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   157
    (layout == #bottom) ifTrue:[
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   158
        "buttons at left"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   159
        button1 origin:(bwn @ bwn).
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   160
        button1 viewGravity:#West.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   161
        button2 origin:(button1 width @ bwn).
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   162
        button2 viewGravity:#West.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   163
        thumb origin:((button1 width + borderWidth + button2 width + sep + sep) @ bwn).
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   164
        thumb viewGravity:#West
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   165
    ] ifFalse:[
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   166
        (layout == #top) ifTrue:[
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   167
            "buttons at right"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   168
            button1 viewGravity:#West.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   169
            button2 viewGravity:#West.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   170
            thumb origin:(bwn @ bwn).
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   171
            thumb viewGravity:#West
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   172
        ] ifFalse:[
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   173
            button1 origin:(bwn @ bwn).
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   174
            button1 viewGravity:#West.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   175
            button2 viewGravity:#West.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   176
            thumb origin:((button1 width + sep) @ bwn).
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   177
            thumb viewGravity:#West
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   178
        ]
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   179
    ]
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   180
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   181
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   182
!HorizontalScrollBar methodsFor:'accessing'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   183
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   184
scrollLeftAction:aBlock
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   185
    button1 action:aBlock
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   186
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   187
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   188
scrollRightAction:aBlock
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   189
    button2 action:aBlock
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   190
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   191
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   192
!HorizontalScrollBar methodsFor:'events'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   193
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   194
sizeChanged:how
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   195
    |leftWidth rightWidth thumbWidth leftAndRightWidth bwn sep sep2 
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   196
     thumbHeight h|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   197
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   198
    button1 isNil ifTrue:[^ self].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   199
    button2 isNil ifTrue:[^ self].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   200
    thumb isNil ifTrue:[^ self].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   201
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   202
    leftWidth := button1 width + borderWidth.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   203
    rightWidth := button2 width + borderWidth.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   204
    leftAndRightWidth := leftWidth + rightWidth.
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   205
    bwn := borderWidth negated + margin.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   206
    self is3D ifTrue:[
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   207
        sep := 1
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   208
    ] ifFalse:[
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   209
        sep := 0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   210
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   211
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   212
    thumbWidth := width - leftAndRightWidth - borderWidth - (sep * 3).
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   213
"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   214
    ((layout ~~ #top) and:[layout ~~ #bottom]) ifTrue:[
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   215
        thumbWidth := thumbWidth - borderWidth
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   216
    ].
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   217
"
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   218
    layout == #around ifTrue:[
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   219
        thumbWidth := thumbWidth + borderWidth
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   220
    ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   221
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   222
    "if I become too small, hide buttons"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   223
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   224
    (width < leftAndRightWidth) ifTrue:[
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   225
        button1 shown ifTrue:[
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   226
            button1 hidden.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   227
            button2 hidden.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   228
            thumb hidden
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   229
        ]
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   230
    ] ifFalse:[
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   231
        shown ifTrue:[
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   232
            button1 shown ifFalse:[
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   233
                button1 show.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   234
                button2 show.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   235
                thumb show
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   236
            ]
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   237
        ]
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   238
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   239
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   240
    (thumbWidth < 10) ifTrue:[
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   241
        thumb shown ifTrue:[
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   242
            thumb hidden
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   243
        ]
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   244
    ] ifFalse:[
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   245
        thumb shown ifFalse:[
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   246
            button1 shown ifTrue:[
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   247
                thumb show
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   248
            ]
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   249
        ]
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   250
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   251
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   252
    "height of buttons is always my width"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   253
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   254
    h := height - (margin * 2).
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   255
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   256
    (h ~~ button1 height) ifTrue:[
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   257
        button1 height:height.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   258
        button2 height:height
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   259
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   260
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   261
    thumbHeight := h.
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   262
    style == #next ifTrue:[
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   263
        thumbHeight := thumbHeight - (thumb borderWidth * 2).
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   264
        thumbWidth := thumbWidth - 1
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   265
    ].
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   266
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   267
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   268
    (layout == #bottom) ifTrue:[
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   269
        "buttons at left"
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   270
        thumb extent:(thumbWidth @ thumbHeight).
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   271
        ^ self
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   272
    ].
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   273
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   274
    sep2 := sep * 2.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   275
    (layout == #top) ifTrue:[
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   276
        "buttons at right"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   277
        (how == #smaller) ifTrue:[
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   278
            thumb extent:(thumbWidth @ thumbHeight).
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   279
            button1 origin:((thumbWidth + sep2) @ bwn).
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   280
            button2 origin:((thumbWidth + sep2 + leftWidth) @ bwn)
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   281
        ] ifFalse:[
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   282
            button1 origin:((thumbWidth + sep2) @ bwn).
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   283
            button2 origin:((thumbWidth + sep2 + leftWidth) @ bwn).
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   284
            thumb extent:(thumbWidth @ thumbHeight)
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   285
        ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   286
        ^ self
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   287
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   288
    "button around thumb"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   289
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   290
    button1 origin:(bwn @ bwn).
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   291
    button2 origin:((leftWidth + thumbWidth + sep2) @ bwn).
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   292
    thumb extent:((thumbWidth + margin) @ thumbHeight).
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   293
    thumb origin:((leftWidth - borderWidth + sep) @ bwn)
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   294
! !