Scroller.st
author tz
Tue, 25 Aug 1998 12:58:48 +0200
changeset 1652 3c8983776c9e
parent 1531 c5f2cfee9998
child 1657 4ae7bf80d51a
permissions -rw-r--r--
enableChannel added
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
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
     3
              All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     4
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    12
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    13
View subclass:#Scroller
1011
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    14
	instanceVariableNames:'thumbOrigin thumbHeight thumbColor thumbFrameColor scrollAction
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    15
		orientation thumbFrame thumbLevel scrolling pressOffset
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    16
		synchronousOperation shadowForm lightForm inset thumbShadowColor
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    17
		thumbLightColor thumbEdgeStyle thumbHalfShadowColor
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    18
		thumbHalfLightColor thumbEnteredColor thumbFrameSizeDifference
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    19
		tallyLevel tallyMarks fixThumbHeight frameBeforeMove ghostColor
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    20
		ghostFrameColor ghostLevel rangeStart rangeEnd rangeStep entered
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
    21
		thumbActiveLevel originBeforeMove thumbImage enabled
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
    22
		enableChannel'
1011
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    23
	classVariableNames:'HandleShadowForm HandleLightForm DefaultViewBackground
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    24
		DefaultShadowColor DefaultLightColor DefaultThumbColor
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    25
		DefaultThumbShadowColor DefaultThumbLightColor
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    26
		DefaultThumbHalfShadowColor DefaultThumbHalfLightColor
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    27
		DefaultHalfShadowColor DefaultHalfLightColor DefaultTallyMarks
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    28
		DefaultTallyLevel DefaultLevel DefaultBorderWidth
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    29
		DefaultThumbLevel DefaultInset DefaultThumbFrameColor
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    30
		DefaultGhostColor DefaultGhostFrameColor DefaultGhostLevel
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    31
		DefaultFixThumbHeight DefaultEdgeStyle DefaultFullViewBackground
1301
1fbe38b283e4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
    32
		DefaultThumbEnteredColor DefaultThumbActiveLevel SnapBackDistance
1531
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
    33
		DefaultMiddleButtonJump NewCursors DefaultThumbImage HandleImage'
1011
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    34
	poolDictionaries:''
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    35
	category:'Views-Interactors'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    36
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    37
897
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
    38
!Scroller class methodsFor:'documentation'!
3
claus
parents: 0
diff changeset
    39
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    40
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    41
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    42
 COPYRIGHT (c) 1989 by Claus Gittinger
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
    43
              All Rights Reserved
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    44
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    45
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    46
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    47
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    48
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    49
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    50
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    51
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    52
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    53
3
claus
parents: 0
diff changeset
    54
documentation
claus
parents: 0
diff changeset
    55
"
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    56
    this class implements the scroller for scrollbars.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    57
    it can also be used by itself for scrollbars without step-buttons.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    58
    When moved, either a predefined action is performed (scrollAction),
119
claus
parents: 117
diff changeset
    59
    or a model is informed via the changeMsg (which is #value: by default).
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    60
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    61
    The scroller can work synchronous (i.e. every move leads to an immediate evaluation
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    62
    of the action, or asynchronous (i.e. perform action on end-of move).
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    63
    By default, scrollers are synchronous. Asynchronous operation makes sense, 
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    64
    if the scroll operation (redraw) is expensive and takes a long time.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    65
127
claus
parents: 120
diff changeset
    66
    This class is used both for concrete instances (vertical scrollers)
claus
parents: 120
diff changeset
    67
    and as an abstract superclass for horizontalScrollers, sliders and
claus
parents: 120
diff changeset
    68
    miniScrollers.
claus
parents: 120
diff changeset
    69
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    70
  range:
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    71
    the value passed to the model or via the action blocks is scaled according
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    72
    to the min/maxRange instance variables.
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    73
    These default to 0..100 for percentage values.
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    74
    It does not make sense to change the range for scrollbar-scrollers,
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    75
    but may be useful with Sliders or in special applications.
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    76
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    77
  style stuff:
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    78
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    79
    Beside the obvious 3D rectangle, a scroller may draw a know-form
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    80
    (as in NeXT) or little tally marks (as on SGI) in itself.
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    81
    These are controlled by the shadowForm, lightForm, tallyLevel and tallyMarks
1302
Claus Gittinger <cg@exept.de>
parents: 1301
diff changeset
    82
    instance variables. All of this is initialized from the styleSheet.
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    83
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
    84
  [Instance variables:]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    85
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    86
    thumbOrigin                 <Number>        origin of thumb (in percent)
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    87
    thumbHeight                 <Number>        height of thumb (in percent)
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    88
    thumbColor                  <Color>         color of thumb
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    89
    thumbFrameColor             <Color>         color of the frame around the thumb
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    90
    scrollAction                <Block>         1 arg block to be evaluated when scrolled
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
    91
                                                (arg is position in percent)
119
claus
parents: 117
diff changeset
    92
    orientation                 <Symbol>        #horizontal or #vertical
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    93
    thumbFrame                  <Rectangle>     frame of thumb in pixels (cached)
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    94
    thumbLevel                  <Number>        level of thumb if 3d
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    95
    scrolling                   <Boolean>       true during scroll
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    96
    pressOffset                 <Number>        temporary (offset into frame when move started)
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    97
    synchronousOperation        <Boolean>       true if synchronous (i.e. dont wait till release
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
    98
                                                to perform action)
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    99
    shadowForm                  <Form>          bitmap of knob if any (shadow part)
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   100
    lightForm                   <Form>          bitmap of knob if any (light part)
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   101
    inset                       <Integer>       number of pixels to inset thumb from view borders
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   102
    thumbShadowColor            <Color>         color do draw dark parts of thumb
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   103
    thumblightColor             <Color>         color to draw light parts of thumb
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   104
    thumbEdgeStyle              <SymbolOrNil>   #soft or nil
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   105
    thumbHalfShadowColor        <Color>         used to draw smooth edges
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   106
    thumbHalfLightColor         <Color>         used to draw smooth edges
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   107
    thumbFrameSizeDifference    <Integer>       number of pixels the thumb is larger than 
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   108
                                                it should be (can be negative for mswin-style)
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   109
    tallyLevel                  <Integer>       if not zero, specifies if tally-marks should
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   110
                                                go into or out of the display (actually only <0/>0 is checked)
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   111
                                                I dont know of a better word for these ...
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   112
    tallyMarks                  <Integer>       number of tally marks
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   113
    fixThumbHeight              <Boolean>       perform 'wrong' height computation a la mswindows
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   114
    rangeStart                  <Number>        the range of the scroller
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   115
    rangeEnd                                    (defaults to 0..100)
119
claus
parents: 117
diff changeset
   116
    rangeStep                                   not currently implemented
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   117
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
   118
  [style settings:]
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   119
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   120
    scrollerLevel               <Integer>       the level of the scroller w.r.t. its enclosing view
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   121
    scrollerBorderWidth         <Integer>       the borderWidth (ignored for 3D styles)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   122
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   123
    scrollerViewBackground      <Color>         the viewBackground (color or image)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   124
    scrollerShadowColor         <Color>         the color of 3D shadowed edges (ignored in 2D styles)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   125
    scrollerLightColor          <Color>         the color of 3D lighted edges (ignored in 2D styles)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   126
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   127
    scrollerThumbColor          <Color>         the thumbs color (color or image)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   128
    scrollerThumbShadowColor    <Color>         the color of the thumbs shadowed edges (ignored in 2D styles)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   129
    scrollerThumbLightColor     <Color>         the color of the thumbs shadowed edges (ignored in 2D styles)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   130
    scrollerThumbEdgeStyle      <Symbol>        the edge style for the thumb (#soft or nil)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   131
    scrollerThumbLevel          <Integer>       the 3D height of the thumb
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   132
    scrollerThumbHalfShadowColor<Color>         the halfShadow for soft edged thumbs
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   133
    scrollerThumbHalfLightColor <Color>         the halfLight for soft edged thumbs
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   134
    scrollerThumbFrameColor     <Color>         if non-nil, a rectangle is drawn around the thumb is this color
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   135
    scrollerThumbInset          <Integer>       inset of thumb from the scrollers boundary
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   136
    scrollerThumbFixHeight      <Boolean>       if true, use a fix thumb height (as in mswindows)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   137
    scrollerGhostColor          <Color>         the color in which a ghost-rectangle is drawn
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   138
    scrollerGhostFrameColor     <Color>         if non-nil, a rectangle is drawn around the ghost is this color
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   139
    scrollerGhostLevel          <Color>         the 3D level of the ghost rectangle
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   140
    scrollerNTallyMarks         <Integer>       number of tally-marks to draw on the thumb
1302
Claus Gittinger <cg@exept.de>
parents: 1301
diff changeset
   141
    scrollerTallyLevel          <Integer>       the 3D level of any tally marks
Claus Gittinger <cg@exept.de>
parents: 1301
diff changeset
   142
    scrollerSnapBack            <Boolean>       win95 behavior: snap back to original position if scrollers view
Claus Gittinger <cg@exept.de>
parents: 1301
diff changeset
   143
                                                is left by mouse (with some distance)
Claus Gittinger <cg@exept.de>
parents: 1301
diff changeset
   144
    scrollerMiddleButtonJump    <Boolean>       xterm behavior: middle button has shift-click behavior
Claus Gittinger <cg@exept.de>
parents: 1301
diff changeset
   145
                                                (positions absolute to click position)
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   146
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   147
    notice: for mswindows style, we force a WRONG thumb-frame
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   148
    computation, to make the thumb have constant size; 
1302
Claus Gittinger <cg@exept.de>
parents: 1301
diff changeset
   149
    if you dont like that (I do not :-), 
Claus Gittinger <cg@exept.de>
parents: 1301
diff changeset
   150
    set scrollerThumbFixHeight to false (in the StyleSheet).
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
   151
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
   152
    [author:]
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   153
        Claus Gittinger
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
   154
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
   155
    [see also:]
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   156
        ScrollBar
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   157
        ScrollableView HVScrollableView
3
claus
parents: 0
diff changeset
   158
"
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   159
!
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   160
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   161
examples
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   162
"
133
claus
parents: 132
diff changeset
   163
    basic scroller setup:
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   164
                                                                        [exBegin]
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   165
        |top s|
133
claus
parents: 132
diff changeset
   166
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   167
        top := StandardSystemView new extent:200@200.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   168
        s := Scroller in:top.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   169
        s origin:(0.0@0.0) corner:(20@1.0).
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   170
        s thumbHeight:10.  'percent'.     
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   171
        top open
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   172
                                                                        [exEnd]
133
claus
parents: 132
diff changeset
   173
claus
parents: 132
diff changeset
   174
    setting its thumb-height:
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   175
                                                                        [exBegin]
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   176
        |top s|
133
claus
parents: 132
diff changeset
   177
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   178
        top := StandardSystemView new extent:200@200.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   179
        s := Scroller in:top.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   180
        s origin:(0.0@0.0) corner:(20@1.0).
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   181
        s thumbHeight:50.  'percent'.     
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   182
        top open
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   183
                                                                        [exEnd]
133
claus
parents: 132
diff changeset
   184
claus
parents: 132
diff changeset
   185
    setting its thumb-origin:
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   186
                                                                        [exBegin]
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   187
        |top s|
133
claus
parents: 132
diff changeset
   188
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   189
        top := StandardSystemView new extent:200@200.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   190
        s := Scroller in:top.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   191
        s origin:(0.0@0.0) corner:(20@1.0).
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   192
        s thumbHeight:10.  'percent'.     
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   193
        s thumbOrigin:30.  'percent'.     
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   194
        top open
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   195
                                                                        [exEnd]
133
claus
parents: 132
diff changeset
   196
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   197
    a scroller with action block (ST/X style):
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   198
                                                                        [exBegin]
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   199
        |top s|
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   200
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   201
        top := StandardSystemView new extent:200@200.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   202
        s := Scroller in:top.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   203
        s origin:(0.0@0.0) corner:(20@1.0).
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   204
        s thumbHeight:10.  'percent'.     
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   205
        s scrollAction:[:percent | Transcript show:'moved to: '; showCR:percent asFloat].
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   206
        top open
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   207
                                                                        [exEnd]
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   208
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   209
    setting its range:
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   210
                                                                        [exBegin]
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   211
        |top s|
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   212
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   213
        top := StandardSystemView new extent:200@200.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   214
        s := Scroller in:top.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   215
        s origin:(0.0@0.0) corner:(20@1.0).
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   216
        s thumbHeight:10.  'percent'.     
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   217
        s scrollAction:[:percent | Transcript show:'moved to: '; showCR:percent asFloat].
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   218
        s start:0 stop:1.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   219
        top open
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   220
                                                                        [exEnd]
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   221
130
claus
parents: 128
diff changeset
   222
    create a scroller in its default extent and have it positioned
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   223
    at the side; beside another view:
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   224
                                                                        [exBegin]
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   225
        |top s v|
130
claus
parents: 128
diff changeset
   226
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   227
        top := StandardSystemView new extent:200@200.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   228
        s := Scroller in:top.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   229
        s origin:(0.0@0.0) corner:(0.0@1.0).
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   230
        s rightInset:(s preferredExtent x negated).
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   231
        s thumbHeight:10.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   232
        s level:1.
130
claus
parents: 128
diff changeset
   233
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   234
        v := View in:top.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   235
        v origin:0.0@0.0 corner:1.0@1.0.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   236
        v leftInset:(s preferredExtent x).
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   237
        v viewBackground:Color red.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   238
        v level:2.
130
claus
parents: 128
diff changeset
   239
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   240
        top open
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   241
                                                                        [exEnd]
130
claus
parents: 128
diff changeset
   242
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   243
    using a model (ST-80 style):
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   244
                                                                        [exBegin]
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   245
        |top s m|
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   246
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   247
        m := 0 asValue.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   248
        InspectorView openOn:m monitor:'value'.  'look at value'.
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   249
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   250
        top := StandardSystemView new extent:200@200.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   251
        s := Scroller in:top.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   252
        s origin:(0.0@0.0) corner:(20@1.0).
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   253
        s thumbHeight:10.  'percent'.     
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   254
        s model:m.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   255
        top open
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   256
                                                                        [exEnd]
119
claus
parents: 117
diff changeset
   257
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   258
    using a different changeSelector:
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   259
                                                                        [exBegin]
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   260
        |top s1 s2 m|
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   261
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   262
        m := Plug new.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   263
        m respondTo:#value1: with:[:v | Transcript show:'scroller 1 moved to: '; showCR:v].
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   264
        m respondTo:#value2: with:[:v | Transcript show:'scroller 2 moved to: '; showCR:v].
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   265
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   266
        top := StandardSystemView new extent:200@200.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   267
        s1 := Scroller in:top.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   268
        s1 origin:(0.0@0.0) corner:(20@1.0).
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   269
        s1 thumbHeight:10.  'percent'.     
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   270
        s1 model:m; change:#value1:.
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   271
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   272
        s2 := Scroller in:top.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   273
        s2 origin:(30@0.0) corner:(50@1.0).
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   274
        s2 thumbHeight:10.  'percent'.     
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   275
        s2 model:m; change:#value2:.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   276
        top open
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   277
                                                                        [exEnd]
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   278
"
3
claus
parents: 0
diff changeset
   279
! !
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   280
897
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   281
!Scroller class methodsFor:'defaults'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   282
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   283
handleLightFormOn:aDisplay
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   284
    "answer the form used for the handles light area;
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   285
     cache the one for Display for the next round"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   286
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   287
    |f|
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   288
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   289
    ((aDisplay == Display) and:[HandleLightForm notNil]) ifTrue:[
897
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   290
        ^ HandleLightForm
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   291
    ].
897
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   292
    f := Image fromFile:'bitmaps/HandleLight.xbm' resolution:100 on:aDisplay.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   293
    f isNil ifTrue:[
897
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   294
        f := Form width:8 height:8 fromArray:#[2r00000000
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   295
                                               2r00000010
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   296
                                               2r00000011
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   297
                                               2r00000011
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   298
                                               2r00000011
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   299
                                               2r00000011
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   300
                                               2r00000110
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   301
                                               2r00111100]
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   302
                                              on:aDisplay
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   303
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   304
    (aDisplay == Display) ifTrue:[
897
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   305
        HandleLightForm := f
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   306
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   307
    ^ f
897
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   308
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   309
    "Modified: 23.10.2031 / 01:00:00 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   310
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   311
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   312
handleShadowFormOn:aDisplay
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   313
    "answer the form used for the handles shadow area;
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   314
     cache the one for Display for the next round"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   315
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   316
    |f|
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   317
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   318
    ((aDisplay == Display) and:[HandleShadowForm notNil]) ifTrue:[
897
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   319
        ^ HandleShadowForm
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   320
    ].
897
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   321
    f := Image fromFile:'bitmaps/HandleShadow.xbm' resolution:100 on:aDisplay.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   322
    f isNil ifTrue:[
897
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   323
        f := Form width:8 height:8 fromArray:#[2r00111100
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   324
                                               2r01100000
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   325
                                               2r11000000
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   326
                                               2r11000000
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   327
                                               2r11000000
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   328
                                               2r11000000
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   329
                                               2r01000000
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   330
                                               2r00000000]
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   331
                                           on:aDisplay
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   332
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   333
    (aDisplay == Display) ifTrue:[
897
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   334
        HandleShadowForm := f
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   335
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   336
    ^ f
897
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   337
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   338
    "Modified: 19.12.1996 / 01:00:00 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   339
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   340
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   341
updateStyleCache
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
   342
    "extract values from the styleSheet and cache them in class variables"
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
   343
1347
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   344
    <resource: #style (#'scroller.viewBackground' #'scroller.fullViewBackground'
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   345
                       #'scroller.thumbColor' 
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   346
                       #'scroller.shadowColor' #'scroller.lightColor'
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   347
                       #'scroller.thumbShadowColor' #'scroller.thumbLightColor'
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   348
                       #'scroller.thumbHalfShadowColor' #'scroller.thumbHalfLightColor'
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   349
                       #'scroller.thumbFrameColor' #'scroller.ghostColor'
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   350
                       #'scroller.ghostLevel' #'scroller.ghostFrameColor'
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   351
                       #'scroller.NTallyMarks' #'scroller.tallyLevel'
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   352
                       #'scroller.level' #'scroller.borderWidth'
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   353
                       #'scroller.thumbLevel' #'scroller.thumbInset'
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   354
                       #'scroller.thumbFixHeight' #'scroller.thumbEdgeStyle'
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   355
                       #'scroller.thumbEnteredColor' #'scroller.thumbActiveLevel'
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   356
                       #'scroller.middleButtonJump' 
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   357
                       #'scroller.newCursors')>
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
   358
1347
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   359
    DefaultViewBackground := StyleSheet colorAt:'scroller.viewBackground'.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   360
    DefaultFullViewBackground := StyleSheet colorAt:'scroller.fullViewBackground'.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   361
    DefaultThumbColor := StyleSheet colorAt:'scroller.thumbColor'.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   362
    DefaultThumbEnteredColor := StyleSheet colorAt:'scroller.thumbEnteredColor'.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   363
    DefaultShadowColor := StyleSheet colorAt:'scroller.shadowColor'.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   364
    DefaultLightColor := StyleSheet colorAt:'scroller.lightColor'.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   365
    DefaultThumbShadowColor := StyleSheet colorAt:'scroller.thumbShadowColor'.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   366
    DefaultThumbLightColor := StyleSheet colorAt:'scroller.thumbLightColor'.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   367
    DefaultThumbHalfShadowColor := StyleSheet colorAt:'scroller.thumbHalfShadowColor'.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   368
    DefaultThumbHalfLightColor := StyleSheet colorAt:'scroller.thumbHalfLightColor'.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   369
    DefaultThumbFrameColor := StyleSheet colorAt:'scroller.thumbFrameColor'.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   370
    DefaultGhostColor := StyleSheet colorAt:'scroller.ghostColor' default:nil.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   371
    DefaultGhostFrameColor := StyleSheet colorAt:'scroller.ghostFrameColor' default:nil.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   372
    DefaultGhostLevel := StyleSheet at:'scroller.ghostLevel' default:0.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   373
    DefaultTallyMarks := StyleSheet at:'scroller.NTallyMarks' default:0.
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   374
    DefaultTallyLevel := 0.
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   375
    DefaultTallyMarks ~~ 0 ifTrue:[
1347
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   376
        DefaultTallyLevel := StyleSheet at:'scroller.tallyLevel' default:1.
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   377
    ].
1347
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   378
    DefaultLevel := StyleSheet at:'scroller.level' default:0.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   379
    DefaultBorderWidth := StyleSheet at:'scroller.borderWidth' default:(StyleSheet at:'borderWidth').
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   380
    DefaultThumbLevel := StyleSheet at:'scroller.thumbLevel' default:0.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   381
    DefaultThumbActiveLevel := StyleSheet at:'scroller.thumbActiveLevel' default:DefaultThumbLevel.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   382
    DefaultInset := StyleSheet at:'scroller.thumbInset' default:0.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   383
    DefaultFixThumbHeight := StyleSheet at:'scroller.thumbFixHeight' default:false.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   384
    DefaultEdgeStyle := StyleSheet at:'scroller.thumbEdgeStyle'.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   385
    DefaultMiddleButtonJump := StyleSheet at:'scroller.middleButtonJump' default:false.
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   386
    NewCursors := StyleSheet at:'scroller.newCursors' default:true.
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   387
    DefaultThumbImage := StyleSheet at:'scroller.thumbImage'.
1531
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
   388
    HandleImage := StyleSheet at:'scroller.handleImage'.
130
claus
parents: 128
diff changeset
   389
claus
parents: 128
diff changeset
   390
    StyleSheet fileReadFailed ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   391
        DefaultViewBackground := Grey.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   392
        DefaultThumbColor := White.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   393
        DefaultThumbFrameColor := Black.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   394
        DefaultInset := 1.
1203
c25ad158d812 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1189
diff changeset
   395
    ].
c25ad158d812 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1189
diff changeset
   396
c25ad158d812 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1189
diff changeset
   397
    SnapBackDistance := 30.
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
   398
1121
dccc1c729fd3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1115
diff changeset
   399
    "
dccc1c729fd3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1115
diff changeset
   400
     self updateStyleCache
dccc1c729fd3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1115
diff changeset
   401
    "
dccc1c729fd3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1115
diff changeset
   402
1531
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
   403
    "Modified: / 19.5.1998 / 16:24:02 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   404
! !
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   405
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   406
!Scroller methodsFor:'accessing'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   407
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   408
start 
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   409
    "return the scrollers range min.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   410
     (not used with Scrollers, but provided for subclasses)"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   411
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   412
    ^ rangeStart
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   413
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   414
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   415
start:start
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   416
    "set the scrollers range min.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   417
     (not used with Scrollers, but provided for subclasses)"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   418
679
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   419
    self start:start stop:rangeEnd.
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   420
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   421
    "Modified: 25.5.1996 / 11:28:22 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   422
!
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   423
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   424
start:start stop:stop
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   425
    "set the range.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   426
     (not used with Scrollers, but provided for subclasses)"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   427
679
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   428
    |org|
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   429
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   430
    org := self thumbOrigin.
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   431
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   432
    rangeStart := start.
679
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   433
    rangeEnd := stop.
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   434
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   435
    rangeStart = rangeEnd ifTrue:[
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   436
        self halt:'invalud slider range (start = stop)'.
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   437
        rangeStep isNil ifTrue:[
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   438
            rangeEnd := rangeStart + 1
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   439
        ] ifFalse:[
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   440
            rangeEnd := rangeStart + rangeStep.
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   441
        ]
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   442
    ].
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   443
679
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   444
    org < rangeStart ifTrue:[
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   445
        org := rangeStart
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   446
    ] ifFalse:[
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   447
        org > rangeEnd ifTrue:[
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   448
            org := rangeEnd
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   449
        ]
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   450
    ].
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   451
    self thumbOrigin:org.
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   452
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   453
    "Modified: / 21.1.1998 / 19:22:07 / cg"
679
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   454
!
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   455
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   456
start:start stop:stop step:step
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   457
    "set the range.
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   458
     (not used with Scrollers, but provided for subclasses)"
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   459
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   460
    self start:start stop:stop.
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   461
    rangeStep := step.
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   462
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   463
    "Created: 25.5.1996 / 11:24:09 / cg"
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   464
    "Modified: 25.5.1996 / 11:27:43 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   465
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   466
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   467
step
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   468
    "return the scrollers range step.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   469
     (not used with Scrollers, but provided for subclasses)"
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   470
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   471
    ^ rangeStep
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   472
!
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   473
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   474
step:step
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   475
    "set the scrollers range step.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   476
     (not used with Scrollers, but provided for subclasses)"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   477
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   478
    rangeStep := step
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   479
!
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   480
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   481
stop
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   482
    "return the scrollers range max.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   483
     (not used with Scrollers, but provided for subclasses)"
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   484
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   485
    ^ rangeEnd
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   486
!
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   487
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   488
stop:stop
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   489
    "set the scrollers range max.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   490
     (not used with Scrollers, but provided for subclasses)"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   491
679
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   492
    self start:rangeStart stop:stop.
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   493
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   494
    "Modified: 25.5.1996 / 11:28:35 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   495
!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   496
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   497
thumbFrame
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   498
    "return the area used by the thumbFrame (in device coordinates).
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   499
     Allows access to the thumbs physical screen position, for
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   500
     example to position a label below (see Slider-Examples)"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   501
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   502
    thumbFrame isNil ifTrue:[ self computeThumbFrame].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   503
    ^ thumbFrame
119
claus
parents: 117
diff changeset
   504
!
claus
parents: 117
diff changeset
   505
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   506
thumbHeight
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   507
    "answer the thumbs height (in percent by default)"
119
claus
parents: 117
diff changeset
   508
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   509
    ^ thumbHeight * (rangeEnd - rangeStart) abs / 100
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   510
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   511
    "Modified: / 21.1.1998 / 19:25:33 / cg"
119
claus
parents: 117
diff changeset
   512
!
claus
parents: 117
diff changeset
   513
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   514
thumbHeight:aNumber 
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   515
    "set the thumbs height (in percent by default)"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   516
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   517
    |newHeight realNewHeight oldFrame nBg|
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   518
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   519
    newHeight := aNumber / ((rangeEnd - rangeStart) abs / 100).
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   520
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   521
    (newHeight > 100) ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   522
        realNewHeight := 100
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   523
    ] ifFalse:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   524
        realNewHeight := newHeight
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   525
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   526
    ((realNewHeight ~= thumbHeight) or:[thumbFrame isNil]) ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   527
        thumbHeight := realNewHeight.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   528
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   529
        (DefaultFullViewBackground notNil
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   530
        and:[DefaultViewBackground notNil
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   531
        and:[DefaultFullViewBackground ~~ DefaultViewBackground]]) ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   532
            realNewHeight >= 100 ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   533
                nBg := DefaultFullViewBackground.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   534
            ] ifFalse:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   535
                nBg := DefaultViewBackground
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   536
            ].
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   537
            nBg := nBg on:device.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   538
            nBg ~~ viewBackground ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   539
                self viewBackground:nBg.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   540
                shown ifTrue:[self clear].
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   541
            ]
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   542
        ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   543
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   544
        shown ifTrue:[
1189
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   545
            thumbFrame := nil.
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   546
            self invalidate.
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   547
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   548
"/            oldFrame := thumbFrame.
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   549
"/            self computeThumbFrame.
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   550
"/            (fixThumbHeight or:[oldFrame ~= thumbFrame]) ifTrue:[
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   551
"/                oldFrame notNil ifTrue:[
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   552
"/                    self drawThumbBackgroundInX:(oldFrame left)
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   553
"/                                              y:(oldFrame top) 
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   554
"/                                          width:(oldFrame width) 
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   555
"/                                         height:(oldFrame height).
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   556
"/                ].
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   557
"/                self drawThumb
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   558
"/            ]
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   559
        ] ifFalse:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   560
            thumbFrame := nil
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   561
        ]
119
claus
parents: 117
diff changeset
   562
    ]
1127
e55aa76e226d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   563
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   564
    "Modified: / 21.1.1998 / 19:25:46 / cg"
119
claus
parents: 117
diff changeset
   565
!
claus
parents: 117
diff changeset
   566
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   567
thumbOrigin
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   568
    "answer the thumbs origin (in percent by default)"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   569
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   570
    |org|
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   571
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   572
    org := thumbOrigin * (rangeEnd - rangeStart) / 100 + rangeStart.
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   573
    rangeStep notNil ifTrue:[
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   574
        org := org roundTo:rangeStep.
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   575
        rangeStep isInteger ifTrue:[
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   576
            org := org asInteger
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   577
        ]
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   578
    ].
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   579
    ^ org
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   580
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   581
    "Modified: / 21.1.1998 / 19:13:48 / cg"
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   582
!
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   583
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   584
thumbOrigin:aNumber 
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   585
    "set the thumbs origin (in percent by default)"
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   586
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   587
    |org newOrigin realNewOrigin 
119
claus
parents: 117
diff changeset
   588
     oldFrame oldTop oldBot oldLeft oldRight
claus
parents: 117
diff changeset
   589
     thumbTop thumbBot thumbLeft thumbRight
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   590
     tH "{ Class: SmallInteger }"
119
claus
parents: 117
diff changeset
   591
     tW 
132
claus
parents: 131
diff changeset
   592
     delta needFullDraw 
119
claus
parents: 117
diff changeset
   593
     bgLeft bgTop bgWidth bgHeight|
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   594
1250
5e4f96c330de handle a nil thumbOrigin argument (uninitialized model)
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   595
    aNumber isNil ifTrue:[
5e4f96c330de handle a nil thumbOrigin argument (uninitialized model)
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   596
        newOrigin := 0
5e4f96c330de handle a nil thumbOrigin argument (uninitialized model)
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   597
    ] ifFalse:[
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   598
        org := aNumber.
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   599
        rangeStep notNil ifTrue:[
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   600
            org := org roundTo:rangeStep.
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   601
            rangeStep isInteger ifTrue:[
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   602
                org := org asInteger
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   603
            ]
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   604
        ].
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   605
        newOrigin := (org - rangeStart) asFloat / (rangeEnd - rangeStart / 100).
1250
5e4f96c330de handle a nil thumbOrigin argument (uninitialized model)
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   606
    ].
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   607
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   608
    ((newOrigin + thumbHeight) > 100) ifTrue:[
983
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   609
        realNewOrigin := 100 - thumbHeight
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   610
    ] ifFalse: [
983
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   611
        realNewOrigin := newOrigin
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   612
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   613
    (realNewOrigin > 100) ifTrue:[
983
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   614
        realNewOrigin := 100
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   615
    ] ifFalse: [
983
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   616
        (realNewOrigin < 0) ifTrue:[
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   617
            realNewOrigin := 0
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   618
        ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   619
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   620
    ((realNewOrigin ~= thumbOrigin) or:[thumbFrame isNil]) ifTrue:[
983
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   621
        thumbOrigin := realNewOrigin.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   622
983
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   623
        shown ifTrue:[
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   624
            oldFrame := thumbFrame.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   625
            self computeThumbFrame.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   626
            (thumbHeight = 100) ifTrue:[
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   627
                "/ full: don't draw
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   628
                ^ self
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   629
            ].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   630
1127
e55aa76e226d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   631
            (thumbFrame ~= oldFrame) ifTrue:[
983
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   632
                oldFrame isNil ifTrue:[
1189
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   633
                    self invalidate.
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   634
                    "/ self drawThumb.
983
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   635
                    ^ self
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   636
                ].
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   637
                tH := thumbFrame height.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   638
                tW := thumbFrame width.
119
claus
parents: 117
diff changeset
   639
983
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   640
                oldTop := oldFrame top.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   641
                oldBot := oldTop + tH.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   642
                oldLeft := oldFrame left.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   643
                oldRight := oldLeft + tW.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   644
983
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   645
                thumbTop := thumbFrame top.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   646
                thumbBot := thumbTop + tH.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   647
                thumbLeft := thumbFrame left.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   648
                thumbRight := thumbLeft + tW.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   649
983
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   650
                needFullDraw := self exposeEventPending
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   651
                                or:[((orientation == #vertical) and:[oldBot >= height])
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   652
                                or:[((orientation ~~ #vertical) and:[oldRight >= width])]].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   653
983
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   654
                needFullDraw ifTrue:[
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   655
                    "
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   656
                     cannot copy since thumb was below the end
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   657
                     or may be not available for the copy
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   658
                    "
1189
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   659
                    self invalidate.
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   660
"/                    (orientation == #vertical) ifTrue:[
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   661
"/                        self drawThumbBackgroundInX:thumbLeft y:oldTop
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   662
"/                                              width:tW height:(height - oldTop).
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   663
"/                    ] ifFalse:[
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   664
"/                        self drawThumbBackgroundInX:oldLeft y:thumbTop
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   665
"/                                              width:(width - oldLeft) height:tH.
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   666
"/                    ].
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   667
"/                    self drawThumb.
983
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   668
                    ^ self
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   669
                ].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   670
983
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   671
                self catchExpose.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   672
                "
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   673
                 copy the thumbs pixels
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   674
                "
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   675
                (orientation == #vertical) ifTrue:[
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   676
                    self 
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   677
                        copyFrom:self 
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   678
                        x:thumbLeft y:oldTop
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   679
                        toX:thumbLeft y:thumbTop
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   680
                        width:tW height:tH
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   681
                        async:true.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   682
                ] ifFalse:[
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   683
                    self 
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   684
                        copyFrom:self 
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   685
                        x:oldLeft y:thumbTop
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   686
                        toX:thumbLeft y:thumbTop
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   687
                        width:tW height:tH
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   688
                        async:true.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   689
                ].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   690
983
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   691
                "
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   692
                 clear some of the previous thumbs area to background
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   693
                "
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   694
                (orientation == #vertical) ifTrue:[
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   695
                    bgLeft := thumbLeft.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   696
                    bgWidth := tW.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   697
                    oldTop > thumbTop ifTrue:[
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   698
                        delta := oldTop - thumbTop.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   699
                        oldTop > thumbBot ifTrue:[
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   700
                            bgTop := oldTop.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   701
                            bgHeight := tH + 1
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   702
                        ] ifFalse:[
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   703
                            bgTop := thumbBot.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   704
                            bgHeight := delta
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   705
                        ]
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   706
                    ] ifFalse:[
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   707
                        delta := thumbTop - oldTop.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   708
                        oldBot < thumbTop ifTrue:[
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   709
                            bgTop := oldTop.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   710
                            bgHeight := tH + 1
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   711
                        ] ifFalse:[
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   712
                            bgTop := oldTop.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   713
                            bgHeight := delta
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   714
                        ]
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   715
                    ].
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   716
                ] ifFalse:[
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   717
                    bgTop := thumbTop.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   718
                    bgHeight := tH.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   719
                    oldLeft > thumbLeft ifTrue:[
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   720
                        delta := oldLeft - thumbLeft.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   721
                        oldLeft > thumbRight ifTrue:[
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   722
                            bgLeft := oldLeft.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   723
                            bgWidth := tW + 1.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   724
                        ] ifFalse:[
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   725
                            bgLeft := thumbRight.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   726
                            bgWidth := delta.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   727
                        ]
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   728
                    ] ifFalse:[
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   729
                        delta := thumbLeft - oldLeft.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   730
                        oldRight < thumbLeft ifTrue:[
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   731
                            bgLeft := oldLeft.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   732
                            bgWidth := tW + 1.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   733
                        ] ifFalse:[
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   734
                            bgLeft := oldLeft.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   735
                            bgWidth := delta.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   736
                        ]
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   737
                    ].
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   738
                ].
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   739
                self drawThumbBackgroundInX:bgLeft y:bgTop width:bgWidth height:bgHeight.
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   740
                self waitForExpose
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   741
            ]
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   742
        ] ifFalse:[
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   743
            thumbFrame := nil
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   744
        ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   745
    ]
983
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   746
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   747
    "Modified: / 21.1.1998 / 19:16:32 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   748
!
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   749
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   750
thumbOrigin:originNumber thumbHeight:heightNumber
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   751
    "set both thumbs height and origin (in percent by default)"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   752
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   753
    |newHeight newOrigin realNewOrigin realNewHeight old new changed 
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   754
     nBg range|
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   755
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   756
    range := rangeEnd - rangeStart.
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   757
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   758
    newOrigin := originNumber - rangeStart / (range / 100).
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   759
    newHeight := heightNumber / (range abs / 100).
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   760
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   761
    (newHeight > 100) ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   762
        realNewHeight := 100
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   763
    ] ifFalse:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   764
        realNewHeight := newHeight
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   765
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   766
    ((newOrigin + realNewHeight) > 100) ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   767
        realNewOrigin := 100 - realNewHeight
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   768
    ] ifFalse: [
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   769
        realNewOrigin := newOrigin
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   770
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   771
    (realNewOrigin < 0) ifTrue: [
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   772
        realNewOrigin := 0
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   773
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   774
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   775
    changed := (realNewHeight ~= thumbHeight) or:[realNewOrigin ~= thumbOrigin].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   776
    (changed or:[thumbFrame isNil]) ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   777
        old := self absFromPercent:thumbOrigin.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   778
        new := self absFromPercent:realNewOrigin.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   779
        changed := old ~~ new.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   780
        changed ifFalse:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   781
            old := self absFromPercent:thumbHeight.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   782
            new := self absFromPercent:realNewHeight.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   783
            changed := (old ~~ new)
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   784
        ].
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   785
        (changed or:[thumbFrame isNil]) ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   786
            thumbOrigin := realNewOrigin.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   787
            thumbHeight := realNewHeight.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   788
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   789
            (DefaultFullViewBackground notNil
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   790
            and:[DefaultViewBackground notNil
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   791
            and:[DefaultFullViewBackground ~~ DefaultViewBackground]]) ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   792
                realNewHeight >= 100 ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   793
                    nBg := DefaultFullViewBackground.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   794
                ] ifFalse:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   795
                    nBg := DefaultViewBackground
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   796
                ].
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   797
                nBg := nBg on:device.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   798
                nBg ~~ viewBackground ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   799
                    self viewBackground:nBg.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   800
                    shown ifTrue:[self clear].
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   801
                ]
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   802
            ].
128
claus
parents: 127
diff changeset
   803
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   804
            shown ifTrue:[
1189
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   805
                thumbFrame := nil.
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   806
                self invalidate.
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   807
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   808
"/                thumbFrame notNil ifTrue:[
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   809
"/                    self drawThumbBackgroundInX:(thumbFrame left)
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   810
"/                                              y:(thumbFrame top) 
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   811
"/                                          width:(thumbFrame width) 
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   812
"/                                         height:(thumbFrame height).
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   813
"/                ].
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   814
"/                self computeThumbFrame.
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   815
"/                self drawThumb
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   816
            ] ifFalse:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   817
                thumbFrame := nil
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   818
            ]
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
   819
        ]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   820
    ]
1189
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   821
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   822
    "Modified: / 21.1.1998 / 19:32:41 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   823
! !
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   824
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   825
!Scroller methodsFor:'accessing-behavior'!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   826
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   827
action:aBlock
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   828
    "for protocol compatibility; same as scrollAction:"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   829
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   830
    self scrollAction:aBlock
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   831
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   832
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   833
asynchronousOperation
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   834
    "set scroll-mode to be asynchronous - scroll action is performed after
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   835
     scrolling, when mouse-button is finally released"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   836
     
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   837
    synchronousOperation := false
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   838
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   839
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   840
disable
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   841
    "disable the scoller"
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   842
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   843
    enabled ifTrue:[
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   844
        enabled := false.
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   845
        self updateBackground.
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   846
        self cursor: Cursor normal
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   847
    ]
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   848
!
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   849
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   850
enable
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   851
    "enable the scroller"
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   852
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   853
    enabled ifFalse:[
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   854
        enabled := true.
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   855
        self updateBackground.
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   856
    ]
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   857
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   858
!
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   859
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   860
scrollAction
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   861
    "answer the scroll action block"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   862
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   863
    ^ scrollAction
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   864
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   865
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   866
scrollAction:aBlock
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   867
    "set the scroll action, aBlock which is evaluated when scrolled"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   868
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   869
    scrollAction := aBlock
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   870
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   871
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   872
scrollDownAction:aBlock
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   873
    "ignored -
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   874
     but implemented, so that scroller can be used in place of a scrollbar"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   875
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   876
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   877
scrollUpAction:aBlock
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   878
    "ignored -
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   879
     but implemented, so that scroller can be used in place of a scrollbar"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   880
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   881
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   882
synchronousOperation
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   883
    "set scroll-mode to be synchronous - scroll action is performed for 
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   884
     every movement of thumb"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   885
     
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   886
    synchronousOperation := true
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   887
! !
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   888
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   889
!Scroller methodsFor:'accessing-bg & border'!
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   890
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   891
allViewBackground:something
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   892
    "ignore here"
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   893
! !
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   894
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   895
!Scroller methodsFor:'accessing-channels'!
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   896
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   897
enableChannel 
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   898
    "return a valueHolder for enable/disable"
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   899
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   900
    ^ enableChannel
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   901
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   902
!
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   903
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   904
enableChannel:aValueHolder 
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   905
    "set the valueHolder, which holds the enable boolean value"
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   906
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   907
    |prev|
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   908
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   909
    prev := enableChannel.      
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   910
    enableChannel := aValueHolder.
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   911
    self setupChannel:aValueHolder for:nil withOld:prev
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   912
! !
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   913
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   914
!Scroller methodsFor:'accessing-look'!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   915
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   916
is3D
958
b75025112346 commentary
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
   917
    "return true, if I use a 3D style"
b75025112346 commentary
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
   918
764
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
   919
    <resource: #style (#name)>
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
   920
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   921
    styleSheet name = #mswindows ifTrue:[^ true].
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   922
    ^ super is3D
764
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
   923
958
b75025112346 commentary
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
   924
    "Modified: 17.1.1997 / 23:21:42 / cg"
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   925
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   926
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   927
orientation 
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   928
    "return the scrollers orientation (#vertical or #horizontal)"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   929
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   930
    ^ orientation
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   931
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   932
1167
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   933
orientation:aSymbol 
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   934
    "set the scrollers orientation (#vertical or #horizontal)"
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   935
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   936
    |oldFrame|
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   937
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   938
    orientation := aSymbol.
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   939
    preferredExtent := nil.
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   940
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   941
    shown ifTrue:[
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   942
        oldFrame := thumbFrame.
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   943
        self computeThumbFrame.
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   944
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   945
        oldFrame ~= thumbFrame ifTrue:[
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   946
            self invalidate.
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   947
        ]
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   948
    ]
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   949
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   950
    "Created: 1.4.1997 / 12:18:32 / cg"
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   951
    "Modified: 1.4.1997 / 12:20:46 / cg"
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   952
!
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   953
689
1f0e278ce283 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   954
thumb
1f0e278ce283 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   955
    "for compatibility with scrollBars, return the receiver"
1f0e278ce283 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   956
1f0e278ce283 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   957
    ^ self
1f0e278ce283 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   958
1f0e278ce283 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   959
    "Created: 26.5.1996 / 12:21:12 / cg"
1f0e278ce283 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   960
!
1f0e278ce283 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   961
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   962
thumbColor
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   963
    "return the thumbs color"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   964
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   965
    ^ thumbColor
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   966
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   967
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   968
thumbColor:aColor
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   969
    "change the color of the thumb"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   970
764
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
   971
    <resource: #style (#name)>
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
   972
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   973
    thumbColor := aColor on:device.
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   974
    (styleSheet name ~~ #normal) ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   975
        thumbShadowColor := aColor darkened on:device.
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   976
        thumbLightColor := aColor lightened on:device.
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   977
        thumbHalfShadowColor := thumbShadowColor darkened on:device.
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   978
        thumbHalfLightColor := thumbLightColor lightened on:device.
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   979
    ].
993
51cce445b5d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
   980
    self invalidate
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   981
993
51cce445b5d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
   982
    "Modified: 8.2.1997 / 15:15:58 / cg"
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   983
! !
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   984
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   985
!Scroller methodsFor:'drawing'!
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   986
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   987
drawHandleFormAtX:x y:y
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   988
    thumbShadowColor := thumbShadowColor on:device.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   989
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   990
    self paint:thumbShadowColor.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   991
    self displayForm:shadowForm x:x y:y.
1531
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
   992
    lightForm notNil ifTrue:[
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
   993
        thumbLightColor := thumbLightColor on:device.
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
   994
        self paint:thumbLightColor.
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
   995
        self displayForm:lightForm x:x y:y.
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
   996
    ].
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
   997
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
   998
    "Modified: / 19.5.1998 / 16:26:49 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   999
!
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1000
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1001
drawThumb
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1002
    "draw the thumb"
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1003
505
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1004
    |handleX handleY l t lvl
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1005
     w "{ Class: SmallInteger }"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1006
     h "{ Class: SmallInteger }"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1007
     x "{ Class: SmallInteger }"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1008
     y "{ Class: SmallInteger }"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1009
     mm xL xR yT yB color1 color2|
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1010
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1011
    (thumbHeight >= 100) ifTrue:[^ self].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1012
    orientation == #vertical ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1013
        thumbFrame height >= height ifTrue:[^ self].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1014
    ] ifFalse:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1015
        thumbFrame width >= width ifTrue:[^ self].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1016
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1017
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1018
    l := thumbFrame left.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1019
    t := thumbFrame top.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1020
    w := thumbFrame width.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1021
    h := thumbFrame height.
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1022
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1023
    self paint:(entered ifTrue:[thumbEnteredColor] ifFalse:[thumbColor]).
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1024
    self fillRectangleX:l y:t width:w-1 height:h.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1025
505
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1026
    lvl := thumbLevel.
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1027
    scrolling ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1028
        lvl := thumbActiveLevel
505
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1029
    ].
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1030
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1031
    lvl == 0 ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1032
        thumbFrameColor notNil ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1033
            self paint:thumbFrameColor.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1034
            self displayRectangle:thumbFrame.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1035
        ].
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1036
        thumbImage notNil ifTrue:[
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1037
            thumbImage displayOn:self x:l y:t
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1038
        ].
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1039
        ^ self
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1040
    ].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
  1041
505
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1042
    self drawEdgesForX:l y:t width:w height:h level:lvl
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1043
                shadow:thumbShadowColor light:thumbLightColor
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1044
                halfShadow:thumbHalfShadowColor halfLight:thumbHalfLightColor
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1045
                style:thumbEdgeStyle.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1046
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1047
    thumbFrameColor notNil ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1048
        self paint:thumbFrameColor.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1049
        orientation == #vertical ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1050
            self displayRectangleX:l y:t width:w"-1" height:h.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1051
        ] ifFalse:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1052
            self displayRectangleX:l y:t width:w height:h"-1".
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1053
        ]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1054
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1055
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1056
    thumbImage notNil ifTrue:[
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1057
        thumbImage displayOn:self x:l y:t
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1058
    ].
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1059
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1060
    (tallyLevel == 0 or:[tallyMarks == 0]) ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1061
        shadowForm notNil ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1062
            handleX := l + ((w - 8) // 2).
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1063
            handleY := t + ((h - 8) // 2).
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1064
            self drawHandleFormAtX:handleX y:handleY
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1065
        ].
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1066
        ^ self
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1067
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1068
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1069
    "iris style - draw tallys"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1070
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1071
    tallyLevel > 0 ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1072
        color1 := thumbLightColor.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1073
        color2 := thumbShadowColor.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1074
    ] ifFalse:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1075
        color1 := thumbShadowColor.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1076
        color2 := thumbLightColor.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1077
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1078
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1079
    "draw tally marks"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1080
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1081
    (orientation == #vertical) ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1082
        self paint:color1.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1083
        y := t + (h // 2) - 1.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1084
        xL := l + lvl - 1.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1085
        xR := l + w - lvl "+ 1".
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1086
        self displayLineFromX:xL y:y toX:xR y:y.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1087
        y := y + 1.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1088
        self paint:color2.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1089
        self displayLineFromX:xL y:y toX:xR y:y.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1090
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1091
        tallyMarks > 1 ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1092
            "dont draw other marks if there is not enough space"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1093
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1094
            mm := device verticalPixelPerMillimeter rounded.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1095
            h > (mm * (tallyMarks * 2)) ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1096
                y := y - 1 - mm.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1097
                self paint:color1.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1098
                self displayLineFromX:xL y:y toX:xR y:y.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1099
                y := y + 1.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1100
                self paint:color2.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1101
                self displayLineFromX:xL y:y toX:xR y:y.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1102
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1103
                y := y - 1 + mm + mm.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1104
                self paint:color1.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1105
                self displayLineFromX:xL y:y toX:xR y:y.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1106
                y := y + 1.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1107
                self paint:color2.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1108
                self displayLineFromX:xL y:y toX:xR y:y
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1109
            ]
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1110
        ]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1111
    ] ifFalse:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1112
        x := l + (w // 2) - 1.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1113
        yT := t + lvl - 1.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1114
        yB := t + h - lvl "+ 1".
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1115
        self paint:color1.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1116
        self displayLineFromX:x y:yT toX:x y:yB.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1117
        self paint:color2.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1118
        x := x + 1.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1119
        self displayLineFromX:x y:yT toX:x y:yB.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1120
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1121
        tallyMarks > 1 ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1122
            "dont draw other marks if there is not enough space"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1123
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1124
            mm := device horizontalPixelPerMillimeter rounded.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1125
            w > (mm * (tallyMarks * 2)) ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1126
                x := x - 1 - mm.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1127
                self paint:color1.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1128
                self displayLineFromX:x y:yT toX:x y:yB.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1129
                x := x + 1.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1130
                self paint:color2.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1131
                self displayLineFromX:x y:yT toX:x y:yB.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1132
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1133
                x := x - 1 + mm + mm.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1134
                self paint:color1.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1135
                self displayLineFromX:x y:yT toX:x y:yB.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1136
                x := x + 1.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1137
                self paint:color2.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1138
                self displayLineFromX:x y:yT toX:x y:yB
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1139
            ]
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1140
        ]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1141
    ]
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1142
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1143
    "Modified: / 12.5.1998 / 20:39:52 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1144
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1145
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1146
drawThumbBackgroundInX:x y:y width:w height:h
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1147
    "draw part of the thumbs background; defined as a separate
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1148
     method, to allow drawing of arbitrary patterns under thumb 
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1149
     (see ColorSlider)."
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1150
699
6b464bf0ced8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
  1151
    |oldClip gX gY gW gH|
6b464bf0ced8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
  1152
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1153
    shown ifTrue:[
695
1c52a7c0166d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
  1154
        self clearRectangleX:x y:y width:w height:h.
1c52a7c0166d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
  1155
        frameBeforeMove notNil ifTrue:[
1009
ae6be1f683fe dont draw frameBeforeMove, if we dont have to
Claus Gittinger <cg@exept.de>
parents: 999
diff changeset
  1156
	    (frameBeforeMove intersects:(x@y extent:w@h)) ifTrue:[
ae6be1f683fe dont draw frameBeforeMove, if we dont have to
Claus Gittinger <cg@exept.de>
parents: 999
diff changeset
  1157
                oldClip := self clippingRectangleOrNil.
ae6be1f683fe dont draw frameBeforeMove, if we dont have to
Claus Gittinger <cg@exept.de>
parents: 999
diff changeset
  1158
                self clippingRectangle:(Rectangle left:x top:y width:w height:h).
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1159
1009
ae6be1f683fe dont draw frameBeforeMove, if we dont have to
Claus Gittinger <cg@exept.de>
parents: 999
diff changeset
  1160
                gX := frameBeforeMove left.
ae6be1f683fe dont draw frameBeforeMove, if we dont have to
Claus Gittinger <cg@exept.de>
parents: 999
diff changeset
  1161
                gY := frameBeforeMove top.
ae6be1f683fe dont draw frameBeforeMove, if we dont have to
Claus Gittinger <cg@exept.de>
parents: 999
diff changeset
  1162
                gW := frameBeforeMove width.
ae6be1f683fe dont draw frameBeforeMove, if we dont have to
Claus Gittinger <cg@exept.de>
parents: 999
diff changeset
  1163
                gH := frameBeforeMove height.
699
6b464bf0ced8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
  1164
            
1009
ae6be1f683fe dont draw frameBeforeMove, if we dont have to
Claus Gittinger <cg@exept.de>
parents: 999
diff changeset
  1165
                ghostColor notNil ifTrue:[
ae6be1f683fe dont draw frameBeforeMove, if we dont have to
Claus Gittinger <cg@exept.de>
parents: 999
diff changeset
  1166
                    self paint:ghostColor.
ae6be1f683fe dont draw frameBeforeMove, if we dont have to
Claus Gittinger <cg@exept.de>
parents: 999
diff changeset
  1167
                    self fillRectangle:frameBeforeMove.
ae6be1f683fe dont draw frameBeforeMove, if we dont have to
Claus Gittinger <cg@exept.de>
parents: 999
diff changeset
  1168
                ].
ae6be1f683fe dont draw frameBeforeMove, if we dont have to
Claus Gittinger <cg@exept.de>
parents: 999
diff changeset
  1169
                (ghostLevel ~~ 0) ifTrue:[
ae6be1f683fe dont draw frameBeforeMove, if we dont have to
Claus Gittinger <cg@exept.de>
parents: 999
diff changeset
  1170
                    self drawEdgesForX:gX y:gY width:gW height:gH level:ghostLevel
ae6be1f683fe dont draw frameBeforeMove, if we dont have to
Claus Gittinger <cg@exept.de>
parents: 999
diff changeset
  1171
                ].
ae6be1f683fe dont draw frameBeforeMove, if we dont have to
Claus Gittinger <cg@exept.de>
parents: 999
diff changeset
  1172
                ghostFrameColor notNil ifTrue:[
ae6be1f683fe dont draw frameBeforeMove, if we dont have to
Claus Gittinger <cg@exept.de>
parents: 999
diff changeset
  1173
                    self paint:ghostFrameColor.
ae6be1f683fe dont draw frameBeforeMove, if we dont have to
Claus Gittinger <cg@exept.de>
parents: 999
diff changeset
  1174
                    self displayRectangleX:gX y:gY width:gW height:gH
ae6be1f683fe dont draw frameBeforeMove, if we dont have to
Claus Gittinger <cg@exept.de>
parents: 999
diff changeset
  1175
                ].
ae6be1f683fe dont draw frameBeforeMove, if we dont have to
Claus Gittinger <cg@exept.de>
parents: 999
diff changeset
  1176
                self clippingRectangle:oldClip
ae6be1f683fe dont draw frameBeforeMove, if we dont have to
Claus Gittinger <cg@exept.de>
parents: 999
diff changeset
  1177
	    ]
695
1c52a7c0166d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
  1178
        ]
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1179
    ]
695
1c52a7c0166d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
  1180
699
6b464bf0ced8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
  1181
    "Modified: 28.5.1996 / 19:53:40 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1182
! !
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1183
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1184
!Scroller methodsFor:'event handling'!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1185
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1186
buttonMotion:state x:x y:y
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1187
    "mouse-button was moved while pressed;
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1188
     redraw thumb at its new position and, if scroll-mode is asynchronous, 
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1189
     the scroll action is performed"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1190
1279
4cb391ed6fbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  1191
    |pos curr limit prevOrigin newOrigin snap|
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1192
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1193
    enabled ifFalse:[^ self].
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1194
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1195
    scrolling ifFalse: [
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1196
        self highlightThumbForPointerX:x y:y.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1197
        ^ self              
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1198
    ].              
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1199
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1200
    entered := true.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1201
    frameBeforeMove isNil ifTrue:[
1166
dc68cd54225b care for range when snapping back
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1202
        originBeforeMove := self thumbOrigin.
1133
4395bae7e94e added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
  1203
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1204
        (ghostColor notNil 
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1205
        or:[ghostFrameColor notNil
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1206
        or:[ghostLevel ~~ 0]]) ifTrue:[
1485
5716db1ccb4e care for nil thumbFrame (race condition)
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
  1207
            thumbFrame isNil ifTrue:[
5716db1ccb4e care for nil thumbFrame (race condition)
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
  1208
                self computeThumbFrame.
5716db1ccb4e care for nil thumbFrame (race condition)
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
  1209
            ].
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1210
            frameBeforeMove := thumbFrame insetBy:1@1
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1211
        ]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1212
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1213
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1214
    (orientation == #vertical) ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1215
        curr := y.
1133
4395bae7e94e added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
  1216
        limit := height.
1203
c25ad158d812 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1189
diff changeset
  1217
        snap := (x < SnapBackDistance negated) or:[x > (width + SnapBackDistance)].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1218
    ] ifFalse:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1219
        curr := x.
1133
4395bae7e94e added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
  1220
        limit := width.
1203
c25ad158d812 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1189
diff changeset
  1221
        snap := (y < SnapBackDistance negated) or:[y > (height + SnapBackDistance)].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1222
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1223
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1224
    (curr < 0) ifTrue:[                        "check against limits"
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1225
        pos := 0
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1226
    ] ifFalse:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1227
        (curr > limit) ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1228
            pos := limit
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1229
        ] ifFalse:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1230
            pos := curr
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1231
        ]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1232
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1233
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1234
    prevOrigin := self thumbOrigin.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1235
    newOrigin := self percentFromAbs:(pos - pressOffset).
1133
4395bae7e94e added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
  1236
4395bae7e94e added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
  1237
    snap ifTrue:[
4395bae7e94e added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
  1238
        (styleSheet at:'scrollerSnapBack' default:false) ifTrue:[
4395bae7e94e added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
  1239
            newOrigin := originBeforeMove.
4395bae7e94e added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
  1240
        ]
4395bae7e94e added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
  1241
    ].
4395bae7e94e added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
  1242
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1243
    prevOrigin ~= newOrigin ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1244
        self thumbOrigin:newOrigin.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1245
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1246
        synchronousOperation ifTrue: [
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1247
            self tellOthers.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1248
        ]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1249
    ]
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1250
1485
5716db1ccb4e care for nil thumbFrame (race condition)
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
  1251
    "Modified: / 14.4.1998 / 18:37:34 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1252
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1253
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1254
buttonMultiPress:button x:x y:y
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1255
    ^ self buttonPress:button x:x y:y
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1256
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1257
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1258
buttonPress:button x:x y:y
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1259
    "button was pressed - if above thumb, page up; if below thumb, page down;
1301
1fbe38b283e4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1260
     otherwise start scrolling.
1fbe38b283e4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1261
     If either shift is pressed, or the 'scrollerMiddleButtonJump' styleSheet
1fbe38b283e4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1262
     value is true and its the middle button, do a jump to the clicked position."
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1263
1514
b819aca5ab4b care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1507
diff changeset
  1264
    |curr limit1 limit2 sensor|
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1265
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1266
    enabled ifFalse:[^ self].
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1267
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1268
    shown ifFalse:[^ self].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1269
1420
e9999993396f ignore other button press/release while scrolling
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
  1270
    scrolling ifTrue:[^ self].
e9999993396f ignore other button press/release while scrolling
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
  1271
1514
b819aca5ab4b care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1507
diff changeset
  1272
    sensor := self sensor.
b819aca5ab4b care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1507
diff changeset
  1273
    (((sensor notNil and:[sensor shiftDown]))
1301
1fbe38b283e4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1274
    or:[DefaultMiddleButtonJump and:[button == 2]]) ifTrue:[
811
7271a0746af6 Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  1275
        ^ self buttonShiftPress:button x:x y:y
7271a0746af6 Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  1276
    ].
1441
fdb91f9d5360 Correct behavior for button 2.
Stefan Vogel <sv@exept.de>
parents: 1432
diff changeset
  1277
    button ~~ 1 ifTrue:[
fdb91f9d5360 Correct behavior for button 2.
Stefan Vogel <sv@exept.de>
parents: 1432
diff changeset
  1278
        ^ self
fdb91f9d5360 Correct behavior for button 2.
Stefan Vogel <sv@exept.de>
parents: 1432
diff changeset
  1279
    ].
811
7271a0746af6 Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  1280
1295
dd5ba64ae8a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1283
diff changeset
  1281
    thumbFrame isNil ifTrue:[
dd5ba64ae8a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1283
diff changeset
  1282
        self computeThumbFrame.
dd5ba64ae8a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1283
diff changeset
  1283
        thumbFrame isNil ifTrue:[^ self].
dd5ba64ae8a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1283
diff changeset
  1284
    ].
dd5ba64ae8a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1283
diff changeset
  1285
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1286
    (orientation == #vertical) ifTrue:[
811
7271a0746af6 Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  1287
        curr := y.
7271a0746af6 Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  1288
        limit1 := thumbFrame top.
7271a0746af6 Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  1289
        limit2 := thumbFrame bottom
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1290
    ] ifFalse:[
811
7271a0746af6 Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  1291
        curr := x.
7271a0746af6 Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  1292
        limit1 := thumbFrame left.
7271a0746af6 Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  1293
        limit2 := thumbFrame right
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1294
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1295
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1296
    (curr < limit1) ifTrue:[
811
7271a0746af6 Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  1297
        "page up/left"
7271a0746af6 Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  1298
        self pageUp
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1299
    ] ifFalse:[
811
7271a0746af6 Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  1300
        (curr > limit2) ifTrue:[
7271a0746af6 Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  1301
            "page down/right"
7271a0746af6 Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  1302
            self pageDown
7271a0746af6 Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  1303
        ] ifFalse:[
7271a0746af6 Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  1304
            pressOffset := curr - limit1.
7271a0746af6 Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  1305
            scrolling := true
7271a0746af6 Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  1306
        ]
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1307
    ].
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1308
    self highlightThumbForPointerX:x y:y.
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1309
    self changeCursorFor:(x@y).
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1310
1441
fdb91f9d5360 Correct behavior for button 2.
Stefan Vogel <sv@exept.de>
parents: 1432
diff changeset
  1311
    "Modified: / 2.2.1998 / 23:30:26 / stefan"
1514
b819aca5ab4b care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1507
diff changeset
  1312
    "Modified: / 7.5.1998 / 02:05:41 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1313
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1314
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1315
buttonRelease:button x:x y:y
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1316
    "mouse-button was released - if scroll-mode is asynchronous, the scroll
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1317
     action is now performed"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1318
505
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1319
    |rect mustDrawThumb|
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1320
1441
fdb91f9d5360 Correct behavior for button 2.
Stefan Vogel <sv@exept.de>
parents: 1432
diff changeset
  1321
    (button == 1 or:[DefaultMiddleButtonJump and:[button == 2]])
fdb91f9d5360 Correct behavior for button 2.
Stefan Vogel <sv@exept.de>
parents: 1432
diff changeset
  1322
        ifFalse:[^ super buttonRelease:button x:x y:y].
1420
e9999993396f ignore other button press/release while scrolling
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
  1323
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1324
    scrolling ifTrue:[
1432
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  1325
        scrolling := false.
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1326
        thumbFrame notNil ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1327
            mustDrawThumb := false.
505
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1328
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1329
            frameBeforeMove notNil ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1330
                rect := frameBeforeMove.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1331
                frameBeforeMove := nil.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1332
                self drawThumbBackgroundInX:rect left
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1333
                                          y:rect top
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1334
                                      width:rect width 
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1335
                                     height:rect height.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1336
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1337
                (rect intersects:thumbFrame) ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1338
                    mustDrawThumb := true.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1339
                ]
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1340
            ].
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1341
            thumbLevel ~~ thumbActiveLevel ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1342
                mustDrawThumb := true
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1343
            ].
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1344
            mustDrawThumb ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1345
                self drawThumb
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1346
            ].    
505
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1347
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1348
"/            scrolling := false.
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1349
            synchronousOperation ifFalse: [
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1350
                self tellOthers.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1351
            ]
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1352
        ]
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1353
    ].
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1354
    self changeCursorFor:(x@y)
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1355
1420
e9999993396f ignore other button press/release while scrolling
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
  1356
    "Modified: / 19.1.1998 / 13:45:59 / cg"
1441
fdb91f9d5360 Correct behavior for button 2.
Stefan Vogel <sv@exept.de>
parents: 1432
diff changeset
  1357
    "Modified: / 2.2.1998 / 23:37:27 / stefan"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1358
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1359
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1360
buttonShiftPress:button x:x y:y
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1361
    "mouse-click with shift - jump to position"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1362
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1363
    |pos curr curr2 limit1 limit2|
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1364
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1365
    (orientation == #vertical) ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1366
        curr := y.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1367
        curr2 := y - (thumbFrame height // 2).
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1368
        limit1 := height.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1369
        limit2 := thumbFrame top
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1370
    ] ifFalse:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1371
        curr := x.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1372
        curr2 := x - (thumbFrame width // 2).
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1373
        limit1 := width.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1374
        limit2 := thumbFrame left
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1375
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1376
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1377
    (curr2 < 0) ifTrue:[                        "check against limits"
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1378
        pos := 0
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1379
    ] ifFalse:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1380
        (curr2 > limit1) ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1381
            pos := limit1
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1382
        ] ifFalse:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1383
            pos := curr2
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1384
        ]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1385
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1386
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1387
    frameBeforeMove := thumbFrame insetBy:1@1.
1133
4395bae7e94e added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
  1388
    originBeforeMove := thumbOrigin.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1389
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1390
    (orientation == #vertical) ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1391
        limit2 := thumbFrame top
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1392
    ] ifFalse:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1393
        limit2 := thumbFrame left
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1394
    ].
1432
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  1395
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  1396
    self thumbOrigin:(self percentFromAbs:pos).
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  1397
    self tellOthers.
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  1398
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1399
    pressOffset := curr - limit2.
1441
fdb91f9d5360 Correct behavior for button 2.
Stefan Vogel <sv@exept.de>
parents: 1432
diff changeset
  1400
    scrolling := true.
1133
4395bae7e94e added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
  1401
1441
fdb91f9d5360 Correct behavior for button 2.
Stefan Vogel <sv@exept.de>
parents: 1432
diff changeset
  1402
    "Modified: / 19.3.1997 / 11:29:08 / cg"
fdb91f9d5360 Correct behavior for button 2.
Stefan Vogel <sv@exept.de>
parents: 1432
diff changeset
  1403
    "Modified: / 2.2.1998 / 23:35:18 / stefan"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1404
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1405
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1406
changeCursorFor:p
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1407
    "update the mouse cursor"
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1408
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1409
    |crsr frm sensor which|
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1410
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1411
    enabled ifFalse:[^ self].
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1412
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1413
    NewCursors ifFalse:[^ self].
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1414
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1415
    frm := self thumbFrame.
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1416
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1417
    thumbHeight = 100 ifTrue:[
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1418
        which := #normal.
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1419
    ] ifFalse:[
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1420
        sensor := self sensor.
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1421
1514
b819aca5ab4b care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1507
diff changeset
  1422
        (((frm containsPoint:p) and:[sensor notNil and:[sensor leftButtonPressed]])
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1423
         or:[sensor notNil and:[sensor shiftDown]]) ifTrue:[ 
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1424
            orientation == #horizontal ifTrue:[
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1425
                which := #xMarker
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1426
            ] ifFalse:[
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1427
                which := #marker
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1428
            ].
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1429
        ] ifFalse:[
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1430
            orientation == #horizontal ifTrue:[
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1431
                p x > frm right ifTrue:[
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1432
                    which := #right
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1433
                ] ifFalse:[
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1434
                    p x < frm left ifTrue:[
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1435
                        which := #left
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1436
                    ] ifFalse:[
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1437
                        which := #hand
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1438
                    ]
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1439
                ]
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1440
            ] ifFalse:[
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1441
                p y > frm bottom ifTrue:[
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1442
                    which := #down
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1443
                ] ifFalse:[
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1444
                    p y < frm top ifTrue:[
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1445
                        which := #up
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1446
                    ] ifFalse:[
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1447
                        which := #hand
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1448
                    ]
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1449
                ]
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1450
            ]
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1451
        ]
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1452
    ].
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1453
    self cursor:(Cursor perform:which).
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1454
1514
b819aca5ab4b care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1507
diff changeset
  1455
    "Created: / 23.10.1997 / 03:55:24 / cg"
b819aca5ab4b care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1507
diff changeset
  1456
    "Modified: / 7.5.1998 / 02:06:10 / cg"
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1457
!
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1458
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1459
enableStateChange
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1460
    enableChannel value ifTrue:[
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1461
        self enable
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1462
    ] ifFalse:[
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1463
        self disable
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1464
    ].
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1465
!
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1466
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1467
highlightThumbForPointerX:x y:y
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1468
    "if x/y is within the thumb frame, highlight it"
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1469
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1470
    |frm in crsr|
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1471
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1472
    in := (frm := self thumbFrame) containsPoint:(x@y).
505
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1473
    (in ~~ entered 
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1474
    or:[thumbLevel ~~ thumbActiveLevel]) ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1475
        entered := in.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1476
        (thumbColor ~~ thumbEnteredColor 
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1477
        or:[thumbLevel ~~ thumbActiveLevel]) ifTrue: [
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1478
            self drawThumb
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1479
        ].
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1480
    ].
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1481
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1482
    self changeCursorFor:(x@y)
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1483
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1484
    "Created: 6.3.1996 / 17:35:07 / cg"
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1485
    "Modified: 23.10.1997 / 03:56:31 / cg"
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1486
!
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1487
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1488
keyPress:key x:x y:y
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1489
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1490
    enabled ifFalse:[^ self].
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1491
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1492
    self changeCursorFor:(x@y).
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1493
    super keyPress:key x:x y:y
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1494
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1495
    "Created: 23.10.1997 / 03:57:34 / cg"
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1496
!
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1497
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1498
keyRelease:key x:x y:y
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1499
    self changeCursorFor:(x@y).
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1500
    super keyRelease:key x:x y:y
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1501
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1502
    "Created: 23.10.1997 / 03:58:25 / cg"
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1503
!
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1504
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1505
pointerLeave:state
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1506
    "mouse-button left view
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1507
     redraw thumb if enteredColor ~~ thumbColor"
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1508
759
9defb0b4883a oops - ignore caps-lock/scroll-lock etc. in pointerLeave
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1509
    (entered and:[(state bitAnd:(device anyButtonMotionMask)) == 0]) ifTrue: [
9defb0b4883a oops - ignore caps-lock/scroll-lock etc. in pointerLeave
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1510
        entered := false.
1432
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  1511
        self invalidate.
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  1512
        "/ self drawThumb
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1513
    ].
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1514
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1515
    "Created: 6.3.1996 / 17:31:16 / cg"
759
9defb0b4883a oops - ignore caps-lock/scroll-lock etc. in pointerLeave
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1516
    "Modified: 10.6.1996 / 14:01:33 / cg"
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1517
!
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1518
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1519
redraw
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1520
    "redraw"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1521
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1522
    self redrawX:0 y:0 width:width height:height.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1523
    self redrawEdges
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1524
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1525
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1526
redrawX:x y:y width:w height:h
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1527
    shown ifTrue:[
1366
652634d99bfe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1528
        thumbFrame isNil ifTrue:[
652634d99bfe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1529
            self computeThumbFrame
652634d99bfe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1530
        ].
767
c96a1130b833 oops - tiny bug in redraw-optimization
Claus Gittinger <cg@exept.de>
parents: 764
diff changeset
  1531
        self drawThumbBackgroundInX:x y:y width:w height:h.
1366
652634d99bfe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1532
        thumbFrame isNil ifTrue:[
652634d99bfe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1533
            "/ thumb hidden
652634d99bfe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1534
            ^ self 
652634d99bfe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1535
        ].
767
c96a1130b833 oops - tiny bug in redraw-optimization
Claus Gittinger <cg@exept.de>
parents: 764
diff changeset
  1536
c96a1130b833 oops - tiny bug in redraw-optimization
Claus Gittinger <cg@exept.de>
parents: 764
diff changeset
  1537
        orientation == #vertical ifTrue:[
c96a1130b833 oops - tiny bug in redraw-optimization
Claus Gittinger <cg@exept.de>
parents: 764
diff changeset
  1538
            (y > thumbFrame bottom) ifTrue:[
c96a1130b833 oops - tiny bug in redraw-optimization
Claus Gittinger <cg@exept.de>
parents: 764
diff changeset
  1539
                ^ self
c96a1130b833 oops - tiny bug in redraw-optimization
Claus Gittinger <cg@exept.de>
parents: 764
diff changeset
  1540
            ].
c96a1130b833 oops - tiny bug in redraw-optimization
Claus Gittinger <cg@exept.de>
parents: 764
diff changeset
  1541
            ((y + h) < thumbFrame top) ifTrue:[
c96a1130b833 oops - tiny bug in redraw-optimization
Claus Gittinger <cg@exept.de>
parents: 764
diff changeset
  1542
                ^ self
c96a1130b833 oops - tiny bug in redraw-optimization
Claus Gittinger <cg@exept.de>
parents: 764
diff changeset
  1543
            ].
c96a1130b833 oops - tiny bug in redraw-optimization
Claus Gittinger <cg@exept.de>
parents: 764
diff changeset
  1544
        ] ifFalse:[
c96a1130b833 oops - tiny bug in redraw-optimization
Claus Gittinger <cg@exept.de>
parents: 764
diff changeset
  1545
            (x > thumbFrame right) ifTrue:[
c96a1130b833 oops - tiny bug in redraw-optimization
Claus Gittinger <cg@exept.de>
parents: 764
diff changeset
  1546
                ^ self
c96a1130b833 oops - tiny bug in redraw-optimization
Claus Gittinger <cg@exept.de>
parents: 764
diff changeset
  1547
            ].
c96a1130b833 oops - tiny bug in redraw-optimization
Claus Gittinger <cg@exept.de>
parents: 764
diff changeset
  1548
            ((x + w) < thumbFrame left) ifTrue:[
c96a1130b833 oops - tiny bug in redraw-optimization
Claus Gittinger <cg@exept.de>
parents: 764
diff changeset
  1549
                ^ self
c96a1130b833 oops - tiny bug in redraw-optimization
Claus Gittinger <cg@exept.de>
parents: 764
diff changeset
  1550
            ].
c96a1130b833 oops - tiny bug in redraw-optimization
Claus Gittinger <cg@exept.de>
parents: 764
diff changeset
  1551
        ].
c96a1130b833 oops - tiny bug in redraw-optimization
Claus Gittinger <cg@exept.de>
parents: 764
diff changeset
  1552
c96a1130b833 oops - tiny bug in redraw-optimization
Claus Gittinger <cg@exept.de>
parents: 764
diff changeset
  1553
        self drawThumb
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1554
    ]
767
c96a1130b833 oops - tiny bug in redraw-optimization
Claus Gittinger <cg@exept.de>
parents: 764
diff changeset
  1555
1366
652634d99bfe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1556
    "Modified: / 29.10.1997 / 15:48:48 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1557
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1558
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1559
sizeChanged:how
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1560
    "size of scroller changed - recompute thumbs frame and redraw it"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1561
1444
eff7016070f8 no need for invalidate on sizeChange (will get expose event anyway)
Claus Gittinger <cg@exept.de>
parents: 1441
diff changeset
  1562
    thumbFrame := nil.
1507
c712eb1a247e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
  1563
    shown ifTrue:[
c712eb1a247e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
  1564
        self clear.
c712eb1a247e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
  1565
        self invalidate
c712eb1a247e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
  1566
    ].
1127
e55aa76e226d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
  1567
1507
c712eb1a247e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
  1568
    "Modified: / 27.4.1998 / 10:06:32 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1569
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1570
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1571
update:something with:aParameter from:changedObject
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1572
    "handle update from a model (if any)"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1573
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1574
    (changedObject == model 
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1575
    "and:[something == aspectMsg]") ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1576
        self thumbOrigin:(model value).
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1577
        ^ self
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1578
    ].
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1579
    changedObject == enableChannel ifTrue:[
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1580
        self enableStateChange.
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1581
        ^ self
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1582
    ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1583
    super update:something with:aParameter from:changedObject
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1584
! !
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1585
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1586
!Scroller methodsFor:'forced scroll'!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1587
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1588
pageDown
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1589
    "page down/right"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1590
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1591
    self thumbOrigin:(thumbOrigin + thumbHeight).
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1592
    self tellOthers
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1593
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1594
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1595
pageUp
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1596
    "page up/left"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1597
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1598
    self thumbOrigin:(thumbOrigin - thumbHeight).
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1599
    self tellOthers
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1600
!
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1601
1493
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1602
scrollStep:delta
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1603
    "step by some delta"
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1604
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1605
    |oldOrg newOrg|
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1606
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1607
    oldOrg := self thumbOrigin.
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1608
    newOrg := ((oldOrg + delta) max:rangeStart) min:rangeEnd.
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1609
    oldOrg ~= newOrg ifTrue:[
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1610
        self thumbOrigin:newOrg.
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1611
        self tellOthers.
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1612
    ]
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1613
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1614
    "Created: / 21.4.1998 / 20:51:57 / cg"
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1615
    "Modified: / 21.4.1998 / 20:52:22 / cg"
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1616
!
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1617
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1618
scrollToBeginning
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1619
    "scroll to the beginning"
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1620
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1621
    self thumbOrigin:rangeStart.
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1622
    self tellOthers
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1623
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1624
    "Created: 6.3.1996 / 17:55:13 / cg"
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1625
!
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1626
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1627
scrollToEnd
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1628
    "scroll to the end"
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1629
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1630
    self thumbOrigin:rangeEnd.
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1631
    self tellOthers
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1632
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1633
    "Created: 6.3.1996 / 17:55:25 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1634
! !
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1635
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1636
!Scroller methodsFor:'forwarding changed origin'!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1637
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1638
tellOthers
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1639
    |org|
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1640
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1641
    org := self thumbOrigin.
1011
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  1642
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  1643
    "
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  1644
     the ST-80 way of notifying scrolls
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  1645
    "
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  1646
    self sendChangeMessageWith:org.
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  1647
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1648
    "
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1649
     the ST/X way of notifying scrolls
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1650
    "
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1651
    scrollAction notNil ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1652
        scrollAction value:org 
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1653
    ].
1011
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  1654
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  1655
    "/
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  1656
    "/ this will vanish - the scroller should share
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  1657
    "/ a valueHolder with the scrolledView.
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  1658
    "/
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1659
    self changed:#scrollerPosition.
1011
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  1660
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
  1661
    "Modified: / 21.1.1998 / 19:12:55 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1662
! !
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1663
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1664
!Scroller methodsFor:'initialization'!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1665
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1666
defaultExtent
571
ddc5d56bd636 commentary
Claus Gittinger <cg@exept.de>
parents: 556
diff changeset
  1667
    "compute my extent from sub-components"
ddc5d56bd636 commentary
Claus Gittinger <cg@exept.de>
parents: 556
diff changeset
  1668
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1669
    ^ self preferredExtent
571
ddc5d56bd636 commentary
Claus Gittinger <cg@exept.de>
parents: 556
diff changeset
  1670
ddc5d56bd636 commentary
Claus Gittinger <cg@exept.de>
parents: 556
diff changeset
  1671
    "Modified: 22.4.1996 / 23:37:53 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1672
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1673
930
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1674
fetchDeviceResources
931
a22726fd8e32 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 930
diff changeset
  1675
    "fetch device colors, to avoid reallocation at redraw time"
930
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1676
931
a22726fd8e32 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 930
diff changeset
  1677
    super fetchDeviceResources.
930
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1678
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1679
    thumbShadowColor notNil ifTrue:[thumbShadowColor := thumbShadowColor on:device].
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1680
    thumbLightColor notNil ifTrue:[thumbLightColor := thumbLightColor on:device].
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1681
    thumbHalfShadowColor notNil ifTrue:[thumbHalfShadowColor := thumbHalfShadowColor on:device].
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1682
    thumbHalfLightColor notNil ifTrue:[thumbHalfLightColor := thumbHalfLightColor on:device].
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1683
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1684
    thumbEnteredColor notNil ifTrue:[thumbEnteredColor := thumbEnteredColor on:device].
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1685
    ghostColor notNil ifTrue:[ghostColor := ghostColor on:device].
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1686
    ghostFrameColor notNil ifTrue:[ghostFrameColor := ghostFrameColor on:device].
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1687
931
a22726fd8e32 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 930
diff changeset
  1688
    "Modified: 13.1.1997 / 21:56:38 / cg"
930
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1689
!
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1690
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1691
initCursor
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1692
    "set the cursor - a hand"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1693
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1694
    cursor := Cursor hand
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1695
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1696
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1697
initStyle
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1698
    "initialize style dep. stuff"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1699
764
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  1700
    <resource: #style (#name)>
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  1701
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  1702
    |nm|
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  1703
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1704
    super initStyle.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1705
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1706
    DefaultViewBackground notNil ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1707
        viewBackground := DefaultViewBackground on:device.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1708
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1709
    DefaultShadowColor notNil ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1710
        shadowColor := DefaultShadowColor on:device.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1711
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1712
    DefaultLightColor notNil ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1713
        lightColor := DefaultLightColor on:device.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1714
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1715
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1716
    tallyMarks := DefaultTallyMarks.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1717
    tallyLevel := DefaultTallyLevel.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1718
    DefaultLevel ~~ level ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1719
        self level:DefaultLevel.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1720
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1721
    DefaultBorderWidth ~~ borderWidth ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1722
        self borderWidth:DefaultBorderWidth.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1723
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1724
    thumbLevel := DefaultThumbLevel.
505
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1725
    thumbActiveLevel := DefaultThumbActiveLevel.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1726
    inset := DefaultInset.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1727
    fixThumbHeight := DefaultFixThumbHeight.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1728
    thumbEdgeStyle := DefaultEdgeStyle.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1729
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1730
    DefaultGhostColor notNil ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1731
        ghostColor := DefaultGhostColor on:device.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1732
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1733
    DefaultGhostFrameColor notNil ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1734
        ghostFrameColor := DefaultGhostFrameColor on:device.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1735
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1736
    ghostLevel := DefaultGhostLevel.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1737
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1738
    DefaultThumbFrameColor notNil ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1739
        thumbFrameColor := DefaultThumbFrameColor on:device.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1740
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1741
    DefaultThumbShadowColor notNil ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1742
        thumbShadowColor := DefaultThumbShadowColor
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1743
    ] ifFalse:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1744
        thumbShadowColor := shadowColor.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1745
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1746
    DefaultThumbLightColor notNil ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1747
        thumbLightColor := DefaultThumbLightColor
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1748
    ] ifFalse:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1749
        thumbLightColor := lightColor.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1750
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1751
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1752
    thumbEdgeStyle notNil ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1753
        DefaultThumbHalfShadowColor notNil ifTrue:[
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1754
            thumbHalfShadowColor := DefaultThumbHalfShadowColor
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1755
        ].
1121
dccc1c729fd3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1115
diff changeset
  1756
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1757
        DefaultThumbHalfLightColor notNil ifTrue:[
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1758
            thumbHalfLightColor := DefaultThumbHalfLightColor
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1759
        ].
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1760
    ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1761
764
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  1762
    nm := styleSheet name.
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  1763
709
a738bd76ace4 grey vs. gray
Claus Gittinger <cg@exept.de>
parents: 705
diff changeset
  1764
    device hasGrayscales ifFalse:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1765
        thumbEdgeStyle notNil ifTrue:[
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1766
            thumbHalfShadowColor := Color darkGray.
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1767
            thumbHalfLightColor := White
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1768
        ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1769
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1770
        thumbShadowColor := Black.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1771
"/        thumbLightColor := White.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1772
764
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  1773
        nm = #motif ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1774
            DefaultThumbColor isNil ifTrue:[
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1775
                thumbColor := White .
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1776
            ].
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1777
        ]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1778
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1779
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1780
    DefaultThumbColor notNil ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1781
        thumbColor := DefaultThumbColor on:device
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1782
    ] ifFalse:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1783
        thumbColor := White.
764
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  1784
        nm ~= #normal ifTrue:[
709
a738bd76ace4 grey vs. gray
Claus Gittinger <cg@exept.de>
parents: 705
diff changeset
  1785
            device hasGrayscales ifFalse:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1786
                thumbColor := Color grey
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1787
            ].
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1788
        ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1789
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1790
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1791
    thumbColor := thumbColor on:device.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1792
    thumbShadowColor notNil ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1793
        thumbShadowColor := thumbShadowColor on:device.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1794
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1795
    thumbLightColor notNil ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1796
        thumbLightColor := thumbLightColor on:device.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1797
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1798
    thumbHalfShadowColor notNil ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1799
        thumbHalfShadowColor := thumbHalfShadowColor on:device.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1800
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1801
    thumbHalfLightColor notNil ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1802
        thumbHalfLightColor := thumbHalfLightColor on:device.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1803
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1804
    thumbEdgeStyle notNil ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1805
        thumbHalfShadowColor isNil ifTrue:[
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1806
            thumbHalfShadowColor := thumbShadowColor lightened on:device
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1807
        ]
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1808
    ].
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1809
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1810
    DefaultThumbEnteredColor notNil ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1811
        thumbEnteredColor := DefaultThumbEnteredColor on:device.
1366
652634d99bfe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1812
    ] ifFalse:[
652634d99bfe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1813
        thumbEnteredColor := thumbColor.
652634d99bfe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1814
    ].
652634d99bfe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1815
652634d99bfe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1816
    (DefaultThumbEnteredColor notNil or:[NewCursors]) ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1817
        self enableMotionEvents.
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1818
        self enableEnterLeaveEvents.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1819
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1820
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1821
    DefaultThumbImage notNil ifTrue:[
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1822
        thumbImage := DefaultThumbImage on:device.
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1823
        fixThumbHeight := true.
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1824
    ].
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1825
1531
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
  1826
    HandleImage notNil ifTrue:[
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
  1827
        shadowForm := HandleImage onDevice:device.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1828
    ] ifFalse:[
1531
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
  1829
        nm = #next ifTrue:[
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
  1830
            shadowForm := self class handleShadowFormOn:device.
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
  1831
            lightForm := self class handleLightFormOn:device
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
  1832
        ] ifFalse:[
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
  1833
            shadowForm := lightForm := nil
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
  1834
        ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1835
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1836
    drawableId notNil ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
  1837
        self computeThumbFrame
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1838
    ]
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1839
1531
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
  1840
    "Modified: / 19.5.1998 / 16:25:38 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1841
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1842
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1843
initialize
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1844
    "initialize - setup instvars from defaults"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1845
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1846
    super initialize.
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1847
556
4c3edf42c03e checkin from browser
ca
parents: 538
diff changeset
  1848
    orientation isNil ifTrue:[orientation := #vertical].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1849
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1850
    scrolling := entered              := false.
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1851
    enabled   := synchronousOperation := true.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1852
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1853
    thumbOrigin := 0.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1854
    thumbHeight := 100.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1855
    thumbFrameSizeDifference := 0.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1856
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1857
    rangeStart := 0.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1858
    rangeEnd := 100.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1859
    rangeStep := nil.   "/ meaning: arbitrary precision
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1860
"/    inset := 1.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1861
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1862
"/    self computeThumbFrame
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1863
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1864
    "Modified: 6.3.1996 / 17:25:59 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1865
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1866
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1867
realize
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1868
    super realize.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1869
    model notNil ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1870
        self thumbOrigin:(model value).
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1871
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1872
! !
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1873
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1874
!Scroller methodsFor:'private'!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1875
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1876
absFromPercent:percent
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1877
    "given a percentage, compute number of pixels"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1878
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1879
    |fullSize|
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1880
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1881
    (orientation == #vertical) ifTrue:[
1115
6b7ba45f83a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
  1882
        fullSize := height 
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1883
    ] ifFalse:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1884
        fullSize := width
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1885
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1886
1115
6b7ba45f83a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
  1887
    "/ avoid hitting the boundary if no frame and no level (i.e. st80 style)
6b7ba45f83a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
  1888
    (thumbLevel == 0 and:[thumbFrameColor isNil]) ifTrue:[
6b7ba45f83a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
  1889
        fullSize := fullSize - 1
6b7ba45f83a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
  1890
    ].
6b7ba45f83a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
  1891
6b7ba45f83a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
  1892
    ^ ((percent * (fullSize - thumbFrameSizeDifference - (margin * 2))) / 100) rounded
6b7ba45f83a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
  1893
6b7ba45f83a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
  1894
    "Modified: 7.3.1997 / 16:05:57 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1895
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1896
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1897
computeThumbFrame
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1898
    "compute the thumbs frame (a rectangle) whenever thumb is moved, 
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1899
     changed height or the scrollers size has changed.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1900
     We take care, that the thumb will not become too small (i.e.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1901
     invisible or uncatchable).
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1902
     Also, for mswindows style, its height/width is constant."
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1903
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1904
    |newPos1 newPos2 newSize1 newSize2 nh nw ny nx 
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1905
     computedSize minSz sz1 sz2|
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1906
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1907
    "compute position & size"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1908
    newPos1 := (self absFromPercent:thumbOrigin) + margin.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1909
    newSize1 := computedSize := self absFromPercent:thumbHeight.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1910
    (orientation == #vertical) ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1911
        sz1 := height.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1912
        sz2 := width
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1913
    ] ifFalse:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1914
        sz1 := width.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1915
        sz2 := height
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1916
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1917
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1918
    "
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1919
     do we have to adjust the computed size ?
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1920
    "
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1921
    newPos2 := margin + inset.     
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1922
    newSize2 := sz2 - (2 * newPos2).
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1923
"/    (style ~~ #normal) ifTrue:[
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1924
    thumbLevel ~~ 0 ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1925
        "
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1926
         do not make thumb too small (for handle & to be catchable)
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1927
        "
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1928
        minSz := 10 + (2 * thumbLevel)
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1929
    ] ifFalse:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1930
        "
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1931
         do not make thumb too small (uncatchable)
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1932
        "
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1933
        minSz := 4
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1934
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1935
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1936
    (newSize1 < minSz) ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1937
        newSize1 := minSz.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1938
        thumbFrameSizeDifference := newSize1 - computedSize
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1939
    ] ifFalse:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1940
        thumbFrameSizeDifference := 0.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1941
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1942
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1943
    fixThumbHeight ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1944
        "have a fix-size thumb (i.e. mswindows style)"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1945
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1946
        newSize1 := sz2 - (2 * inset).   "make it square"
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1947
        thumbImage notNil ifTrue:[
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1948
            newSize1 := (newSize1 max:(thumbImage height)) max:(thumbImage width)
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1949
        ].
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1950
        thumbFrameSizeDifference := newSize1 - computedSize.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1951
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1952
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1953
    "
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1954
     oops - if height does not relect real visibible area, we have to adjust the origin
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1955
    "
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1956
    (thumbFrameSizeDifference == 0) ifFalse:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1957
        newPos1 := (self absFromPercent:thumbOrigin) + margin.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1958
"/        newPos1 := ((thumbOrigin * (sz1 - thumbFrameSizeDifference - (margin * 2))) / 100) rounded + margin
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1959
    ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1960
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1961
    (orientation == #vertical) ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1962
        ny := newPos1.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1963
        nx := newPos2.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1964
        nh := newSize1.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1965
        nw := newSize2.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1966
        ny + nh + margin > height ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1967
            ny := height - margin - nh
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1968
        ]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1969
    ] ifFalse:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1970
        nx := newPos1.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1971
        ny := newPos2.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1972
        nw := newSize1.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1973
        nh := newSize2.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1974
        nx + nw + margin > width ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1975
            nx := width - margin - nw
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1976
        ]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1977
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1978
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1979
    "
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1980
     do not create new Rectangle if its the same anyway
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1981
    "
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1982
    thumbFrame notNil ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1983
        (ny == thumbFrame top) ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1984
          (nx == thumbFrame left) ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1985
            (nh == thumbFrame height) ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1986
              (nw == thumbFrame width) ifTrue:[ ^ self]
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1987
            ]
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1988
          ]
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  1989
        ]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1990
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1991
    thumbFrame := Rectangle left:nx top:ny width:nw height:nh
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1992
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1993
    "Modified: / 12.5.1998 / 20:58:51 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1994
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1995
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1996
percentFromAbs:absValue
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1997
    "given a number of pixels, compute percentage"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1998
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1999
    |fullSize val t|
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2000
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2001
    (orientation == #vertical) ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2002
        fullSize := height
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2003
    ] ifFalse:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2004
        fullSize := width
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2005
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2006
1283
1d1a04076471 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1279
diff changeset
  2007
    absValue < 0 ifTrue:[^ rangeStart].
1d1a04076471 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1279
diff changeset
  2008
    absValue > fullSize ifTrue:[^ rangeEnd].
1d1a04076471 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1279
diff changeset
  2009
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2010
    t := fullSize - thumbFrameSizeDifference - (margin * 2).
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2011
    t = 0 ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2012
        "/ in rare cases, this happens ...
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2013
        val := 0
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2014
    ] ifFalse:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2015
        val := absValue / t * (rangeEnd - rangeStart).
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2016
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2017
    val := val + rangeStart.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2018
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
  2019
    rangeStart < rangeEnd ifTrue:[
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
  2020
        val < rangeStart ifTrue:[^ rangeStart].
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
  2021
        val > rangeEnd ifTrue:[^ rangeEnd].
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
  2022
    ] ifFalse:[
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
  2023
        val > rangeStart ifTrue:[^ rangeStart].
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
  2024
        val < rangeEnd ifTrue:[^ rangeEnd].
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
  2025
    ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2026
    ^ val
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2027
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
  2028
    "Modified: / 21.1.1998 / 19:31:15 / cg"
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2029
!
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2030
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2031
updateBackground
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2032
    "make my background grey, whenever either readOnly or disable"
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2033
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2034
    enabled ifFalse:[
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2035
        self backgroundColor:View defaultViewBackgroundColor.
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2036
    ] ifTrue:[
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2037
        self backgroundColor:DefaultViewBackground.
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2038
    ].
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2039
    self invalidate
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2040
! !
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2041
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2042
!Scroller methodsFor:'private scrollbar & scrollview interface'!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2043
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2044
setThumbFor:aView
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2045
    "get contents and size info from aView and adjust thumb"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2046
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2047
    |percentSize percentOrigin contentsSize contentsPosition viewsSize|
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2048
1432
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  2049
    scrolling ifTrue:[self invalidate].
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  2050
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2051
    "
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2052
     get the content's size
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2053
    "
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2054
    aView isNil ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2055
        contentsSize := 0
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2056
    ] ifFalse:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2057
        orientation == #vertical ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2058
            contentsSize := aView heightOfContents.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2059
            aView transformation notNil ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2060
                contentsSize := aView transformation applyScaleY:contentsSize.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2061
            ].
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2062
        ] ifFalse:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2063
            contentsSize := aView widthOfContents.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2064
            aView transformation notNil ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2065
                contentsSize := aView transformation applyScaleX:contentsSize.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2066
            ].
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2067
        ]
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2068
    ].
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2069
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2070
    (contentsSize = 0) ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2071
        percentSize := 100.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2072
        percentOrigin := 100
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2073
    ] ifFalse:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2074
        (orientation == #vertical) ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2075
            viewsSize := aView innerHeight.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2076
            contentsPosition := aView yOriginOfContents.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2077
        ] ifFalse:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2078
            viewsSize := aView innerWidth.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2079
            contentsPosition := aView xOriginOfContents
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2080
        ].
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2081
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2082
        percentSize := viewsSize * 100.0 / contentsSize.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2083
        percentOrigin := contentsPosition * 100.0 / contentsSize.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2084
        percentOrigin + percentSize > 100.0 ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2085
            "actually showing stuff below contents of view"
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2086
"
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2087
            contentsSize := contentsPosition + aView innerHeight.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2088
            percentSize := viewsSize * 100.0 / contentsSize.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2089
            percentOrigin := contentsPosition * 100.0 / contentsSize
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2090
"
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2091
        ]
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2092
    ].
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2093
    (percentSize = thumbHeight) ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2094
        self thumbOrigin:percentOrigin
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2095
    ] ifFalse:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2096
        (percentOrigin = thumbOrigin) ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2097
            self thumbHeight:percentSize
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2098
        ] ifFalse:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2099
            self thumbOrigin:percentOrigin thumbHeight:percentSize
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2100
        ]
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2101
    ]
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2102
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2103
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2104
setThumbHeightFor:aView
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2105
    "get contents and size info from aView and adjust thumb height"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2106
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2107
    |percent total viewsSize|
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2108
1432
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  2109
    scrolling ifTrue:[self invalidate].
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  2110
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2111
    (orientation == #vertical) ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2112
        total := aView heightOfContents.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2113
        aView transformation notNil ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2114
            total := aView transformation applyScaleY:total.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2115
        ].
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2116
    ] ifFalse:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2117
        total := aView widthOfContents.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2118
        aView transformation notNil ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2119
            total := aView transformation applyScaleX:total.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2120
        ].
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2121
    ].
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2122
    (total = 0) ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2123
        percent := 100
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2124
    ] ifFalse:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2125
        viewsSize := (orientation == #vertical) ifTrue:[aView innerHeight]
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2126
                                           ifFalse:[aView innerWidth].
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2127
        percent := viewsSize * 100.0 / total
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2128
    ].
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2129
    self thumbHeight:percent
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2130
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2131
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2132
setThumbOriginFor:aView
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2133
    "get contents and size info from aView and adjust thumb origin"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2134
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2135
    |percent total contentsPosition|
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2136
1432
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  2137
    scrolling ifTrue:[self invalidate].
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  2138
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2139
    (orientation == #vertical) ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2140
        total := aView heightOfContents.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2141
        aView transformation notNil ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2142
            total := aView transformation applyScaleY:total.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2143
        ].
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2144
    ] ifFalse:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2145
        total := aView widthOfContents.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2146
        aView transformation notNil ifTrue:[
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2147
            total := aView transformation applyScaleX:total.
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2148
        ].
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2149
    ].
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2150
    (total = 0) ifTrue:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2151
        percent := 100
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2152
    ] ifFalse:[
999
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2153
        contentsPosition := (orientation == #vertical) ifTrue:[aView yOriginOfContents]
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2154
                                                  ifFalse:[aView xOriginOfContents].
3c330af7516c flushExposeEvents is now done in #invalidate
ca
parents: 993
diff changeset
  2155
        percent := contentsPosition * 100.0 / total
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2156
    ].
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2157
    self thumbOrigin:percent
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2158
! !
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2159
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2160
!Scroller methodsFor:'queries'!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2161
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2162
preferredExtent
572
121735c2aff6 commentary
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2163
    "return my preferredExtent"
121735c2aff6 commentary
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2164
538
b747ea31b972 use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
  2165
    |defExt w h|
b747ea31b972 use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
  2166
797
2f9cd56f48ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  2167
    "/ If I have an explicit preferredExtent ..
2f9cd56f48ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  2168
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  2169
    preferredExtent notNil ifTrue:[
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  2170
        ^ preferredExtent
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  2171
    ].
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  2172
538
b747ea31b972 use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
  2173
    defExt := self class defaultExtent.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2174
538
b747ea31b972 use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
  2175
    orientation == #vertical ifTrue:[
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  2176
        h := defExt y.
1315
48413a06ceba better look if no styleSheet is present
Claus Gittinger <cg@exept.de>
parents: 1302
diff changeset
  2177
        w := (device horizontalPixelPerMillimeter asFloat * 5) rounded.
538
b747ea31b972 use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
  2178
    ] ifFalse:[
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  2179
        w := defExt x.
1315
48413a06ceba better look if no styleSheet is present
Claus Gittinger <cg@exept.de>
parents: 1302
diff changeset
  2180
        h := (device verticalPixelPerMillimeter asFloat * 5) rounded.
538
b747ea31b972 use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
  2181
    ].
b747ea31b972 use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
  2182
786
8b301af1cdcc remember and do not recompute the preferredExtent;
Claus Gittinger <cg@exept.de>
parents: 767
diff changeset
  2183
    preferredExtent := w @ h.
8b301af1cdcc remember and do not recompute the preferredExtent;
Claus Gittinger <cg@exept.de>
parents: 767
diff changeset
  2184
    ^ preferredExtent.
538
b747ea31b972 use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
  2185
797
2f9cd56f48ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  2186
    "Modified: 19.7.1996 / 20:45:35 / cg"
1122
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2187
!
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2188
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2189
thumbVisible
1122
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2190
    "return true, if the thumb is usable i.e. its visible & movable.
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2191
     Can be used by the scrollBar to decide if it should hide the scroller."
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2192
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2193
    |m2|
1122
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2194
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2195
    (thumbHeight >= 100) ifTrue:[^ false].
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2196
    self computeThumbFrame.
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2197
    thumbFrame isNil ifTrue:[^ false].
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2198
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2199
    m2 := margin * 2.
1122
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2200
    orientation == #vertical ifTrue:[
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2201
        thumbFrame height >= (height - m2) ifTrue:[^ false].
1122
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2202
    ] ifFalse:[
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2203
        thumbFrame width >= (width - m2) ifTrue:[^ false].
1122
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2204
    ].
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2205
    ^ true
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2206
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2207
    "Created: / 7.3.1997 / 21:10:23 / cg"
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2208
    "Modified: / 12.5.1998 / 20:21:00 / cg"
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  2209
! !
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  2210
897
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  2211
!Scroller class methodsFor:'documentation'!
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
  2212
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  2213
version
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2214
    ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.106 1998-08-25 10:58:48 tz Exp $'
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
  2215
! !