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