Scroller.st
author Claus Gittinger <cg@exept.de>
Sat, 10 Nov 2018 00:18:14 +0100
changeset 6487 debe1f7cce35
parent 6337 2b13966b73f3
child 6490 3d1a00dd648f
permissions -rw-r--r--
#OTHER by cg class: HorizontalPanelView added: #computePreferredExtent removed: #preferredExtent changed: #setChildPositions
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6311
c7610420a3ae #BUGFIX by sr
sr
parents: 6102
diff changeset
     1
"{ Encoding: utf8 }"
c7610420a3ae #BUGFIX by sr
sr
parents: 6102
diff changeset
     2
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     3
"
5
claus
parents: 3
diff changeset
     4
 COPYRIGHT (c) 1989 by Claus Gittinger
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
     5
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    12
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    13
"
2171
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
    14
"{ Package: 'stx:libwidg' }"
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
    15
5420
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
    16
"{ NameSpace: Smalltalk }"
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
    17
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    18
View subclass:#Scroller
1011
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    19
	instanceVariableNames:'thumbOrigin thumbHeight thumbColor thumbFrameColor scrollAction
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    20
		orientation thumbFrame thumbLevel scrolling pressOffset
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    21
		synchronousOperation shadowForm lightForm inset thumbShadowColor
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    22
		thumbLightColor thumbEdgeStyle thumbHalfShadowColor
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    23
		thumbHalfLightColor thumbEnteredColor thumbFrameSizeDifference
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    24
		tallyLevel tallyMarks fixThumbHeight frameBeforeMove ghostColor
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    25
		ghostFrameColor ghostLevel rangeStart rangeEnd rangeStep entered
1830
f732d15043a4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1821
diff changeset
    26
		thumbActiveLevel originBeforeMove thumbImage enabled keyboardStep
2594
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
    27
		autoRepeat repeatBlock initialRepeatDelay repeatDelay
4874
4b2eedd37770 class: Scroller
Claus Gittinger <cg@exept.de>
parents: 4869
diff changeset
    28
		lastMousePosition thumbActiveColor'
1011
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    29
	classVariableNames:'HandleShadowForm HandleLightForm DefaultViewBackground
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    30
		DefaultShadowColor DefaultLightColor DefaultThumbColor
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    31
		DefaultThumbShadowColor DefaultThumbLightColor
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    32
		DefaultThumbHalfShadowColor DefaultThumbHalfLightColor
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    33
		DefaultHalfShadowColor DefaultHalfLightColor DefaultTallyMarks
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    34
		DefaultTallyLevel DefaultLevel DefaultBorderWidth
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    35
		DefaultThumbLevel DefaultInset DefaultThumbFrameColor
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    36
		DefaultGhostColor DefaultGhostFrameColor DefaultGhostLevel
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    37
		DefaultFixThumbHeight DefaultEdgeStyle DefaultFullViewBackground
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
    38
		DefaultThumbEnteredColor DefaultThumbActiveColor
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
    39
		DefaultThumbActiveLevel SnapBackDistance DefaultMiddleButtonJump
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
    40
		NewCursors DefaultThumbImage HandleImage DefaultHScrollerHeight
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
    41
		DefaultVScrollerWidth DefaultStopPagerAtThumb DefaultTallyInset
5218
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
    42
		MinThumbSize DefaultTallyDistance DefaultVerticalThumbFrameImage
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
    43
		DefaultHorizontalThumbFrameImage'
1011
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    44
	poolDictionaries:''
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    45
	category:'Views-Interactors'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    46
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    47
897
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
    48
!Scroller class methodsFor:'documentation'!
3
claus
parents: 0
diff changeset
    49
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    50
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    51
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    52
 COPYRIGHT (c) 1989 by Claus Gittinger
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
    53
	      All Rights Reserved
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    54
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    55
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    56
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    57
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    58
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    59
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    60
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    61
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    62
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    63
3
claus
parents: 0
diff changeset
    64
documentation
claus
parents: 0
diff changeset
    65
"
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    66
    this class implements the scroller for scrollbars.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    67
    it can also be used by itself for scrollbars without step-buttons.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    68
    When moved, either a predefined action is performed (scrollAction),
119
claus
parents: 117
diff changeset
    69
    or a model is informed via the changeMsg (which is #value: by default).
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    70
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    71
    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
    72
    of the action, or asynchronous (i.e. perform action on end-of move).
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    73
    By default, scrollers are synchronous. Asynchronous operation makes sense, 
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    74
    if the scroll operation (redraw) is expensive and takes a long time.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    75
127
claus
parents: 120
diff changeset
    76
    This class is used both for concrete instances (vertical scrollers)
claus
parents: 120
diff changeset
    77
    and as an abstract superclass for horizontalScrollers, sliders and
claus
parents: 120
diff changeset
    78
    miniScrollers.
claus
parents: 120
diff changeset
    79
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    80
  range:
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    81
    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
    82
    to the min/maxRange instance variables.
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    83
    These default to 0..100 for percentage values.
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    84
    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
    85
    but may be useful with Sliders or in special applications.
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    86
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    87
  style stuff:
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    88
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    89
    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
    90
    (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
    91
    These are controlled by the shadowForm, lightForm, tallyLevel and tallyMarks
1302
Claus Gittinger <cg@exept.de>
parents: 1301
diff changeset
    92
    instance variables. All of this is initialized from the styleSheet.
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    93
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
    94
  [Instance variables:]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    95
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    96
    thumbOrigin                 <Number>        origin of thumb (in percent)
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    97
    thumbHeight                 <Number>        height of thumb (in percent)
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    98
    thumbColor                  <Color>         color of thumb
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    99
    thumbFrameColor             <Color>         color of the frame around the thumb
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   100
    scrollAction                <Block>         1 arg block to be evaluated when scrolled
5949
2c3b91259dcc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5872
diff changeset
   101
                                                (arg is position in percent)
119
claus
parents: 117
diff changeset
   102
    orientation                 <Symbol>        #horizontal or #vertical
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   103
    thumbFrame                  <Rectangle>     frame of thumb in pixels (cached)
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   104
    thumbLevel                  <Number>        level of thumb if 3d
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   105
    scrolling                   <Boolean>       true during scroll
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   106
    pressOffset                 <Number>        temporary (offset into frame when move started)
5949
2c3b91259dcc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5872
diff changeset
   107
    synchronousOperation        <Boolean>       true if synchronous (i.e. don't wait till release
2c3b91259dcc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5872
diff changeset
   108
                                                to perform action)
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   109
    shadowForm                  <Form>          bitmap of knob if any (shadow part)
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   110
    lightForm                   <Form>          bitmap of knob if any (light part)
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   111
    inset                       <Integer>       number of pixels to inset thumb from view borders
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   112
    thumbShadowColor            <Color>         color do draw dark parts of thumb
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   113
    thumblightColor             <Color>         color to draw light parts of thumb
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   114
    thumbEdgeStyle              <SymbolOrNil>   #soft or nil
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   115
    thumbHalfShadowColor        <Color>         used to draw smooth edges
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   116
    thumbHalfLightColor         <Color>         used to draw smooth edges
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   117
    thumbFrameSizeDifference    <Integer>       number of pixels the thumb is larger than 
5949
2c3b91259dcc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5872
diff changeset
   118
                                                it should be (can be negative for mswin-style)
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   119
    tallyLevel                  <Integer>       if not zero, specifies if tally-marks should
5949
2c3b91259dcc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5872
diff changeset
   120
                                                go into or out of the display (actually only <0/>0 is checked)
2c3b91259dcc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5872
diff changeset
   121
                                                I dont know of a better word for these ...
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   122
    tallyMarks                  <Integer>       number of tally marks
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   123
    fixThumbHeight              <Boolean>       perform 'wrong' height computation a la mswindows
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   124
    rangeStart                  <Number>        the range of the scroller
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   125
    rangeEnd                                    (defaults to 0..100)
119
claus
parents: 117
diff changeset
   126
    rangeStep                                   not currently implemented
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   127
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
   128
  [style settings:]
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   129
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   130
    scrollerLevel               <Integer>       the level of the scroller w.r.t. its enclosing view
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   131
    scrollerBorderWidth         <Integer>       the borderWidth (ignored for 3D styles)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   132
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   133
    scrollerViewBackground      <Color>         the viewBackground (color or image)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   134
    scrollerShadowColor         <Color>         the color of 3D shadowed edges (ignored in 2D styles)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   135
    scrollerLightColor          <Color>         the color of 3D lighted edges (ignored in 2D styles)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   136
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   137
    scrollerThumbColor          <Color>         the thumbs color (color or image)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   138
    scrollerThumbShadowColor    <Color>         the color of the thumbs shadowed edges (ignored in 2D styles)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   139
    scrollerThumbLightColor     <Color>         the color of the thumbs shadowed edges (ignored in 2D styles)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   140
    scrollerThumbEdgeStyle      <Symbol>        the edge style for the thumb (#soft or nil)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   141
    scrollerThumbLevel          <Integer>       the 3D height of the thumb
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   142
    scrollerThumbHalfShadowColor<Color>         the halfShadow for soft edged thumbs
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   143
    scrollerThumbHalfLightColor <Color>         the halfLight for soft edged thumbs
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   144
    scrollerThumbFrameColor     <Color>         if non-nil, a rectangle is drawn around the thumb is this color
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   145
    scrollerThumbInset          <Integer>       inset of thumb from the scrollers boundary
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   146
    scrollerThumbFixHeight      <Boolean>       if true, use a fix thumb height (as in mswindows)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   147
    scrollerGhostColor          <Color>         the color in which a ghost-rectangle is drawn
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   148
    scrollerGhostFrameColor     <Color>         if non-nil, a rectangle is drawn around the ghost is this color
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   149
    scrollerGhostLevel          <Color>         the 3D level of the ghost rectangle
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   150
    scrollerNTallyMarks         <Integer>       number of tally-marks to draw on the thumb
1302
Claus Gittinger <cg@exept.de>
parents: 1301
diff changeset
   151
    scrollerTallyLevel          <Integer>       the 3D level of any tally marks
Claus Gittinger <cg@exept.de>
parents: 1301
diff changeset
   152
    scrollerSnapBack            <Boolean>       win95 behavior: snap back to original position if scrollers view
5949
2c3b91259dcc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5872
diff changeset
   153
                                                is left by mouse (with some distance)
1302
Claus Gittinger <cg@exept.de>
parents: 1301
diff changeset
   154
    scrollerMiddleButtonJump    <Boolean>       xterm behavior: middle button has shift-click behavior
5949
2c3b91259dcc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5872
diff changeset
   155
                                                (positions absolute to click position)
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   156
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   157
    notice: for mswindows style, we force a WRONG thumb-frame
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   158
    computation, to make the thumb have constant size; 
1302
Claus Gittinger <cg@exept.de>
parents: 1301
diff changeset
   159
    if you dont like that (I do not :-), 
Claus Gittinger <cg@exept.de>
parents: 1301
diff changeset
   160
    set scrollerThumbFixHeight to false (in the StyleSheet).
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
   161
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
   162
    [author:]
5949
2c3b91259dcc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5872
diff changeset
   163
        Claus Gittinger
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
   164
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
   165
    [see also:]
5949
2c3b91259dcc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5872
diff changeset
   166
        ScrollBar
2c3b91259dcc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5872
diff changeset
   167
        ScrollableView HVScrollableView
3
claus
parents: 0
diff changeset
   168
"
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   169
!
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   170
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   171
examples
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   172
"
133
claus
parents: 132
diff changeset
   173
    basic scroller setup:
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   174
									[exBegin]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   175
	|top s|
133
claus
parents: 132
diff changeset
   176
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   177
	top := StandardSystemView new extent:200@200.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   178
	s := Scroller in:top.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   179
	s origin:(0.0@0.0) corner:(20@1.0).
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   180
	s thumbHeight:10.  'percent'.     
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   181
	top open
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   182
									[exEnd]
133
claus
parents: 132
diff changeset
   183
claus
parents: 132
diff changeset
   184
    setting its thumb-height:
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   185
									[exBegin]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   186
	|top s|
133
claus
parents: 132
diff changeset
   187
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   188
	top := StandardSystemView new extent:200@200.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   189
	s := Scroller in:top.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   190
	s origin:(0.0@0.0) corner:(20@1.0).
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   191
	s thumbHeight:50.  'percent'.     
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   192
	top open
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   193
									[exEnd]
133
claus
parents: 132
diff changeset
   194
claus
parents: 132
diff changeset
   195
    setting its thumb-origin:
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   196
									[exBegin]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   197
	|top s|
133
claus
parents: 132
diff changeset
   198
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   199
	top := StandardSystemView new extent:200@200.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   200
	s := Scroller in:top.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   201
	s origin:(0.0@0.0) corner:(20@1.0).
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   202
	s thumbHeight:10.  'percent'.     
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   203
	s thumbOrigin:30.  'percent'.     
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   204
	top open
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   205
									[exEnd]
133
claus
parents: 132
diff changeset
   206
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   207
    a scroller with action block (ST/X style):
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   208
									[exBegin]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   209
	|top s|
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   210
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   211
	top := StandardSystemView new extent:200@200.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   212
	s := Scroller in:top.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   213
	s origin:(0.0@0.0) corner:(20@1.0).
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   214
	s thumbHeight:10.  'percent'.     
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   215
	s scrollAction:[:percent | Transcript show:'moved to: '; showCR:percent asFloat].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   216
	top open
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   217
									[exEnd]
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   218
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   219
    setting its range:
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   220
									[exBegin]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   221
	|top s|
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   222
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   223
	top := StandardSystemView new extent:200@200.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   224
	s := Scroller in:top.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   225
	s origin:(0.0@0.0) corner:(20@1.0).
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   226
	s thumbHeight:10.  'percent'.     
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   227
	s scrollAction:[:percent | Transcript show:'moved to: '; showCR:percent asFloat].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   228
	s start:0 stop:1.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   229
	top open
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   230
									[exEnd]
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   231
130
claus
parents: 128
diff changeset
   232
    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
   233
    at the side; beside another view:
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   234
									[exBegin]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   235
	|top s v|
130
claus
parents: 128
diff changeset
   236
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   237
	top := StandardSystemView new extent:200@200.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   238
	s := Scroller in:top.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   239
	s origin:(0.0@0.0) corner:(0.0@1.0).
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   240
	s rightInset:(s preferredExtent x negated).
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   241
	s thumbHeight:10.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   242
	s level:1.
130
claus
parents: 128
diff changeset
   243
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   244
	v := View in:top.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   245
	v origin:0.0@0.0 corner:1.0@1.0.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   246
	v leftInset:(s preferredExtent x).
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   247
	v viewBackground:Color red.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   248
	v level:2.
130
claus
parents: 128
diff changeset
   249
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   250
	top open
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   251
									[exEnd]
130
claus
parents: 128
diff changeset
   252
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   253
    using a model (ST-80 style):
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   254
									[exBegin]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   255
	|top s m|
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   256
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   257
	m := 0 asValue.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   258
	InspectorView openOn:m monitor:'value'.  'look at value'.
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   259
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   260
	top := StandardSystemView new extent:200@200.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   261
	s := Scroller in:top.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   262
	s origin:(0.0@0.0) corner:(20@1.0).
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   263
	s thumbHeight:10.  'percent'.     
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   264
	s model:m.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   265
	top open
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   266
									[exEnd]
119
claus
parents: 117
diff changeset
   267
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   268
    using a different changeSelector:
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   269
									[exBegin]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   270
	|top s1 s2 m|
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   271
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   272
	m := Plug new.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   273
	m respondTo:#value1: with:[:v | Transcript show:'scroller 1 moved to: '; showCR:v].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   274
	m respondTo:#value2: with:[:v | Transcript show:'scroller 2 moved to: '; showCR:v].
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   275
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   276
	top := StandardSystemView new extent:200@200.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   277
	s1 := Scroller in:top.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   278
	s1 origin:(0.0@0.0) corner:(20@1.0).
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   279
	s1 thumbHeight:10.  'percent'.     
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   280
	s1 model:m; change:#value1:.
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   281
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   282
	s2 := Scroller in:top.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   283
	s2 origin:(30@0.0) corner:(50@1.0).
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   284
	s2 thumbHeight:10.  'percent'.     
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   285
	s2 model:m; change:#value2:.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   286
	top open
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   287
									[exEnd]
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   288
"
3
claus
parents: 0
diff changeset
   289
! !
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   290
897
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   291
!Scroller class methodsFor:'defaults'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   292
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   293
handleLightFormOn:aDisplay
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   294
    "answer the form used for the handles light area;
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   295
     cache the one for Display for the next round"
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
    |f|
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   298
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   299
    ((aDisplay == Display) and:[HandleLightForm notNil]) ifTrue:[
2061
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   300
        ^ HandleLightForm
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   301
    ].
2075
005c01e3f259 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2061
diff changeset
   302
    f := Smalltalk imageFromFileNamed:'HandleLight.xbm' forClass:self.
2061
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   303
    f notNil ifTrue:[
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   304
        f := f onDevice:aDisplay
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   305
    ] ifFalse:[
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   306
        f := Form width:8 height:8 fromArray:#[2r00000000
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   307
                                               2r00000010
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   308
                                               2r00000011
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   309
                                               2r00000011
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   310
                                               2r00000011
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   311
                                               2r00000011
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   312
                                               2r00000110
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   313
                                               2r00111100]
3486
317fc3d76634 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 3281
diff changeset
   314
                                              onDevice:aDisplay
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   315
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   316
    (aDisplay == Display) ifTrue:[
2061
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   317
        HandleLightForm := f
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   318
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   319
    ^ f
897
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   320
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   321
    "Modified: 23.10.2031 / 01:00:00 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   322
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   323
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   324
handleShadowFormOn:aDisplay
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   325
    "answer the form used for the handles shadow area;
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   326
     cache the one for Display for the next round"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   327
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   328
    |f|
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   329
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   330
    ((aDisplay == Display) and:[HandleShadowForm notNil]) ifTrue:[
2061
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   331
        ^ HandleShadowForm
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   332
    ].
2075
005c01e3f259 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2061
diff changeset
   333
    f := Smalltalk imageFromFileNamed:'HandleShadow.xbm' forClass:self.
2061
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   334
    f notNil ifTrue:[
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   335
        f := f onDevice:aDisplay
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   336
    ] ifFalse:[
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   337
        f := Form width:8 height:8 fromArray:#[2r00111100
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   338
                                               2r01100000
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   339
                                               2r11000000
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   340
                                               2r11000000
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   341
                                               2r11000000
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   342
                                               2r11000000
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   343
                                               2r01000000
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   344
                                               2r00000000]
3486
317fc3d76634 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 3281
diff changeset
   345
                                           onDevice:aDisplay
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   346
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   347
    (aDisplay == Display) ifTrue:[
2061
fd67d71cc107 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   348
        HandleShadowForm := f
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   349
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   350
    ^ f
897
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   351
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   352
    "Modified: 19.12.1996 / 01:00:00 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   353
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   354
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   355
updateStyleCache
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
   356
    "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
   357
1347
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   358
    <resource: #style (#'scroller.viewBackground' #'scroller.fullViewBackground'
2594
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
   359
                       #'scroller.thumbColor' 
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
   360
                       #'scroller.shadowColor' #'scroller.lightColor'
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
   361
                       #'scroller.thumbShadowColor' #'scroller.thumbLightColor'
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
   362
                       #'scroller.thumbHalfShadowColor' #'scroller.thumbHalfLightColor'
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
   363
                       #'scroller.thumbFrameColor' #'scroller.ghostColor'
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
   364
                       #'scroller.ghostLevel'  #'scroller.ghostFrameColor'
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
   365
                       #'scroller.NTallyMarks' #'scroller.tallyLevel' #'scroller.tallyInset'
2594
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
   366
                       #'scroller.level' #'scroller.borderWidth'
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
   367
                       #'scroller.thumbLevel' #'scroller.thumbInset'
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
   368
                       #'scroller.thumbFixHeight' #'scroller.thumbEdgeStyle'
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
   369
                       #'scroller.thumbEnteredColor' #'scroller.thumbActiveLevel'
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
   370
                       #'scroller.thumbActiveColor' 
2594
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
   371
                       #'scroller.middleButtonJump' 
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
   372
                       #'scroller.newCursors' 
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
   373
                       #'scroller.thumbImage' #'scroller.handleImage'
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
   374
                       #'scroller.vScrollerWidth' #'scroller.hScrollerHeight'
5218
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
   375
                       #'scroller.stopPagerAtThumb'
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
   376
                       #'scroller.verticalThumbFrameImage' #'scroller.horizontalThumbFrameImage' 
2594
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
   377
                     )>
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
   378
1870
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   379
    DefaultViewBackground := StyleSheet colorAt:#'scroller.viewBackground'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   380
    DefaultFullViewBackground := StyleSheet colorAt:#'scroller.fullViewBackground'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   381
    DefaultThumbColor := StyleSheet colorAt:#'scroller.thumbColor'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   382
    DefaultThumbEnteredColor := StyleSheet colorAt:#'scroller.thumbEnteredColor'.
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
   383
    DefaultThumbActiveColor := StyleSheet colorAt:#'scroller.thumbActiveColor'.
1870
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   384
    DefaultShadowColor := StyleSheet colorAt:#'scroller.shadowColor'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   385
    DefaultLightColor := StyleSheet colorAt:#'scroller.lightColor'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   386
    DefaultThumbShadowColor := StyleSheet colorAt:#'scroller.thumbShadowColor'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   387
    DefaultThumbLightColor := StyleSheet colorAt:#'scroller.thumbLightColor'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   388
    DefaultThumbHalfShadowColor := StyleSheet colorAt:#'scroller.thumbHalfShadowColor'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   389
    DefaultThumbHalfLightColor := StyleSheet colorAt:#'scroller.thumbHalfLightColor'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   390
    DefaultThumbFrameColor := StyleSheet colorAt:#'scroller.thumbFrameColor'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   391
    DefaultGhostColor := StyleSheet colorAt:#'scroller.ghostColor' default:nil.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   392
    DefaultGhostFrameColor := StyleSheet colorAt:#'scroller.ghostFrameColor' default:nil.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   393
    DefaultGhostLevel := StyleSheet at:#'scroller.ghostLevel' default:0.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   394
    DefaultTallyMarks := StyleSheet at:#'scroller.NTallyMarks' default:0.
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
   395
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
   396
    DefaultTallyLevel := DefaultTallyInset := 0.
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   397
    DefaultTallyMarks ~~ 0 ifTrue:[
2594
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
   398
        DefaultTallyLevel := StyleSheet at:#'scroller.tallyLevel' default:1.
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
   399
        DefaultTallyInset := StyleSheet at:#'scroller.tallyInset' default:0.
2612
be0f78b12b4a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2609
diff changeset
   400
        DefaultTallyDistance := StyleSheet at:#'scroller.tallyDistance'.
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   401
    ].
1870
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   402
    DefaultLevel := StyleSheet at:#'scroller.level' default:0.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   403
    DefaultBorderWidth := StyleSheet at:#'scroller.borderWidth' default:(StyleSheet at:#'borderWidth').
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   404
    DefaultThumbLevel := StyleSheet at:#'scroller.thumbLevel' default:0.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   405
    DefaultThumbActiveLevel := StyleSheet at:#'scroller.thumbActiveLevel' default:DefaultThumbLevel.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   406
    DefaultInset := StyleSheet at:#'scroller.thumbInset' default:0.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   407
    DefaultFixThumbHeight := StyleSheet at:#'scroller.thumbFixHeight' default:false.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   408
    DefaultEdgeStyle := StyleSheet at:#'scroller.thumbEdgeStyle'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   409
    DefaultMiddleButtonJump := StyleSheet at:#'scroller.middleButtonJump' default:false.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   410
    NewCursors := StyleSheet at:#'scroller.newCursors' default:true.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   411
    DefaultThumbImage := StyleSheet at:#'scroller.thumbImage'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   412
    HandleImage := StyleSheet at:#'scroller.handleImage'.
5218
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
   413
    DefaultVerticalThumbFrameImage := StyleSheet at:#'scroller.verticalThumbFrameImage'.
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
   414
    DefaultHorizontalThumbFrameImage := StyleSheet at:#'scroller.horizontalThumbFrameImage'.
130
claus
parents: 128
diff changeset
   415
1886
cb557485dfcb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1875
diff changeset
   416
    DefaultVScrollerWidth  := StyleSheet at:#'scroller.vScrollerWidth' default:nil.
cb557485dfcb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1875
diff changeset
   417
    DefaultHScrollerHeight := StyleSheet at:#'scroller.hScrollerHeight' default:nil.
cb557485dfcb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1875
diff changeset
   418
130
claus
parents: 128
diff changeset
   419
    StyleSheet fileReadFailed ifTrue:[
2594
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
   420
        DefaultViewBackground := Grey.
4911
fb84639b995e class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4908
diff changeset
   421
        DefaultThumbColor := Color white.
fb84639b995e class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4908
diff changeset
   422
        DefaultThumbFrameColor := Color black.
2594
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
   423
        DefaultInset := 1.
1203
c25ad158d812 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1189
diff changeset
   424
    ].
c25ad158d812 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1189
diff changeset
   425
2594
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
   426
    DefaultStopPagerAtThumb := StyleSheet at:#'scroller.stopPagerAtThumb' default:true.
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
   427
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
   428
    SnapBackDistance := StyleSheet at:#'scroller.snapBackDistance' default:30.
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
   429
    MinThumbSize := StyleSheet at:#'scroller.minThumbSize' default:8.
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
   430
1121
dccc1c729fd3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1115
diff changeset
   431
    "
dccc1c729fd3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1115
diff changeset
   432
     self updateStyleCache
dccc1c729fd3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1115
diff changeset
   433
    "
dccc1c729fd3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1115
diff changeset
   434
1887
3e9d0074808d allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
   435
    "Modified: / 28.4.1999 / 19:23:24 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   436
! !
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   437
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   438
!Scroller methodsFor:'accessing'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   439
1737
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   440
keyboardStep
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   441
    "return the scrollers keyboard step. If non-nil,
5872
3840d3ff35a2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5794
diff changeset
   442
     that's the stepping value used with cursorUp/cursorDown keys.
1737
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   443
     (not used with Scrollers, but provided for subclasses)"
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   444
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   445
    ^ keyboardStep
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   446
!
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   447
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   448
keyboardStep:aNumber
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   449
    "set the scrollers keyboard step. If non-nil,
5872
3840d3ff35a2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5794
diff changeset
   450
     that's the stepping value used with cursorUp/cursorDown keys.
1737
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   451
     (not used with Scrollers, but provided for subclasses)"
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   452
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   453
    keyboardStep := aNumber
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   454
!
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   455
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   456
start 
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   457
    "return the scrollers range min.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   458
     (not used with Scrollers, but provided for subclasses)"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   459
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   460
    ^ rangeStart
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   461
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   462
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   463
start:start
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   464
    "set the scrollers range min.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   465
     (not used with Scrollers, but provided for subclasses)"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   466
679
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   467
    self start:start stop:rangeEnd.
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   468
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   469
    "Modified: 25.5.1996 / 11:28:22 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   470
!
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   471
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   472
start:start stop:stop
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   473
    "set the range.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   474
     (not used with Scrollers, but provided for subclasses)"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   475
679
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   476
    |org|
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   477
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   478
    org := self thumbOrigin.
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   479
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   480
    rangeStart := start.
679
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   481
    rangeEnd := stop.
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   482
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   483
    rangeStart = rangeEnd ifTrue:[
3028
4089edca9a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3026
diff changeset
   484
        self error:'invalid slider range (start = stop)' mayProceed:true.
4089edca9a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3026
diff changeset
   485
        rangeEnd := rangeStart + (rangeStep ? 1).
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   486
    ].
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   487
679
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   488
    org < rangeStart ifTrue:[
3019
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
   489
        org := rangeStart
679
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   490
    ] ifFalse:[
3019
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
   491
        org > rangeEnd ifTrue:[
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
   492
            org := rangeEnd
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
   493
        ]
679
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   494
    ].
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   495
    self thumbOrigin:org.
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   496
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   497
    "Modified: / 21.1.1998 / 19:22:07 / cg"
679
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   498
!
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   499
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   500
start:start stop:stop step:step
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   501
    "set the range.
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   502
     (not used with Scrollers, but provided for subclasses)"
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   503
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   504
    self start:start stop:stop.
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   505
    rangeStep := step.
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   506
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   507
    "Created: 25.5.1996 / 11:24:09 / cg"
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   508
    "Modified: 25.5.1996 / 11:27:43 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   509
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   510
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   511
step
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   512
    "return the scrollers range step.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   513
     (not used with Scrollers, but provided for subclasses)"
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   514
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   515
    ^ rangeStep
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   516
!
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   517
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   518
step:step
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   519
    "set the scrollers range step.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   520
     (not used with Scrollers, but provided for subclasses)"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   521
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   522
    rangeStep := step
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   523
!
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   524
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   525
stop
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   526
    "return the scrollers range max.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   527
     (not used with Scrollers, but provided for subclasses)"
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   528
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   529
    ^ rangeEnd
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   530
!
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   531
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   532
stop:stop
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   533
    "set the scrollers range max.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   534
     (not used with Scrollers, but provided for subclasses)"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   535
679
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   536
    self start:rangeStart stop:stop.
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   537
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   538
    "Modified: 25.5.1996 / 11:28:35 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   539
!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   540
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   541
thumbFrame
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   542
    "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
   543
     Allows access to the thumbs physical screen position, for
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   544
     example to position a label below (see Slider-Examples)"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   545
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   546
    thumbFrame isNil ifTrue:[ self computeThumbFrame].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   547
    ^ thumbFrame
119
claus
parents: 117
diff changeset
   548
!
claus
parents: 117
diff changeset
   549
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   550
thumbHeight
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   551
    "answer the thumbs height (in percent by default)"
119
claus
parents: 117
diff changeset
   552
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   553
    ^ thumbHeight * (rangeEnd - rangeStart) abs / 100
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   554
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   555
    "Modified: / 21.1.1998 / 19:25:33 / cg"
119
claus
parents: 117
diff changeset
   556
!
claus
parents: 117
diff changeset
   557
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   558
thumbHeight:aNumber 
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   559
    "set the thumbs height (in percent by default)"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   560
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   561
    |newHeight realNewHeight oldFrame nBg|
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   562
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   563
    newHeight := aNumber / ((rangeEnd - rangeStart) abs / 100).
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   564
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   565
    (newHeight > 100) ifTrue:[
2175
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   566
        realNewHeight := 100
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   567
    ] ifFalse:[
2175
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   568
        realNewHeight := newHeight
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   569
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   570
    ((realNewHeight ~= thumbHeight) or:[thumbFrame isNil]) ifTrue:[
2175
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   571
        thumbHeight := realNewHeight.
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   572
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   573
        (DefaultFullViewBackground notNil
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   574
        and:[DefaultViewBackground notNil
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   575
        and:[DefaultFullViewBackground ~~ DefaultViewBackground]]) ifTrue:[
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   576
            realNewHeight >= 100 ifTrue:[
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   577
                nBg := DefaultFullViewBackground.
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   578
            ] ifFalse:[
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   579
                nBg := DefaultViewBackground
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   580
            ].
5622
cb4139a2302c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5468
diff changeset
   581
            nBg := nBg onDevice:device.
2175
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   582
            nBg ~~ viewBackground ifTrue:[
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   583
                self viewBackground:nBg.
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   584
                self invalidate.
2175
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   585
            ]
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   586
        ].
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   587
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   588
        shown ifTrue:[
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   589
            oldFrame := thumbFrame.
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   590
            self computeThumbFrame.
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   591
            oldFrame ~= thumbFrame ifTrue:[
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   592
                self invalidate.
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   593
            ]
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   594
        ] ifFalse:[
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   595
            thumbFrame := nil.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   596
            self invalidate.
3019
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
   597
        ].
119
claus
parents: 117
diff changeset
   598
    ]
1127
e55aa76e226d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   599
1709
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   600
    "Modified: / 21.10.1998 / 22:35:31 / cg"
119
claus
parents: 117
diff changeset
   601
!
claus
parents: 117
diff changeset
   602
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   603
thumbOrigin
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   604
    "answer the thumbs origin (in percent by default)"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   605
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   606
    |org|
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   607
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   608
    org := thumbOrigin * (rangeEnd - rangeStart) / 100 + rangeStart.
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   609
    rangeStep notNil ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   610
	org := org roundTo:rangeStep.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   611
	rangeStep isInteger ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   612
	    org := org asInteger
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   613
	]
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   614
    ].
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   615
    ^ org
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   616
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   617
    "Modified: / 21.1.1998 / 19:13:48 / cg"
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   618
!
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   619
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   620
thumbOrigin:aNumber 
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   621
    "set the thumbs origin (in percent by default)"
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   622
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   623
    |org newOrigin realNewOrigin 
119
claus
parents: 117
diff changeset
   624
     oldFrame oldTop oldBot oldLeft oldRight
claus
parents: 117
diff changeset
   625
     thumbTop thumbBot thumbLeft thumbRight
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   626
     tH "{ Class: SmallInteger }"
1897
d66a3dbfebf0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1896
diff changeset
   627
     tW "{ Class: SmallInteger }"
132
claus
parents: 131
diff changeset
   628
     delta needFullDraw 
119
claus
parents: 117
diff changeset
   629
     bgLeft bgTop bgWidth bgHeight|
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   630
1250
5e4f96c330de handle a nil thumbOrigin argument (uninitialized model)
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   631
    aNumber isNil ifTrue:[
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   632
        newOrigin := 0
1250
5e4f96c330de handle a nil thumbOrigin argument (uninitialized model)
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   633
    ] ifFalse:[
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   634
        org := aNumber.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   635
        rangeStep notNil ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   636
            org := org roundTo:rangeStep.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   637
            rangeStep isInteger ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   638
                org := org asInteger
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   639
            ]
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   640
        ].
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   641
        newOrigin := (org - rangeStart) asFloat / (rangeEnd - rangeStart / 100).
1250
5e4f96c330de handle a nil thumbOrigin argument (uninitialized model)
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   642
    ].
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   643
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   644
    ((newOrigin + thumbHeight) > 100) ifTrue:[
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   645
        realNewOrigin := 100 - thumbHeight
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   646
    ] ifFalse: [
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   647
        realNewOrigin := newOrigin
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   648
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   649
    (realNewOrigin > 100) ifTrue:[
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   650
        realNewOrigin := 100
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   651
    ] ifFalse: [
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   652
        (realNewOrigin < 0) ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   653
            realNewOrigin := 0
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   654
        ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   655
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   656
    ((realNewOrigin ~= thumbOrigin) or:[thumbFrame isNil]) ifTrue:[
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   657
        thumbOrigin := realNewOrigin.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   658
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   659
        shown ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   660
            oldFrame := thumbFrame.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   661
            self computeThumbFrame.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   662
            (thumbHeight = 100) ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   663
                "/ full: don't draw
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   664
                ^ self
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   665
            ].
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   666
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   667
            (thumbFrame ~= oldFrame) ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   668
                oldFrame isNil ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   669
                    self invalidate.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   670
                    ^ self
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   671
                ].
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   672
                tH := thumbFrame height.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   673
                tW := thumbFrame width.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   674
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   675
                oldTop := oldFrame top.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   676
                oldBot := oldTop + tH.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   677
                oldLeft := oldFrame left.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   678
                oldRight := oldLeft + tW.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   679
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   680
                thumbTop := thumbFrame top.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   681
                thumbBot := thumbTop + tH.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   682
                thumbLeft := thumbFrame left.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   683
                thumbRight := thumbLeft + tW.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   684
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   685
                needFullDraw := self exposeEventPending
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   686
                                or:[((orientation == #vertical) and:[oldBot >= height])
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   687
                                or:[((orientation ~~ #vertical) and:[oldRight >= width])]].
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   688
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   689
                needFullDraw ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   690
                    "
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   691
                     cannot copy since thumb was below the end
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   692
                     or may be not available for the copy
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   693
                    "
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   694
                    self invalidate.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   695
                    ^ self
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   696
                ].
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   697
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   698
                self catchExpose.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   699
                "
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   700
                 copy the thumbs pixels
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   701
                "
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   702
                (orientation == #vertical) ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   703
                    self 
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   704
                        copyFrom:self 
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   705
                        x:thumbLeft y:oldTop
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   706
                        toX:thumbLeft y:thumbTop
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   707
                        width:tW height:tH
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   708
                        async:true.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   709
                ] ifFalse:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   710
                    self 
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   711
                        copyFrom:self 
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   712
                        x:oldLeft y:thumbTop
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   713
                        toX:thumbLeft y:thumbTop
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   714
                        width:tW height:tH
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   715
                        async:true.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   716
                ].
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   717
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   718
                "
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   719
                 clear some of the previous thumbs area to background
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   720
                "
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   721
                (orientation == #vertical) ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   722
                    bgLeft := thumbLeft.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   723
                    bgWidth := tW.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   724
                    oldTop > thumbTop ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   725
                        delta := oldTop - thumbTop.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   726
                        oldTop > thumbBot ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   727
                            bgTop := oldTop.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   728
                            bgHeight := tH + 1
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   729
                        ] ifFalse:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   730
                            bgTop := thumbBot.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   731
                            bgHeight := delta
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   732
                        ]
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   733
                    ] ifFalse:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   734
                        delta := thumbTop - oldTop.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   735
                        oldBot < thumbTop ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   736
                            bgTop := oldTop.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   737
                            bgHeight := tH + 1
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   738
                        ] ifFalse:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   739
                            bgTop := oldTop.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   740
                            bgHeight := delta
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   741
                        ]
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   742
                    ].
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   743
                ] ifFalse:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   744
                    bgTop := thumbTop.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   745
                    bgHeight := tH.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   746
                    oldLeft > thumbLeft ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   747
                        delta := oldLeft - thumbLeft.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   748
                        oldLeft > thumbRight ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   749
                            bgLeft := oldLeft.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   750
                            bgWidth := tW + 1.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   751
                        ] ifFalse:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   752
                            bgLeft := thumbRight.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   753
                            bgWidth := delta.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   754
                        ]
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   755
                    ] ifFalse:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   756
                        delta := thumbLeft - oldLeft.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   757
                        oldRight < thumbLeft ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   758
                            bgLeft := oldLeft.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   759
                            bgWidth := tW + 1.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   760
                        ] ifFalse:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   761
                            bgLeft := oldLeft.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   762
                            bgWidth := delta.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   763
                        ]
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   764
                    ].
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   765
                ].
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   766
                self drawThumbBackgroundInX:bgLeft y:bgTop width:bgWidth height:bgHeight.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   767
                self waitForExpose
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   768
            ]
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   769
        ] ifFalse:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   770
            thumbFrame := nil
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   771
        ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   772
    ]
983
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   773
1897
d66a3dbfebf0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1896
diff changeset
   774
    "Modified: / 4.5.1999 / 18:57:28 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   775
!
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   776
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   777
thumbOrigin:originNumber thumbHeight:heightNumber
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   778
    "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
   779
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   780
    |newHeight newOrigin realNewOrigin realNewHeight old new changed 
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   781
     nBg range|
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   782
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   783
    range := rangeEnd - rangeStart.
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   784
5622
cb4139a2302c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5468
diff changeset
   785
    newOrigin := (originNumber - rangeStart) / (range / 100).
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   786
    newHeight := heightNumber / (range abs / 100).
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   787
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   788
    (newHeight > 100) ifTrue:[
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   789
        realNewHeight := 100
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   790
    ] ifFalse:[
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   791
        realNewHeight := newHeight
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   792
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   793
    ((newOrigin + realNewHeight) > 100) ifTrue:[
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   794
        realNewOrigin := 100 - realNewHeight
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   795
    ] ifFalse: [
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   796
        realNewOrigin := newOrigin
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   797
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   798
    (realNewOrigin < 0) ifTrue: [
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   799
        realNewOrigin := 0
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   800
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   801
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   802
    changed := (realNewHeight ~= thumbHeight) or:[realNewOrigin ~= thumbOrigin].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   803
    (changed or:[thumbFrame isNil]) ifTrue:[
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   804
        old := self absFromPercent:thumbOrigin.
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   805
        new := self absFromPercent:realNewOrigin.
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   806
        changed := old ~~ new.
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   807
        changed ifFalse:[
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   808
            old := self absFromPercent:thumbHeight.
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   809
            new := self absFromPercent:realNewHeight.
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   810
            changed := (old ~~ new)
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   811
        ].
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   812
        (changed or:[thumbFrame isNil]) ifTrue:[
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   813
            thumbOrigin := realNewOrigin.
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   814
            thumbHeight := realNewHeight.
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   815
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   816
            (DefaultFullViewBackground notNil
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   817
            and:[DefaultViewBackground notNil
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   818
            and:[DefaultFullViewBackground ~~ DefaultViewBackground]]) ifTrue:[
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   819
                realNewHeight >= 100 ifTrue:[
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   820
                    nBg := DefaultFullViewBackground.
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   821
                ] ifFalse:[
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   822
                    nBg := DefaultViewBackground
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   823
                ].
5622
cb4139a2302c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5468
diff changeset
   824
                nBg := nBg onDevice:device.
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   825
                nBg ~~ viewBackground ifTrue:[
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   826
                    self viewBackground:nBg.
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   827
                ]
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   828
            ].
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   829
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   830
            thumbFrame := nil.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   831
            self invalidate.
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
   832
        ]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   833
    ]
1189
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   834
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   835
    "Modified: / 21.1.1998 / 19:32:41 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   836
! !
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   837
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   838
!Scroller methodsFor:'accessing-behavior'!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   839
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   840
action:aBlock
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   841
    "for protocol compatibility; same as scrollAction:"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   842
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   843
    self scrollAction:aBlock
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   844
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   845
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   846
asynchronousOperation
3165
58b08c376a6e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3164
diff changeset
   847
    <resource:#obsolete>
3017
8acd72001dd6 *** empty log message ***
ca
parents: 2913
diff changeset
   848
    self obsoleteMethodWarning:'use #beAsynchronous'.
8acd72001dd6 *** empty log message ***
ca
parents: 2913
diff changeset
   849
    self beAsynchronous
8acd72001dd6 *** empty log message ***
ca
parents: 2913
diff changeset
   850
!
8acd72001dd6 *** empty log message ***
ca
parents: 2913
diff changeset
   851
8acd72001dd6 *** empty log message ***
ca
parents: 2913
diff changeset
   852
beAsynchronous
8acd72001dd6 *** empty log message ***
ca
parents: 2913
diff changeset
   853
    "set scroll-mode to be asynchronous - scroll action is only performed after
8acd72001dd6 *** empty log message ***
ca
parents: 2913
diff changeset
   854
     scrolling, when mouse-button is finally released (no tracking)."
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   855
     
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   856
    synchronousOperation := false
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   857
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   858
3017
8acd72001dd6 *** empty log message ***
ca
parents: 2913
diff changeset
   859
beSynchronous
8acd72001dd6 *** empty log message ***
ca
parents: 2913
diff changeset
   860
    "set scroll-mode to be synchronous - scroll action is performed for 
8acd72001dd6 *** empty log message ***
ca
parents: 2913
diff changeset
   861
     every movement of thumb (tracking)."
8acd72001dd6 *** empty log message ***
ca
parents: 2913
diff changeset
   862
     
8acd72001dd6 *** empty log message ***
ca
parents: 2913
diff changeset
   863
    synchronousOperation := true
8acd72001dd6 *** empty log message ***
ca
parents: 2913
diff changeset
   864
!
8acd72001dd6 *** empty log message ***
ca
parents: 2913
diff changeset
   865
1830
f732d15043a4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1821
diff changeset
   866
enabled
f732d15043a4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1821
diff changeset
   867
    "return enable/disable state of the scoller"
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   868
1830
f732d15043a4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1821
diff changeset
   869
    ^ enabled
f732d15043a4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1821
diff changeset
   870
f732d15043a4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1821
diff changeset
   871
    "Created: / 30.3.1999 / 15:24:50 / stefan"
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   872
!
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   873
1830
f732d15043a4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1821
diff changeset
   874
enabled:aBoolean
f732d15043a4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1821
diff changeset
   875
    "enable/disable the scoller"
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   876
1830
f732d15043a4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1821
diff changeset
   877
    enabled ~~ aBoolean ifTrue:[
2010
ca8dcc8723dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
   878
	enabled := aBoolean.
ca8dcc8723dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
   879
	self updateBackground.
ca8dcc8723dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
   880
	aBoolean ifFalse:[
ca8dcc8723dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
   881
	    self cursor: Cursor normal
ca8dcc8723dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
   882
	]
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   883
    ]
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   884
1830
f732d15043a4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1821
diff changeset
   885
    "Created: / 30.3.1999 / 15:23:14 / stefan"
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   886
!
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   887
3017
8acd72001dd6 *** empty log message ***
ca
parents: 2913
diff changeset
   888
isSynchronous
8acd72001dd6 *** empty log message ***
ca
parents: 2913
diff changeset
   889
    "return true if the scroll-mode is synchronous.
8acd72001dd6 *** empty log message ***
ca
parents: 2913
diff changeset
   890
     If true, the scroll action is performed for every movement of the thumb (tracking).
8acd72001dd6 *** empty log message ***
ca
parents: 2913
diff changeset
   891
     If false, the scroll action is only performed at the end."
8acd72001dd6 *** empty log message ***
ca
parents: 2913
diff changeset
   892
8acd72001dd6 *** empty log message ***
ca
parents: 2913
diff changeset
   893
    ^ synchronousOperation
8acd72001dd6 *** empty log message ***
ca
parents: 2913
diff changeset
   894
!
8acd72001dd6 *** empty log message ***
ca
parents: 2913
diff changeset
   895
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   896
scrollAction
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   897
    "answer the scroll action block"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   898
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   899
    ^ scrollAction
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   900
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   901
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   902
scrollAction:aBlock
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   903
    "set the scroll action, aBlock which is evaluated when scrolled"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   904
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   905
    scrollAction := aBlock
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   906
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   907
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   908
scrollDownAction:aBlock
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   909
    "ignored -
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   910
     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
   911
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   912
3165
58b08c376a6e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3164
diff changeset
   913
scrollLeftAction:aBlock
58b08c376a6e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3164
diff changeset
   914
    "ignored -
58b08c376a6e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3164
diff changeset
   915
     but implemented, so that scroller can be used in place of a scrollbar"
58b08c376a6e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3164
diff changeset
   916
!
58b08c376a6e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3164
diff changeset
   917
58b08c376a6e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3164
diff changeset
   918
scrollRightAction:aBlock
58b08c376a6e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3164
diff changeset
   919
    "ignored -
58b08c376a6e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3164
diff changeset
   920
     but implemented, so that scroller can be used in place of a scrollbar"
58b08c376a6e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3164
diff changeset
   921
!
58b08c376a6e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3164
diff changeset
   922
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   923
scrollUpAction:aBlock
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   924
    "ignored -
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   925
     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
   926
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   927
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   928
synchronousOperation
3165
58b08c376a6e *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3164
diff changeset
   929
    <resource:#obsolete>
3017
8acd72001dd6 *** empty log message ***
ca
parents: 2913
diff changeset
   930
    self obsoleteMethodWarning:'use #beSynchronous'.
8acd72001dd6 *** empty log message ***
ca
parents: 2913
diff changeset
   931
    self beSynchronous
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   932
! !
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   933
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   934
!Scroller methodsFor:'accessing-bg & border'!
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   935
3603
cf5399ef4d5f allViewBackground: with optional condition
sr
parents: 3486
diff changeset
   936
allViewBackground:something if:condition
1957
41d39e04bf51 comment
Claus Gittinger <cg@exept.de>
parents: 1913
diff changeset
   937
    "ignore here for all scrollers (I want my own background)"
41d39e04bf51 comment
Claus Gittinger <cg@exept.de>
parents: 1913
diff changeset
   938
2456
042817ef96be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2384
diff changeset
   939
    "/ ^ super allViewBackground:something
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   940
! !
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   941
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   942
!Scroller methodsFor:'accessing-look'!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   943
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   944
is3D
958
b75025112346 commentary
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
   945
    "return true, if I use a 3D style"
b75025112346 commentary
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
   946
764
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
   947
    <resource: #style (#name)>
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
   948
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   949
    styleSheet name = #mswindows ifTrue:[^ true].
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   950
    ^ super is3D
764
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
   951
958
b75025112346 commentary
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
   952
    "Modified: 17.1.1997 / 23:21:42 / cg"
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   953
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   954
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   955
orientation 
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   956
    "return the scrollers orientation (#vertical or #horizontal)"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   957
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   958
    ^ orientation
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   959
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   960
1167
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   961
orientation:aSymbol 
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   962
    "set the scrollers orientation (#vertical or #horizontal)"
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   963
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   964
    |oldFrame|
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   965
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   966
    orientation := aSymbol.
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   967
    preferredExtent := nil.
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   968
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   969
    shown ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   970
	oldFrame := thumbFrame.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   971
	self computeThumbFrame.
1167
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   972
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   973
	oldFrame ~= thumbFrame ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   974
	    self invalidate.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   975
	]
1167
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   976
    ]
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   977
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   978
    "Created: 1.4.1997 / 12:18:32 / cg"
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   979
    "Modified: 1.4.1997 / 12:20:46 / cg"
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   980
!
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   981
689
1f0e278ce283 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   982
thumb
1f0e278ce283 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   983
    "for compatibility with scrollBars, return the receiver"
1f0e278ce283 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   984
1f0e278ce283 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   985
    ^ self
1f0e278ce283 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   986
1f0e278ce283 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   987
    "Created: 26.5.1996 / 12:21:12 / cg"
1f0e278ce283 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   988
!
1f0e278ce283 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   989
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   990
thumbColor
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   991
    "return the thumbs color"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   992
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   993
    ^ thumbColor
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   994
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   995
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   996
thumbColor:aColor
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   997
    "change the color of the thumb"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   998
764
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
   999
    <resource: #style (#name)>
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  1000
4908
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  1001
    |avgColor graphicsDevice|
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  1002
5622
cb4139a2302c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5468
diff changeset
  1003
    graphicsDevice := device.
cb4139a2302c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5468
diff changeset
  1004
    thumbColor := aColor onDevice:graphicsDevice.
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1005
    (styleSheet name ~~ #normal) ifTrue:[
4908
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  1006
        avgColor := aColor averageColorIn:(0@0 corner:7@7).
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  1007
        thumbShadowColor := avgColor darkened onDevice:graphicsDevice.
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  1008
        thumbLightColor := avgColor lightened onDevice:graphicsDevice.
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  1009
        thumbHalfShadowColor := thumbShadowColor darkened onDevice:graphicsDevice.
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  1010
        thumbHalfLightColor := thumbLightColor lightened onDevice:graphicsDevice.
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1011
    ].
993
51cce445b5d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
  1012
    self invalidate
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1013
993
51cce445b5d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
  1014
    "Modified: 8.2.1997 / 15:15:58 / cg"
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1015
! !
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1016
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1017
!Scroller methodsFor:'autoRepeat'!
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1018
2313
c3c2415333bb make sure, that autorepeat happens AFTER damages have been
Claus Gittinger <cg@exept.de>
parents: 2301
diff changeset
  1019
installRepeat
2514
cf29e8120cad care for initialRepeat time in autopager
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
  1020
    self installRepeat:repeatDelay.
cf29e8120cad care for initialRepeat time in autopager
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
  1021
!
cf29e8120cad care for initialRepeat time in autopager
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
  1022
cf29e8120cad care for initialRepeat time in autopager
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
  1023
installRepeat:repeatDelay
3164
78412bd19e6d Avoid a (theoretical) race condition when installing repeat blocks
Stefan Vogel <sv@exept.de>
parents: 3163
diff changeset
  1024
    |repeatBlockCopy|
78412bd19e6d Avoid a (theoretical) race condition when installing repeat blocks
Stefan Vogel <sv@exept.de>
parents: 3163
diff changeset
  1025
78412bd19e6d Avoid a (theoretical) race condition when installing repeat blocks
Stefan Vogel <sv@exept.de>
parents: 3163
diff changeset
  1026
    "protect against races"
78412bd19e6d Avoid a (theoretical) race condition when installing repeat blocks
Stefan Vogel <sv@exept.de>
parents: 3163
diff changeset
  1027
    repeatBlockCopy := repeatBlock.
78412bd19e6d Avoid a (theoretical) race condition when installing repeat blocks
Stefan Vogel <sv@exept.de>
parents: 3163
diff changeset
  1028
    repeatBlockCopy notNil ifTrue:[
3163
ed196eb1fa44 Take care of Scrollers without windowgroup when sending #repairDamage.
Stefan Vogel <sv@exept.de>
parents: 3109
diff changeset
  1029
        self repairDamage.
3164
78412bd19e6d Avoid a (theoretical) race condition when installing repeat blocks
Stefan Vogel <sv@exept.de>
parents: 3163
diff changeset
  1030
        Processor addTimedBlock:repeatBlockCopy afterSeconds:repeatDelay
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  1031
    ]
2313
c3c2415333bb make sure, that autorepeat happens AFTER damages have been
Claus Gittinger <cg@exept.de>
parents: 2301
diff changeset
  1032
!
c3c2415333bb make sure, that autorepeat happens AFTER damages have been
Claus Gittinger <cg@exept.de>
parents: 2301
diff changeset
  1033
2594
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1034
pagedAbovePointer
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1035
    lastMousePosition notNil ifTrue:[
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1036
        orientation == #horizontal ifTrue:[
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1037
            ^ lastMousePosition x > thumbFrame center x 
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1038
        ] ifFalse:[
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1039
            ^ lastMousePosition y > thumbFrame center y 
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1040
        ].
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1041
    ].
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1042
    ^ false.
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1043
!
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1044
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1045
pagedBelowPointer
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1046
    lastMousePosition notNil ifTrue:[
3281
bff085fdfa78 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3165
diff changeset
  1047
        thumbFrame isNil ifTrue:[
bff085fdfa78 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3165
diff changeset
  1048
            self computeThumbFrame.
bff085fdfa78 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3165
diff changeset
  1049
            thumbFrame isNil ifTrue:[^ false].
bff085fdfa78 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3165
diff changeset
  1050
        ].
2594
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1051
        orientation == #horizontal ifTrue:[
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1052
            ^ lastMousePosition x < thumbFrame center x 
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1053
        ] ifFalse:[
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1054
            ^ lastMousePosition y < thumbFrame center y 
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1055
        ].
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1056
    ].
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1057
    ^ false.
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1058
!
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1059
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1060
repeatPageDown
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  1061
    repeatBlock notNil ifTrue:[
2594
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1062
        "stop scroll"
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1063
        (DefaultStopPagerAtThumb and:[self pagedBelowPointer]) ifTrue:[^ self].
3163
ed196eb1fa44 Take care of Scrollers without windowgroup when sending #repairDamage.
Stefan Vogel <sv@exept.de>
parents: 3109
diff changeset
  1064
        self repairDamage.
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  1065
        self pageDown.
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  1066
        self installRepeat.
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  1067
    ]
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1068
!
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1069
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1070
repeatPageUp
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  1071
    repeatBlock notNil ifTrue:[
2594
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1072
        "stop scroll"
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1073
        (DefaultStopPagerAtThumb and:[self pagedAbovePointer]) ifTrue:[^ self].
3163
ed196eb1fa44 Take care of Scrollers without windowgroup when sending #repairDamage.
Stefan Vogel <sv@exept.de>
parents: 3109
diff changeset
  1074
        self repairDamage.
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  1075
        self pageUp.
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  1076
        self installRepeat.
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  1077
    ]
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1078
! !
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1079
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1080
!Scroller methodsFor:'drawing'!
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1081
4038
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1082
drawEdgedLineFrom:x1 y:y1 toX:x2 y:y2 level:lvl lightColor:lightColor shadowColor:shadowColor
3103
3ff619dbf7d0 xp style drawing
Claus Gittinger <cg@exept.de>
parents: 3094
diff changeset
  1083
    |color1 color2 x y dl|
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1084
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1085
    "iris style - draw tallys"
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1086
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1087
    lvl > 0 ifTrue:[
4038
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1088
        color1 := lightColor.
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1089
        color2 := shadowColor.
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1090
    ] ifFalse:[
4038
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1091
        color1 := shadowColor.
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1092
        color2 := lightColor.
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1093
    ].
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1094
3103
3ff619dbf7d0 xp style drawing
Claus Gittinger <cg@exept.de>
parents: 3094
diff changeset
  1095
    dl := 1.
3ff619dbf7d0 xp style drawing
Claus Gittinger <cg@exept.de>
parents: 3094
diff changeset
  1096
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1097
    self paint:color1.
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1098
    x1 = x2 ifTrue:[
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1099
        "/ vertical
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1100
        gc displayLineFromX:x1 y:y1-dl toX:x2 y:y2-dl.
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1101
        gc paint:color2.
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1102
        x := x1 + 1.
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1103
        gc displayLineFromX:x y:y1 toX:x y:y2.
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1104
    ] ifFalse:[
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1105
        "/ horizontal
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1106
        gc displayLineFromX:x1-dl y:y1 toX:x2-dl y:y2.
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1107
        gc paint:color2.
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1108
        y := y1 + 1.
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1109
        gc displayLineFromX:x1 y:y toX:x2 y:y.
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1110
    ].
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1111
!
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1112
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1113
drawHandleFormAtX:x y:y
4038
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1114
    "styles with a handle in the middle (NeXT) use this"
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1115
5622
cb4139a2302c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5468
diff changeset
  1116
    thumbShadowColor := thumbShadowColor onDevice:device.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1117
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1118
    gc paint:thumbShadowColor.
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1119
    gc displayForm:shadowForm x:x y:y.
1531
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
  1120
    lightForm notNil ifTrue:[
5622
cb4139a2302c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5468
diff changeset
  1121
        thumbLightColor := thumbLightColor onDevice:device.
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1122
        gc paint:thumbLightColor.
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1123
        gc displayForm:lightForm x:x y:y.
1531
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
  1124
    ].
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
  1125
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
  1126
    "Modified: / 19.5.1998 / 16:26:49 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1127
!
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1128
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1129
drawTallyMarks
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1130
    "draw the thumb"
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1131
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1132
    |color1 color2 
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1133
     lvl "{ Class: SmallInteger }"
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1134
     t "{ Class: SmallInteger }"
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1135
     l "{ Class: SmallInteger }"
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1136
     w "{ Class: SmallInteger }"
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1137
     h "{ Class: SmallInteger }"
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1138
     x "{ Class: SmallInteger }"
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1139
     y "{ Class: SmallInteger }"
3103
3ff619dbf7d0 xp style drawing
Claus Gittinger <cg@exept.de>
parents: 3094
diff changeset
  1140
     xL xR yT yB dist yTop yBot xLeft xRight
4038
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1141
     light shadow|
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1142
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1143
    "iris style - draw tallys"
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1144
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1145
    lvl := thumbLevel.
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1146
    scrolling ifTrue:[
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1147
        lvl := thumbActiveLevel
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1148
    ].
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1149
4052
b5249a7611f4 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4039
diff changeset
  1150
    thumbFrame isNil ifTrue:[^ self].
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1151
    w := thumbFrame width.
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1152
    h := thumbFrame height.
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1153
    l := thumbFrame left.
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1154
    t := thumbFrame top.
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1155
4038
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1156
    light := thumbLightColor.
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1157
    shadow := thumbShadowColor.
5467
1c31382917e7 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5420
diff changeset
  1158
    (styleSheet at:#'scroller.vista3DStyle' default:false) "styleSheet name == #winVista" ifTrue:[
4039
51eb8083cffb changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4038
diff changeset
  1159
        light := (entered ifTrue:[thumbEnteredColor] ifFalse:[thumbColor]) lightened.
4038
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1160
        shadow := (entered ifTrue:[thumbEnteredColor] ifFalse:[thumbColor]) darkened.
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1161
    ].
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1162
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1163
    tallyLevel > 0 ifTrue:[
4038
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1164
        color1 := light.
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1165
        color2 := shadow.
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1166
    ] ifFalse:[
4038
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1167
        color1 := shadow.
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1168
        color2 := light.
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1169
    ].
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1170
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1171
    "draw tally marks"
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1172
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1173
    (orientation == #vertical) ifTrue:[
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1174
        y := t + (h // 2) - 1.
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1175
        xL := l + lvl - 1 + DefaultTallyInset.
5468
795a25c2eb2c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5467
diff changeset
  1176
        xR := l + w - lvl + 1 - DefaultTallyInset.
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1177
5622
cb4139a2302c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5468
diff changeset
  1178
        dist := DefaultTallyDistance ? device verticalPixelPerMillimeter rounded.
3103
3ff619dbf7d0 xp style drawing
Claus Gittinger <cg@exept.de>
parents: 3094
diff changeset
  1179
3ff619dbf7d0 xp style drawing
Claus Gittinger <cg@exept.de>
parents: 3094
diff changeset
  1180
        tallyMarks even ifTrue:[
3ff619dbf7d0 xp style drawing
Claus Gittinger <cg@exept.de>
parents: 3094
diff changeset
  1181
            yTop := y - (dist // 2).   
3ff619dbf7d0 xp style drawing
Claus Gittinger <cg@exept.de>
parents: 3094
diff changeset
  1182
            yBot := y + (dist - (dist // 2)).
4038
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1183
            self drawEdgedLineFrom:xL y:yTop toX:xR y:yTop level:tallyLevel lightColor:light shadowColor:shadow.
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1184
            self drawEdgedLineFrom:xL y:yBot toX:xR y:yBot level:tallyLevel lightColor:light shadowColor:shadow.
3103
3ff619dbf7d0 xp style drawing
Claus Gittinger <cg@exept.de>
parents: 3094
diff changeset
  1185
        ] ifFalse:[
4038
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1186
            self drawEdgedLineFrom:xL y:y toX:xR y:y level:tallyLevel lightColor:light shadowColor:shadow.
3103
3ff619dbf7d0 xp style drawing
Claus Gittinger <cg@exept.de>
parents: 3094
diff changeset
  1187
            yTop := yBot := y.   
3ff619dbf7d0 xp style drawing
Claus Gittinger <cg@exept.de>
parents: 3094
diff changeset
  1188
        ].
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1189
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1190
        tallyMarks > 1 ifTrue:[
5949
2c3b91259dcc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5872
diff changeset
  1191
            "don't draw other marks if there is not enough space"
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1192
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1193
            h > (dist * (tallyMarks * 2)) ifTrue:[
4038
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1194
                self drawEdgedLineFrom:xL y:(yTop - dist) toX:xR y:(yTop - dist) level:tallyLevel lightColor:light shadowColor:shadow.
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1195
                self drawEdgedLineFrom:xL y:(yBot + dist) toX:xR y:(yBot + dist) level:tallyLevel lightColor:light shadowColor:shadow.
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1196
            ]
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1197
        ]
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1198
    ] ifFalse:[
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1199
        x := l + (w // 2) - 1.
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1200
        yT := t + lvl - 1 + DefaultTallyInset.
5468
795a25c2eb2c #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5467
diff changeset
  1201
        yB := t + h - lvl + 1 - DefaultTallyInset.
3103
3ff619dbf7d0 xp style drawing
Claus Gittinger <cg@exept.de>
parents: 3094
diff changeset
  1202
5622
cb4139a2302c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5468
diff changeset
  1203
        dist := DefaultTallyDistance ? device horizontalPixelPerMillimeter rounded.
3103
3ff619dbf7d0 xp style drawing
Claus Gittinger <cg@exept.de>
parents: 3094
diff changeset
  1204
3ff619dbf7d0 xp style drawing
Claus Gittinger <cg@exept.de>
parents: 3094
diff changeset
  1205
        tallyMarks even ifTrue:[
3ff619dbf7d0 xp style drawing
Claus Gittinger <cg@exept.de>
parents: 3094
diff changeset
  1206
            xLeft := x - (dist // 2).   
3ff619dbf7d0 xp style drawing
Claus Gittinger <cg@exept.de>
parents: 3094
diff changeset
  1207
            xRight := x + (dist - (dist // 2)).
4038
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1208
            self drawEdgedLineFrom:xLeft y:yT toX:xLeft y:yB level:tallyLevel lightColor:light shadowColor:shadow.
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1209
            self drawEdgedLineFrom:xRight y:yT toX:xRight y:yB level:tallyLevel lightColor:light shadowColor:shadow.
3103
3ff619dbf7d0 xp style drawing
Claus Gittinger <cg@exept.de>
parents: 3094
diff changeset
  1210
        ] ifFalse:[
4038
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1211
            self drawEdgedLineFrom:x y:yT toX:x y:yB level:tallyLevel lightColor:light shadowColor:shadow.
3103
3ff619dbf7d0 xp style drawing
Claus Gittinger <cg@exept.de>
parents: 3094
diff changeset
  1212
            xLeft := xRight := x.   
3ff619dbf7d0 xp style drawing
Claus Gittinger <cg@exept.de>
parents: 3094
diff changeset
  1213
        ].
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1214
        tallyMarks > 1 ifTrue:[
5949
2c3b91259dcc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5872
diff changeset
  1215
            "don't draw other marks if there is not enough space"
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1216
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1217
            w > (dist * (tallyMarks * 2)) ifTrue:[
4038
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1218
                self drawEdgedLineFrom:(xLeft - dist) y:yT toX:(xLeft - dist) y:yB level:tallyLevel lightColor:light shadowColor:shadow.
bb2c21273645 changed: #drawTallyMarks
Claus Gittinger <cg@exept.de>
parents: 4036
diff changeset
  1219
                self drawEdgedLineFrom:(xRight + dist) y:yT toX:(xRight + dist) y:yB level:tallyLevel lightColor:light shadowColor:shadow.
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1220
            ]
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1221
        ]
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1222
    ]
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1223
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1224
    "Modified: / 29.4.1999 / 09:35:52 / cg"
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1225
!
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1226
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1227
drawThumb
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1228
    "draw the thumb"
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1229
505
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1230
    |handleX handleY l t lvl
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1231
     w "{ Class: SmallInteger }"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1232
     h "{ Class: SmallInteger }"
5420
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1233
     clr clr2 styleName xpStyle vistaStyle n frameImageOrNil frameImage|
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1234
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1235
    (thumbHeight >= 100) ifTrue:[^ self].
2177
f554919e10ab invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1236
    thumbFrame isNil ifTrue:[^ self].
1890
ad2a761d19cf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
  1237
5420
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1238
    styleName := styleSheet name.
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1239
    xpStyle := styleName == #winXP.
5467
1c31382917e7 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5420
diff changeset
  1240
    vistaStyle := styleSheet at:#'scroller.vista3DStyle' default:false. "/ styleName == #winVista.
3093
201f489cde64 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3090
diff changeset
  1241
1890
ad2a761d19cf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
  1242
    w := thumbFrame width.
ad2a761d19cf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
  1243
    h := thumbFrame height.
2176
7069af4213d6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2175
diff changeset
  1244
    l := thumbFrame left.
7069af4213d6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2175
diff changeset
  1245
    t := thumbFrame top.
1890
ad2a761d19cf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
  1246
5420
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1247
    (scrolling and:[thumbActiveColor notNil]) ifTrue:[
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1248
        clr := thumbActiveColor
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1249
    ] ifFalse:[
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1250
        clr := entered 
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1251
            ifTrue:[thumbEnteredColor] 
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1252
            ifFalse:[thumbColor].
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1253
    ].
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1254
5218
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1255
    clr notNil ifTrue:[
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1256
        (styleSheet at:#'scroller.vista3DStyle' default:false) ifTrue:[
5420
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1257
            "/ color gradient drawing
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1258
            "/ with colors rougly smilar to the vista colors, which are:
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1259
            "/ 243 242 240 236 234 233 215 211 207 205 200 192 206
5794
57bb8f3b793c #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5775
diff changeset
  1260
            clr2 := styleSheet colorAt:#'scroller.vista3DStyleLightColor' default:self whiteColor.
5467
1c31382917e7 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5420
diff changeset
  1261
            
5218
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1262
            (orientation == #vertical) ifTrue:[
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1263
                n := w
4030
864057d8abe1 drawThumb
Claus Gittinger <cg@exept.de>
parents: 4029
diff changeset
  1264
            ] ifFalse:[
5218
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1265
                n := h
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1266
            ].
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1267
            1 to:n-1 do:[:i |
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1268
                |m|
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1269
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1270
                i == (n-1) ifTrue:[
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1271
                    m := 0.4.
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1272
                ] ifFalse:[
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1273
                    i <= (n//2) ifTrue:[
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1274
                        i <= (n//4) ifTrue:[
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1275
                            m := 3.
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1276
                        ] ifFalse:[
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1277
                            i <= (n//3) ifTrue:[
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1278
                                m := 2.5.
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1279
                            ] ifFalse:[
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1280
                                m := 2.
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1281
                            ].
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1282
                        ].
4029
70adb0e2a164 preps for blending a la vista
Claus Gittinger <cg@exept.de>
parents: 4017
diff changeset
  1283
                    ] ifFalse:[
5218
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1284
                        i > (n*3//4) ifTrue:[
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1285
                            i > (n*4//5) ifTrue:[
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1286
                                m := 0.
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1287
                            ] ifFalse:[
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1288
                                m := 0.2.
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1289
                            ]
4030
864057d8abe1 drawThumb
Claus Gittinger <cg@exept.de>
parents: 4029
diff changeset
  1290
                        ] ifFalse:[
5218
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1291
                            i > (n*2//3) ifTrue:[
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1292
                                m := 0.4
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1293
                            ] ifFalse:[
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1294
                                m := 0.8.
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1295
                            ].
4030
864057d8abe1 drawThumb
Claus Gittinger <cg@exept.de>
parents: 4029
diff changeset
  1296
                        ].
4029
70adb0e2a164 preps for blending a la vista
Claus Gittinger <cg@exept.de>
parents: 4017
diff changeset
  1297
                    ].
70adb0e2a164 preps for blending a la vista
Claus Gittinger <cg@exept.de>
parents: 4017
diff changeset
  1298
                ].
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1299
                gc paint:(clr2 mixed:m with:clr).
5218
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1300
                (orientation == #vertical) ifTrue:[
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1301
                    gc displayLineFromX:(l+i-1) y:t+1 toX:(l+i-1) y:(t+h-2)
5218
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1302
                ] ifFalse:[
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1303
                    gc displayLineFromX:(l+1) y:(t+i-1) toX:(l+w-2) y:(t+i-1)
5218
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1304
                ].
4029
70adb0e2a164 preps for blending a la vista
Claus Gittinger <cg@exept.de>
parents: 4017
diff changeset
  1305
            ].
5218
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1306
        ] ifFalse:[
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1307
            gc paint:clr.
5218
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1308
            (xpStyle and:[self isMiniScroller not]) ifTrue:[
5420
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1309
                "/ hack for xp
5218
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1310
                (orientation == #vertical) ifTrue:[
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1311
                    gc fillRectangleX:l y:t+1 width:w-2 height:h-4.
5218
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1312
                ] ifFalse:[
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1313
                    gc fillRectangleX:l+1 y:t width:w-4 height:h-2.
5218
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1314
                ]
4029
70adb0e2a164 preps for blending a la vista
Claus Gittinger <cg@exept.de>
parents: 4017
diff changeset
  1315
            ] ifFalse:[
5420
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1316
                (styleSheet at:#'scroller.roundStyle' default:false) ifTrue:[
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1317
                    "/ hack for osx
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1318
                    (orientation == #vertical) ifTrue:[
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1319
                        1 to:3 do:[:i |
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1320
                            |yLine left right|
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1321
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1322
                            left := l+i-1.
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1323
                            right := l+w-i+1.
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1324
                            yLine := t+3-i.
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1325
                            gc displayLineFromX:left y:yLine toX:right y:yLine.    
5420
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1326
                            yLine := t+h-3-1+i. 
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1327
                            gc displayLineFromX:left y:yLine toX:right y:yLine.    
5420
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1328
                        ].
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1329
                        gc fillRectangleX:l y:t+3 width:w height:h-6.
5420
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1330
                    ] ifFalse:[
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1331
                        1 to:3 do:[:i |
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1332
                            |xLine top bot|
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1333
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1334
                            top := t+i-1.
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1335
                            bot := t+h-i+1.
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1336
                            xLine := l+3-i.
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1337
                            gc displayLineFromX:xLine y:top toX:xLine y:bot.    
5420
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1338
                            xLine := l+w-3-1+i. 
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1339
                            gc displayLineFromX:xLine y:top toX:xLine y:bot.    
5420
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1340
                        ].
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1341
                        gc fillRectangleX:l+3 y:t width:w-6 height:h.
5420
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1342
                    ].
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1343
                ] ifFalse:[
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1344
                    gc fillRectangleX:l y:t width:w height:h.
5420
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  1345
                ].
4029
70adb0e2a164 preps for blending a la vista
Claus Gittinger <cg@exept.de>
parents: 4017
diff changeset
  1346
            ].
70adb0e2a164 preps for blending a la vista
Claus Gittinger <cg@exept.de>
parents: 4017
diff changeset
  1347
        ].
3093
201f489cde64 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3090
diff changeset
  1348
    ].
505
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1349
    lvl := thumbLevel.
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1350
    scrolling ifTrue:[
2176
7069af4213d6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2175
diff changeset
  1351
        lvl := thumbActiveLevel
505
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1352
    ].
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1353
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1354
    lvl ~~ 0 ifTrue:[
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1355
        self drawEdgesForX:l y:t width:w height:h level:lvl
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1356
                    shadow:thumbShadowColor light:thumbLightColor
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1357
                    halfShadow:thumbHalfShadowColor halfLight:thumbHalfLightColor
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1358
                    style:thumbEdgeStyle.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1359
    ].
5218
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1360
    frameImageOrNil := (orientation == #vertical) 
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1361
                        ifTrue:[ DefaultVerticalThumbFrameImage ]
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1362
                        ifFalse:[ DefaultHorizontalThumbFrameImage ].
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1363
    frameImageOrNil notNil ifTrue:[
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1364
        frameImage  := frameImageOrNil magnifiedTo:(w @ h).
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1365
        frameImage displayOn:self x:l y:t
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  1366
    ].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
  1367
3090
aaba67b31568 Do not draw thumbFrame for MiniScrollers -
Stefan Vogel <sv@exept.de>
parents: 3073
diff changeset
  1368
    self isMiniScroller ifTrue:[^ self].
aaba67b31568 Do not draw thumbFrame for MiniScrollers -
Stefan Vogel <sv@exept.de>
parents: 3073
diff changeset
  1369
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1370
    thumbFrameColor notNil ifTrue:[
3109
3037d2c0350d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3105
diff changeset
  1371
        clr2 := styleSheet colorAt:#'scroller.thumbFrameColor2'.
3037d2c0350d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3105
diff changeset
  1372
        clr2 notNil ifTrue:[
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1373
            gc paint:clr2.
3109
3037d2c0350d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3105
diff changeset
  1374
            (orientation == #vertical) ifTrue:[
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1375
                gc displayLineFromX:l+w-2 y:t+1 toX:l+w-2 y:t+h-3.
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1376
                gc displayLineFromX:l y:t+h-3 toX:l+w-2 y:t+h-3.
3109
3037d2c0350d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3105
diff changeset
  1377
            ] ifFalse:[
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1378
                gc displayLineFromX:l+2 y:t+h-2 toX:l+w-3 y:t+h-2.
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1379
                gc displayLineFromX:l+w-3 y:t toX:l+w-3 y:t+h-2. 
3109
3037d2c0350d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3105
diff changeset
  1380
            ].
3037d2c0350d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3105
diff changeset
  1381
        ].
3037d2c0350d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3105
diff changeset
  1382
4032
edc14bf0c5a5 changed:
Claus Gittinger <cg@exept.de>
parents: 4031
diff changeset
  1383
        vistaStyle ifTrue:[
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1384
            gc paint:clr slightlyDarkened.
4032
edc14bf0c5a5 changed:
Claus Gittinger <cg@exept.de>
parents: 4031
diff changeset
  1385
        ] ifFalse:[
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1386
            gc paint:thumbFrameColor.
4032
edc14bf0c5a5 changed:
Claus Gittinger <cg@exept.de>
parents: 4031
diff changeset
  1387
        ].
3093
201f489cde64 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3090
diff changeset
  1388
        xpStyle ifTrue:[
3103
3ff619dbf7d0 xp style drawing
Claus Gittinger <cg@exept.de>
parents: 3094
diff changeset
  1389
            (orientation == #vertical) ifTrue:[
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1390
                gc displayLineFromX:l+w-1 y:t+1 toX:l+w-1 y:t+h-3.
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1391
                gc displayLineFromX:l+1 y:t+h-2 toX:l+w-2 y:t+h-2.
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1392
                gc displayLineFromX:l+w-2 y:t+h-3 toX:l+w-2 y:t+h-3.
3103
3ff619dbf7d0 xp style drawing
Claus Gittinger <cg@exept.de>
parents: 3094
diff changeset
  1393
                "/ self displayLineFromX:l-2 y:t+h-3 toX:l-2 y:t+h-3.
3ff619dbf7d0 xp style drawing
Claus Gittinger <cg@exept.de>
parents: 3094
diff changeset
  1394
            ] ifFalse:[
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1395
                gc displayLineFromX:l+2 y:t+h-1 toX:l+w-3 y:t+h-1.
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1396
                gc displayLineFromX:l+w-2 y:t+1 toX:l+w-2 y:t+h-2. 
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1397
                gc displayLineFromX:l+w-3 y:t+h-2 toX:l+w-3 y:t+h-2.
3109
3037d2c0350d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3105
diff changeset
  1398
            ].
3093
201f489cde64 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3090
diff changeset
  1399
        ] ifFalse:[
5467
1c31382917e7 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5420
diff changeset
  1400
            h := h - 1.
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1401
            gc displayRectangleX:l y:t width:w height:h.
3093
201f489cde64 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3090
diff changeset
  1402
        ].
4032
edc14bf0c5a5 changed:
Claus Gittinger <cg@exept.de>
parents: 4031
diff changeset
  1403
        vistaStyle ifTrue:[
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1404
            gc paint:clr lightened.
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1405
            gc displayPointX:l y:t.
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1406
            gc displayPointX:l+w-1 y:t.
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1407
            gc displayPointX:l y:t+h-1.
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1408
            gc displayPointX:l+w-1 y:t+h-1.
4032
edc14bf0c5a5 changed:
Claus Gittinger <cg@exept.de>
parents: 4031
diff changeset
  1409
        ].
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
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1412
    thumbImage notNil ifTrue:[
2176
7069af4213d6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2175
diff changeset
  1413
        thumbImage displayOn:self x:l y:t
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1414
    ].
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1415
5467
1c31382917e7 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5420
diff changeset
  1416
    (false "tallyLevel == 0" or:[tallyMarks == 0]) ifTrue:[
2176
7069af4213d6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2175
diff changeset
  1417
        shadowForm notNil ifTrue:[
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1418
            "next style - draw tally bitmap"
2176
7069af4213d6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2175
diff changeset
  1419
            handleX := l + ((w - 8) // 2).
7069af4213d6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2175
diff changeset
  1420
            handleY := t + ((h - 8) // 2).
7069af4213d6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2175
diff changeset
  1421
            self drawHandleFormAtX:handleX y:handleY
7069af4213d6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2175
diff changeset
  1422
        ].
7069af4213d6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2175
diff changeset
  1423
        ^ self
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1424
    ].
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
    "iris style - draw tallys"
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1427
    self drawTallyMarks.
4339
dcee90ff3398 changed: #drawThumb
Claus Gittinger <cg@exept.de>
parents: 4202
diff changeset
  1428
dcee90ff3398 changed: #drawThumb
Claus Gittinger <cg@exept.de>
parents: 4202
diff changeset
  1429
    "Modified: / 29-11-2011 / 11:55:24 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1430
!
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
drawThumbBackgroundInX:x y:y width:w height:h
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1433
    "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
  1434
     method, to allow drawing of arbitrary patterns under thumb 
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1435
     (see ColorSlider)."
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1436
699
6b464bf0ced8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
  1437
    |oldClip gX gY gW gH|
6b464bf0ced8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
  1438
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1439
    shown ifTrue:[
6030
06928de3213b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5949
diff changeset
  1440
        oldClip := self clippingBoundsOrNil.
06928de3213b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5949
diff changeset
  1441
        self clippingBounds:(Rectangle left:x top:y width:w height:h).
6094
d465941bfe0b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6058
diff changeset
  1442
        "/ don't do this via gc - might have a viewBackground
d465941bfe0b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6058
diff changeset
  1443
        self clearDeviceRectangleX:x y:y width:w height:h.
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1444
4032
edc14bf0c5a5 changed:
Claus Gittinger <cg@exept.de>
parents: 4031
diff changeset
  1445
        styleSheet name == #winVista ifTrue:[
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1446
            gc paint:(Color greyByte:16rE3).
4032
edc14bf0c5a5 changed:
Claus Gittinger <cg@exept.de>
parents: 4031
diff changeset
  1447
            (orientation == #vertical) ifTrue:[
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1448
                gc displayLineFromX:0 y:0 toX:0 y:height-1.
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1449
                gc displayLineFromX:1 y:0 toX:1 y:height-1.
4032
edc14bf0c5a5 changed:
Claus Gittinger <cg@exept.de>
parents: 4031
diff changeset
  1450
            ] ifFalse:[
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1451
                gc displayLineFromX:0 y:0 toX:width-1 y:0.
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1452
                gc displayLineFromX:0 y:1 toX:width-1 y:1.
4032
edc14bf0c5a5 changed:
Claus Gittinger <cg@exept.de>
parents: 4031
diff changeset
  1453
            ].
edc14bf0c5a5 changed:
Claus Gittinger <cg@exept.de>
parents: 4031
diff changeset
  1454
        ].
edc14bf0c5a5 changed:
Claus Gittinger <cg@exept.de>
parents: 4031
diff changeset
  1455
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1456
        frameBeforeMove notNil ifTrue:[
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1457
            (ghostColor notNil 
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1458
            or:[ghostFrameColor notNil
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1459
            or:[ghostLevel ~~ 0]]) ifTrue:[
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1460
                (frameBeforeMove intersects:(x@y extent:w@h)) ifTrue:[
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1461
                    gX := frameBeforeMove left.
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1462
                    gY := frameBeforeMove top.
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1463
                    gW := frameBeforeMove width.
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1464
                    gH := frameBeforeMove height.
1896
2e9c0db359ed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1890
diff changeset
  1465
                
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1466
                    ghostColor notNil ifTrue:[
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1467
                        gc paint:ghostColor.
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1468
                        gc fillRectangle:frameBeforeMove.
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1469
                    ].
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1470
                    (ghostLevel ~~ 0) ifTrue:[
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1471
                        self drawEdgesForX:gX y:gY width:gW height:gH level:ghostLevel
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1472
                    ].
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1473
                    ghostFrameColor notNil ifTrue:[
6058
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1474
                        gc paint:ghostFrameColor.
e844c95ec8c2 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1475
                        gc displayRectangleX:gX y:gY width:gW height:gH
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1476
                    ].
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1477
                ]
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1478
            ]
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1479
        ].
6030
06928de3213b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5949
diff changeset
  1480
        self clippingBounds:oldClip
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1481
    ]
695
1c52a7c0166d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
  1482
6094
d465941bfe0b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6058
diff changeset
  1483
    "Modified (comment): / 12-02-2017 / 14:41:10 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1484
! !
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1485
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1486
!Scroller methodsFor:'event handling'!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1487
2297
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1488
buttonControlPress:button x:x y:y
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1489
    "mouse-click with control - jump to top/bottom"
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1490
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1491
    |curr limit1 limit2|
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1492
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1493
    thumbFrame isNil ifTrue:[
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1494
        self computeThumbFrame.
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1495
        thumbFrame isNil ifTrue:[
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1496
            ^ self.
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1497
        ]
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1498
    ].
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1499
    (orientation == #vertical) ifTrue:[
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1500
        curr := y.
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1501
        limit1 := thumbFrame top.
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1502
        limit2 := thumbFrame bottom
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1503
    ] ifFalse:[
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1504
        curr := x.
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1505
        limit1 := thumbFrame left.
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1506
        limit2 := thumbFrame right
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1507
    ].
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1508
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1509
    (curr < limit1) ifTrue:[
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1510
        "to top"
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1511
        self thumbOrigin:0.
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1512
        self tellOthers
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1513
    ] ifFalse:[
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1514
        (curr > limit2) ifTrue:[
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1515
            "to bottom"
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1516
            self thumbOrigin:100.
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1517
            self tellOthers
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1518
        ]
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1519
    ].
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1520
!
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1521
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1522
buttonMotion:state x:x y:y
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1523
    "mouse-button was moved while pressed;
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1524
     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
  1525
     the scroll action is performed"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1526
1800
e3e987087c46 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  1527
    <resource: #style (#name 
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1528
                       #'scroller.snapBack')>
1800
e3e987087c46 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  1529
2730
61a2f1981ac6 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2612
diff changeset
  1530
    |pos curr limit prevOrigin newOrigin snap|
2351
26bcce60314c defer scroll, if more motion events are pending.
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  1531
2594
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1532
    lastMousePosition := x@y.
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1533
2730
61a2f1981ac6 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2612
diff changeset
  1534
    (self sensor hasButtonMotionEventFor:self) ifTrue:[
61a2f1981ac6 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2612
diff changeset
  1535
        ^ self.
2351
26bcce60314c defer scroll, if more motion events are pending.
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  1536
    ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1537
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1538
    enabled ifFalse:[^ self].
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1539
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1540
    scrolling ifFalse: [
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1541
        thumbFrame notNil ifTrue:[
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1542
            self highlightThumbForPointerX:x y:y.
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1543
        ].
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1544
        ^ self              
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1545
    ].              
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1546
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1547
    entered := true.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1548
    frameBeforeMove isNil ifTrue:[
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1549
        self startMove.
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
    (orientation == #vertical) ifTrue:[
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1553
        curr := y.
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1554
        limit := height.
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1555
        snap := (x < SnapBackDistance negated) or:[x > (width + SnapBackDistance)].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1556
    ] ifFalse:[
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1557
        curr := x.
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1558
        limit := width.
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1559
        snap := (y < SnapBackDistance negated) or:[y > (height + SnapBackDistance)].
452
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
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1562
    (curr < 0) ifTrue:[                        "check against limits"
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1563
        pos := 0
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1564
    ] ifFalse:[
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1565
        (curr > limit) ifTrue:[
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1566
            pos := limit
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1567
        ] ifFalse:[
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1568
            pos := curr
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1569
        ]
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
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1572
    prevOrigin := self thumbOrigin.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1573
    newOrigin := self percentFromAbs:(pos - pressOffset).
1133
4395bae7e94e added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
  1574
4395bae7e94e added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
  1575
    snap ifTrue:[
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1576
        (styleSheet at:#'scroller.snapBack' default:false) ifTrue:[
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1577
            newOrigin := originBeforeMove.
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1578
        ]
1133
4395bae7e94e added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
  1579
    ].
4395bae7e94e added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
  1580
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1581
    prevOrigin ~= newOrigin ifTrue:[
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1582
        self thumbOrigin:newOrigin.
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1583
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1584
        synchronousOperation ifTrue: [
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1585
            self tellOthers.
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1586
        ]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1587
    ]
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1588
1485
5716db1ccb4e care for nil thumbFrame (race condition)
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
  1589
    "Modified: / 14.4.1998 / 18:37:34 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1590
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1591
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1592
buttonPress:button x:x y:y
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1593
    "button was pressed - if above thumb, page up; if below thumb, page down;
1301
1fbe38b283e4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1594
     otherwise start scrolling.
1fbe38b283e4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1595
     If either shift is pressed, or the 'scrollerMiddleButtonJump' styleSheet
1fbe38b283e4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1596
     value is true and its the middle button, do a jump to the clicked position."
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1597
1514
b819aca5ab4b care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1507
diff changeset
  1598
    |curr limit1 limit2 sensor|
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1599
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1600
    enabled ifFalse:[^ self].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1601
    shown ifFalse:[^ self].
1420
e9999993396f ignore other button press/release while scrolling
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
  1602
    scrolling ifTrue:[^ self].
e9999993396f ignore other button press/release while scrolling
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
  1603
1514
b819aca5ab4b care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1507
diff changeset
  1604
    sensor := self sensor.
2730
61a2f1981ac6 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2612
diff changeset
  1605
    (sensor shiftDown
3920
28936fdd049b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3754
diff changeset
  1606
     or:[DefaultMiddleButtonJump and:[button ~~ 1]]) ifTrue:[
2146
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1607
        ^ self buttonShiftPress:button x:x y:y
811
7271a0746af6 Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  1608
    ].
2730
61a2f1981ac6 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2612
diff changeset
  1609
    sensor ctrlDown ifTrue:[
2297
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1610
        ^ self buttonControlPress:button x:x y:y
b09f0d274532 ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents: 2215
diff changeset
  1611
    ].
2301
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1612
    (button ~~ #select and:[button ~~ 1]) ifTrue:[
2146
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1613
        ^ self
1441
fdb91f9d5360 Correct behavior for button 2.
Stefan Vogel <sv@exept.de>
parents: 1432
diff changeset
  1614
    ].
811
7271a0746af6 Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  1615
1295
dd5ba64ae8a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1283
diff changeset
  1616
    thumbFrame isNil ifTrue:[
2146
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1617
        self computeThumbFrame.
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1618
        thumbFrame isNil ifTrue:[^ self].
1295
dd5ba64ae8a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1283
diff changeset
  1619
    ].
dd5ba64ae8a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1283
diff changeset
  1620
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1621
    (orientation == #vertical) ifTrue:[
2146
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1622
        curr := y.
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1623
        limit1 := thumbFrame top.
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1624
        limit2 := thumbFrame bottom
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1625
    ] ifFalse:[
2146
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1626
        curr := x.
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1627
        limit1 := thumbFrame left.
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1628
        limit2 := thumbFrame right
452
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
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1631
    self highlightThumbForPointerX:x y:y.
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1632
    self changeCursorFor:(x@y).
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1633
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1634
    (curr < limit1) ifTrue:[
2146
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1635
        "page up/left"
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1636
        self pageUp.
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1637
        autoRepeat ifTrue:[
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1638
            repeatBlock notNil ifTrue:[
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1639
                Processor removeTimedBlock:repeatBlock.
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1640
            ].
2730
61a2f1981ac6 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2612
diff changeset
  1641
            repeatBlock := [self sensor pushUserEvent:#repeatPageUp for:self].
2514
cf29e8120cad care for initialRepeat time in autopager
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
  1642
            sensor pushUserEvent:#installRepeat: for:self withArgument:initialRepeatDelay.
2146
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1643
        ]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1644
    ] ifFalse:[
2146
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1645
        (curr > limit2) ifTrue:[
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1646
            "page down/right"
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1647
            self pageDown.
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1648
            autoRepeat ifTrue:[
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1649
                repeatBlock notNil ifTrue:[
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1650
                    Processor removeTimedBlock:repeatBlock.
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1651
                ].
2730
61a2f1981ac6 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2612
diff changeset
  1652
                repeatBlock := [self sensor pushUserEvent:#repeatPageDown for:self].
2514
cf29e8120cad care for initialRepeat time in autopager
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
  1653
                sensor pushUserEvent:#installRepeat: for:self withArgument:initialRepeatDelay.
2146
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1654
            ]
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1655
        ] ifFalse:[
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1656
            pressOffset := curr - limit1.
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1657
            scrolling := true.
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1658
            (thumbActiveColor notNil and:[thumbColor ~~ thumbActiveColor]) ifTrue:[
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1659
                self drawThumb
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1660
            ]
2146
db617dfb5161 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1661
        ]
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1662
    ].
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1663
4202
55f92509b8fb comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4052
diff changeset
  1664
    "Modified: / 02-02-1998 / 23:30:26 / stefan"
55f92509b8fb comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4052
diff changeset
  1665
    "Modified: / 15-12-2010 / 10:13:10 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1666
!
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
buttonRelease:button x:x y:y
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1669
    "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
  1670
     action is now performed"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1671
505
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1672
    |rect mustDrawThumb|
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1673
2594
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1674
    lastMousePosition := nil.
48b325aac887 stop scroller at thumb implemented
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1675
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1676
    repeatBlock notNil ifTrue:[
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  1677
        repeatBlock := nil.
2301
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1678
        Processor removeTimedBlock:repeatBlock.
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1679
        repeatBlock := nil
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1680
    ].
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1681
3920
28936fdd049b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3754
diff changeset
  1682
    (button == 1 or:[DefaultMiddleButtonJump])
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1683
    ifFalse:[
2301
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1684
        ^ super buttonRelease:button x:x y:y
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1685
    ].
1420
e9999993396f ignore other button press/release while scrolling
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
  1686
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1687
    scrolling ifTrue:[
2301
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1688
        scrolling := false.
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1689
        thumbFrame notNil ifTrue:[
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1690
            mustDrawThumb := false.
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1691
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1692
            frameBeforeMove notNil ifTrue:[
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1693
                rect := frameBeforeMove.
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1694
                frameBeforeMove := nil.
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1695
                self drawThumbBackgroundInX:rect left
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1696
                                          y:rect top
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1697
                                      width:rect width 
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1698
                                     height:rect height.
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1699
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1700
                (rect intersects:thumbFrame) ifTrue:[
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1701
                    mustDrawThumb := true.
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1702
                ]
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1703
            ].
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1704
            thumbLevel ~~ thumbActiveLevel ifTrue:[
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1705
                mustDrawThumb := true
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1706
            ].
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1707
            (thumbActiveColor notNil and:[thumbColor ~~ thumbActiveColor]) ifTrue:[
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1708
                mustDrawThumb := true
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1709
            ].
2301
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1710
            mustDrawThumb ifTrue:[
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1711
                self drawThumb
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1712
            ].    
505
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1713
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1714
"/            scrolling := false.
2301
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1715
            synchronousOperation ifFalse: [
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1716
                self tellOthers.
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1717
            ]
55553c2e2e0f Handle symbolic buttons.
Stefan Vogel <sv@exept.de>
parents: 2297
diff changeset
  1718
        ]
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1719
    ].
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1720
    self changeCursorFor:(x@y)
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1721
1420
e9999993396f ignore other button press/release while scrolling
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
  1722
    "Modified: / 19.1.1998 / 13:45:59 / cg"
1441
fdb91f9d5360 Correct behavior for button 2.
Stefan Vogel <sv@exept.de>
parents: 1432
diff changeset
  1723
    "Modified: / 2.2.1998 / 23:37:27 / stefan"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1724
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1725
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1726
buttonShiftPress:button x:x y:y
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1727
    "mouse-click with shift - jump to position"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1728
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1729
    |pos curr curr2 limit1 limit2|
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1730
2189
dfbbe49ef316 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2178
diff changeset
  1731
    thumbFrame isNil ifTrue:[
dfbbe49ef316 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2178
diff changeset
  1732
        self computeThumbFrame.
dfbbe49ef316 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2178
diff changeset
  1733
        thumbFrame isNil ifTrue:[
dfbbe49ef316 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2178
diff changeset
  1734
            ^ self.
dfbbe49ef316 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2178
diff changeset
  1735
        ]
dfbbe49ef316 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2178
diff changeset
  1736
    ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1737
    (orientation == #vertical) ifTrue:[
2189
dfbbe49ef316 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2178
diff changeset
  1738
        curr := y.
dfbbe49ef316 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2178
diff changeset
  1739
        curr2 := y - (thumbFrame height // 2).
dfbbe49ef316 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2178
diff changeset
  1740
        limit1 := height.
dfbbe49ef316 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2178
diff changeset
  1741
        limit2 := thumbFrame top
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1742
    ] ifFalse:[
2189
dfbbe49ef316 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2178
diff changeset
  1743
        curr := x.
dfbbe49ef316 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2178
diff changeset
  1744
        curr2 := x - (thumbFrame width // 2).
dfbbe49ef316 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2178
diff changeset
  1745
        limit1 := width.
dfbbe49ef316 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2178
diff changeset
  1746
        limit2 := thumbFrame left
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1747
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1748
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1749
    (curr2 < 0) ifTrue:[                        "check against limits"
2189
dfbbe49ef316 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2178
diff changeset
  1750
        pos := 0
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1751
    ] ifFalse:[
2189
dfbbe49ef316 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2178
diff changeset
  1752
        (curr2 > limit1) ifTrue:[
dfbbe49ef316 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2178
diff changeset
  1753
            pos := limit1
dfbbe49ef316 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2178
diff changeset
  1754
        ] ifFalse:[
dfbbe49ef316 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2178
diff changeset
  1755
            pos := curr2
dfbbe49ef316 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2178
diff changeset
  1756
        ]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1757
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1758
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1759
    self startMove.
1432
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  1760
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  1761
    self thumbOrigin:(self percentFromAbs:pos).
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  1762
    self tellOthers.
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  1763
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1764
    (orientation == #vertical) ifTrue:[
2189
dfbbe49ef316 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2178
diff changeset
  1765
        limit2 := thumbFrame top
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1766
    ] ifFalse:[
2189
dfbbe49ef316 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2178
diff changeset
  1767
        limit2 := thumbFrame left
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1768
    ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1769
    pressOffset := curr - limit2.
1441
fdb91f9d5360 Correct behavior for button 2.
Stefan Vogel <sv@exept.de>
parents: 1432
diff changeset
  1770
    scrolling := true.
1133
4395bae7e94e added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
  1771
1801
92c6052b2d53 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  1772
    self changeCursorFor:(x@y).
92c6052b2d53 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  1773
92c6052b2d53 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  1774
1441
fdb91f9d5360 Correct behavior for button 2.
Stefan Vogel <sv@exept.de>
parents: 1432
diff changeset
  1775
    "Modified: / 19.3.1997 / 11:29:08 / cg"
fdb91f9d5360 Correct behavior for button 2.
Stefan Vogel <sv@exept.de>
parents: 1432
diff changeset
  1776
    "Modified: / 2.2.1998 / 23:35:18 / stefan"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1777
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1778
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1779
changeCursorFor:p
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1780
    "update the mouse cursor"
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1781
1808
097b86f1473e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1801
diff changeset
  1782
    |frm sensor which|
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1783
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1784
    enabled ifFalse:[
2215
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1785
        self cursor:Cursor normal.
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1786
        ^ self
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1787
    ].
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1788
    NewCursors ifFalse:[^ self].
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1789
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1790
    frm := self thumbFrame.
2215
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1791
    frm isNil ifTrue:[^ self].
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1792
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1793
    thumbHeight = 100 ifTrue:[
2215
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1794
        which := #normal.
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1795
    ] ifFalse:[
2215
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1796
        sensor := self sensor.
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1797
2730
61a2f1981ac6 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2612
diff changeset
  1798
        (((frm containsPoint:p) and:[sensor leftButtonPressed])
61a2f1981ac6 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2612
diff changeset
  1799
         "or:[sensor shiftDown]") ifTrue:[ 
2215
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1800
            orientation == #horizontal ifTrue:[
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1801
                which := #xMarker
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1802
            ] ifFalse:[
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1803
                which := #marker
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1804
            ].
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1805
        ] ifFalse:[
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1806
            orientation == #horizontal ifTrue:[
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1807
                p x > frm right ifTrue:[
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1808
                    which := #right
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1809
                ] ifFalse:[
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1810
                    p x < frm left ifTrue:[
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1811
                        which := #left
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1812
                    ] ifFalse:[
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1813
                        which := #hand
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1814
                    ]
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1815
                ]
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1816
            ] ifFalse:[
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1817
                p y > frm bottom ifTrue:[
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1818
                    which := #down
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1819
                ] ifFalse:[
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1820
                    p y < frm top ifTrue:[
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1821
                        which := #up
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1822
                    ] ifFalse:[
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1823
                        which := #hand
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1824
                    ]
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1825
                ]
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1826
            ]
7757d56a38ab care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents: 2189
diff changeset
  1827
        ]
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1828
    ].
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1829
    self cursor:(Cursor perform:which).
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1830
1514
b819aca5ab4b care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1507
diff changeset
  1831
    "Created: / 23.10.1997 / 03:55:24 / cg"
b819aca5ab4b care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1507
diff changeset
  1832
    "Modified: / 7.5.1998 / 02:06:10 / cg"
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1833
!
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1834
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1835
highlightThumbForPointerX:x y:y
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1836
    "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
  1837
2010
ca8dcc8723dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
  1838
    |frm in|
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1839
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1840
    in := (frm := self thumbFrame) containsPoint:(x@y).
505
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1841
    (in ~~ entered 
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1842
    or:[thumbLevel ~~ thumbActiveLevel]) ifTrue:[
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1843
        entered := in.
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1844
        (thumbColor ~~ thumbEnteredColor 
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1845
        or:[thumbLevel ~~ thumbActiveLevel]) ifTrue: [
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1846
            self drawThumb
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1847
        ].
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1848
    ].
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1849
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1850
    self changeCursorFor:(x@y)
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1851
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1852
    "Created: 6.3.1996 / 17:35:07 / cg"
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1853
    "Modified: 23.10.1997 / 03:56:31 / cg"
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1854
!
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1855
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1856
keyPress:key x:x y:y
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1857
    "/ stupid - due to delegation, this is never invoked ...
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1858
    enabled ifFalse:[^ self].
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1859
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1860
    self changeCursorFor:(x@y).
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1861
    super keyPress:key x:x y:y
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1862
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1863
    "Created: 23.10.1997 / 03:57:34 / cg"
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1864
!
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1865
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1866
keyRelease:key x:x y:y
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1867
    "/ stupid - due to delegation, this is never invoked ...
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1868
    self changeCursorFor:(x@y).
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1869
    super keyRelease:key x:x y:y
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1870
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1871
    "Created: 23.10.1997 / 03:58:25 / cg"
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1872
!
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1873
1706
eb2f9e689f5e when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  1874
pointerEnter:state x:x y:y
eb2f9e689f5e when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  1875
    "mouse-button left view
eb2f9e689f5e when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  1876
     redraw thumb if enteredColor ~~ thumbColor"
eb2f9e689f5e when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  1877
eb2f9e689f5e when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  1878
    scrolling ifTrue:[
5622
cb4139a2302c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5468
diff changeset
  1879
        (state bitAnd:(device anyButtonMotionMask)) == 0 ifTrue: [
4908
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  1880
            self buttonRelease:1 x:x y:y
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  1881
        ].
1706
eb2f9e689f5e when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  1882
    ].
eb2f9e689f5e when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  1883
    super pointerEnter:state x:x y:y
eb2f9e689f5e when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  1884
eb2f9e689f5e when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  1885
    "Modified: / 14.10.1998 / 15:40:51 / cg"
eb2f9e689f5e when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  1886
!
eb2f9e689f5e when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  1887
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1888
pointerLeave:state
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1889
    "mouse-button left view
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1890
     redraw thumb if enteredColor ~~ thumbColor"
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1891
5622
cb4139a2302c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5468
diff changeset
  1892
    (entered and:[(state bitAnd:(device anyButtonMotionMask)) == 0]) ifTrue: [
4908
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  1893
        entered := false.
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  1894
        thumbEnteredColor ~= thumbColor ifTrue:[
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  1895
            self invalidate.
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  1896
            "/ self drawThumb
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  1897
        ]
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1898
    ].
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1899
1673
ff43258f2224 only redraw in pointerLeave, if thumbColor will change
Claus Gittinger <cg@exept.de>
parents: 1662
diff changeset
  1900
    "Created: / 6.3.1996 / 17:31:16 / cg"
ff43258f2224 only redraw in pointerLeave, if thumbColor will change
Claus Gittinger <cg@exept.de>
parents: 1662
diff changeset
  1901
    "Modified: / 11.9.1998 / 00:13:53 / cg"
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1902
!
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1903
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1904
redraw
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1905
    "redraw"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1906
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1907
    self redrawX:0 y:0 width:width height:height.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1908
    self redrawEdges
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1909
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1910
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1911
redrawX:x y:y width:w height:h
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1912
    shown ifFalse:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1913
        ^ self.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1914
    ].
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1915
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1916
    thumbFrame isNil ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1917
        self computeThumbFrame
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1918
    ].
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1919
    self drawThumbBackgroundInX:x y:y width:w height:h.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1920
    thumbFrame isNil ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1921
        "/ thumb hidden
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1922
        ^ self 
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1923
    ].
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1924
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1925
    orientation == #vertical ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1926
        (y > thumbFrame bottom) ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1927
            ^ self
2175
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
  1928
        ].
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1929
        ((y + h) < thumbFrame top) ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1930
            ^ self
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1931
        ].
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1932
    ] ifFalse:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1933
        (x > thumbFrame right) ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1934
            ^ self
2175
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
  1935
        ].
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1936
        ((x + w) < thumbFrame left) ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1937
            ^ self
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1938
        ].
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1939
    ].
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1940
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1941
    self drawThumb
767
c96a1130b833 oops - tiny bug in redraw-optimization
Claus Gittinger <cg@exept.de>
parents: 764
diff changeset
  1942
1366
652634d99bfe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1943
    "Modified: / 29.10.1997 / 15:48:48 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1944
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1945
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1946
sizeChanged:how
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1947
    "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
  1948
1908
3862a49ad525 slight redraw-tuning
Claus Gittinger <cg@exept.de>
parents: 1897
diff changeset
  1949
    |oldThumbFrame oldTop oldBot newTop newBot oldLeft oldRight newLeft newRight|
1718
a472f4a57562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  1950
3677
b545f945772c sizeChanged: dont forget to tell others
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  1951
    super sizeChanged:how.
b545f945772c sizeChanged: dont forget to tell others
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  1952
1718
a472f4a57562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  1953
    oldThumbFrame := thumbFrame.
1444
eff7016070f8 no need for invalidate on sizeChange (will get expose event anyway)
Claus Gittinger <cg@exept.de>
parents: 1441
diff changeset
  1954
    thumbFrame := nil.
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1955
    shown ifFalse:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1956
        thumbFrame := nil.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1957
        self invalidate.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1958
        ^ self.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1959
    ].
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1960
    self computeThumbFrame.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1961
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1962
    "/ any change ?
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1963
    thumbFrame = oldThumbFrame ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1964
        ^ self
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1965
    ].
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1966
    thumbFrame isNil ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1967
        self invalidate.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1968
        ^ self
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1969
    ].
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1970
    oldThumbFrame isNil ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1971
        self invalidate:thumbFrame.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1972
        ^ self.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1973
    ].
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1974
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1975
    "/ try to redraw as little as possible
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1976
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1977
    oldTop := oldThumbFrame top.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1978
    oldBot := oldThumbFrame bottom.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1979
    newTop := thumbFrame top.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1980
    newBot := thumbFrame bottom.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1981
    oldLeft := oldThumbFrame left.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1982
    oldRight := oldThumbFrame right.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1983
    newLeft := thumbFrame left.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1984
    newRight := thumbFrame right.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1985
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1986
    (orientation == #vertical
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1987
    and:[oldLeft == newLeft
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1988
    and:[oldRight == newRight]]) ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1989
        (oldTop == newTop) ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1990
            oldBot < newBot ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1991
                "/ thumb became larger, but origin remains
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1992
                "/ (view became smaller)
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1993
                self invalidate:(Rectangle 
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1994
                                    left:newLeft top:oldBot-thumbLevel
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1995
                                    right:newRight bottom:newBot).
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1996
                ^ self.
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1997
            ].
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1998
            oldBot > newBot ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  1999
                "/ thumb became smaller, but origin remains
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2000
                "/ (view became larger)
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2001
                self invalidate:(Rectangle 
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2002
                                    left:newLeft top:newBot-thumbLevel
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2003
                                    right:newRight bottom:oldBot).
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2004
                ^ self.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2005
            ].
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2006
        ].
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2007
        (oldBot == newBot) ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2008
            newTop < oldTop ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2009
                "/ thumb became larger, but corner remains
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2010
                "/ (view became smaller)
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2011
                self invalidate:(Rectangle 
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2012
                                    left:newLeft top:newTop
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2013
                                    right:newRight bottom:oldTop+thumbLevel).
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2014
                ^ self.
2175
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
  2015
            ].
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2016
            newTop > oldTop ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2017
                "/ thumb became smaller, but corner remains
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2018
                "/ (view became larger)
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2019
                self invalidate:(Rectangle 
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2020
                                    left:newLeft top:oldTop
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2021
                                    right:newRight bottom:newTop+thumbLevel).
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2022
                ^ self.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2023
            ]
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2024
        ].
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2025
    ].
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2026
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2027
    (orientation == #horizontal
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2028
    and:[oldTop == newTop
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2029
    and:[oldBot == newBot]]) ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2030
        (oldLeft == newLeft) ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2031
            oldRight < newRight ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2032
                "/ thumb became larger, but origin remains
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2033
                "/ (view became smaller)
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2034
                self invalidate:(Rectangle 
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2035
                                    left:oldRight-thumbLevel top:newTop
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2036
                                    right:newRight bottom:newBot).
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2037
                ^ self.
2175
5042e15f3cf6 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
  2038
            ].
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2039
            oldRight > newRight ifTrue:[
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2040
                "/ thumb became smaller, but origin remains
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2041
                "/ (view became larger)
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2042
                self invalidate:(Rectangle 
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2043
                                    left:newRight-thumbLevel top:newTop
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2044
                                    right:oldRight bottom:newBot).
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2045
                ^ self.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2046
            ].
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2047
        ].
1507
c712eb1a247e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
  2048
    ].
1127
e55aa76e226d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
  2049
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2050
    self invalidate:(oldThumbFrame merge: thumbFrame).
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2051
1913
37653d123b68 redraw optimizations when resized.
Claus Gittinger <cg@exept.de>
parents: 1908
diff changeset
  2052
    "Modified: / 23.5.1999 / 13:50:41 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2053
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2054
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2055
update:something with:aParameter from:changedObject
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2056
    "handle update from a model (if any)"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2057
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2058
    (changedObject == model 
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2059
    "and:[something == aspectMsg]") ifTrue:[
3019
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2060
        self thumbOrigin:(model value).
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2061
        "/ self tellOthers.
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2062
        ^ self
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2063
    ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2064
    super update:something with:aParameter from:changedObject
1830
f732d15043a4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1821
diff changeset
  2065
f732d15043a4 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1821
diff changeset
  2066
    "Modified: / 30.3.1999 / 14:26:28 / stefan"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2067
! !
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2068
1821
b57cc9dc2c08 changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  2069
!Scroller methodsFor:'focus handling'!
b57cc9dc2c08 changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  2070
b57cc9dc2c08 changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  2071
wantsFocusWithButtonPress
b57cc9dc2c08 changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  2072
    "no, do not catch the keyboard focus on button click"
b57cc9dc2c08 changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  2073
b57cc9dc2c08 changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  2074
    ^ false
b57cc9dc2c08 changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  2075
b57cc9dc2c08 changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  2076
b57cc9dc2c08 changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  2077
! !
b57cc9dc2c08 changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  2078
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2079
!Scroller methodsFor:'forced scroll'!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2080
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2081
pageDown
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2082
    "page down/right"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2083
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2084
    self thumbOrigin:(thumbOrigin + thumbHeight).
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2085
    self tellOthers
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2086
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2087
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2088
pageUp
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2089
    "page up/left"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2090
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2091
    self thumbOrigin:(thumbOrigin - thumbHeight).
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2092
    self tellOthers
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  2093
!
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  2094
2383
5783b2c07e85 Make mouse wheel work.
Stefan Vogel <sv@exept.de>
parents: 2358
diff changeset
  2095
scrollDown:amountToScroll
6337
2b13966b73f3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6311
diff changeset
  2096
    "compatibility with SimpleView. 
2b13966b73f3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6311
diff changeset
  2097
     This allows mouse wheel actions on Scrollers & Wheels
2383
5783b2c07e85 Make mouse wheel work.
Stefan Vogel <sv@exept.de>
parents: 2358
diff changeset
  2098
     Note: this is used for horizontal scrollers, too (scrollRight)"
5783b2c07e85 Make mouse wheel work.
Stefan Vogel <sv@exept.de>
parents: 2358
diff changeset
  2099
5783b2c07e85 Make mouse wheel work.
Stefan Vogel <sv@exept.de>
parents: 2358
diff changeset
  2100
    self scrollStep:amountToScroll
6337
2b13966b73f3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6311
diff changeset
  2101
2b13966b73f3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6311
diff changeset
  2102
    "Modified (comment): / 13-06-2018 / 21:59:10 / Claus Gittinger"
2383
5783b2c07e85 Make mouse wheel work.
Stefan Vogel <sv@exept.de>
parents: 2358
diff changeset
  2103
!
5783b2c07e85 Make mouse wheel work.
Stefan Vogel <sv@exept.de>
parents: 2358
diff changeset
  2104
1493
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  2105
scrollStep:delta
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  2106
    "step by some delta"
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  2107
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  2108
    |oldOrg newOrg|
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  2109
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  2110
    oldOrg := self thumbOrigin.
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  2111
    newOrg := ((oldOrg + delta) max:rangeStart) min:rangeEnd.
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  2112
    oldOrg ~= newOrg ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2113
	self thumbOrigin:newOrg.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2114
	self tellOthers.
1493
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  2115
    ]
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  2116
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  2117
    "Created: / 21.4.1998 / 20:51:57 / cg"
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  2118
    "Modified: / 21.4.1998 / 20:52:22 / cg"
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  2119
!
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  2120
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  2121
scrollToBeginning
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  2122
    "scroll to the beginning"
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  2123
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  2124
    self thumbOrigin:rangeStart.
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  2125
    self tellOthers
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  2126
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  2127
    "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
  2128
!
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  2129
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  2130
scrollToEnd
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  2131
    "scroll to the end"
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  2132
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  2133
    self thumbOrigin:rangeEnd.
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  2134
    self tellOthers
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  2135
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  2136
    "Created: 6.3.1996 / 17:55:25 / cg"
2383
5783b2c07e85 Make mouse wheel work.
Stefan Vogel <sv@exept.de>
parents: 2358
diff changeset
  2137
!
5783b2c07e85 Make mouse wheel work.
Stefan Vogel <sv@exept.de>
parents: 2358
diff changeset
  2138
5783b2c07e85 Make mouse wheel work.
Stefan Vogel <sv@exept.de>
parents: 2358
diff changeset
  2139
scrollUp:amountToScroll
6337
2b13966b73f3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6311
diff changeset
  2140
    "compatibility with SimpleView. 
2b13966b73f3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6311
diff changeset
  2141
     This allows mouse wheel actions on Scrollers & Wheels
2383
5783b2c07e85 Make mouse wheel work.
Stefan Vogel <sv@exept.de>
parents: 2358
diff changeset
  2142
     Note: this is used for horizontal scrollers, too (scrollLeft)"
5783b2c07e85 Make mouse wheel work.
Stefan Vogel <sv@exept.de>
parents: 2358
diff changeset
  2143
5783b2c07e85 Make mouse wheel work.
Stefan Vogel <sv@exept.de>
parents: 2358
diff changeset
  2144
    self scrollStep:amountToScroll negated
6337
2b13966b73f3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6311
diff changeset
  2145
2b13966b73f3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6311
diff changeset
  2146
    "Modified (comment): / 13-06-2018 / 21:58:47 / Claus Gittinger"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2147
! !
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2148
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2149
!Scroller methodsFor:'forwarding changed origin'!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2150
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2151
tellOthers
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2152
    |org|
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2153
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2154
    org := self thumbOrigin.
1011
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  2155
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  2156
    "
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  2157
     the ST-80 way of notifying scrolls
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  2158
    "
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  2159
    self sendChangeMessageWith:org.
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  2160
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2161
    "
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2162
     the ST/X way of notifying scrolls
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2163
    "
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2164
    scrollAction notNil ifTrue:[
5775
8b9394e8dd35 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5622
diff changeset
  2165
        scrollAction value:org 
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2166
    ].
1011
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  2167
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  2168
    "/
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  2169
    "/ this will vanish - the scroller should share
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  2170
    "/ a valueHolder with the scrolledView.
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  2171
    "/
5775
8b9394e8dd35 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5622
diff changeset
  2172
    dependents notNil ifTrue:[ self changed:#scrollerPosition ].
1011
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  2173
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
  2174
    "Modified: / 21.1.1998 / 19:12:55 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2175
! !
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2176
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2177
!Scroller methodsFor:'initialization'!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2178
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2179
defaultExtent
571
ddc5d56bd636 commentary
Claus Gittinger <cg@exept.de>
parents: 556
diff changeset
  2180
    "compute my extent from sub-components"
ddc5d56bd636 commentary
Claus Gittinger <cg@exept.de>
parents: 556
diff changeset
  2181
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2182
    ^ self preferredExtent
571
ddc5d56bd636 commentary
Claus Gittinger <cg@exept.de>
parents: 556
diff changeset
  2183
ddc5d56bd636 commentary
Claus Gittinger <cg@exept.de>
parents: 556
diff changeset
  2184
    "Modified: 22.4.1996 / 23:37:53 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2185
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2186
930
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  2187
fetchDeviceResources
931
a22726fd8e32 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 930
diff changeset
  2188
    "fetch device colors, to avoid reallocation at redraw time"
930
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  2189
4908
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2190
    |graphicsDevice|
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2191
931
a22726fd8e32 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 930
diff changeset
  2192
    super fetchDeviceResources.
5622
cb4139a2302c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5468
diff changeset
  2193
    graphicsDevice := device.
4908
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2194
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2195
    thumbShadowColor notNil ifTrue:[thumbShadowColor := thumbShadowColor onDevice:graphicsDevice].
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2196
    thumbLightColor notNil ifTrue:[thumbLightColor := thumbLightColor onDevice:graphicsDevice].
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2197
    thumbHalfShadowColor notNil ifTrue:[thumbHalfShadowColor := thumbHalfShadowColor onDevice:graphicsDevice].
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2198
    thumbHalfLightColor notNil ifTrue:[thumbHalfLightColor := thumbHalfLightColor onDevice:graphicsDevice].
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2199
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2200
    thumbEnteredColor notNil ifTrue:[thumbEnteredColor := thumbEnteredColor onDevice:graphicsDevice].
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2201
    ghostColor notNil ifTrue:[ghostColor := ghostColor onDevice:graphicsDevice].
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2202
    ghostFrameColor notNil ifTrue:[ghostFrameColor := ghostFrameColor onDevice:graphicsDevice].
930
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  2203
931
a22726fd8e32 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 930
diff changeset
  2204
    "Modified: 13.1.1997 / 21:56:38 / cg"
930
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  2205
!
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  2206
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2207
initCursor
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2208
    "set the cursor - a hand"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2209
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2210
    cursor := Cursor hand
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2211
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2212
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2213
initStyle
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2214
    "initialize style dep. stuff"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2215
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  2216
    <resource: #style (#name 
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2217
                       #'scroller.autoRepeat'
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2218
                       #'scroller.initialRepeatDelay'
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2219
                       #'scroller.repeatDelay')>
764
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  2220
4908
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2221
    |nm graphicsDevice|
764
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  2222
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2223
    super initStyle.
5622
cb4139a2302c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5468
diff changeset
  2224
    graphicsDevice := device.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2225
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2226
    DefaultViewBackground notNil ifTrue:[
4908
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2227
        viewBackground := DefaultViewBackground onDevice:graphicsDevice.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2228
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2229
    DefaultShadowColor notNil ifTrue:[
4908
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2230
        shadowColor := DefaultShadowColor onDevice:graphicsDevice.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2231
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2232
    DefaultLightColor notNil ifTrue:[
4908
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2233
        lightColor := DefaultLightColor onDevice:graphicsDevice.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2234
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2235
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2236
    tallyMarks := DefaultTallyMarks.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2237
    tallyLevel := DefaultTallyLevel.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2238
    DefaultLevel ~~ level ifTrue:[
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2239
        self level:DefaultLevel.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2240
    ].
4017
3b1cb7d7db47 no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
  2241
    DefaultBorderWidth ~~ self borderWidth ifTrue:[
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2242
        self borderWidth:DefaultBorderWidth.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2243
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2244
    thumbLevel := DefaultThumbLevel.
505
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  2245
    thumbActiveLevel := DefaultThumbActiveLevel.
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  2246
    thumbActiveColor := DefaultThumbActiveColor.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2247
    inset := DefaultInset.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2248
    fixThumbHeight := DefaultFixThumbHeight.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2249
    thumbEdgeStyle := DefaultEdgeStyle.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2250
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2251
    DefaultGhostColor notNil ifTrue:[
4908
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2252
        ghostColor := DefaultGhostColor onDevice:graphicsDevice.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2253
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2254
    DefaultGhostFrameColor notNil ifTrue:[
4908
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2255
        ghostFrameColor := DefaultGhostFrameColor onDevice:graphicsDevice.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2256
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2257
    ghostLevel := DefaultGhostLevel.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2258
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2259
    DefaultThumbFrameColor notNil ifTrue:[
4908
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2260
        thumbFrameColor := DefaultThumbFrameColor onDevice:graphicsDevice.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2261
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2262
    DefaultThumbShadowColor notNil ifTrue:[
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2263
        thumbShadowColor := DefaultThumbShadowColor
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2264
    ] ifFalse:[
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2265
        thumbShadowColor := shadowColor.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2266
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2267
    DefaultThumbLightColor notNil ifTrue:[
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2268
        thumbLightColor := DefaultThumbLightColor
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2269
    ] ifFalse:[
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2270
        thumbLightColor := lightColor.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2271
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2272
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2273
    thumbEdgeStyle notNil ifTrue:[
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2274
        DefaultThumbHalfShadowColor notNil ifTrue:[
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2275
            thumbHalfShadowColor := DefaultThumbHalfShadowColor
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2276
        ].
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2277
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2278
        DefaultThumbHalfLightColor notNil ifTrue:[
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2279
            thumbHalfLightColor := DefaultThumbHalfLightColor
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2280
        ].
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  2281
    ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2282
764
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  2283
    nm := styleSheet name.
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  2284
4908
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2285
    graphicsDevice hasGrayscales ifFalse:[
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2286
        thumbEdgeStyle notNil ifTrue:[
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2287
            thumbHalfShadowColor := Color darkGray.
4911
fb84639b995e class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4908
diff changeset
  2288
            thumbHalfLightColor := self whiteColor
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2289
        ].
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2290
4917
75b139264ad4 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4911
diff changeset
  2291
        thumbShadowColor := self blackColor.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2292
"/        thumbLightColor := White.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2293
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2294
        nm = #motif ifTrue:[
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2295
            DefaultThumbColor isNil ifTrue:[
4911
fb84639b995e class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4908
diff changeset
  2296
                thumbColor := self whiteColor.
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2297
            ].
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2298
        ]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2299
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2300
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2301
    DefaultThumbColor notNil ifTrue:[
4908
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2302
        thumbColor := DefaultThumbColor onDevice:graphicsDevice
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2303
    ] ifFalse:[
5218
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  2304
        nm ~= #napkin ifTrue:[
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  2305
            thumbColor := self whiteColor.
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  2306
            nm ~= #normal ifTrue:[
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  2307
                graphicsDevice hasGrayscales ifFalse:[
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  2308
                    thumbColor := Color gray
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  2309
                ].
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2310
            ].
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2311
        ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2312
    ].
5218
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  2313
    thumbColor notNil ifTrue:[  
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  2314
        thumbColor := thumbColor onDevice:graphicsDevice.
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  2315
    ].
06e5b79c3f3f class: Scroller
Claus Gittinger <cg@exept.de>
parents: 5101
diff changeset
  2316
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2317
    thumbShadowColor notNil ifTrue:[
4908
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2318
        thumbShadowColor := thumbShadowColor onDevice:graphicsDevice.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2319
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2320
    thumbLightColor notNil ifTrue:[
4908
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2321
        thumbLightColor := thumbLightColor onDevice:graphicsDevice.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2322
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2323
    thumbHalfShadowColor notNil ifTrue:[
4908
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2324
        thumbHalfShadowColor := thumbHalfShadowColor onDevice:graphicsDevice.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2325
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2326
    thumbHalfLightColor notNil ifTrue:[
4908
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2327
        thumbHalfLightColor := thumbHalfLightColor onDevice:graphicsDevice.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2328
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2329
    thumbEdgeStyle notNil ifTrue:[
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2330
        thumbHalfShadowColor isNil ifTrue:[
4908
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2331
            thumbHalfShadowColor := thumbShadowColor lightened onDevice:graphicsDevice
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2332
        ]
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  2333
    ].
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  2334
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  2335
    DefaultThumbEnteredColor notNil ifTrue:[
4908
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2336
        thumbEnteredColor := DefaultThumbEnteredColor onDevice:graphicsDevice.
1366
652634d99bfe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2337
    ] ifFalse:[
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2338
        thumbEnteredColor := thumbColor.
1366
652634d99bfe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2339
    ].
652634d99bfe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2340
652634d99bfe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2341
    (DefaultThumbEnteredColor notNil or:[NewCursors]) ifTrue:[
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2342
        self enableMotionEvents.
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2343
        self enableEnterLeaveEvents.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2344
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2345
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2346
    DefaultThumbImage notNil ifTrue:[
4908
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2347
        thumbImage := DefaultThumbImage onDevice:graphicsDevice.
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2348
        fixThumbHeight := true.
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2349
    ].
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2350
1531
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
  2351
    HandleImage notNil ifTrue:[
4908
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2352
        shadowForm := HandleImage onDevice:graphicsDevice.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2353
    ] ifFalse:[
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2354
        nm = #next ifTrue:[
4908
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2355
            shadowForm := self class handleShadowFormOn:graphicsDevice.
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2356
            lightForm := self class handleLightFormOn:graphicsDevice
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2357
        ] ifFalse:[
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2358
            shadowForm := lightForm := nil
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2359
        ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2360
    ].
4908
bc2630136762 class: Scroller
Stefan Vogel <sv@exept.de>
parents: 4874
diff changeset
  2361
    self drawableId notNil ifTrue:[
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2362
        self computeThumbFrame
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  2363
    ].
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  2364
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  2365
    autoRepeat := styleSheet at:#'scroller.autoRepeat' default:true.
2514
cf29e8120cad care for initialRepeat time in autopager
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
  2366
    initialRepeatDelay := styleSheet at:#'scroller.initialRepeatDelay' default:0.3.
2321
e1fa2ff7d945 dont scroll too much
Claus Gittinger <cg@exept.de>
parents: 2313
diff changeset
  2367
    repeatDelay := styleSheet at:#'scroller.repeatDelay' default:0.15.
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  2368
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2369
    "Modified: / 5.9.1998 / 20:21:41 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2370
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2371
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2372
initialize
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2373
    "initialize - setup instvars from defaults"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2374
1768
32eb81e67be1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2375
    orientation isNil ifTrue:[orientation := #vertical].
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2376
1768
32eb81e67be1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2377
    super initialize.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2378
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2379
    scrolling := entered              := false.
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2380
    enabled   := synchronousOperation := true.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2381
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2382
    thumbOrigin := 0.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2383
    thumbHeight := 100.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2384
    thumbFrameSizeDifference := 0.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2385
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2386
    rangeStart := 0.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2387
    rangeEnd := 100.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2388
    rangeStep := nil.   "/ meaning: arbitrary precision
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2389
"/    inset := 1.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2390
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2391
"/    self computeThumbFrame
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  2392
1768
32eb81e67be1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2393
    "Modified: / 7.3.1999 / 00:07:32 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2394
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2395
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2396
realize
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2397
    super realize.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2398
    model notNil ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2399
	self thumbOrigin:(model value).
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2400
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2401
! !
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2402
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2403
!Scroller methodsFor:'private'!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2404
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2405
absFromPercent:percent
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2406
    "given a percentage, compute number of pixels"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2407
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2408
    |fullSize|
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2409
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2410
    (orientation == #vertical) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2411
	fullSize := height 
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  2412
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2413
	fullSize := width
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2414
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2415
1115
6b7ba45f83a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
  2416
    "/ avoid hitting the boundary if no frame and no level (i.e. st80 style)
6b7ba45f83a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
  2417
    (thumbLevel == 0 and:[thumbFrameColor isNil]) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2418
	fullSize := fullSize - 1
1115
6b7ba45f83a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
  2419
    ].
6b7ba45f83a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
  2420
6b7ba45f83a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
  2421
    ^ ((percent * (fullSize - thumbFrameSizeDifference - (margin * 2))) / 100) rounded
6b7ba45f83a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
  2422
6b7ba45f83a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
  2423
    "Modified: 7.3.1997 / 16:05:57 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2424
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2425
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2426
computeThumbFrame
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2427
    "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
  2428
     changed height or the scrollers size has changed.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2429
     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
  2430
     invisible or uncatchable).
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2431
     Also, for mswindows style, its height/width is constant."
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2432
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2433
    |newPos1 newPos2 newSize1 newSize2 nh nw ny nx 
2177
f554919e10ab invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  2434
     computedSize minSz sz1 sz2 nb nr|
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2435
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  2436
    thumbHeight >= 100 ifTrue:[
2342
9ceffaf3718e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  2437
        self thumbOrigin ~= 0.0 ifTrue:[
9ceffaf3718e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  2438
            self thumbOrigin:0
9ceffaf3718e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  2439
        ].
9ceffaf3718e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  2440
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  2441
        thumbFrame := nil.
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  2442
        ^ self
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  2443
    ].
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  2444
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2445
    "compute position & size"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2446
    newPos1 := (self absFromPercent:thumbOrigin) + margin.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2447
    newSize1 := computedSize := self absFromPercent:thumbHeight.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2448
    (orientation == #vertical) ifTrue:[
2171
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2449
        sz1 := height.
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2450
        sz2 := width
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2451
    ] ifFalse:[
2171
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2452
        sz1 := width.
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2453
        sz2 := height
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2454
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2455
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2456
    "
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2457
     do we have to adjust the computed size ?
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2458
    "
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2459
    newPos2 := margin + inset.     
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2460
    newSize2 := sz2 - (2 * newPos2).
1662
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2461
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2462
"/    (style ~~ #normal) ifTrue:[
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2463
    thumbLevel ~~ 0 ifTrue:[
2171
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2464
        "
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2465
         do not make thumb too small (for handle & to be catchable)
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2466
        "
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  2467
        minSz := MinThumbSize "10" + (2 * thumbLevel)
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2468
    ] ifFalse:[
2171
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2469
        "
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2470
         do not make thumb too small (uncatchable)
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2471
        "
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  2472
        minSz := MinThumbSize "4"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2473
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2474
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2475
    (newSize1 < minSz) ifTrue:[
2171
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2476
        newSize1 := minSz.
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2477
        thumbFrameSizeDifference := newSize1 - computedSize
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2478
    ] ifFalse:[
2171
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2479
        thumbFrameSizeDifference := 0.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2480
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2481
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2482
    fixThumbHeight ifTrue:[
2171
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2483
        "have a fix-size thumb (i.e. mswindows style)"
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2484
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2485
        newSize1 := sz2 - (2 * inset).   "make it square"
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2486
        thumbImage notNil ifTrue:[
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2487
            newSize1 := (newSize1 max:(thumbImage height)) max:(thumbImage width)
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2488
        ].
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2489
        thumbFrameSizeDifference := newSize1 - computedSize.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2490
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2491
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2492
    "
2171
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2493
     oops - if height does not reflect real visibible area, we have to adjust the origin
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2494
    "
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2495
    (thumbFrameSizeDifference == 0) ifFalse:[
2171
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2496
        newPos1 := (self absFromPercent:thumbOrigin) + margin.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2497
"/        newPos1 := ((thumbOrigin * (sz1 - thumbFrameSizeDifference - (margin * 2))) / 100) rounded + margin
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  2498
    ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2499
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2500
    (orientation == #vertical) ifTrue:[
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  2501
        ny := newPos1 max:margin.
2171
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2502
        nx := newPos2.
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2503
        nh := newSize1.
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2504
        nw := newSize2 max:2.
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  2505
        ny + nh >= (height - margin) ifTrue:[
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  2506
            ny := (height - 1 - margin - nh) max:margin.
2171
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2507
        ].
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2508
        (nx+nw) >= width ifTrue:[
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2509
            nx := ((width - nw) // 2) max:0.
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2510
        ].
2177
f554919e10ab invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  2511
f554919e10ab invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  2512
        nb := ny + nh - 1.
f554919e10ab invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  2513
        nb >= (height - margin) ifTrue:[
f554919e10ab invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  2514
            ny <= margin ifTrue:[
f554919e10ab invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  2515
                thumbFrame := nil.
f554919e10ab invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  2516
                ^ self
f554919e10ab invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  2517
            ]
f554919e10ab invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  2518
        ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2519
    ] ifFalse:[
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  2520
        nx := newPos1 max:margin.
2171
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2521
        ny := newPos2.
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2522
        nw := newSize1.
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2523
        nh := newSize2 max:2.
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  2524
        nx + nw >= (width - margin) ifTrue:[
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  2525
            nx := (width - 1 - margin - nw) max:margin.
2171
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2526
        ].
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2527
        (ny+nh) >= height ifTrue:[
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2528
            ny := ((height - nh) // 2) max:0.
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2529
        ].
2177
f554919e10ab invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  2530
        nr := nx + nw - 1.
f554919e10ab invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  2531
        nr >= (width - margin) ifTrue:[
f554919e10ab invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  2532
            nx <= margin ifTrue:[
f554919e10ab invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  2533
                thumbFrame := nil.
f554919e10ab invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  2534
                ^ self
f554919e10ab invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  2535
            ]
f554919e10ab invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  2536
        ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2537
    ].
4031
5f0133b18996 changed: #computeThumbFrame
Claus Gittinger <cg@exept.de>
parents: 4030
diff changeset
  2538
    (((styleSheet name == #winXP) or:[styleSheet name == #winVista]) 
5f0133b18996 changed: #computeThumbFrame
Claus Gittinger <cg@exept.de>
parents: 4030
diff changeset
  2539
    and:[self isMiniScroller not]) ifTrue:[
3103
3ff619dbf7d0 xp style drawing
Claus Gittinger <cg@exept.de>
parents: 3094
diff changeset
  2540
        nw := nw + 1.
3ff619dbf7d0 xp style drawing
Claus Gittinger <cg@exept.de>
parents: 3094
diff changeset
  2541
        nh := nh + 1.
3ff619dbf7d0 xp style drawing
Claus Gittinger <cg@exept.de>
parents: 3094
diff changeset
  2542
    ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2543
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2544
    "
6102
14d35f3b317c #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6094
diff changeset
  2545
     do not create a new Rectangle if it's the same anyway
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2546
    "
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2547
    thumbFrame notNil ifTrue:[
2171
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2548
        (ny == thumbFrame top) ifTrue:[
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2549
          (nx == thumbFrame left) ifTrue:[
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2550
            (nh == thumbFrame height) ifTrue:[
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2551
              (nw == thumbFrame width) ifTrue:[ ^ self]
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2552
            ]
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2553
          ]
c78dc6f74a80 comment
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2554
        ]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2555
    ].
2177
f554919e10ab invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  2556
2178
ba7c746da7c9 invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  2557
    thumbFrame := Rectangle left:nx top:ny width:nw height:nh.
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2558
6102
14d35f3b317c #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6094
diff changeset
  2559
    "Modified: / 12-05-1998 / 20:58:51 / cg"
14d35f3b317c #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6094
diff changeset
  2560
    "Modified (comment): / 13-02-2017 / 20:30:04 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2561
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2562
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2563
percentFromAbs:absValue
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2564
    "given a number of pixels, compute percentage"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2565
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2566
    |fullSize val t|
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2567
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2568
    (orientation == #vertical) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2569
	fullSize := height
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2570
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2571
	fullSize := width
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2572
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2573
1283
1d1a04076471 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1279
diff changeset
  2574
    absValue < 0 ifTrue:[^ rangeStart].
1d1a04076471 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1279
diff changeset
  2575
    absValue > fullSize ifTrue:[^ rangeEnd].
1d1a04076471 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1279
diff changeset
  2576
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2577
    t := fullSize - thumbFrameSizeDifference - (margin * 2).
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2578
    t = 0 ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2579
	"/ in rare cases, this happens ...
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2580
	val := 0
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2581
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2582
	val := absValue / t * (rangeEnd - rangeStart).
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2583
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2584
    val := val + rangeStart.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2585
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
  2586
    rangeStart < rangeEnd ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2587
	val < rangeStart ifTrue:[^ rangeStart].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2588
	val > rangeEnd ifTrue:[^ rangeEnd].
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
  2589
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2590
	val > rangeStart ifTrue:[^ rangeStart].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2591
	val < rangeEnd ifTrue:[^ rangeEnd].
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
  2592
    ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2593
    ^ val
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2594
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
  2595
    "Modified: / 21.1.1998 / 19:31:15 / cg"
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2596
!
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2597
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  2598
startMove
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  2599
    originBeforeMove := self thumbOrigin.
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  2600
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  2601
    (ghostColor notNil 
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  2602
    or:[ghostFrameColor notNil
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  2603
    or:[ghostLevel ~~ 0]]) ifTrue:[
2010
ca8dcc8723dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
  2604
	thumbFrame isNil ifTrue:[
ca8dcc8723dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
  2605
	    self computeThumbFrame.
ca8dcc8723dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
  2606
	].
ca8dcc8723dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
  2607
	frameBeforeMove := thumbFrame insetBy:1@1
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  2608
    ].
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  2609
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  2610
!
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  2611
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2612
updateBackground
6094
d465941bfe0b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6058
diff changeset
  2613
    "make my background grey, whenever disabled"
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2614
1731
5f8ceeb41e93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  2615
    |bg|
5f8ceeb41e93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  2616
2032
9807d0681551 bugfix (DefaultBackground is nil in iris style) for updateBackground
ah
parents: 2010
diff changeset
  2617
    enabled ifTrue:[
9807d0681551 bugfix (DefaultBackground is nil in iris style) for updateBackground
ah
parents: 2010
diff changeset
  2618
        bg := DefaultViewBackground.
9807d0681551 bugfix (DefaultBackground is nil in iris style) for updateBackground
ah
parents: 2010
diff changeset
  2619
    ].
9807d0681551 bugfix (DefaultBackground is nil in iris style) for updateBackground
ah
parents: 2010
diff changeset
  2620
    bg isNil ifTrue:[
9807d0681551 bugfix (DefaultBackground is nil in iris style) for updateBackground
ah
parents: 2010
diff changeset
  2621
        bg := View defaultViewBackgroundColor.
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2622
    ].
1731
5f8ceeb41e93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  2623
5f8ceeb41e93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  2624
    bg ~= viewBackground ifTrue:[
2032
9807d0681551 bugfix (DefaultBackground is nil in iris style) for updateBackground
ah
parents: 2010
diff changeset
  2625
        self backgroundColor:bg.
9807d0681551 bugfix (DefaultBackground is nil in iris style) for updateBackground
ah
parents: 2010
diff changeset
  2626
        self invalidate
1731
5f8ceeb41e93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  2627
    ]
2032
9807d0681551 bugfix (DefaultBackground is nil in iris style) for updateBackground
ah
parents: 2010
diff changeset
  2628
6094
d465941bfe0b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6058
diff changeset
  2629
    "Modified (comment): / 12-02-2017 / 14:38:38 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2630
! !
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2631
2742
c5614cbcd83d method category rename
Claus Gittinger <cg@exept.de>
parents: 2730
diff changeset
  2632
!Scroller methodsFor:'private-scrollbar & scrollview interface'!
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2633
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2634
setThumbFor:aView
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2635
    "get contents and size info from aView and adjust thumb"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2636
1962
baf22110671e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  2637
    |percentSize percentOrigin contentsSize contentsPosition viewsSize t|
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2638
1432
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  2639
    scrolling ifTrue:[self invalidate].
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  2640
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2641
    "
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2642
     get the content's size
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2643
    "
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2644
    aView isNil ifTrue:[
3019
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2645
        contentsSize := 0
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2646
    ] ifFalse:[
3019
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2647
        orientation == #vertical ifTrue:[
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2648
            contentsSize := aView heightOfContents.
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2649
            (t := aView transformation) notNil ifTrue:[
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2650
                contentsSize := t applyScaleY:contentsSize.
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2651
            ].
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2652
        ] ifFalse:[
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2653
            contentsSize := aView widthOfContents.
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2654
            (t := aView transformation) notNil ifTrue:[
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2655
                contentsSize := t applyScaleX:contentsSize.
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2656
            ].
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2657
        ]
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2658
    ].
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2659
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2660
    (contentsSize = 0) ifTrue:[
3019
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2661
        percentSize := 100.
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2662
        percentOrigin := 100
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2663
    ] ifFalse:[
3019
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2664
        (orientation == #vertical) ifTrue:[
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2665
            viewsSize := aView innerHeight.
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2666
            contentsPosition := aView yOriginOfContents.
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2667
        ] ifFalse:[
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2668
            viewsSize := aView innerWidth.
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2669
            contentsPosition := aView xOriginOfContents
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2670
        ].
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2671
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2672
        percentSize := viewsSize * 100.0 / contentsSize.
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2673
        percentOrigin := contentsPosition * 100.0 / contentsSize.
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2674
        percentOrigin + percentSize > 100.0 ifTrue:[
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2675
            "actually showing stuff below contents of view"
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2676
"
3019
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2677
            contentsSize := contentsPosition + aView innerHeight.
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2678
            percentSize := viewsSize * 100.0 / contentsSize.
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2679
            percentOrigin := contentsPosition * 100.0 / contentsSize
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2680
"
3019
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2681
        ]
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2682
    ].
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2683
    (percentSize = thumbHeight) ifTrue:[
3019
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2684
        self thumbOrigin:percentOrigin
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2685
    ] ifFalse:[
3019
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2686
        (percentOrigin = thumbOrigin) ifTrue:[
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2687
            self thumbHeight:percentSize
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2688
        ] ifFalse:[
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2689
            self thumbOrigin:percentOrigin thumbHeight:percentSize
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2690
        ]
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2691
    ].
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2692
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2693
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2694
setThumbHeightFor:aView
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2695
    "get contents and size info from aView and adjust thumb height"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2696
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2697
    |percent total viewsSize|
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2698
1432
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  2699
    scrolling ifTrue:[self invalidate].
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  2700
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2701
    (orientation == #vertical) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2702
	total := aView heightOfContents.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2703
	aView transformation notNil ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2704
	    total := aView transformation applyScaleY:total.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2705
	].
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2706
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2707
	total := aView widthOfContents.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2708
	aView transformation notNil ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2709
	    total := aView transformation applyScaleX:total.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2710
	].
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2711
    ].
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2712
    (total = 0) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2713
	percent := 100
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2714
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2715
	viewsSize := (orientation == #vertical) ifTrue:[aView innerHeight]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2716
					   ifFalse:[aView innerWidth].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2717
	percent := viewsSize * 100.0 / total
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2718
    ].
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2719
    self thumbHeight:percent
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2720
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2721
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2722
setThumbOriginFor:aView
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2723
    "get contents and size info from aView and adjust thumb origin"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2724
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2725
    |percent total contentsPosition|
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2726
1432
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  2727
    scrolling ifTrue:[self invalidate].
6311
c7610420a3ae #BUGFIX by sr
sr
parents: 6102
diff changeset
  2728
    aView isNil ifTrue:[^ self].
1432
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  2729
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2730
    (orientation == #vertical) ifTrue:[
3019
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2731
        total := aView heightOfContents.
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2732
        aView transformation notNil ifTrue:[
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2733
            total := aView transformation applyScaleY:total.
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2734
        ].
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2735
    ] ifFalse:[
3019
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2736
        total := aView widthOfContents.
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2737
        aView transformation notNil ifTrue:[
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2738
            total := aView transformation applyScaleX:total.
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2739
        ].
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2740
    ].
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2741
    (total = 0) ifTrue:[
3019
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2742
        percent := 100
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2743
    ] ifFalse:[
3019
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2744
        contentsPosition := (orientation == #vertical) ifTrue:[aView yOriginOfContents]
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2745
                                                  ifFalse:[aView xOriginOfContents].
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2746
        percent := contentsPosition * 100.0 / total
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2747
    ].
3019
6cfaf60fd8ea *** empty log message ***
ca
parents: 3017
diff changeset
  2748
    self thumbOrigin:percent.
6311
c7610420a3ae #BUGFIX by sr
sr
parents: 6102
diff changeset
  2749
c7610420a3ae #BUGFIX by sr
sr
parents: 6102
diff changeset
  2750
    "Modified: / 24-04-2018 / 10:39:36 / sr"
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2751
! !
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2752
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2753
!Scroller methodsFor:'queries'!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2754
3072
5d9adc17b9f1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3028
diff changeset
  2755
isMiniScroller
5d9adc17b9f1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3028
diff changeset
  2756
    ^ false
5d9adc17b9f1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3028
diff changeset
  2757
!
5d9adc17b9f1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3028
diff changeset
  2758
2358
eadde3a9c586 added #isScrolling query
Claus Gittinger <cg@exept.de>
parents: 2351
diff changeset
  2759
isScrolling
eadde3a9c586 added #isScrolling query
Claus Gittinger <cg@exept.de>
parents: 2351
diff changeset
  2760
    "true, if thumb is being moved (by user)"
eadde3a9c586 added #isScrolling query
Claus Gittinger <cg@exept.de>
parents: 2351
diff changeset
  2761
eadde3a9c586 added #isScrolling query
Claus Gittinger <cg@exept.de>
parents: 2351
diff changeset
  2762
    ^ scrolling
eadde3a9c586 added #isScrolling query
Claus Gittinger <cg@exept.de>
parents: 2351
diff changeset
  2763
!
eadde3a9c586 added #isScrolling query
Claus Gittinger <cg@exept.de>
parents: 2351
diff changeset
  2764
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2765
preferredExtent
572
121735c2aff6 commentary
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2766
    "return my preferredExtent"
121735c2aff6 commentary
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2767
538
b747ea31b972 use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
  2768
    |defExt w h|
b747ea31b972 use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
  2769
3754
cc51fb09ee61 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3677
diff changeset
  2770
    "/ If I have an explicit preferredExtent..
cc51fb09ee61 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3677
diff changeset
  2771
    explicitExtent notNil ifTrue:[
cc51fb09ee61 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3677
diff changeset
  2772
        ^ explicitExtent
cc51fb09ee61 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3677
diff changeset
  2773
    ].
cc51fb09ee61 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3677
diff changeset
  2774
cc51fb09ee61 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3677
diff changeset
  2775
    "/ If I have a cached preferredExtent value..
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  2776
    preferredExtent notNil ifTrue:[
3754
cc51fb09ee61 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3677
diff changeset
  2777
        ^ preferredExtent
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  2778
    ].
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  2779
538
b747ea31b972 use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
  2780
    defExt := self class defaultExtent.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2781
538
b747ea31b972 use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
  2782
    orientation == #vertical ifTrue:[
3754
cc51fb09ee61 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3677
diff changeset
  2783
        h := defExt y.
cc51fb09ee61 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3677
diff changeset
  2784
        (w := DefaultVScrollerWidth) isNil ifTrue:[
5622
cb4139a2302c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5468
diff changeset
  2785
            w := (device horizontalPixelPerMillimeter asFloat * 5) rounded
3754
cc51fb09ee61 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3677
diff changeset
  2786
        ]
538
b747ea31b972 use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
  2787
    ] ifFalse:[
3754
cc51fb09ee61 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3677
diff changeset
  2788
        w := defExt x.
cc51fb09ee61 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3677
diff changeset
  2789
        (h := DefaultHScrollerHeight) isNil ifTrue:[
5622
cb4139a2302c #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5468
diff changeset
  2790
            h := (device verticalPixelPerMillimeter asFloat * 5) rounded
3754
cc51fb09ee61 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3677
diff changeset
  2791
        ]
538
b747ea31b972 use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
  2792
    ].
b747ea31b972 use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
  2793
786
8b301af1cdcc remember and do not recompute the preferredExtent;
Claus Gittinger <cg@exept.de>
parents: 767
diff changeset
  2794
    preferredExtent := w @ h.
8b301af1cdcc remember and do not recompute the preferredExtent;
Claus Gittinger <cg@exept.de>
parents: 767
diff changeset
  2795
    ^ preferredExtent.
538
b747ea31b972 use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
  2796
1886
cb557485dfcb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1875
diff changeset
  2797
    "Modified: / 28.4.1999 / 18:28:19 / cg"
1122
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2798
!
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2799
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2800
thumbVisible
1122
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2801
    "return true, if the thumb is usable i.e. its visible & movable.
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2802
     Can be used by the scrollBar to decide if it should hide the scroller."
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2803
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2804
    |m2|
1122
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2805
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2806
    (thumbHeight >= 100) ifTrue:[^ false].
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2807
    self computeThumbFrame.
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2808
    thumbFrame isNil ifTrue:[^ false].
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2809
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2810
    m2 := margin * 2.
1122
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2811
    orientation == #vertical ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2812
	thumbFrame height >= (height - m2) ifTrue:[^ false].
1122
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2813
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2814
	thumbFrame width >= (width - m2) ifTrue:[^ false].
1122
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2815
    ].
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2816
    ^ true
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2817
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2818
    "Created: / 7.3.1997 / 21:10:23 / cg"
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2819
    "Modified: / 12.5.1998 / 20:21:00 / cg"
2383
5783b2c07e85 Make mouse wheel work.
Stefan Vogel <sv@exept.de>
parents: 2358
diff changeset
  2820
!
5783b2c07e85 Make mouse wheel work.
Stefan Vogel <sv@exept.de>
parents: 2358
diff changeset
  2821
5783b2c07e85 Make mouse wheel work.
Stefan Vogel <sv@exept.de>
parents: 2358
diff changeset
  2822
verticalScrollStep
2384
74eed28cb624 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 2383
diff changeset
  2823
    "mouse wheel: scroll by keyboardStep or a quarter of a page
2383
5783b2c07e85 Make mouse wheel work.
Stefan Vogel <sv@exept.de>
parents: 2358
diff changeset
  2824
     Note: this is used for horizontal scrollers, too"
5783b2c07e85 Make mouse wheel work.
Stefan Vogel <sv@exept.de>
parents: 2358
diff changeset
  2825
2384
74eed28cb624 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 2383
diff changeset
  2826
    ^ (keyboardStep ? (thumbHeight / 4)) max:1
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  2827
! !
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  2828
897
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  2829
!Scroller class methodsFor:'documentation'!
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
  2830
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  2831
version
5420
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  2832
    ^ '$Header$'
4017
3b1cb7d7db47 no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
  2833
!
3b1cb7d7db47 no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
  2834
3b1cb7d7db47 no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
  2835
version_CVS
5420
40136151fb83 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5218
diff changeset
  2836
    ^ '$Header$'
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
  2837
! !
4869
7d64deb9bce6 class: Scroller
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  2838