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