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