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