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