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