author | Claus Gittinger <cg@exept.de> |
Tue, 03 Mar 2015 11:37:29 +0100 | |
changeset 5307 | 32c2e84b9c1d |
parent 5127 | fcd696f9f401 |
child 5419 | 2b1c1cf06f3b |
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 |
" |
|
2230 | 12 |
"{ Package: 'stx:libwidg' }" |
13 |
||
119 | 14 |
SimpleView subclass:#ScrollBar |
1950 | 15 |
instanceVariableNames:'thumb button1 button2 buttonLayout elementSpacing orientation' |
345 | 16 |
classVariableNames:'DefaultButtonPositions DefaultLevel DefaultElementSpacing |
1887
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
17 |
DefaultScrollerBordered DefaultHScrollBarHeight |
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
18 |
DefaultVScrollBarWidth' |
345 | 19 |
poolDictionaries:'' |
20 |
category:'Views-Interactors' |
|
0 | 21 |
! |
22 |
||
855 | 23 |
!ScrollBar class methodsFor:'documentation'! |
0 | 24 |
|
38 | 25 |
copyright |
26 |
" |
|
27 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
59 | 28 |
All Rights Reserved |
0 | 29 |
|
38 | 30 |
This software is furnished under a license and may be used |
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
38 |
||
39 |
documentation |
|
40 |
" |
|
41 |
this class implements vertical scrollbars with scroller and |
|
42 |
2 step-scroll buttons. when moved or stepped, it performs a |
|
43 |
predefined action. |
|
44 |
||
45 |
The action is specified by: the block to be evaluated for step-up |
|
585 | 46 |
aScrollBar scrollUpAction:aBlock |
47 |
(scrollLeftAction for hor-Scrollbars) |
|
0 | 48 |
|
585 | 49 |
aScrollBar scrollDownAction:aBlock the block to be evaluated for step-down |
50 |
(scrollRightAction for hor-Scrollbars) |
|
38 | 51 |
|
585 | 52 |
aScrollbar scrollAction:aBlock the block to be evaluated for scroll |
53 |
passing percentage as argument. |
|
38 | 54 |
|
55 |
Scrollbars can scroll syncronous (i.e. every movement is notified immediately via the |
|
56 |
scrollAction) or asynchronous (i.e. only one notification takes place at the end of the movement). |
|
57 |
The choice is up to the user of the scrollbar (typically, views which are complicated to redraw, |
|
58 |
will set it to asynchronous.) |
|
59 |
||
60 |
Most often scrollbars are used hidden with ScrollableView or HVScrollableView (i.e. you |
|
61 |
dont have to care for all the details). |
|
128 | 62 |
|
63 |
The scrollBars and scrollers protocols have been made similar enough to |
|
64 |
allow transparent use of either a scroller or a scrollBar in applications. |
|
585 | 65 |
|
66 |
[author:] |
|
67 |
Claus Gittinger |
|
68 |
||
69 |
[see also:] |
|
70 |
Scroller Slider |
|
71 |
ScrollableView |
|
38 | 72 |
" |
0 | 73 |
! ! |
74 |
||
855 | 75 |
!ScrollBar class methodsFor:'style changes'! |
0 | 76 |
|
59 | 77 |
updateStyleCache |
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
78 |
"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
|
79 |
|
1538
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
80 |
<resource: #style (#'scrollBar.buttonPositions' |
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
81 |
#'scrollBar.level' |
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
82 |
#'scrollBar.scrollerBordered' |
1887
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
83 |
#'scrollBar.elementSpacing' |
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
84 |
#'scrollBar.vScrollBarWidth' |
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
85 |
#'scrollBar.vScrollBarWidth' |
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
86 |
)> |
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
87 |
|
1887
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
88 |
DefaultButtonPositions := StyleSheet at:#'scrollBar.buttonPositions' default:#bottom. |
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
89 |
DefaultLevel := StyleSheet at:#'scrollBar.level'. |
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
90 |
DefaultScrollerBordered := StyleSheet at:#'scrollBar.scrollerBordered' default:false. |
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
91 |
DefaultElementSpacing := StyleSheet |
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
92 |
at:#'scrollBar.elementSpacing' |
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
93 |
default:(StyleSheet is3D ifTrue:[1] ifFalse:[0]). |
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
94 |
|
1887
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
95 |
DefaultVScrollBarWidth := StyleSheet at:#'scrollBar.vScrollBarWidth' default:nil. |
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
96 |
DefaultHScrollBarHeight := StyleSheet at:#'scrollBar.hScrollBarHeight' default:nil. |
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
97 |
|
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
98 |
"Modified: / 28.4.1999 / 19:27:53 / cg" |
0 | 99 |
! ! |
100 |
||
205 | 101 |
!ScrollBar methodsFor:'accessing'! |
0 | 102 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
103 |
thumbHeight |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
104 |
"return height of thumb in percent" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
105 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
106 |
^ thumb thumbHeight |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
107 |
! |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
108 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
109 |
thumbHeight:newHeight |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
110 |
"set height of thumb in percent" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
111 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
112 |
thumb thumbHeight:newHeight. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
113 |
self enableDisableButtons |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
114 |
! |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
115 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
116 |
thumbOrigin |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
117 |
"return position of (top of) thumb in percent" |
205 | 118 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
119 |
^ thumb thumbOrigin |
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 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
122 |
thumbOrigin:newOrigin |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
123 |
"set position of (top of) thumb in percent" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
124 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
125 |
thumb thumbOrigin:newOrigin. |
3018 | 126 |
self enableDisableButtons. |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
127 |
! |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
128 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
129 |
thumbOrigin:newOrigin thumbHeight:newHeight |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
130 |
"set origin and height of thumb (both in percent)" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
131 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
132 |
thumb thumbOrigin:newOrigin thumbHeight:newHeight. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
133 |
self enableDisableButtons |
455 | 134 |
! ! |
135 |
||
136 |
!ScrollBar methodsFor:'accessing-behavior'! |
|
137 |
||
138 |
asynchronousOperation |
|
3846 | 139 |
<resource: #obsolete> |
3017 | 140 |
self obsoleteMethodWarning:'use #beAsynchronous'. |
141 |
self beAsynchronous |
|
142 |
! |
|
143 |
||
144 |
beAsynchronous |
|
455 | 145 |
"set asynchronous-mode - scroll action is performed after movement |
3017 | 146 |
of scroller when mouse-button is finally released (no tracking). |
455 | 147 |
This is forwarded to the scroller here." |
148 |
||
3017 | 149 |
thumb beAsynchronous |
150 |
! |
|
151 |
||
152 |
beSynchronous |
|
153 |
"set synchronous-mode - scroll action is performed for every movement |
|
154 |
of scroller (tracking). |
|
155 |
This is forwarded to the scroller here." |
|
156 |
||
157 |
thumb beSynchronous |
|
158 |
! |
|
159 |
||
160 |
isSynchronous |
|
161 |
"return true if the scroll-mode is synchronous. |
|
162 |
If true, the scroll action is performed for every movement of the thumb (tracking). |
|
163 |
If false, the scroll action is only performed at the end." |
|
164 |
||
165 |
^ thumb isSynchronous |
|
455 | 166 |
! |
167 |
||
168 |
scrollAction:aBlock |
|
169 |
"set the action, aBlock to be performed when the scroller is moved. |
|
170 |
This is forwarded to the scroller here." |
|
171 |
||
172 |
thumb scrollAction:aBlock |
|
173 |
! |
|
174 |
||
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
175 |
scrollDownAction |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
176 |
"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
|
177 |
(vertical scrollBars)" |
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 |
^ button2 action |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
180 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
181 |
"Created: 28.5.1997 / 15:52:39 / cg" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
182 |
"Modified: 28.5.1997 / 15:53:56 / cg" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
183 |
! |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
184 |
|
455 | 185 |
scrollDownAction:aBlock |
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
186 |
"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
|
187 |
(for vertical scrollBars)" |
455 | 188 |
|
189 |
button2 action:aBlock |
|
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
190 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
191 |
"Modified: 28.5.1997 / 15:51:39 / cg" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
192 |
! |
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 |
scrollLeftAction |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
195 |
"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
|
196 |
(for horizontal scrollBars)" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
197 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
198 |
^ button1 action |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
199 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
200 |
"Created: 28.5.1997 / 15:51:22 / cg" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
201 |
! |
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 |
scrollLeftAction:aBlock |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
204 |
"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
|
205 |
(for horizontal scrollBars)" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
206 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
207 |
button1 action:aBlock |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
208 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
209 |
"Created: 28.5.1997 / 15:52:55 / cg" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
210 |
! |
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 |
scrollRightAction |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
213 |
"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
|
214 |
(for horizontal scrollBars)" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
215 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
216 |
^ button2 action |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
217 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
218 |
"Created: 28.5.1997 / 15:53:15 / cg" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
219 |
! |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
220 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
221 |
scrollRightAction:aBlock |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
222 |
"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
|
223 |
(for horizontal scrollBars)" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
224 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
225 |
button2 action:aBlock |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
226 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
227 |
"Created: 28.5.1997 / 15:53:30 / cg" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
228 |
! |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
229 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
230 |
scrollUpAction |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
231 |
"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
|
232 |
(for vertical scrollBars)" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
233 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
234 |
^ button1 action |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
235 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
236 |
"Created: 28.5.1997 / 15:53:51 / cg" |
455 | 237 |
! |
238 |
||
239 |
scrollUpAction:aBlock |
|
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
240 |
"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
|
241 |
(for vertical scrollBars)" |
455 | 242 |
|
243 |
button1 action:aBlock |
|
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
244 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
245 |
"Modified: 28.5.1997 / 15:51:33 / cg" |
455 | 246 |
! |
247 |
||
248 |
synchronousOperation |
|
3846 | 249 |
<resource: #obsolete> |
3017 | 250 |
self obsoleteMethodWarning:'use #beSynchronous'. |
251 |
self beSynchronous |
|
455 | 252 |
! ! |
253 |
||
254 |
!ScrollBar methodsFor:'accessing-components'! |
|
255 |
||
256 |
downButton |
|
257 |
"return the down-button |
|
258 |
(Please: only use this direct access for special applications)" |
|
259 |
||
260 |
^ button2 |
|
261 |
||
262 |
" |
|
263 |
|v| |
|
264 |
||
265 |
v := ScrollableView for:EditTextView. |
|
266 |
v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile). |
|
267 |
v scrollBar upButton activeForegroundColor:Color red. |
|
268 |
v scrollBar downButton activeForegroundColor:Color red. |
|
269 |
v open |
|
270 |
" |
|
271 |
! |
|
272 |
||
273 |
thumb |
|
274 |
"return the thumb (i.e. the scroller subview) |
|
275 |
(Please: only use this direct access for special applications)" |
|
276 |
||
277 |
^ thumb |
|
278 |
||
279 |
" |
|
280 |
|v| |
|
281 |
||
282 |
v := ScrollableView for:EditTextView. |
|
283 |
v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile). |
|
284 |
v scrollBar thumb thumbColor:(Color red). |
|
285 |
v open |
|
286 |
" |
|
287 |
||
288 |
"Modified: 1.3.1996 / 19:15:50 / cg" |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
289 |
! |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
290 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
291 |
upButton |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
292 |
"return the up-button |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
293 |
(Please: only use this direct access for special applications)" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
294 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
295 |
^ button1 |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
296 |
|
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
297 |
" |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
298 |
|v| |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
299 |
|
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
300 |
v := ScrollableView for:EditTextView. |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
301 |
v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile). |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
302 |
v scrollBar upButton foregroundColor:(Color red). |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
303 |
v scrollBar upButton enteredForegroundColor:(Color red lightened). |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
304 |
v scrollBar downButton foregroundColor:(Color green). |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
305 |
v scrollBar downButton enteredForegroundColor:(Color green lightened). |
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
306 |
v open |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
307 |
" |
455 | 308 |
! ! |
309 |
||
310 |
!ScrollBar methodsFor:'accessing-look'! |
|
311 |
||
3602 | 312 |
allViewBackground:something if:condition |
2456 | 313 |
"blocked for all scrollBars (I want my own background)" |
1958 | 314 |
|
2456 | 315 |
"/ ^ super allViewBackground:something |
1958 | 316 |
! |
317 |
||
1950 | 318 |
orientation |
319 |
"for ST-80 compatibility, answer this query" |
|
320 |
||
321 |
^ orientation |
|
322 |
! |
|
323 |
||
324 |
orientation:aSymbol |
|
325 |
"set the orientation; either #horizontal or #vertical" |
|
326 |
||
1952 | 327 |
aSymbol ~~ orientation ifTrue:[ |
328 |
orientation := aSymbol. |
|
329 |
] |
|
1950 | 330 |
! |
331 |
||
455 | 332 |
thumbColor:aColor |
333 |
"set the thumbs color" |
|
334 |
||
335 |
thumb thumbColor:aColor |
|
205 | 336 |
! |
128 | 337 |
|
133 | 338 |
upButtonLabel:label1 downButtonLabel:label2 |
446 | 339 |
"set the labels shown in the buttons. |
340 |
Because of the fixed button sizes, this only makes sense with |
|
341 |
single-character strings or small bitmaps." |
|
133 | 342 |
|
343 |
button1 label:label1. |
|
344 |
button2 label:label2. |
|
345 |
self setElementPositions. |
|
346 |
||
446 | 347 |
"not bad: |
133 | 348 |
|v| |
349 |
||
350 |
v := ScrollableView for:EditTextView. |
|
351 |
v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile). |
|
352 |
v scrollBar upButtonLabel:'+' downButtonLabel:'-'. |
|
353 |
v open |
|
354 |
" |
|
446 | 355 |
|
356 |
"also possible : |
|
357 |
|v| |
|
358 |
||
359 |
v := ScrollableView for:EditTextView. |
|
360 |
v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile). |
|
361 |
v scrollBar upButtonLabel:'u' downButtonLabel:'d'. |
|
362 |
v open |
|
363 |
" |
|
364 |
||
365 |
"BAD example: |
|
366 |
|v| |
|
367 |
||
368 |
v := ScrollableView for:EditTextView. |
|
369 |
v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile). |
|
370 |
v scrollBar upButtonLabel:'up' downButtonLabel:'down'. |
|
371 |
v open |
|
372 |
" |
|
373 |
||
374 |
"Modified: 1.3.1996 / 19:06:50 / cg" |
|
205 | 375 |
! ! |
376 |
||
377 |
!ScrollBar methodsFor:'change & update'! |
|
0 | 378 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
379 |
update:something with:aParameter from:changedObject |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
380 |
changedObject == thumb ifTrue:[ |
3032 | 381 |
self enableDisableButtons. |
382 |
^ self. |
|
383 |
]. |
|
384 |
super update:something with:aParameter from:changedObject. |
|
0 | 385 |
! ! |
386 |
||
387 |
!ScrollBar methodsFor:'events'! |
|
388 |
||
482
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
389 |
keyPress:key x:x y:y |
491 | 390 |
|
391 |
<resource: #keyboard (#BeginOfText #EndOfText)> |
|
392 |
||
482
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
393 |
(key == #BeginOfText) ifTrue:[ |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
394 |
self scrollToBeginning. |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
395 |
^ self |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
396 |
]. |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
397 |
(key == #EndOfText) ifTrue:[ |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
398 |
self scrollToEnd. |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
399 |
^ self |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
400 |
]. |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
401 |
super keyPress:key x:x y:y |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
402 |
|
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
403 |
"Created: 6.3.1996 / 17:58:02 / cg" |
491 | 404 |
"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
|
405 |
! |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
406 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
407 |
sizeChanged:how |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
408 |
"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
|
409 |
Also, if I became too small, hide thumb/buttons." |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
410 |
|
1538
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
411 |
<resource: #style (#name)> |
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
412 |
|
1383 | 413 |
|upHeight "{ Class: SmallInteger }" |
414 |
downHeight "{ Class: SmallInteger }" |
|
415 |
thumbHeight "{ Class: SmallInteger }" |
|
416 |
upAndDownHeight "{ Class: SmallInteger }" |
|
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
417 |
bw "{ Class: SmallInteger }" |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
418 |
bwn "{ Class: SmallInteger }" |
1383 | 419 |
sep2 "{ Class: SmallInteger }" |
1443
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
420 |
sep3 "{ Class: SmallInteger }" |
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
421 |
m2 "{ Class: SmallInteger }" |
3010
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
422 |
thumbWidth w h style b1Visible b2Visible thumbVisible |
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
423 |
b1WasVisible b2WasVisible thumbWasVisible bX bY |
1443
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
424 |
leftWidth rightWidth leftAndRightWidth isHorizontal |
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
425 |
tX tY tW tH tExt bOrg| |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
426 |
|
3676
ee14ed5d72f0
sizeChanged: dont forget to tell others
Claus Gittinger <cg@exept.de>
parents:
3602
diff
changeset
|
427 |
super sizeChanged:how. |
ee14ed5d72f0
sizeChanged: dont forget to tell others
Claus Gittinger <cg@exept.de>
parents:
3602
diff
changeset
|
428 |
|
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
429 |
(button1 isNil or:[thumb isNil or:[button2 isNil]]) ifTrue:[^ self]. |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
430 |
|
4016 | 431 |
bw := self borderWidth. |
1383 | 432 |
bwn := bw negated + margin. |
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
433 |
m2 := margin * 2. |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
434 |
|
3010
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
435 |
b1WasVisible := button1 realized. |
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
436 |
b2WasVisible := button2 realized. |
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
437 |
thumbWasVisible := thumb realized. |
1265
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
438 |
|
1950 | 439 |
(isHorizontal := (orientation == #horizontal)) ifTrue:[ |
1383 | 440 |
leftWidth := button1 width + bw. |
441 |
rightWidth := button2 width + bw. |
|
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
442 |
leftAndRightWidth := leftWidth + rightWidth. |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
443 |
|
1383 | 444 |
thumbWidth := width - leftAndRightWidth - bw - (elementSpacing * 3). |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
445 |
" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
446 |
((buttonLayout ~~ #top) and:[buttonLayout ~~ #bottom]) ifTrue:[ |
1383 | 447 |
thumbWidth := thumbWidth - bw |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
448 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
449 |
" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
450 |
buttonLayout == #around ifTrue:[ |
1383 | 451 |
thumbWidth := thumbWidth + bw |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
452 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
453 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
454 |
"if I become too small, hide buttons" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
455 |
|
1724 | 456 |
width <= (leftAndRightWidth + m2) ifTrue:[ |
3010
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
457 |
b1Visible := b2Visible := thumbVisible := false. |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
458 |
] ifFalse:[ |
3010
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
459 |
b1Visible := b2Visible := thumbVisible := true. |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
460 |
]. |
0 | 461 |
|
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
462 |
(thumbWidth < 10) ifTrue:[ |
3010
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
463 |
thumbVisible := false. |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
464 |
] ifFalse:[ |
3010
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
465 |
thumbVisible := true. |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
466 |
]. |
1265
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
467 |
] ifFalse:[ |
1383 | 468 |
upHeight := button1 height + bw. |
469 |
downHeight := button2 height + bw. |
|
1265
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
470 |
upAndDownHeight := upHeight + downHeight. |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
471 |
|
1383 | 472 |
thumbHeight := height - upAndDownHeight - bw - (elementSpacing * 3). |
1265
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
473 |
" |
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
474 |
((buttonLayout ~~ #top) and:[buttonLayout ~~ #bottom]) ifTrue:[ |
1383 | 475 |
thumbHeight := thumbHeight - bw |
1265
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
476 |
]. |
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
477 |
" |
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
478 |
buttonLayout == #around ifTrue:[ |
1383 | 479 |
thumbHeight := thumbHeight + bw |
1265
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
480 |
]. |
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
481 |
|
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
482 |
"if I become too small, hide buttons and thumb" |
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
483 |
|
1724 | 484 |
height <= (upAndDownHeight + (m2)) ifTrue:[ |
3010
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
485 |
b1Visible := b2Visible := thumbVisible := false. |
1265
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
486 |
] ifFalse:[ |
3010
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
487 |
b1Visible := b2Visible := thumbVisible := true. |
1265
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
488 |
]. |
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
489 |
|
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
490 |
(thumbHeight < 10) ifTrue:[ |
3010
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
491 |
thumbVisible := false. |
1265
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
492 |
] ifFalse:[ |
3010
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
493 |
thumbVisible := true. |
1265
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
494 |
]. |
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
495 |
]. |
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
496 |
|
3010
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
497 |
b1Visible ~~ b1WasVisible ifTrue:[ |
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
498 |
self changeVisibilityOf:button1 to:b1Visible. |
1265
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
499 |
]. |
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
500 |
|
3010
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
501 |
b2Visible ~~ b2WasVisible ifTrue:[ |
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
502 |
self changeVisibilityOf:button2 to:b2Visible. |
1265
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
503 |
]. |
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
504 |
|
3010
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
505 |
thumbVisible ~~ thumbWasVisible ifTrue:[ |
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
506 |
self changeVisibilityOf:thumb to:thumbVisible. |
1265
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
507 |
]. |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
508 |
|
1443
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
509 |
sep2 := elementSpacing * 2. |
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
510 |
|
1538
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
511 |
style := styleSheet name. |
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
512 |
|
1265
6899d60add7b
avoid re-realizing in #sizeChanged
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
513 |
isHorizontal ifTrue:[ |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
514 |
"height of buttons is always my width" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
515 |
|
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
516 |
h := height - m2. |
130 | 517 |
|
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
518 |
(h ~~ button1 height) ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
519 |
button1 height:h. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
520 |
button2 height:h |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
521 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
522 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
523 |
thumbHeight := h. |
1538
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
524 |
|
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
525 |
style == #next ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
526 |
thumbHeight := thumbHeight - (thumb borderWidth * 2). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
527 |
thumbWidth := thumbWidth - 1 |
1538
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
528 |
] ifFalse:[ |
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
529 |
style == #motif ifTrue:[ |
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
530 |
thumbWidth := thumbWidth - margin |
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
531 |
] |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
532 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
533 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
534 |
" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
535 |
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
|
536 |
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
|
537 |
" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
538 |
thumbWidth <= 0 ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
539 |
thumbWidth := 1 |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
540 |
]. |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
541 |
|
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
542 |
(buttonLayout == #bottom) ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
543 |
"buttons at left" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
544 |
thumb extent:(thumbWidth @ thumbHeight). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
545 |
^ self |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
546 |
]. |
0 | 547 |
|
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
548 |
(buttonLayout == #top) ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
549 |
"buttons at right" |
1383 | 550 |
thumbWidth := thumbWidth + bw. |
3010
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
551 |
thumbVisible ifFalse:[ |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
552 |
bX := elementSpacing |
3010
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
553 |
] ifTrue:[ |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
554 |
bX := thumbWidth + sep2. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
555 |
]. |
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
556 |
tExt := (thumbWidth @ thumbHeight). |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
557 |
(how == #smaller) ifTrue:[ |
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
558 |
"/ resize thumb first |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
559 |
thumb extent:tExt. |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
560 |
]. |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
561 |
button1 origin:(bX @ bwn). |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
562 |
button2 origin:((bX + leftWidth) @ bwn). |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
563 |
(how == #smaller) ifFalse:[ |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
564 |
"/ resize thumb last |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
565 |
thumb extent:tExt |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
566 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
567 |
^ self |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
568 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
569 |
"button around thumb" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
570 |
|
1443
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
571 |
sep3 := 0. |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
572 |
style == #motif ifTrue:[ |
1847
acd644fef86e
geometry of motif arrowButtons fixed
Claus Gittinger <cg@exept.de>
parents:
1821
diff
changeset
|
573 |
"/ sep2 := sep2 + 1. |
1443
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
574 |
sep3 := 1. |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
575 |
]. |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
576 |
|
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
577 |
button1 origin:(bwn @ bwn). |
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
578 |
bX := leftWidth + thumbWidth + sep2. |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
579 |
tX := leftWidth - bw + elementSpacing. |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
580 |
style == #os2 ifTrue:[ |
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
581 |
bX := bX - margin. |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
582 |
tW := thumbWidth - m2. |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
583 |
tX := tX + margin. |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
584 |
] ifFalse:[ |
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
585 |
bX := bX - (margin // 2). |
1443
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
586 |
tW := thumbWidth + margin - sep3 - (margin // 2). |
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
587 |
tX := tX + sep3. |
1443
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
588 |
]. |
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
589 |
|
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
590 |
"/ if made smaller, shrink thumb first, then move lower button. |
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
591 |
"/ otherwise, move lower button first, then make thumb larger. |
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
592 |
"/ this avoids a need to redraw the button2. |
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
593 |
|
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
594 |
bOrg := (bX @ bwn). |
1443
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
595 |
how ~~ #smaller ifTrue:[ |
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
596 |
button2 origin:bOrg. |
1443
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
597 |
]. |
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
598 |
thumb extent:(tW @ thumbHeight). |
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
599 |
thumb origin:(tX @ bwn). |
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
600 |
how == #smaller ifTrue:[ |
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
601 |
button2 origin:bOrg. |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
602 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
603 |
] ifFalse:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
604 |
"width of buttons is always my width" |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
605 |
|
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
606 |
w := width - m2. |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
607 |
(w ~~ button1 width) ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
608 |
button1 width:w. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
609 |
button2 width:w |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
610 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
611 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
612 |
thumbWidth := w. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
613 |
style == #next ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
614 |
thumbWidth := thumbWidth - (thumb borderWidth * 2). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
615 |
thumbHeight := thumbHeight - 1 |
1538
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
616 |
] ifFalse:[ |
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
617 |
style == #motif ifTrue:[ |
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
618 |
thumbHeight := thumbHeight - margin |
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
619 |
] |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
620 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
621 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
622 |
" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
623 |
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
|
624 |
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
|
625 |
" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
626 |
thumbHeight <= 0 ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
627 |
thumbHeight := 1 |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
628 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
629 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
630 |
(buttonLayout == #top) ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
631 |
"buttons at top" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
632 |
thumb extent:(thumbWidth @ thumbHeight). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
633 |
^ self |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
634 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
635 |
|
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
636 |
(buttonLayout == #bottom) ifTrue:[ |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
637 |
"buttons at bottom" |
855 | 638 |
|
1383 | 639 |
thumbHeight := thumbHeight + bw. |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
640 |
|
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
641 |
bY := thumbHeight + sep2. |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
642 |
(bY + upAndDownHeight) >= height ifTrue:[ |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
643 |
bY := height - margin - upAndDownHeight |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
644 |
]. |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
645 |
|
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
646 |
button1 viewGravity:#North. |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
647 |
button2 viewGravity:#North. |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
648 |
|
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
649 |
tExt := (thumbWidth @ thumbHeight). |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
650 |
|
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
651 |
(how == #smaller) ifTrue:[ |
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
652 |
"/ resize thumb first |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
653 |
thumb extent:tExt. |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
654 |
]. |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
655 |
button1 origin:(bwn @ bY). |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
656 |
button2 origin:(bwn @ (bY + upHeight)). |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
657 |
(how == #smaller) ifFalse:[ |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
658 |
"/ resize thumb last |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
659 |
thumb extent:tExt |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
660 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
661 |
^ self |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
662 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
663 |
"buttons around thumb" |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
664 |
|
1443
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
665 |
sep3 := 0. |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
666 |
style == #motif ifTrue:[ |
1847
acd644fef86e
geometry of motif arrowButtons fixed
Claus Gittinger <cg@exept.de>
parents:
1821
diff
changeset
|
667 |
"/ sep2 := sep2 + 1. |
1443
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
668 |
sep3 := 1. |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
669 |
]. |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
670 |
button1 origin:(bwn @ bwn). |
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
671 |
|
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
672 |
bY := upHeight + thumbHeight + sep2. |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
673 |
tY := upHeight - bw + elementSpacing. |
1230
9d052df857b8
more code moved to superclass
Claus Gittinger <cg@exept.de>
parents:
1229
diff
changeset
|
674 |
style == #os2 ifTrue:[ |
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
675 |
bY := bY - margin "+ bw". |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
676 |
tH := thumbHeight - m2 "+ margin - (margin // 2)". |
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
677 |
tY := tY + margin. |
613 | 678 |
] ifFalse:[ |
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
679 |
bY := bY - (margin // 2) "+ bw". |
1443
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
680 |
tH := thumbHeight + margin - sep3 - (margin // 2). |
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
681 |
tY := tY + sep3. |
1443
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
682 |
]. |
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
683 |
|
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
684 |
"/ if made smaller, shrink thumb first, then move lower button. |
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
685 |
"/ otherwise, move lower button first, then make thumb larger. |
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
686 |
"/ this avoids a need to redraw the button2. |
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
687 |
|
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
688 |
bOrg := (bwn @ bY). |
1443
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
689 |
how ~~ #smaller ifTrue:[ |
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
690 |
button2 origin:bOrg. |
1443
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
691 |
]. |
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
692 |
thumb extent:(thumbWidth @ tH). |
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
693 |
thumb origin:(bwn @ tY). |
f6ff48dfde38
faster resize (avoid expose for button, by moving components
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
694 |
how == #smaller ifTrue:[ |
1603
9089f7bdf62a
some manual common expression elimination
Claus Gittinger <cg@exept.de>
parents:
1538
diff
changeset
|
695 |
button2 origin:bOrg. |
613 | 696 |
]. |
63 | 697 |
]. |
613 | 698 |
|
1383 | 699 |
"Modified: / 3.5.1996 / 23:49:02 / stefan" |
1724 | 700 |
"Modified: / 2.12.1998 / 00:02:14 / cg" |
0 | 701 |
! ! |
110 | 702 |
|
1821
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1724
diff
changeset
|
703 |
!ScrollBar methodsFor:'focus handling'! |
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1724
diff
changeset
|
704 |
|
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1724
diff
changeset
|
705 |
wantsFocusWithButtonPress |
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1724
diff
changeset
|
706 |
"no, do not catch the keyboard focus on button click" |
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1724
diff
changeset
|
707 |
|
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1724
diff
changeset
|
708 |
^ false |
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1724
diff
changeset
|
709 |
|
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1724
diff
changeset
|
710 |
|
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1724
diff
changeset
|
711 |
! ! |
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1724
diff
changeset
|
712 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
713 |
!ScrollBar methodsFor:'forced scroll'! |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
714 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
715 |
pageDown |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
716 |
"page down/right" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
717 |
|
3033 | 718 |
thumb pageDown. |
719 |
self updateNativeWidget. |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
720 |
! |
205 | 721 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
722 |
pageUp |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
723 |
"page up/left" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
724 |
|
3033 | 725 |
thumb pageUp. |
726 |
self updateNativeWidget. |
|
482
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
727 |
! |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
728 |
|
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
729 |
scrollToBeginning |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
730 |
"to top" |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
731 |
|
3033 | 732 |
thumb scrollToBeginning. |
733 |
self updateNativeWidget. |
|
482
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
734 |
|
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
735 |
"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
|
736 |
! |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
737 |
|
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
738 |
scrollToEnd |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
739 |
"to end" |
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
740 |
|
3033 | 741 |
thumb scrollToEnd. |
742 |
self updateNativeWidget. |
|
482
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
743 |
|
f4d7344ae396
added scrollToBeginning/scrollToEnd & key-handling for them
Claus Gittinger <cg@exept.de>
parents:
455
diff
changeset
|
744 |
"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
|
745 |
"Modified: 6.3.1996 / 17:54:49 / cg" |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
746 |
! ! |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
747 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
748 |
!ScrollBar methodsFor:'initialization'! |
205 | 749 |
|
455 | 750 |
createElements |
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
751 |
"private: create my elements" |
1041 | 752 |
|
5127
fcd696f9f401
Access device and drawableId via message sends
Stefan Vogel <sv@exept.de>
parents:
5126
diff
changeset
|
753 |
(self graphicsDevice supportsNativeWidgetType:#Scrollbar) ifTrue:[ |
5126 | 754 |
"/ native widget contains all I need. |
5127
fcd696f9f401
Access device and drawableId via message sends
Stefan Vogel <sv@exept.de>
parents:
5126
diff
changeset
|
755 |
"/ but I need a thumb from the model |
5126 | 756 |
thumb := Scroller new. |
757 |
thumb beInvisible. |
|
758 |
^ self |
|
759 |
]. |
|
760 |
||
1950 | 761 |
orientation == #horizontal ifTrue:[ |
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
762 |
button1 := ArrowButton leftIn:self. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
763 |
button1 name:'leftButton'. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
764 |
button2 := ArrowButton rightIn:self. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
765 |
button2 name:'rightButton'. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
766 |
thumb := HorizontalScroller in:self. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
767 |
] ifFalse:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
768 |
button1 := ArrowButton upIn:self. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
769 |
button1 name:'upButton'. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
770 |
button2 := ArrowButton downIn:self. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
771 |
button2 name:'downButton'. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
772 |
thumb := Scroller in:self. |
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 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
775 |
"Modified: 28.5.1997 / 15:49:05 / cg" |
455 | 776 |
! |
777 |
||
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
778 |
defaultExtent |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
779 |
"compute my extent from sub-components" |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
780 |
|
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
781 |
^ self preferredExtent |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
782 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
783 |
|
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
784 |
"Created: 1.3.1996 / 19:22:11 / cg" |
205 | 785 |
! |
786 |
||
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
787 |
initStyle |
968 | 788 |
"setup viewStyle specifics" |
789 |
||
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
790 |
super initStyle. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
791 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
792 |
buttonLayout := DefaultButtonPositions. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
793 |
DefaultLevel notNil ifTrue:[ |
968 | 794 |
self level:DefaultLevel |
205 | 795 |
]. |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
796 |
elementSpacing := DefaultElementSpacing |
968 | 797 |
|
798 |
"Modified: 22.1.1997 / 11:57:41 / cg" |
|
205 | 799 |
! |
800 |
||
801 |
initialize |
|
802 |
"setup; create the 2 buttons and a scroller" |
|
803 |
||
1538
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
804 |
<resource: #style (#'scrollBar.disableButtons')> |
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
805 |
|
4016 | 806 |
|clr style bw| |
205 | 807 |
|
1952 | 808 |
orientation isNil ifTrue:[ |
1950 | 809 |
orientation := #vertical |
810 |
]. |
|
205 | 811 |
|
1952 | 812 |
super initialize. |
813 |
||
205 | 814 |
self createElements. |
815 |
||
1889 | 816 |
(styleSheet at:#'scrollBar.disableButtons' default:false) ifTrue:[ |
706 | 817 |
thumb addDependent:self |
205 | 818 |
]. |
819 |
||
5126 | 820 |
button1 isNil ifTrue:[ |
821 |
"/ native widget: no buttons |
|
822 |
^ self |
|
823 |
]. |
|
824 |
||
345 | 825 |
button1 autoRepeat:true. |
826 |
button2 autoRepeat:true. |
|
205 | 827 |
|
4016 | 828 |
bw := self borderWidth. |
4026 | 829 |
button1 borderWidth:bw. |
205 | 830 |
DefaultScrollerBordered ifFalse:[ |
4026 | 831 |
thumb borderWidth:bw. |
205 | 832 |
]. |
4026 | 833 |
button2 borderWidth:bw. |
205 | 834 |
|
835 |
style := styleSheet name. |
|
744
8d84193ca610
use 'Screen current' instead of 'Display'
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
836 |
((style = #iris) and:[Screen current hasGrayscales]) ifTrue:[ |
706 | 837 |
"have to change some of Buttons defaults" |
4907 | 838 |
clr := (Color gray:25) onDevice:self graphicsDevice. |
710 | 839 |
button1 passiveLevel:2. |
840 |
button2 passiveLevel:2. |
|
706 | 841 |
button1 foregroundColor:clr. |
842 |
button1 activeForegroundColor:clr. |
|
843 |
button1 enteredForegroundColor:clr. |
|
844 |
button2 foregroundColor:clr. |
|
845 |
button2 activeForegroundColor:clr. |
|
846 |
button2 enteredForegroundColor:clr. |
|
205 | 847 |
]. |
848 |
||
849 |
self setElementPositions. |
|
850 |
||
851 |
style = #motif ifTrue:[ |
|
706 | 852 |
clr := thumb thumbColor. |
853 |
button1 foregroundColor:clr. |
|
854 |
button2 foregroundColor:clr. |
|
345 | 855 |
|
706 | 856 |
clr := thumb viewBackground. |
857 |
button1 viewBackground:clr. |
|
858 |
button2 viewBackground:clr. |
|
859 |
button1 backgroundColor:clr. |
|
860 |
button2 backgroundColor:clr. |
|
861 |
button1 activeBackgroundColor:clr. |
|
862 |
button2 activeBackgroundColor:clr. |
|
4907 | 863 |
self graphicsDevice hasGrayscales ifFalse:[ |
4916 | 864 |
button1 activeForegroundColor:self blackColor. |
865 |
button2 activeForegroundColor:self blackColor. |
|
706 | 866 |
] |
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
867 |
] |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
868 |
|
1889 | 869 |
"Modified: / 29.4.1999 / 08:43:30 / cg" |
205 | 870 |
! |
871 |
||
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
872 |
reinitialize |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
873 |
super reinitialize. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
874 |
self setElementPositions. |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
875 |
! |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
876 |
|
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
877 |
setElementPositions |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
878 |
"position sub-components" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
879 |
|
4016 | 880 |
|bw bwn| |
205 | 881 |
|
4016 | 882 |
bw := self borderWidth. |
883 |
bwn := bw negated + margin. |
|
205 | 884 |
|
1950 | 885 |
orientation == #horizontal ifTrue:[ |
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
886 |
(buttonLayout == #bottom) ifTrue:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
887 |
"buttons at left" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
888 |
button1 origin:(bwn @ bwn). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
889 |
button1 viewGravity:#West. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
890 |
button2 origin:(button1 width @ bwn). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
891 |
button2 viewGravity:#West. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
892 |
thumb origin:((button1 width |
4016 | 893 |
+ bw |
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
894 |
+ button2 width |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
895 |
+ elementSpacing + elementSpacing) @ bwn). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
896 |
thumb viewGravity:#West. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
897 |
^ self |
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 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
900 |
(buttonLayout == #top) ifTrue:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
901 |
"buttons at right" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
902 |
button1 viewGravity:#West. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
903 |
button2 viewGravity:#West. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
904 |
thumb origin:(bwn @ bwn). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
905 |
thumb viewGravity:#West |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
906 |
]. |
205 | 907 |
|
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
908 |
"buttonLayout == #around " |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
909 |
button1 origin:(bwn @ bwn). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
910 |
button1 viewGravity:#West. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
911 |
button2 viewGravity:#West. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
912 |
thumb origin:((button1 width + elementSpacing) @ bwn). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
913 |
thumb viewGravity:#West |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
914 |
] ifFalse:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
915 |
(buttonLayout == #top) ifTrue:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
916 |
button1 origin:(bwn @ bwn). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
917 |
button1 viewGravity:#North. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
918 |
button2 origin:(bwn @ (button1 height)). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
919 |
button2 viewGravity:#North. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
920 |
thumb origin:(bwn @ (button1 height |
4016 | 921 |
+ bw |
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
922 |
+ button2 height |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
923 |
+ elementSpacing |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
924 |
+ elementSpacing)). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
925 |
thumb viewGravity:#North. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
926 |
^ self |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
927 |
]. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
928 |
(buttonLayout == #bottom) ifTrue:[ |
4907 | 929 |
self graphicsDevice supportsViewGravity ifTrue:[ |
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
930 |
button1 viewGravity:#South. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
931 |
button2 viewGravity:#South. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
932 |
thumb viewGravity:#North. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
933 |
]. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
934 |
thumb origin:(bwn @ bwn). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
935 |
^ self |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
936 |
]. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
937 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
938 |
"buttonLayout == #around" |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
939 |
button1 origin:(bwn @ bwn). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
940 |
button1 viewGravity:#North. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
941 |
"/ button2 viewGravity:#North. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
942 |
thumb origin:(bwn @ (button1 height + elementSpacing)). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
943 |
thumb viewGravity:#North |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
944 |
] |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
945 |
|
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
946 |
"Modified: 28.5.1997 / 15:50:27 / cg" |
205 | 947 |
! ! |
948 |
||
3030 | 949 |
!ScrollBar methodsFor:'native widget support'! |
950 |
||
3032 | 951 |
beNativeWidget |
952 |
super beNativeWidget. |
|
953 |
self makeElementsInvisible. |
|
954 |
! |
|
955 |
||
956 |
makeElementsInvisible |
|
957 |
"when using native widget, my elements are not visible. |
|
958 |
(they are not destroyed, to keep a place for their attributes, |
|
959 |
and to allow future dynamic switching and snapshot restore on |
|
960 |
a non-native system)" |
|
961 |
||
962 |
button1 notNil ifTrue:[ |
|
963 |
button1 beInvisible. |
|
964 |
]. |
|
965 |
button2 notNil ifTrue:[ |
|
966 |
button2 beInvisible. |
|
967 |
]. |
|
968 |
thumb notNil ifTrue:[ |
|
969 |
thumb beInvisible. |
|
970 |
]. |
|
971 |
! |
|
972 |
||
3030 | 973 |
nativeWindowType |
974 |
"return a symbol describing my native window type |
|
975 |
(may be used internally by the device as a native window creation hint)" |
|
976 |
||
977 |
orientation == #vertical ifTrue:[ |
|
978 |
^ #VerticalScrollBar |
|
979 |
]. |
|
980 |
^ #HorizontalScrollBar |
|
981 |
! |
|
982 |
||
983 |
updateNativeWidget |
|
5126 | 984 |
|id| |
985 |
||
3030 | 986 |
self isNativeWidget ifTrue:[ |
5126 | 987 |
(id := self drawableId) notNil ifTrue:[ |
4907 | 988 |
self graphicsDevice |
3036 | 989 |
setScrollRange:0 to:100 |
990 |
redraw:false |
|
5126 | 991 |
in:id. |
3036 | 992 |
|
4907 | 993 |
self graphicsDevice |
3030 | 994 |
setScrollPosition:thumb thumbOrigin rounded |
3036 | 995 |
redraw:false |
5126 | 996 |
in:id. |
3030 | 997 |
|
4907 | 998 |
self graphicsDevice |
3030 | 999 |
setScrollBarPageSize:thumb thumbHeight rounded |
1000 |
redraw:true |
|
5126 | 1001 |
in:id. |
3030 | 1002 |
] |
1003 |
]. |
|
1004 |
! ! |
|
1005 |
||
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1006 |
!ScrollBar methodsFor:'private'! |
205 | 1007 |
|
3010
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
1008 |
changeVisibilityOf:aComponent to:aBoolean |
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
1009 |
self isNativeWidget ifTrue:[^ self]. |
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
1010 |
|
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
1011 |
aComponent hiddenOnRealize:aBoolean not. |
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
1012 |
aBoolean ifFalse:[ |
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
1013 |
aComponent unmap |
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
1014 |
] ifTrue:[ |
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
1015 |
shown ifTrue:[aComponent realize] |
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
1016 |
]. |
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
1017 |
! |
f920bb8248bd
care for being nativeWidget (invisible thumb & buttons)
Claus Gittinger <cg@exept.de>
parents:
2914
diff
changeset
|
1018 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1019 |
enableDisableButtons |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1020 |
"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
|
1021 |
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
|
1022 |
as appropriate." |
205 | 1023 |
|
1538
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
1024 |
<resource: #style (#'scrollBar.disableButtons')> |
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
1025 |
|
3019 | 1026 |
|e1 e2 th to ena| |
205 | 1027 |
|
1889 | 1028 |
(styleSheet at:#'scrollBar.disableButtons' default:false) ifFalse:[^ self]. |
205 | 1029 |
e1 := e2 := true. |
1030 |
(th := thumb thumbHeight) notNil ifTrue:[ |
|
1538
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
1031 |
(th >= (thumb stop)) ifTrue:[ |
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
1032 |
e1 := false. |
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
1033 |
e2 := false |
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
1034 |
] |
205 | 1035 |
]. |
1036 |
((to := thumb thumbOrigin) <= thumb start) ifTrue:[ |
|
1538
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
1037 |
e1 := false |
205 | 1038 |
] ifFalse:[ |
1538
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
1039 |
th isNil ifTrue:[th := 0]. |
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
1040 |
(to + th) >= thumb stop ifTrue:[ |
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
1041 |
e2 := false |
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
1042 |
] |
205 | 1043 |
]. |
4470
c18deb0cab99
changed: #enableDisableButtons
Claus Gittinger <cg@exept.de>
parents:
4026
diff
changeset
|
1044 |
button1 enabled:e1. "/ e1 ifTrue:[button1 enable] ifFalse:[button1 disable]. |
c18deb0cab99
changed: #enableDisableButtons
Claus Gittinger <cg@exept.de>
parents:
4026
diff
changeset
|
1045 |
button2 enabled:e2. "/ e2 ifTrue:[button2 enable] ifFalse:[button2 disable]. |
1538
f0d7b67bcc2b
fixed styleSheet access (wrong key); added resource-markers
Claus Gittinger <cg@exept.de>
parents:
1443
diff
changeset
|
1046 |
|
3019 | 1047 |
self isNativeWidget ifTrue:[ |
4907 | 1048 |
self drawableId notNil ifTrue:[ |
3019 | 1049 |
e1 ifTrue:[ |
1050 |
e2 ifTrue:[ |
|
1051 |
"/ both enabled |
|
1052 |
ena := #ENABLE_BOTH. |
|
1053 |
] ifFalse:[ |
|
1054 |
ena := #DISABLE_RTDN. |
|
1055 |
] |
|
1056 |
] ifFalse:[ |
|
1057 |
e2 ifTrue:[ |
|
1058 |
ena := #DISABLE_LTUP. |
|
1059 |
] ifFalse:[ |
|
1060 |
ena := #DISABLE_BOTH. |
|
1061 |
] |
|
1062 |
]. |
|
4907 | 1063 |
self graphicsDevice enableScrollBar:ena in:self drawableId. |
3019 | 1064 |
]. |
1065 |
]. |
|
1066 |
||
1889 | 1067 |
"Modified: / 29.4.1999 / 08:44:03 / cg" |
205 | 1068 |
! ! |
1069 |
||
2741 | 1070 |
!ScrollBar methodsFor:'private-scrollview interface'! |
455 | 1071 |
|
1072 |
setThumbFor:aView |
|
1073 |
"adjust thumb for aView |
|
1074 |
(i.e. adjust thumbs origin & size for views size & views contents). |
|
1075 |
This is forwarded to the scroller here." |
|
1076 |
||
3018 | 1077 |
thumb setThumbFor:aView. |
3014 | 1078 |
self isNativeWidget ifTrue:[ |
3018 | 1079 |
self updateNativeWidget. |
3014 | 1080 |
]. |
455 | 1081 |
self enableDisableButtons |
1082 |
! |
|
1083 |
||
1084 |
setThumbHeightFor:aView |
|
1085 |
"adjust thumbs height for aViews size & contents. |
|
1086 |
This is forwarded to the scroller here." |
|
1087 |
||
3018 | 1088 |
thumb setThumbHeightFor:aView. |
3014 | 1089 |
self isNativeWidget ifTrue:[ |
3018 | 1090 |
self updateNativeWidget. |
3014 | 1091 |
]. |
455 | 1092 |
self enableDisableButtons |
1093 |
! |
|
1094 |
||
1095 |
setThumbOriginFor:aView |
|
1096 |
"adjust thumbs origin for aViews size & contents. |
|
1097 |
This is forwarded to the scroller here." |
|
1098 |
||
3018 | 1099 |
thumb setThumbOriginFor:aView. |
3014 | 1100 |
self isNativeWidget ifTrue:[ |
3018 | 1101 |
self updateNativeWidget. |
3014 | 1102 |
]. |
455 | 1103 |
self enableDisableButtons |
1104 |
! ! |
|
1105 |
||
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1106 |
!ScrollBar methodsFor:'queries'! |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1107 |
|
1117 | 1108 |
isMiniScroller |
1109 |
^ false |
|
1110 |
||
1111 |
"Created: 7.3.1997 / 16:20:12 / cg" |
|
1112 |
! |
|
1113 |
||
2358 | 1114 |
isScrolling |
1115 |
"true, if thumb is being moved (by user)" |
|
1116 |
||
1117 |
^ thumb isScrolling |
|
1118 |
! |
|
1119 |
||
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1120 |
preferredExtent |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1121 |
"compute my extent from sub-components" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1122 |
|
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
1123 |
<resource: #style (#name)> |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
1124 |
|
1887
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1125 |
|w h form1 form2 style |
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
1126 |
height1 "{ Class: SmallInteger }" |
1887
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1127 |
height2 "{ Class: SmallInteger }" |
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1128 |
width1 "{ Class: SmallInteger }" |
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1129 |
width2 "{ Class: SmallInteger }" | |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1130 |
|
3763
446dd5f64d8a
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3676
diff
changeset
|
1131 |
"/ If I have an explicit preferredExtent.. |
446dd5f64d8a
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3676
diff
changeset
|
1132 |
explicitExtent notNil ifTrue:[ |
446dd5f64d8a
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3676
diff
changeset
|
1133 |
^ explicitExtent |
446dd5f64d8a
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3676
diff
changeset
|
1134 |
]. |
797 | 1135 |
|
3763
446dd5f64d8a
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3676
diff
changeset
|
1136 |
"/ If I have a cached preferredExtent value.. |
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
710
diff
changeset
|
1137 |
preferredExtent notNil ifTrue:[ |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
710
diff
changeset
|
1138 |
^ preferredExtent |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
710
diff
changeset
|
1139 |
]. |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
710
diff
changeset
|
1140 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1141 |
" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1142 |
need fix - this is a kludge; |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1143 |
the if should not be needed ... |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1144 |
" |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1145 |
style := styleSheet name. |
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
1146 |
|
1950 | 1147 |
orientation == #horizontal ifTrue:[ |
4907 | 1148 |
form1 := ArrowButton leftArrowButtonForm:style on:self graphicsDevice. |
1149 |
form2 := ArrowButton rightArrowButtonForm:style on:self graphicsDevice. |
|
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
1150 |
] ifFalse:[ |
4907 | 1151 |
form1 := ArrowButton upArrowButtonForm:style on:self graphicsDevice. |
1152 |
form2 := ArrowButton downArrowButtonForm:style on:self graphicsDevice. |
|
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
1153 |
]. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
1154 |
form1 isNil ifTrue:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
1155 |
height1 := width1 := 16. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
1156 |
] ifFalse:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
1157 |
height1 := form1 height. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
1158 |
width1 := form1 width |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
1159 |
]. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
1160 |
form2 isNil ifTrue:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
1161 |
height2 := width2 := 16 |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
1162 |
] ifFalse:[ |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
1163 |
height2 := form2 height. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
1164 |
width2 := form2 width |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
1165 |
]. |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
1166 |
|
1950 | 1167 |
orientation == #horizontal ifTrue:[ |
1887
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1168 |
DefaultHScrollBarHeight notNil ifTrue:[ |
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1169 |
h := DefaultHScrollBarHeight |
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1170 |
] ifFalse:[ |
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1171 |
h := height1 max:height2. |
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1172 |
]. |
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
1173 |
w := width1 + width2 + (1 * 2) + (HorizontalScroller defaultExtent x). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
1174 |
] ifFalse:[ |
1887
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1175 |
DefaultVScrollBarWidth notNil ifTrue:[ |
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1176 |
w := DefaultVScrollBarWidth |
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1177 |
] ifFalse:[ |
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1178 |
w := width1 max:width2. |
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1179 |
]. |
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
1180 |
h := height1 + height2 + (1 * 2) + (Scroller defaultExtent y). |
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
1181 |
]. |
1887
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1182 |
|
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
1183 |
style ~~ #normal ifTrue:[ |
1887
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1184 |
DefaultHScrollBarHeight isNil ifTrue:[h := h + 4]. |
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1185 |
DefaultVScrollBarWidth isNil ifTrue:[w := w + 4]. |
1229
19be2e822d45
merged common code from scrollBar & horizontalScrollBar
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
1186 |
]. |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1187 |
|
786
8b301af1cdcc
remember and do not recompute the preferredExtent;
Claus Gittinger <cg@exept.de>
parents:
744
diff
changeset
|
1188 |
preferredExtent := w @ h. |
8b301af1cdcc
remember and do not recompute the preferredExtent;
Claus Gittinger <cg@exept.de>
parents:
744
diff
changeset
|
1189 |
^ preferredExtent |
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
710
diff
changeset
|
1190 |
|
1887
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1191 |
"Modified: / 28.4.1999 / 19:33:45 / cg" |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1192 |
! ! |
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1193 |
|
855 | 1194 |
!ScrollBar class methodsFor:'documentation'! |
205 | 1195 |
|
1196 |
version |
|
5127
fcd696f9f401
Access device and drawableId via message sends
Stefan Vogel <sv@exept.de>
parents:
5126
diff
changeset
|
1197 |
^ '$Header: /cvs/stx/stx/libwidg/ScrollBar.st,v 1.94 2014-08-18 18:28:19 stefan Exp $' |
4016 | 1198 |
! |
1199 |
||
1200 |
version_CVS |
|
5127
fcd696f9f401
Access device and drawableId via message sends
Stefan Vogel <sv@exept.de>
parents:
5126
diff
changeset
|
1201 |
^ '$Header: /cvs/stx/stx/libwidg/ScrollBar.st,v 1.94 2014-08-18 18:28:19 stefan Exp $' |
205 | 1202 |
! ! |
4628 | 1203 |