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