author | Claus Gittinger <cg@exept.de> |
Wed, 28 May 1997 16:21:11 +0200 | |
changeset 1230 | 9d052df857b8 |
parent 1229 | 19be2e822d45 |
child 1265 | 6899d60add7b |
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 |
||
855 | 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 |
|
585 | 44 |
aScrollBar scrollUpAction:aBlock |
45 |
(scrollLeftAction for hor-Scrollbars) |
|
0 | 46 |
|
585 | 47 |
aScrollBar scrollDownAction:aBlock the block to be evaluated for step-down |
48 |
(scrollRightAction for hor-Scrollbars) |
|
38 | 49 |
|
585 | 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. |
|
585 | 63 |
|
64 |
[author:] |
|
65 |
Claus Gittinger |
|
66 |
||
67 |
[see also:] |
|
68 |
Scroller Slider |
|
69 |
ScrollableView |
|
38 | 70 |
" |
0 | 71 |
! ! |
72 |
||
855 | 73 |
!ScrollBar class methodsFor:'style changes'! |
0 | 74 |
|
59 | 75 |
updateStyleCache |
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
76 |
"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
|
77 |
|
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
78 |
<resource: #style (#scrollBarButtonPositions #scrollBarLevel |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
79 |
#scrollBarScrollerBordered #scrollBarElementSpacing)> |
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
80 |
|
59 | 81 |
DefaultButtonPositions := StyleSheet at:'scrollBarButtonPositions' default:#bottom. |
82 |
DefaultLevel := StyleSheet at:'scrollBarLevel'. |
|
83 |
DefaultScrollerBordered := StyleSheet at:'scrollBarScrollerBordered' default:false. |
|
84 |
DefaultElementSpacing := StyleSheet at:'scrollBarElementSpacing' |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
85 |
default:(StyleSheet is3D ifTrue:[1] ifFalse:[0]). |
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
86 |
|
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
87 |
"Modified: 1.3.1996 / 13:46:29 / cg" |
0 | 88 |
! ! |
89 |
||
205 | 90 |
!ScrollBar methodsFor:'accessing'! |
0 | 91 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
92 |
thumbHeight |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
93 |
"return height of thumb in percent" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
94 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
95 |
^ thumb thumbHeight |
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 |
thumbHeight:newHeight |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
99 |
"set height of thumb in percent" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
100 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
101 |
thumb thumbHeight:newHeight. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
102 |
self enableDisableButtons |
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 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
105 |
thumbOrigin |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
106 |
"return position of (top of) thumb in percent" |
205 | 107 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
108 |
^ thumb thumbOrigin |
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 |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
112 |
"set position of (top of) thumb 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. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
115 |
self enableDisableButtons |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
116 |
! |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
117 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
118 |
thumbOrigin:newOrigin thumbHeight:newHeight |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
119 |
"set origin and height of thumb (both in percent)" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
120 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
121 |
thumb thumbOrigin:newOrigin thumbHeight:newHeight. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
122 |
self enableDisableButtons |
455 | 123 |
! ! |
124 |
||
125 |
!ScrollBar methodsFor:'accessing-behavior'! |
|
126 |
||
127 |
asynchronousOperation |
|
128 |
"set asynchronous-mode - scroll action is performed after movement |
|
129 |
of scroller (i.e. when mouse-button is finally released). |
|
130 |
This is forwarded to the scroller here." |
|
131 |
||
132 |
thumb asynchronousOperation |
|
133 |
! |
|
134 |
||
135 |
scrollAction:aBlock |
|
136 |
"set the action, aBlock to be performed when the scroller is moved. |
|
137 |
This is forwarded to the scroller here." |
|
138 |
||
139 |
thumb scrollAction:aBlock |
|
140 |
! |
|
141 |
||
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
142 |
scrollDownAction |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
143 |
"return the action which is performed on scroll-down. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
144 |
(vertical scrollBars)" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
145 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
146 |
^ button2 action |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
147 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
148 |
"Created: 28.5.1997 / 15:52:39 / cg" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
149 |
"Modified: 28.5.1997 / 15:53:56 / cg" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
150 |
! |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
151 |
|
455 | 152 |
scrollDownAction:aBlock |
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
153 |
"set the action, aBlock to be performed when the down-button is pressed. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
154 |
(for vertical scrollBars)" |
455 | 155 |
|
156 |
button2 action:aBlock |
|
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
157 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
158 |
"Modified: 28.5.1997 / 15:51:39 / cg" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
159 |
! |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
160 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
161 |
scrollLeftAction |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
162 |
"return the action which is performed on scroll-left |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
163 |
(for horizontal scrollBars)" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
164 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
165 |
^ button1 action |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
166 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
167 |
"Created: 28.5.1997 / 15:51:22 / cg" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
168 |
! |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
169 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
170 |
scrollLeftAction:aBlock |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
171 |
"set the action to be performed on scroll-left. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
172 |
(for horizontal scrollBars)" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
173 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
174 |
button1 action:aBlock |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
175 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
176 |
"Created: 28.5.1997 / 15:52:55 / cg" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
177 |
! |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
178 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
179 |
scrollRightAction |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
180 |
"return the action which is performed on scroll-right. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
181 |
(for horizontal scrollBars)" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
182 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
183 |
^ button2 action |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
184 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
185 |
"Created: 28.5.1997 / 15:53:15 / cg" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
186 |
! |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
187 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
188 |
scrollRightAction:aBlock |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
189 |
"set the action to be performed on scroll-right. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
190 |
(for horizontal scrollBars)" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
191 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
192 |
button2 action:aBlock |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
193 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
194 |
"Created: 28.5.1997 / 15:53:30 / cg" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
195 |
! |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
196 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
197 |
scrollUpAction |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
198 |
"return the action which is performed on scroll-up. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
199 |
(for vertical scrollBars)" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
200 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
201 |
^ button1 action |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
202 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
203 |
"Created: 28.5.1997 / 15:53:51 / cg" |
455 | 204 |
! |
205 |
||
206 |
scrollUpAction:aBlock |
|
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
207 |
"set the action, aBlock to be performed when the up-button is pressed. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
208 |
(for vertical scrollBars)" |
455 | 209 |
|
210 |
button1 action:aBlock |
|
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
211 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
212 |
"Modified: 28.5.1997 / 15:51:33 / cg" |
455 | 213 |
! |
214 |
||
215 |
synchronousOperation |
|
216 |
"set synchronous-mode - scroll action is performed for every movement |
|
217 |
of scroller. |
|
218 |
This is forwarded to the scroller here." |
|
219 |
||
220 |
thumb synchronousOperation |
|
221 |
! ! |
|
222 |
||
223 |
!ScrollBar methodsFor:'accessing-components'! |
|
224 |
||
225 |
downButton |
|
226 |
"return the down-button |
|
227 |
(Please: only use this direct access for special applications)" |
|
228 |
||
229 |
^ button2 |
|
230 |
||
231 |
" |
|
232 |
|v| |
|
233 |
||
234 |
v := ScrollableView for:EditTextView. |
|
235 |
v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile). |
|
236 |
v scrollBar upButton activeForegroundColor:Color red. |
|
237 |
v scrollBar downButton activeForegroundColor:Color red. |
|
238 |
v open |
|
239 |
" |
|
240 |
! |
|
241 |
||
242 |
thumb |
|
243 |
"return the thumb (i.e. the scroller subview) |
|
244 |
(Please: only use this direct access for special applications)" |
|
245 |
||
246 |
^ thumb |
|
247 |
||
248 |
" |
|
249 |
|v| |
|
250 |
||
251 |
v := ScrollableView for:EditTextView. |
|
252 |
v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile). |
|
253 |
v scrollBar thumb thumbColor:(Color red). |
|
254 |
v open |
|
255 |
" |
|
256 |
||
257 |
"Modified: 1.3.1996 / 19:15:50 / cg" |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
258 |
! |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
259 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
260 |
upButton |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
261 |
"return the up-button |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
262 |
(Please: only use this direct access for special applications)" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
263 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
264 |
^ button1 |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
265 |
|
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
266 |
" |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
267 |
|v| |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
268 |
|
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
269 |
v := ScrollableView for:EditTextView. |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
270 |
v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile). |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
271 |
v scrollBar upButton foregroundColor:(Color red). |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
272 |
v scrollBar upButton enteredForegroundColor:(Color red lightened). |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
273 |
v scrollBar downButton foregroundColor:(Color green). |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
274 |
v scrollBar downButton enteredForegroundColor:(Color green lightened). |
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
275 |
v open |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
276 |
" |
455 | 277 |
! ! |
278 |
||
279 |
!ScrollBar methodsFor:'accessing-look'! |
|
280 |
||
281 |
thumbColor:aColor |
|
282 |
"set the thumbs color" |
|
283 |
||
284 |
thumb thumbColor:aColor |
|
205 | 285 |
! |
128 | 286 |
|
133 | 287 |
upButtonLabel:label1 downButtonLabel:label2 |
446 | 288 |
"set the labels shown in the buttons. |
289 |
Because of the fixed button sizes, this only makes sense with |
|
290 |
single-character strings or small bitmaps." |
|
133 | 291 |
|
292 |
button1 label:label1. |
|
293 |
button2 label:label2. |
|
294 |
self setElementPositions. |
|
295 |
||
446 | 296 |
"not bad: |
133 | 297 |
|v| |
298 |
||
299 |
v := ScrollableView for:EditTextView. |
|
300 |
v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile). |
|
301 |
v scrollBar upButtonLabel:'+' downButtonLabel:'-'. |
|
302 |
v open |
|
303 |
" |
|
446 | 304 |
|
305 |
"also possible : |
|
306 |
|v| |
|
307 |
||
308 |
v := ScrollableView for:EditTextView. |
|
309 |
v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile). |
|
310 |
v scrollBar upButtonLabel:'u' downButtonLabel:'d'. |
|
311 |
v open |
|
312 |
" |
|
313 |
||
314 |
"BAD example: |
|
315 |
|v| |
|
316 |
||
317 |
v := ScrollableView for:EditTextView. |
|
318 |
v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile). |
|
319 |
v scrollBar upButtonLabel:'up' downButtonLabel:'down'. |
|
320 |
v open |
|
321 |
" |
|
322 |
||
323 |
"Modified: 1.3.1996 / 19:06:50 / cg" |
|
205 | 324 |
! ! |
325 |
||
326 |
!ScrollBar methodsFor:'change & update'! |
|
0 | 327 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
328 |
update:something with:aParameter from:changedObject |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
329 |
changedObject == thumb ifTrue:[ |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
330 |
self enableDisableButtons |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
331 |
] |
0 | 332 |
! ! |
333 |
||
334 |
!ScrollBar methodsFor:'events'! |
|
335 |
||
482
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
336 |
keyPress:key x:x y:y |
491 | 337 |
|
338 |
<resource: #keyboard (#BeginOfText #EndOfText)> |
|
339 |
||
482
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
340 |
(key == #BeginOfText) ifTrue:[ |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
341 |
self scrollToBeginning. |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
342 |
^ self |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
343 |
]. |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
344 |
(key == #EndOfText) ifTrue:[ |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
345 |
self scrollToEnd. |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
346 |
^ self |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
347 |
]. |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
348 |
super keyPress:key x:x y:y |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
349 |
|
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
350 |
"Created: 6.3.1996 / 17:58:02 / cg" |
491 | 351 |
"Modified: 7.3.1996 / 13:18:19 / cg" |
482
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
352 |
! |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
353 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
354 |
sizeChanged:how |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
355 |
"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
|
356 |
Also, if I became too small, hide thumb/buttons." |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
357 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
358 |
|upHeight downHeight thumbHeight upAndDownHeight bwn sep2 |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
359 |
thumbWidth w h style b1Hidden b2Hidden thumbHidden bX bY |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
360 |
leftWidth rightWidth leftAndRightWidth| |
453
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 |
button1 isNil ifTrue:[^ self]. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
363 |
thumb isNil ifTrue:[^ self]. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
364 |
button2 isNil ifTrue:[^ self]. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
365 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
366 |
style := styleSheet name. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
367 |
bwn := borderWidth negated + margin. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
368 |
|
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
369 |
self orientation == #horizontal ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
370 |
leftWidth := button1 width + borderWidth. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
371 |
rightWidth := button2 width + borderWidth. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
372 |
leftAndRightWidth := leftWidth + rightWidth. |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
373 |
|
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
374 |
thumbWidth := width - leftAndRightWidth - borderWidth - (elementSpacing * 3). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
375 |
" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
376 |
((buttonLayout ~~ #top) and:[buttonLayout ~~ #bottom]) ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
377 |
thumbWidth := thumbWidth - borderWidth |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
378 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
379 |
" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
380 |
buttonLayout == #around ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
381 |
thumbWidth := thumbWidth + borderWidth |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
382 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
383 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
384 |
"if I become too small, hide buttons" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
385 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
386 |
width < leftAndRightWidth ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
387 |
b1Hidden := b2Hidden := thumbHidden := true. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
388 |
] ifFalse:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
389 |
b1Hidden := b2Hidden := thumbHidden := false. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
390 |
]. |
0 | 391 |
|
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
392 |
(thumbWidth < 10) ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
393 |
thumbHidden := true. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
394 |
] ifFalse:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
395 |
thumbHidden := false. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
396 |
]. |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
397 |
|
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
398 |
button1 hiddenOnRealize:b1Hidden. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
399 |
b1Hidden ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
400 |
button1 unmap |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
401 |
] ifFalse:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
402 |
shown ifTrue:[button1 realize] |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
403 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
404 |
button2 hiddenOnRealize:b1Hidden. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
405 |
b2Hidden ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
406 |
button2 unmap |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
407 |
] ifFalse:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
408 |
shown ifTrue:[button2 realize] |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
409 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
410 |
thumb hiddenOnRealize:thumbHidden. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
411 |
thumbHidden ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
412 |
thumb unmap |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
413 |
] ifFalse:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
414 |
shown ifTrue:[thumb realize] |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
415 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
416 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
417 |
"height of buttons is always my width" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
418 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
419 |
h := height - (margin * 2). |
130 | 420 |
|
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
421 |
(h ~~ button1 height) ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
422 |
button1 height:h. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
423 |
button2 height:h |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
424 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
425 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
426 |
thumbHeight := h. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
427 |
style := styleSheet name. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
428 |
style == #next ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
429 |
thumbHeight := thumbHeight - (thumb borderWidth * 2). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
430 |
thumbWidth := thumbWidth - 1 |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
431 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
432 |
style == #motif ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
433 |
thumbWidth := thumbWidth - margin |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
434 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
435 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
436 |
" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
437 |
a kludge: views with width or height of 0 are illegal |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
438 |
avoid error from view-creation (it will be hidden anyway) |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
439 |
" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
440 |
thumbWidth <= 0 ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
441 |
thumbWidth := 1 |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
442 |
]. |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
443 |
|
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
444 |
(buttonLayout == #bottom) ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
445 |
"buttons at left" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
446 |
thumb extent:(thumbWidth @ thumbHeight). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
447 |
^ self |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
448 |
]. |
0 | 449 |
|
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
450 |
sep2 := elementSpacing * 2. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
451 |
(buttonLayout == #top) ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
452 |
"buttons at right" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
453 |
thumbWidth := thumbWidth + borderWidth. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
454 |
thumbHidden ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
455 |
bX := elementSpacing |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
456 |
] ifFalse:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
457 |
bX := thumbWidth + sep2. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
458 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
459 |
(how == #smaller) ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
460 |
thumb extent:(thumbWidth @ thumbHeight). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
461 |
button1 origin:(bX @ bwn). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
462 |
button2 origin:((bX + leftWidth) @ bwn) |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
463 |
] ifFalse:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
464 |
button1 origin:(bX @ bwn). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
465 |
button2 origin:((bX + leftWidth) @ bwn). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
466 |
thumb extent:(thumbWidth @ thumbHeight) |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
467 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
468 |
^ self |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
469 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
470 |
"button around thumb" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
471 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
472 |
style == #motif ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
473 |
sep2 := sep2 + 1 |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
474 |
]. |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
475 |
|
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
476 |
button1 origin:(bwn @ bwn). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
477 |
style == #os2 ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
478 |
button2 origin:((leftWidth + thumbWidth + sep2 - margin) @ bwn). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
479 |
thumb extent:((thumbWidth - margin - margin) @ thumbHeight). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
480 |
thumb origin:((leftWidth - borderWidth + elementSpacing + margin) @ bwn) |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
481 |
] ifFalse:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
482 |
button2 origin:((leftWidth + thumbWidth + sep2 - (margin // 2)) @ bwn). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
483 |
thumb extent:((thumbWidth + margin - (margin // 2)) @ thumbHeight). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
484 |
thumb origin:((leftWidth - borderWidth + elementSpacing) @ bwn) |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
485 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
486 |
] ifFalse:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
487 |
upHeight := button1 height + borderWidth. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
488 |
downHeight := button2 height + borderWidth. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
489 |
upAndDownHeight := upHeight + downHeight. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
490 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
491 |
thumbHeight := height - upAndDownHeight - borderWidth - (elementSpacing * 3). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
492 |
" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
493 |
((buttonLayout ~~ #top) and:[buttonLayout ~~ #bottom]) ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
494 |
thumbHeight := thumbHeight - borderWidth |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
495 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
496 |
" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
497 |
buttonLayout == #around ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
498 |
thumbHeight := thumbHeight + borderWidth |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
499 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
500 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
501 |
"if I become too small, hide buttons and thumb" |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
502 |
|
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
503 |
height < upAndDownHeight ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
504 |
b1Hidden := b2Hidden := thumbHidden := true. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
505 |
] ifFalse:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
506 |
b1Hidden := b2Hidden := thumbHidden := false. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
507 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
508 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
509 |
(thumbHeight < 10) ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
510 |
thumbHidden := true. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
511 |
] ifFalse:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
512 |
thumbHidden := false. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
513 |
]. |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
514 |
|
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
515 |
button1 hiddenOnRealize:b1Hidden. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
516 |
b1Hidden ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
517 |
button1 unmap |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
518 |
] ifFalse:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
519 |
shown ifTrue:[button1 realize] |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
520 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
521 |
button2 hiddenOnRealize:b1Hidden. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
522 |
b2Hidden ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
523 |
button2 unmap |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
524 |
] ifFalse:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
525 |
shown ifTrue:[button2 realize] |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
526 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
527 |
thumb hiddenOnRealize:thumbHidden. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
528 |
thumbHidden ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
529 |
thumb unmap |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
530 |
] ifFalse:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
531 |
shown ifTrue:[thumb realize] |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
532 |
]. |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
533 |
|
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
534 |
"width of buttons is always my width" |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
535 |
|
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
536 |
w := width - (margin * 2). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
537 |
(w ~~ button1 width) ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
538 |
button1 width:w. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
539 |
button2 width:w |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
540 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
541 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
542 |
thumbWidth := w. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
543 |
style == #next ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
544 |
thumbWidth := thumbWidth - (thumb borderWidth * 2). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
545 |
thumbHeight := thumbHeight - 1 |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
546 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
547 |
style == #motif ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
548 |
thumbHeight := thumbHeight - margin |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
549 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
550 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
551 |
" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
552 |
a kludge: views with width or height of 0 are illegal |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
553 |
avoid error from view-creation (it will be hidden anyway) |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
554 |
" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
555 |
thumbHeight <= 0 ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
556 |
thumbHeight := 1 |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
557 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
558 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
559 |
(buttonLayout == #top) ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
560 |
"buttons at top" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
561 |
thumb extent:(thumbWidth @ thumbHeight). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
562 |
^ self |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
563 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
564 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
565 |
sep2 := elementSpacing * 2. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
566 |
(buttonLayout == #bottom) ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
567 |
"buttons at bottom" |
855 | 568 |
|
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
569 |
thumbHeight := thumbHeight + borderWidth. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
570 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
571 |
bY := thumbHeight + sep2. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
572 |
(bY + upAndDownHeight) >= height ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
573 |
bY := height - margin - upAndDownHeight |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
574 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
575 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
576 |
button1 viewGravity:#North. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
577 |
button2 viewGravity:#North. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
578 |
(how == #smaller) ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
579 |
thumb extent:(thumbWidth @ thumbHeight). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
580 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
581 |
button1 origin:(bwn @ bY). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
582 |
button2 origin:(bwn @ (bY + upHeight)) |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
583 |
] ifFalse:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
584 |
button1 origin:(bwn @ bY). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
585 |
button2 origin:(bwn @ (bY + upHeight)). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
586 |
thumb extent:(thumbWidth @ thumbHeight) |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
587 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
588 |
^ self |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
589 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
590 |
"buttons around thumb" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
591 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
592 |
style == #motif ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
593 |
sep2 := sep2 + 1 |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
594 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
595 |
button1 origin:(bwn @ bwn). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
596 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
597 |
style == #os2 ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
598 |
button2 origin:(bwn @ (upHeight + thumbHeight + sep2 - margin "+ borderWidth")). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
599 |
thumb extent:(thumbWidth @ (thumbHeight - margin - margin "+ margin - (margin // 2)")). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
600 |
thumb origin:(bwn @ (upHeight - borderWidth + elementSpacing + margin)) |
613 | 601 |
] ifFalse:[ |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
602 |
button2 origin:(bwn @ (upHeight + thumbHeight + sep2 - (margin // 2) "+ borderWidth")). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
603 |
thumb extent:(thumbWidth @ (thumbHeight + margin - (margin // 2))). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
604 |
thumb origin:(bwn @ (upHeight - borderWidth + elementSpacing)) |
613 | 605 |
]. |
63 | 606 |
]. |
613 | 607 |
|
608 |
"Modified: 3.5.1996 / 23:49:02 / stefan" |
|
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
609 |
"Modified: 28.5.1997 / 16:18:21 / cg" |
0 | 610 |
! ! |
110 | 611 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
612 |
!ScrollBar methodsFor:'forced scroll'! |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
613 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
614 |
pageDown |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
615 |
"page down/right" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
616 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
617 |
thumb pageDown |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
618 |
! |
205 | 619 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
620 |
pageUp |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
621 |
"page up/left" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
622 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
623 |
thumb pageUp |
482
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
624 |
! |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
625 |
|
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
626 |
scrollToBeginning |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
627 |
"to top" |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
628 |
|
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
629 |
thumb scrollToBeginning |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
630 |
|
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
631 |
"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
|
632 |
! |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
633 |
|
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
634 |
scrollToEnd |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
635 |
"to end" |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
636 |
|
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
637 |
thumb scrollToEnd |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
638 |
|
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
639 |
"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
|
640 |
"Modified: 6.3.1996 / 17:54:49 / cg" |
453
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 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
643 |
!ScrollBar methodsFor:'initialization'! |
205 | 644 |
|
455 | 645 |
createElements |
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
646 |
"private: create my elements" |
1041 | 647 |
|
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
648 |
self orientation == #horizontal ifTrue:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
649 |
button1 := ArrowButton leftIn:self. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
650 |
button1 name:'leftButton'. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
651 |
button2 := ArrowButton rightIn:self. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
652 |
button2 name:'rightButton'. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
653 |
thumb := HorizontalScroller in:self. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
654 |
] ifFalse:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
655 |
button1 := ArrowButton upIn:self. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
656 |
button1 name:'upButton'. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
657 |
button2 := ArrowButton downIn:self. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
658 |
button2 name:'downButton'. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
659 |
thumb := Scroller in:self. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
660 |
]. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
661 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
662 |
"Modified: 28.5.1997 / 15:49:05 / cg" |
455 | 663 |
! |
664 |
||
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
665 |
defaultExtent |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
666 |
"compute my extent from sub-components" |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
667 |
|
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
668 |
^ self preferredExtent |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
669 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
670 |
|
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
671 |
"Created: 1.3.1996 / 19:22:11 / cg" |
205 | 672 |
! |
673 |
||
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
674 |
initStyle |
968 | 675 |
"setup viewStyle specifics" |
676 |
||
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
677 |
super initStyle. |
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 |
buttonLayout := DefaultButtonPositions. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
680 |
DefaultLevel notNil ifTrue:[ |
968 | 681 |
self level:DefaultLevel |
205 | 682 |
]. |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
683 |
elementSpacing := DefaultElementSpacing |
968 | 684 |
|
685 |
"Modified: 22.1.1997 / 11:57:41 / cg" |
|
205 | 686 |
! |
687 |
||
688 |
initialize |
|
689 |
"setup; create the 2 buttons and a scroller" |
|
690 |
||
691 |
|clr style| |
|
692 |
||
693 |
super initialize. |
|
694 |
||
695 |
self createElements. |
|
696 |
||
697 |
(styleSheet at:'scrollBarDisableButtons' default:false) ifTrue:[ |
|
706 | 698 |
thumb addDependent:self |
205 | 699 |
]. |
700 |
||
345 | 701 |
button1 autoRepeat:true. |
702 |
button2 autoRepeat:true. |
|
205 | 703 |
|
704 |
button1 borderWidth:borderWidth. |
|
705 |
DefaultScrollerBordered ifFalse:[ |
|
706 | 706 |
thumb borderWidth:borderWidth. |
205 | 707 |
]. |
708 |
button2 borderWidth:borderWidth. |
|
709 |
||
710 |
style := styleSheet name. |
|
744
8d84193ca610
use 'Screen current' instead of 'Display'
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
711 |
((style = #iris) and:[Screen current hasGrayscales]) ifTrue:[ |
706 | 712 |
"have to change some of Buttons defaults" |
713 |
clr := (Color gray:25) on:device. |
|
710 | 714 |
button1 passiveLevel:2. |
715 |
button2 passiveLevel:2. |
|
706 | 716 |
button1 foregroundColor:clr. |
717 |
button1 activeForegroundColor:clr. |
|
718 |
button1 enteredForegroundColor:clr. |
|
719 |
button2 foregroundColor:clr. |
|
720 |
button2 activeForegroundColor:clr. |
|
721 |
button2 enteredForegroundColor:clr. |
|
205 | 722 |
]. |
723 |
||
724 |
self setElementPositions. |
|
725 |
||
726 |
style = #motif ifTrue:[ |
|
706 | 727 |
clr := thumb thumbColor. |
728 |
button1 foregroundColor:clr. |
|
729 |
button2 foregroundColor:clr. |
|
345 | 730 |
|
706 | 731 |
clr := thumb viewBackground. |
732 |
button1 viewBackground:clr. |
|
733 |
button2 viewBackground:clr. |
|
734 |
button1 backgroundColor:clr. |
|
735 |
button2 backgroundColor:clr. |
|
736 |
button1 activeBackgroundColor:clr. |
|
737 |
button2 activeBackgroundColor:clr. |
|
709 | 738 |
device hasGrayscales ifFalse:[ |
706 | 739 |
button1 activeForegroundColor:Black. |
740 |
button2 activeForegroundColor:Black. |
|
741 |
] |
|
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
742 |
] |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
743 |
|
744
8d84193ca610
use 'Screen current' instead of 'Display'
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
744 |
"Modified: 3.6.1996 / 17:53:32 / cg" |
205 | 745 |
! |
746 |
||
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
747 |
reinitialize |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
748 |
super reinitialize. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
749 |
self setElementPositions. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
750 |
! |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
751 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
752 |
setElementPositions |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
753 |
"position sub-components" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
754 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
755 |
|bwn| |
205 | 756 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
757 |
bwn := borderWidth negated + margin. |
205 | 758 |
|
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
759 |
self orientation == #horizontal ifTrue:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
760 |
(buttonLayout == #bottom) ifTrue:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
761 |
"buttons at left" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
762 |
button1 origin:(bwn @ bwn). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
763 |
button1 viewGravity:#West. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
764 |
button2 origin:(button1 width @ bwn). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
765 |
button2 viewGravity:#West. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
766 |
thumb origin:((button1 width |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
767 |
+ borderWidth |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
768 |
+ button2 width |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
769 |
+ elementSpacing + elementSpacing) @ bwn). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
770 |
thumb viewGravity:#West. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
771 |
^ self |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
772 |
]. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
773 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
774 |
(buttonLayout == #top) ifTrue:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
775 |
"buttons at right" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
776 |
button1 viewGravity:#West. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
777 |
button2 viewGravity:#West. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
778 |
thumb origin:(bwn @ bwn). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
779 |
thumb viewGravity:#West |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
780 |
]. |
205 | 781 |
|
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
782 |
"buttonLayout == #around " |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
783 |
button1 origin:(bwn @ bwn). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
784 |
button1 viewGravity:#West. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
785 |
button2 viewGravity:#West. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
786 |
thumb origin:((button1 width + elementSpacing) @ bwn). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
787 |
thumb viewGravity:#West |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
788 |
] ifFalse:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
789 |
(buttonLayout == #top) ifTrue:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
790 |
button1 origin:(bwn @ bwn). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
791 |
button1 viewGravity:#North. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
792 |
button2 origin:(bwn @ (button1 height)). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
793 |
button2 viewGravity:#North. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
794 |
thumb origin:(bwn @ (button1 height |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
795 |
+ borderWidth |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
796 |
+ button2 height |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
797 |
+ elementSpacing |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
798 |
+ elementSpacing)). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
799 |
thumb viewGravity:#North. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
800 |
^ self |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
801 |
]. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
802 |
(buttonLayout == #bottom) ifTrue:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
803 |
device supportsViewGravity ifTrue:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
804 |
button1 viewGravity:#South. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
805 |
button2 viewGravity:#South. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
806 |
thumb viewGravity:#North. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
807 |
]. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
808 |
thumb origin:(bwn @ bwn). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
809 |
^ self |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
810 |
]. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
811 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
812 |
"buttonLayout == #around" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
813 |
button1 origin:(bwn @ bwn). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
814 |
button1 viewGravity:#North. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
815 |
"/ button2 viewGravity:#North. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
816 |
thumb origin:(bwn @ (button1 height + elementSpacing)). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
817 |
thumb viewGravity:#North |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
818 |
] |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
819 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
820 |
"Modified: 28.5.1997 / 15:50:27 / cg" |
205 | 821 |
! ! |
822 |
||
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
823 |
!ScrollBar methodsFor:'private'! |
205 | 824 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
825 |
enableDisableButtons |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
826 |
"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
|
827 |
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
|
828 |
as appropriate." |
205 | 829 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
830 |
|e1 e2 th to| |
205 | 831 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
832 |
(styleSheet at:'scrollBarDisableButtons' default:false) ifFalse:[^ self]. |
110 | 833 |
|
205 | 834 |
e1 := e2 := true. |
835 |
(th := thumb thumbHeight) notNil ifTrue:[ |
|
836 |
(th >= (thumb stop)) ifTrue:[ |
|
837 |
e1 := false. |
|
838 |
e2 := false |
|
839 |
] |
|
840 |
]. |
|
841 |
((to := thumb thumbOrigin) <= thumb start) ifTrue:[ |
|
842 |
e1 := false |
|
843 |
] ifFalse:[ |
|
844 |
th isNil ifTrue:[th := 0]. |
|
845 |
(to + th) >= thumb stop ifTrue:[ |
|
846 |
e2 := false |
|
847 |
] |
|
848 |
]. |
|
849 |
e1 ifTrue:[button1 enable] ifFalse:[button1 disable]. |
|
850 |
e2 ifTrue:[button2 enable] ifFalse:[button2 disable]. |
|
851 |
! ! |
|
852 |
||
455 | 853 |
!ScrollBar methodsFor:'private scrollview interface'! |
854 |
||
855 |
setThumbFor:aView |
|
856 |
"adjust thumb for aView |
|
857 |
(i.e. adjust thumbs origin & size for views size & views contents). |
|
858 |
This is forwarded to the scroller here." |
|
859 |
||
860 |
thumb setThumbFor:aView. |
|
861 |
self enableDisableButtons |
|
862 |
! |
|
863 |
||
864 |
setThumbHeightFor:aView |
|
865 |
"adjust thumbs height for aViews size & contents. |
|
866 |
This is forwarded to the scroller here." |
|
867 |
||
868 |
thumb setThumbHeightFor:aView. |
|
869 |
self enableDisableButtons |
|
870 |
! |
|
871 |
||
872 |
setThumbOriginFor:aView |
|
873 |
"adjust thumbs origin for aViews size & contents. |
|
874 |
This is forwarded to the scroller here." |
|
875 |
||
876 |
thumb setThumbOriginFor:aView. |
|
877 |
self enableDisableButtons |
|
878 |
! ! |
|
879 |
||
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
880 |
!ScrollBar methodsFor:'queries'! |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
881 |
|
1117 | 882 |
isMiniScroller |
883 |
^ false |
|
884 |
||
885 |
"Created: 7.3.1997 / 16:20:12 / cg" |
|
886 |
! |
|
887 |
||
1006 | 888 |
orientation |
889 |
"for ST-80 compatibility, answer this query" |
|
890 |
||
891 |
^ #vertical |
|
892 |
! |
|
893 |
||
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
894 |
preferredExtent |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
895 |
"compute my extent from sub-components" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
896 |
|
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
897 |
<resource: #style (#name)> |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
898 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
899 |
|w h form1 form2 |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
900 |
height1 "{ Class: SmallInteger }" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
901 |
height2 "{ Class: SmallInteger }" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
902 |
width1 width2 style| |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
903 |
|
797 | 904 |
"/ If I have an explicit preferredExtent .. |
905 |
||
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
710
diff
changeset
|
906 |
preferredExtent notNil ifTrue:[ |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
710
diff
changeset
|
907 |
^ preferredExtent |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
710
diff
changeset
|
908 |
]. |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
710
diff
changeset
|
909 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
910 |
" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
911 |
need fix - this is a kludge; |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
912 |
the if should not be needed ... |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
913 |
" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
914 |
style := styleSheet name. |
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
915 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
916 |
self orientation == #horizontal ifTrue:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
917 |
form1 := ArrowButton leftArrowButtonForm:style on:device. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
918 |
form2 := ArrowButton rightArrowButtonForm:style on:device. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
919 |
] ifFalse:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
920 |
form1 := ArrowButton upArrowButtonForm:style on:device. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
921 |
form2 := ArrowButton downArrowButtonForm:style on:device. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
922 |
]. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
923 |
form1 isNil ifTrue:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
924 |
height1 := width1 := 16. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
925 |
] ifFalse:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
926 |
height1 := form1 height. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
927 |
width1 := form1 width |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
928 |
]. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
929 |
form2 isNil ifTrue:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
930 |
height2 := width2 := 16 |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
931 |
] ifFalse:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
932 |
height2 := form2 height. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
933 |
width2 := form2 width |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
934 |
]. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
935 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
936 |
self orientation == #horizontal ifTrue:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
937 |
w := width1 + width2 + (1 * 2) + (HorizontalScroller defaultExtent x). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
938 |
h := height1 max:height2. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
939 |
] ifFalse:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
940 |
h := height1 + height2 + (1 * 2) + (Scroller defaultExtent y). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
941 |
w := width1 max:width2. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
942 |
]. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
943 |
style ~~ #normal ifTrue:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
944 |
h := h + 4. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
945 |
w := w + 4 |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
946 |
]. |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
947 |
|
786
8b301af1cdcc
remember and do not recompute the preferredExtent;
Claus Gittinger <cg@exept.de>
parents:
744
diff
changeset
|
948 |
preferredExtent := w @ h. |
8b301af1cdcc
remember and do not recompute the preferredExtent;
Claus Gittinger <cg@exept.de>
parents:
744
diff
changeset
|
949 |
^ preferredExtent |
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
710
diff
changeset
|
950 |
|
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
951 |
"Modified: 28.5.1997 / 15:16:56 / cg" |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
952 |
! ! |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
953 |
|
1213
8839c02cd7ad
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1118
diff
changeset
|
954 |
!ScrollBar methodsFor:'queries - internal'! |
8839c02cd7ad
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1118
diff
changeset
|
955 |
|
8839c02cd7ad
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1118
diff
changeset
|
956 |
nativeWindowType |
8839c02cd7ad
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1118
diff
changeset
|
957 |
"return a symbol describing my native window type |
8839c02cd7ad
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1118
diff
changeset
|
958 |
(may be used internally by the device as a native window creation hint)" |
8839c02cd7ad
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1118
diff
changeset
|
959 |
|
1214 | 960 |
self orientation == #vertical ifTrue:[ |
961 |
^ #VerticalScrollBar |
|
962 |
]. |
|
963 |
^ #HorizontalScrollBar |
|
1213
8839c02cd7ad
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1118
diff
changeset
|
964 |
! ! |
8839c02cd7ad
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1118
diff
changeset
|
965 |
|
855 | 966 |
!ScrollBar class methodsFor:'documentation'! |
205 | 967 |
|
968 |
version |
|
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
969 |
^ '$Header: /cvs/stx/stx/libwidg/ScrollBar.st,v 1.48 1997-05-28 14:21:11 cg Exp $' |
205 | 970 |
! ! |