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