author | ca |
Thu, 07 Mar 1996 10:33:53 +0100 | |
changeset 487 | 4ee60598df58 |
parent 482 | f4d7344ae396 |
child 491 | 7b376aaa06d5 |
permissions | -rw-r--r-- |
0 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
59 | 3 |
All Rights Reserved |
0 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
119 | 13 |
SimpleView subclass:#ScrollBar |
345 | 14 |
instanceVariableNames:'thumb button1 button2 buttonLayout elementSpacing' |
15 |
classVariableNames:'DefaultButtonPositions DefaultLevel DefaultElementSpacing |
|
16 |
DefaultScrollerBordered' |
|
17 |
poolDictionaries:'' |
|
18 |
category:'Views-Interactors' |
|
0 | 19 |
! |
20 |
||
38 | 21 |
!ScrollBar class methodsFor:'documentation'! |
0 | 22 |
|
38 | 23 |
copyright |
24 |
" |
|
25 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
59 | 26 |
All Rights Reserved |
0 | 27 |
|
38 | 28 |
This software is furnished under a license and may be used |
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! |
|
36 |
||
37 |
documentation |
|
38 |
" |
|
39 |
this class implements vertical scrollbars with scroller and |
|
40 |
2 step-scroll buttons. when moved or stepped, it performs a |
|
41 |
predefined action. |
|
42 |
||
43 |
The action is specified by: the block to be evaluated for step-up |
|
59 | 44 |
aScrollBar scrollUpAction:aBlock |
45 |
(scrollLeftAction for hor-Scrollbars) |
|
0 | 46 |
|
59 | 47 |
aScrollBar scrollDownAction:aBlock the block to be evaluated for step-down |
48 |
(scrollRightAction for hor-Scrollbars) |
|
38 | 49 |
|
59 | 50 |
aScrollbar scrollAction:aBlock the block to be evaluated for scroll |
51 |
passing percentage as argument. |
|
38 | 52 |
|
53 |
Scrollbars can scroll syncronous (i.e. every movement is notified immediately via the |
|
54 |
scrollAction) or asynchronous (i.e. only one notification takes place at the end of the movement). |
|
55 |
The choice is up to the user of the scrollbar (typically, views which are complicated to redraw, |
|
56 |
will set it to asynchronous.) |
|
57 |
||
58 |
Most often scrollbars are used hidden with ScrollableView or HVScrollableView (i.e. you |
|
59 |
dont have to care for all the details). |
|
128 | 60 |
|
61 |
The scrollBars and scrollers protocols have been made similar enough to |
|
62 |
allow transparent use of either a scroller or a scrollBar in applications. |
|
38 | 63 |
" |
0 | 64 |
! ! |
65 |
||
66 |
!ScrollBar class methodsFor:'style changes'! |
|
67 |
||
59 | 68 |
updateStyleCache |
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
69 |
"extract values from the styleSheet and cache them in class variables" |
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
70 |
|
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
71 |
<resource: #style (#scrollBarButtonPositions #scrollBarLevel |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
72 |
#scrollBarScrollerBordered #scrollBarElementSpacing)> |
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
73 |
|
59 | 74 |
DefaultButtonPositions := StyleSheet at:'scrollBarButtonPositions' default:#bottom. |
75 |
DefaultLevel := StyleSheet at:'scrollBarLevel'. |
|
76 |
DefaultScrollerBordered := StyleSheet at:'scrollBarScrollerBordered' default:false. |
|
77 |
DefaultElementSpacing := StyleSheet at:'scrollBarElementSpacing' |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
78 |
default:(StyleSheet is3D ifTrue:[1] ifFalse:[0]). |
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
79 |
|
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
80 |
"Modified: 1.3.1996 / 13:46:29 / cg" |
0 | 81 |
! ! |
82 |
||
205 | 83 |
!ScrollBar methodsFor:'accessing'! |
0 | 84 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
85 |
thumbHeight |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
86 |
"return height of thumb in percent" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
87 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
88 |
^ thumb thumbHeight |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
89 |
! |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
90 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
91 |
thumbHeight:newHeight |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
92 |
"set height of thumb in percent" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
93 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
94 |
thumb thumbHeight:newHeight. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
95 |
self enableDisableButtons |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
96 |
! |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
97 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
98 |
thumbOrigin |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
99 |
"return position of (top of) thumb in percent" |
205 | 100 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
101 |
^ thumb thumbOrigin |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
102 |
! |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
103 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
104 |
thumbOrigin:newOrigin |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
105 |
"set position of (top of) thumb in percent" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
106 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
107 |
thumb thumbOrigin:newOrigin. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
108 |
self enableDisableButtons |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
109 |
! |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
110 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
111 |
thumbOrigin:newOrigin thumbHeight:newHeight |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
112 |
"set origin and height of thumb (both in percent)" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
113 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
114 |
thumb thumbOrigin:newOrigin thumbHeight:newHeight. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
115 |
self enableDisableButtons |
455 | 116 |
! ! |
117 |
||
118 |
!ScrollBar methodsFor:'accessing-behavior'! |
|
119 |
||
120 |
asynchronousOperation |
|
121 |
"set asynchronous-mode - scroll action is performed after movement |
|
122 |
of scroller (i.e. when mouse-button is finally released). |
|
123 |
This is forwarded to the scroller here." |
|
124 |
||
125 |
thumb asynchronousOperation |
|
126 |
! |
|
127 |
||
128 |
scrollAction:aBlock |
|
129 |
"set the action, aBlock to be performed when the scroller is moved. |
|
130 |
This is forwarded to the scroller here." |
|
131 |
||
132 |
thumb scrollAction:aBlock |
|
133 |
! |
|
134 |
||
135 |
scrollDownAction:aBlock |
|
136 |
"set the action, aBlock to be performed when the down-button is pressed." |
|
137 |
||
138 |
button2 action:aBlock |
|
139 |
! |
|
140 |
||
141 |
scrollUpAction:aBlock |
|
142 |
"set the action, aBlock to be performed when the up-button is pressed." |
|
143 |
||
144 |
button1 action:aBlock |
|
145 |
! |
|
146 |
||
147 |
synchronousOperation |
|
148 |
"set synchronous-mode - scroll action is performed for every movement |
|
149 |
of scroller. |
|
150 |
This is forwarded to the scroller here." |
|
151 |
||
152 |
thumb synchronousOperation |
|
153 |
! ! |
|
154 |
||
155 |
!ScrollBar methodsFor:'accessing-components'! |
|
156 |
||
157 |
downButton |
|
158 |
"return the down-button |
|
159 |
(Please: only use this direct access for special applications)" |
|
160 |
||
161 |
^ button2 |
|
162 |
||
163 |
" |
|
164 |
|v| |
|
165 |
||
166 |
v := ScrollableView for:EditTextView. |
|
167 |
v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile). |
|
168 |
v scrollBar upButton activeForegroundColor:Color red. |
|
169 |
v scrollBar downButton activeForegroundColor:Color red. |
|
170 |
v open |
|
171 |
" |
|
172 |
! |
|
173 |
||
174 |
thumb |
|
175 |
"return the thumb (i.e. the scroller subview) |
|
176 |
(Please: only use this direct access for special applications)" |
|
177 |
||
178 |
^ thumb |
|
179 |
||
180 |
" |
|
181 |
|v| |
|
182 |
||
183 |
v := ScrollableView for:EditTextView. |
|
184 |
v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile). |
|
185 |
v scrollBar thumb thumbColor:(Color red). |
|
186 |
v open |
|
187 |
" |
|
188 |
||
189 |
"Modified: 1.3.1996 / 19:15:50 / cg" |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
190 |
! |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
191 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
192 |
upButton |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
193 |
"return the up-button |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
194 |
(Please: only use this direct access for special applications)" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
195 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
196 |
^ button1 |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
197 |
|
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
198 |
" |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
199 |
|v| |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
200 |
|
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
201 |
v := ScrollableView for:EditTextView. |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
202 |
v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile). |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
203 |
v scrollBar upButton foregroundColor:(Color red). |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
204 |
v scrollBar upButton enteredForegroundColor:(Color red lightened). |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
205 |
v scrollBar downButton foregroundColor:(Color green). |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
206 |
v scrollBar downButton enteredForegroundColor:(Color green lightened). |
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
207 |
v open |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
208 |
" |
455 | 209 |
! ! |
210 |
||
211 |
!ScrollBar methodsFor:'accessing-look'! |
|
212 |
||
213 |
thumbColor:aColor |
|
214 |
"set the thumbs color" |
|
215 |
||
216 |
thumb thumbColor:aColor |
|
205 | 217 |
! |
128 | 218 |
|
133 | 219 |
upButtonLabel:label1 downButtonLabel:label2 |
446 | 220 |
"set the labels shown in the buttons. |
221 |
Because of the fixed button sizes, this only makes sense with |
|
222 |
single-character strings or small bitmaps." |
|
133 | 223 |
|
224 |
button1 label:label1. |
|
225 |
button2 label:label2. |
|
226 |
self setElementPositions. |
|
227 |
||
446 | 228 |
"not bad: |
133 | 229 |
|v| |
230 |
||
231 |
v := ScrollableView for:EditTextView. |
|
232 |
v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile). |
|
233 |
v scrollBar upButtonLabel:'+' downButtonLabel:'-'. |
|
234 |
v open |
|
235 |
" |
|
446 | 236 |
|
237 |
"also possible : |
|
238 |
|v| |
|
239 |
||
240 |
v := ScrollableView for:EditTextView. |
|
241 |
v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile). |
|
242 |
v scrollBar upButtonLabel:'u' downButtonLabel:'d'. |
|
243 |
v open |
|
244 |
" |
|
245 |
||
246 |
"BAD example: |
|
247 |
|v| |
|
248 |
||
249 |
v := ScrollableView for:EditTextView. |
|
250 |
v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile). |
|
251 |
v scrollBar upButtonLabel:'up' downButtonLabel:'down'. |
|
252 |
v open |
|
253 |
" |
|
254 |
||
255 |
"Modified: 1.3.1996 / 19:06:50 / cg" |
|
205 | 256 |
! ! |
257 |
||
258 |
!ScrollBar methodsFor:'change & update'! |
|
0 | 259 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
260 |
update:something with:aParameter from:changedObject |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
261 |
changedObject == thumb ifTrue:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
262 |
self enableDisableButtons |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
263 |
] |
0 | 264 |
! ! |
265 |
||
266 |
!ScrollBar methodsFor:'events'! |
|
267 |
||
482
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
268 |
keyPress:key x:x y:y |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
269 |
(key == #BeginOfText) ifTrue:[ |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
270 |
self scrollToBeginning. |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
271 |
^ self |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
272 |
]. |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
273 |
(key == #EndOfText) ifTrue:[ |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
274 |
self scrollToEnd. |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
275 |
^ self |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
276 |
]. |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
277 |
super keyPress:key x:x y:y |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
278 |
|
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
279 |
"Created: 6.3.1996 / 17:58:02 / cg" |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
280 |
"Modified: 6.3.1996 / 17:59:05 / cg" |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
281 |
! |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
282 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
283 |
sizeChanged:how |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
284 |
"when my size changes, I have to resize/reposition the subviews. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
285 |
Also, if I became too small, hide thumb/buttons." |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
286 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
287 |
|upHeight downHeight thumbHeight upAndDownHeight bwn sep2 |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
288 |
thumbWidth w style b1Hidden b2Hidden thumbHidden bY| |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
289 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
290 |
button1 isNil ifTrue:[^ self]. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
291 |
thumb isNil ifTrue:[^ self]. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
292 |
button2 isNil ifTrue:[^ self]. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
293 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
294 |
style := styleSheet name. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
295 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
296 |
upHeight := button1 height + borderWidth. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
297 |
downHeight := button2 height + borderWidth. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
298 |
upAndDownHeight := upHeight + downHeight. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
299 |
bwn := borderWidth negated + margin. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
300 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
301 |
thumbHeight := height - upAndDownHeight - borderWidth - (elementSpacing * 3). |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
302 |
" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
303 |
((buttonLayout ~~ #top) and:[buttonLayout ~~ #bottom]) ifTrue:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
304 |
thumbHeight := thumbHeight - borderWidth |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
305 |
]. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
306 |
" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
307 |
buttonLayout == #around ifTrue:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
308 |
thumbHeight := thumbHeight + borderWidth |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
309 |
]. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
310 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
311 |
"if I become too small, hide buttons and thumb" |
0 | 312 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
313 |
height < upAndDownHeight ifTrue:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
314 |
b1Hidden := b2Hidden := thumbHidden := true. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
315 |
] ifFalse:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
316 |
b1Hidden := b2Hidden := thumbHidden := false. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
317 |
]. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
318 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
319 |
(thumbHeight < 10) ifTrue:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
320 |
thumbHidden := true. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
321 |
] ifFalse:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
322 |
thumbHidden := false. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
323 |
]. |
130 | 324 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
325 |
button1 hiddenOnRealize:b1Hidden. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
326 |
b1Hidden ifTrue:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
327 |
button1 unrealize |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
328 |
] ifFalse:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
329 |
shown ifTrue:[button1 realize] |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
330 |
]. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
331 |
button2 hiddenOnRealize:b1Hidden. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
332 |
b2Hidden ifTrue:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
333 |
button2 unrealize |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
334 |
] ifFalse:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
335 |
shown ifTrue:[button2 realize] |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
336 |
]. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
337 |
thumb hiddenOnRealize:thumbHidden. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
338 |
thumbHidden ifTrue:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
339 |
thumb unrealize |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
340 |
] ifFalse:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
341 |
shown ifTrue:[thumb realize] |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
342 |
]. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
343 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
344 |
"width of buttons is always my width" |
0 | 345 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
346 |
w := width - (margin * 2). |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
347 |
(w ~~ button1 width) ifTrue:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
348 |
button1 width:w. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
349 |
button2 width:w |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
350 |
]. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
351 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
352 |
thumbWidth := w. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
353 |
style == #next ifTrue:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
354 |
thumbWidth := thumbWidth - (thumb borderWidth * 2). |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
355 |
thumbHeight := thumbHeight - 1 |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
356 |
]. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
357 |
style == #motif ifTrue:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
358 |
thumbHeight := thumbHeight - margin |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
359 |
]. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
360 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
361 |
" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
362 |
a kludge: views with width or height of 0 are illegal |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
363 |
avoid error from view-creation (it will be hidden anyway) |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
364 |
" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
365 |
thumbHeight <= 0 ifTrue:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
366 |
thumbHeight := 1 |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
367 |
]. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
368 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
369 |
(buttonLayout == #top) ifTrue:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
370 |
"buttons at top" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
371 |
thumb extent:(thumbWidth @ thumbHeight). |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
372 |
^ self |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
373 |
]. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
374 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
375 |
sep2 := elementSpacing * 2. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
376 |
(buttonLayout == #bottom) ifTrue:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
377 |
"buttons at bottom" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
378 |
"/ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
379 |
"/ XX: I thought, that viewGravity shuld fix things automatically |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
380 |
"/ XX: it seems not to do it (or I misused it ;-) |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
381 |
"/ XX: anyway, viewGravity is an X special feature which is probably |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
382 |
"/ XX: not available with other windowing systems. Therefore, |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
383 |
"/ XX: the viewGravity depending code below is disabled. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
384 |
"/ XX: resize is somewhat slower, though. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
385 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
386 |
thumbHeight := thumbHeight + borderWidth. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
387 |
"/ XX thumbHidden ifTrue:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
388 |
"/ XX bY := elementSpacing |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
389 |
"/ XX ] ifFalse:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
390 |
bY := thumbHeight + sep2. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
391 |
"/ XX ]. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
392 |
"XX" button1 viewGravity:#North. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
393 |
"XX" button2 viewGravity:#North. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
394 |
(how == #smaller) ifTrue:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
395 |
thumb extent:(thumbWidth @ thumbHeight). |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
396 |
"XX" button1 origin:(bwn @ (thumbHeight + sep2)). |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
397 |
"XX" button2 origin:(bwn @ (thumbHeight + sep2 + upHeight)) |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
398 |
] ifFalse:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
399 |
button1 origin:(bwn @ bY). |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
400 |
button2 origin:(bwn @ (bY + upHeight)). |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
401 |
thumb extent:(thumbWidth @ thumbHeight) |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
402 |
]. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
403 |
^ self |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
404 |
]. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
405 |
"buttons around thumb" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
406 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
407 |
style == #motif ifTrue:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
408 |
sep2 := sep2 + 1 |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
409 |
]. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
410 |
button1 origin:(bwn @ bwn). |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
411 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
412 |
style == #os2 ifTrue:[ |
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
413 |
button2 origin:(bwn @ (upHeight + thumbHeight + sep2 - margin "+ borderWidth")). |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
414 |
thumb extent:(thumbWidth @ (thumbHeight - margin - margin "+ margin - (margin // 2)")). |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
415 |
thumb origin:(bwn @ (upHeight - borderWidth + elementSpacing + margin)) |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
416 |
] ifFalse:[ |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
417 |
button2 origin:(bwn @ (upHeight + thumbHeight + sep2 - (margin // 2) "+ borderWidth")). |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
418 |
thumb extent:(thumbWidth @ (thumbHeight + margin - (margin // 2))). |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
419 |
thumb origin:(bwn @ (upHeight - borderWidth + elementSpacing)) |
63 | 420 |
]. |
0 | 421 |
! ! |
110 | 422 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
423 |
!ScrollBar methodsFor:'forced scroll'! |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
424 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
425 |
pageDown |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
426 |
"page down/right" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
427 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
428 |
thumb pageDown |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
429 |
! |
205 | 430 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
431 |
pageUp |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
432 |
"page up/left" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
433 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
434 |
thumb pageUp |
482
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
435 |
! |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
436 |
|
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
437 |
scrollToBeginning |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
438 |
"to top" |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
439 |
|
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
440 |
thumb scrollToBeginning |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
441 |
|
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
442 |
"Modified: 6.3.1996 / 17:54:45 / cg" |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
443 |
! |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
444 |
|
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
445 |
scrollToEnd |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
446 |
"to end" |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
447 |
|
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
448 |
thumb scrollToEnd |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
449 |
|
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
450 |
"Created: 6.3.1996 / 17:54:28 / cg" |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
451 |
"Modified: 6.3.1996 / 17:54:49 / cg" |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
452 |
! ! |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
453 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
454 |
!ScrollBar methodsFor:'initialization'! |
205 | 455 |
|
455 | 456 |
createElements |
457 |
button1 := ArrowButton upIn:self. |
|
458 |
button2 := ArrowButton downIn:self. |
|
459 |
thumb := Scroller in:self. |
|
460 |
! |
|
461 |
||
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
462 |
defaultExtent |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
463 |
"compute my extent from sub-components" |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
464 |
|
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
465 |
^ self preferredExtent |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
466 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
467 |
|
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
468 |
"Created: 1.3.1996 / 19:22:11 / cg" |
205 | 469 |
! |
470 |
||
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
471 |
initStyle |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
472 |
super initStyle. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
473 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
474 |
buttonLayout := DefaultButtonPositions. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
475 |
DefaultLevel notNil ifTrue:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
476 |
self level:DefaultLevel |
205 | 477 |
]. |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
478 |
elementSpacing := DefaultElementSpacing |
205 | 479 |
! |
480 |
||
481 |
initialize |
|
482 |
"setup; create the 2 buttons and a scroller" |
|
483 |
||
484 |
|clr style| |
|
485 |
||
486 |
super initialize. |
|
487 |
||
488 |
self createElements. |
|
489 |
||
490 |
(styleSheet at:'scrollBarDisableButtons' default:false) ifTrue:[ |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
491 |
thumb addDependent:self |
205 | 492 |
]. |
493 |
||
345 | 494 |
button1 autoRepeat:true. |
495 |
button2 autoRepeat:true. |
|
205 | 496 |
|
497 |
button1 borderWidth:borderWidth. |
|
498 |
DefaultScrollerBordered ifFalse:[ |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
499 |
thumb borderWidth:borderWidth. |
205 | 500 |
]. |
501 |
button2 borderWidth:borderWidth. |
|
502 |
||
503 |
style := styleSheet name. |
|
504 |
((style = #iris) and:[Display hasGreyscales]) ifTrue:[ |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
505 |
"have to change some of Buttons defaults" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
506 |
clr := (Color grey:25) on:device. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
507 |
button1 offLevel:2. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
508 |
button2 offLevel:2. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
509 |
button1 foregroundColor:clr. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
510 |
button1 activeForegroundColor:clr. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
511 |
button1 enteredForegroundColor:clr. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
512 |
button2 foregroundColor:clr. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
513 |
button2 activeForegroundColor:clr. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
514 |
button2 enteredForegroundColor:clr. |
205 | 515 |
]. |
516 |
||
517 |
self setElementPositions. |
|
518 |
||
519 |
style = #motif ifTrue:[ |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
520 |
clr := thumb thumbColor. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
521 |
button1 foregroundColor:clr. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
522 |
button2 foregroundColor:clr. |
345 | 523 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
524 |
clr := thumb viewBackground. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
525 |
button1 viewBackground:clr. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
526 |
button2 viewBackground:clr. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
527 |
button1 backgroundColor:clr. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
528 |
button2 backgroundColor:clr. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
529 |
button1 activeBackgroundColor:clr. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
530 |
button2 activeBackgroundColor:clr. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
531 |
device hasGreyscales ifFalse:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
532 |
button1 activeForegroundColor:Black. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
533 |
button2 activeForegroundColor:Black. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
534 |
] |
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
535 |
] |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
536 |
|
345 | 537 |
"Modified: 9.2.1996 / 22:42:16 / cg" |
205 | 538 |
! |
539 |
||
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
540 |
reinitialize |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
541 |
super reinitialize. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
542 |
self setElementPositions. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
543 |
! |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
544 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
545 |
setElementPositions |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
546 |
"position sub-components" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
547 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
548 |
|bwn| |
205 | 549 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
550 |
bwn := borderWidth negated + margin. |
205 | 551 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
552 |
(buttonLayout == #top) ifTrue:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
553 |
button1 origin:(bwn @ bwn). |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
554 |
button1 viewGravity:#North. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
555 |
button2 origin:(bwn @ (button1 height)). |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
556 |
button2 viewGravity:#North. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
557 |
thumb origin:(bwn @ (button1 height |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
558 |
+ borderWidth |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
559 |
+ button2 height |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
560 |
+ elementSpacing |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
561 |
+ elementSpacing)). |
205 | 562 |
thumb viewGravity:#North. |
563 |
^ self |
|
564 |
]. |
|
565 |
(buttonLayout == #bottom) ifTrue:[ |
|
566 |
device supportsViewGravity ifTrue:[ |
|
567 |
button1 viewGravity:#South. |
|
568 |
button2 viewGravity:#South. |
|
569 |
thumb viewGravity:#North. |
|
570 |
]. |
|
571 |
thumb origin:(bwn @ bwn). |
|
572 |
^ self |
|
573 |
]. |
|
574 |
||
575 |
"buttonLayout == #around" |
|
576 |
button1 origin:(bwn @ bwn). |
|
577 |
button1 viewGravity:#North. |
|
578 |
"/ button2 viewGravity:#North. |
|
579 |
thumb origin:(bwn @ (button1 height + elementSpacing)). |
|
580 |
thumb viewGravity:#North |
|
581 |
! ! |
|
582 |
||
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
583 |
!ScrollBar methodsFor:'private'! |
205 | 584 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
585 |
enableDisableButtons |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
586 |
"only used with styles which disable their buttons if the |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
587 |
thumb is at either end. Check where the thumb is and enable/disable |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
588 |
as appropriate." |
205 | 589 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
590 |
|e1 e2 th to| |
205 | 591 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
592 |
(styleSheet at:'scrollBarDisableButtons' default:false) ifFalse:[^ self]. |
110 | 593 |
|
205 | 594 |
e1 := e2 := true. |
595 |
(th := thumb thumbHeight) notNil ifTrue:[ |
|
596 |
(th >= (thumb stop)) ifTrue:[ |
|
597 |
e1 := false. |
|
598 |
e2 := false |
|
599 |
] |
|
600 |
]. |
|
601 |
((to := thumb thumbOrigin) <= thumb start) ifTrue:[ |
|
602 |
e1 := false |
|
603 |
] ifFalse:[ |
|
604 |
th isNil ifTrue:[th := 0]. |
|
605 |
(to + th) >= thumb stop ifTrue:[ |
|
606 |
e2 := false |
|
607 |
] |
|
608 |
]. |
|
609 |
e1 ifTrue:[button1 enable] ifFalse:[button1 disable]. |
|
610 |
e2 ifTrue:[button2 enable] ifFalse:[button2 disable]. |
|
611 |
! ! |
|
612 |
||
455 | 613 |
!ScrollBar methodsFor:'private scrollview interface'! |
614 |
||
615 |
setThumbFor:aView |
|
616 |
"adjust thumb for aView |
|
617 |
(i.e. adjust thumbs origin & size for views size & views contents). |
|
618 |
This is forwarded to the scroller here." |
|
619 |
||
620 |
thumb setThumbFor:aView. |
|
621 |
self enableDisableButtons |
|
622 |
! |
|
623 |
||
624 |
setThumbHeightFor:aView |
|
625 |
"adjust thumbs height for aViews size & contents. |
|
626 |
This is forwarded to the scroller here." |
|
627 |
||
628 |
thumb setThumbHeightFor:aView. |
|
629 |
self enableDisableButtons |
|
630 |
! |
|
631 |
||
632 |
setThumbOriginFor:aView |
|
633 |
"adjust thumbs origin for aViews size & contents. |
|
634 |
This is forwarded to the scroller here." |
|
635 |
||
636 |
thumb setThumbOriginFor:aView. |
|
637 |
self enableDisableButtons |
|
638 |
! ! |
|
639 |
||
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
640 |
!ScrollBar methodsFor:'queries'! |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
641 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
642 |
preferredExtent |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
643 |
"compute my extent from sub-components" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
644 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
645 |
|w h upForm downForm |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
646 |
upHeight "{ Class: SmallInteger }" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
647 |
downHeight "{ Class: SmallInteger }" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
648 |
upWidth downWidth style| |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
649 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
650 |
" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
651 |
need fix - this is a kludge; |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
652 |
the if should not be needed ... |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
653 |
" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
654 |
style := styleSheet name. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
655 |
style == #mswindows ifTrue:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
656 |
w := button1 width max:button2 width. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
657 |
h := button1 height + button2 height + (Scroller defaultExtent y). |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
658 |
] ifFalse:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
659 |
upForm := ArrowButton upArrowButtonForm:style on:device. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
660 |
downForm := ArrowButton downArrowButtonForm:style on:device. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
661 |
upForm isNil ifTrue:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
662 |
upHeight := upWidth := 16. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
663 |
] ifFalse:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
664 |
upHeight := upForm height. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
665 |
upWidth := upForm width |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
666 |
]. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
667 |
downForm isNil ifTrue:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
668 |
downHeight := downWidth := 16 |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
669 |
] ifFalse:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
670 |
downHeight := downForm height. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
671 |
downWidth := downForm width |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
672 |
]. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
673 |
h := upHeight + downHeight + (1 * 2) + (Scroller defaultExtent y). |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
674 |
w := upWidth max:downWidth. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
675 |
style ~~ #normal ifTrue:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
676 |
h := h + 4. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
677 |
w := w + 4 |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
678 |
]. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
679 |
]. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
680 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
681 |
^ w @ h. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
682 |
! ! |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
683 |
|
205 | 684 |
!ScrollBar class methodsFor:'documentation'! |
685 |
||
686 |
version |
|
482
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
687 |
^ '$Header: /cvs/stx/stx/libwidg/ScrollBar.st,v 1.27 1996-03-06 17:02:39 cg Exp $' |
205 | 688 |
! ! |