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