author | Claus Gittinger <cg@exept.de> |
Thu, 06 Mar 1997 17:08:06 +0100 | |
changeset 1104 | 88b80680773e |
parent 1074 | 37e748d3328d |
child 1112 | 6bd9edc636cc |
permissions | -rw-r--r-- |
0 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1991 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 |
||
13 |
ScrollableView subclass:#HVScrollableView |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
14 |
instanceVariableNames:'' |
572 | 15 |
classVariableNames:'' |
16 |
poolDictionaries:'' |
|
17 |
category:'Views-Basic' |
|
0 | 18 |
! |
19 |
||
845 | 20 |
!HVScrollableView class methodsFor:'documentation'! |
63 | 21 |
|
22 |
copyright |
|
23 |
" |
|
24 |
COPYRIGHT (c) 1991 by Claus Gittinger |
|
25 |
All Rights Reserved |
|
26 |
||
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
35 |
||
38 | 36 |
documentation |
37 |
" |
|
38 |
a view containing both horizontal and vertical scrollbars |
|
130 | 39 |
and some other (slave-)view. |
40 |
||
41 |
Please see the documentation and examples in my superclass, ScrollableView |
|
584 | 42 |
|
43 |
[author:] |
|
44 |
Claus Gittinger |
|
38 | 45 |
" |
845 | 46 |
! |
47 |
||
48 |
examples |
|
49 |
" |
|
50 |
See more examples in ScrollableView - all of those work |
|
51 |
also by replacing ScrollableView with HVScrollableView. |
|
52 |
||
53 |
||
54 |
example (simple scrolled text): |
|
55 |
[exBegin] |
|
56 |
|top scr txt| |
|
57 |
||
58 |
top := StandardSystemView label:'scroll example'. |
|
59 |
top extent:200@100. |
|
60 |
||
61 |
scr := HVScrollableView for:EditTextView in:top. |
|
62 |
scr origin:0.0@0.0 corner:1.0@1.0. |
|
63 |
txt := scr scrolledView. |
|
64 |
||
65 |
txt list:#('line1' |
|
66 |
'a long line which may require scrolling.' |
|
67 |
'line3' |
|
68 |
'line4' |
|
69 |
'line5' |
|
70 |
'line7' |
|
71 |
'line8' |
|
72 |
'line9' |
|
73 |
'line10' |
|
74 |
). |
|
75 |
top open |
|
76 |
[exEnd] |
|
77 |
example (horizontal miniScroller): |
|
78 |
[exBegin] |
|
79 |
|top scr txt| |
|
80 |
||
81 |
top := StandardSystemView label:'scroll example'. |
|
82 |
top extent:200@100. |
|
83 |
||
84 |
scr := HVScrollableView |
|
85 |
for:EditTextView |
|
86 |
miniScrollerH:true |
|
87 |
miniScrollerV:false |
|
88 |
in:top. |
|
89 |
scr origin:0.0@0.0 corner:1.0@1.0. |
|
90 |
txt := scr scrolledView. |
|
91 |
||
92 |
txt list:#('line1' |
|
93 |
'a long line which may require scrolling.' |
|
94 |
'line3' |
|
95 |
'line4' |
|
96 |
'line5' |
|
97 |
'line7' |
|
98 |
'line8' |
|
99 |
'line9' |
|
100 |
'line10' |
|
101 |
). |
|
102 |
top open |
|
103 |
[exEnd] |
|
104 |
||
105 |
example (vertical miniScroller): |
|
106 |
[exBegin] |
|
107 |
|top scr txt| |
|
108 |
||
109 |
top := StandardSystemView label:'scroll example'. |
|
110 |
top extent:200@100. |
|
111 |
||
112 |
scr := HVScrollableView |
|
113 |
for:EditTextView |
|
114 |
miniScrollerH:false |
|
115 |
miniScrollerV:true |
|
116 |
in:top. |
|
117 |
scr origin:0.0@0.0 corner:1.0@1.0. |
|
118 |
txt := scr scrolledView. |
|
119 |
||
120 |
txt list:#('line1' |
|
121 |
'a long line which may require scrolling.' |
|
122 |
'line3' |
|
123 |
'line4' |
|
124 |
'line5' |
|
125 |
'line7' |
|
126 |
'line8' |
|
127 |
'line9' |
|
128 |
'line10' |
|
129 |
). |
|
130 |
top open |
|
131 |
[exEnd] |
|
132 |
||
133 |
example (both scrollers are miniScroller): |
|
134 |
[exBegin] |
|
135 |
|top scr txt| |
|
136 |
||
137 |
top := StandardSystemView label:'scroll example'. |
|
138 |
top extent:200@100. |
|
139 |
||
140 |
scr := HVScrollableView |
|
141 |
for:EditTextView |
|
142 |
miniScrollerH:true |
|
143 |
miniScrollerV:true |
|
144 |
in:top. |
|
145 |
scr origin:0.0@0.0 corner:1.0@1.0. |
|
146 |
txt := scr scrolledView. |
|
147 |
||
148 |
txt list:#('line1' |
|
149 |
'a long line which may require scrolling.' |
|
150 |
'line3' |
|
151 |
'line4' |
|
152 |
'line5' |
|
153 |
'line7' |
|
154 |
'line8' |
|
155 |
'line9' |
|
156 |
'line10' |
|
157 |
). |
|
158 |
top open |
|
159 |
[exEnd] |
|
160 |
" |
|
161 |
||
38 | 162 |
! ! |
163 |
||
678
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
584
diff
changeset
|
164 |
!HVScrollableView methodsFor:'accessing - components'! |
216 | 165 |
|
166 |
scrolledView:aView |
|
167 |
"set the scrolled view" |
|
168 |
||
169 |
super scrolledView:aView. |
|
170 |
||
171 |
"redefine subviews size" |
|
172 |
styleSheet is3D ifTrue:[ |
|
814 | 173 |
scrolledView |
174 |
extent:[(width |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
175 |
- vScrollBar width |
814 | 176 |
- (innerMargin * 2)) |
177 |
@ |
|
178 |
(height |
|
179 |
- hScrollBar height |
|
180 |
- (innerMargin * 2)) |
|
181 |
] |
|
216 | 182 |
] ifFalse:[ |
814 | 183 |
scrolledView |
184 |
extent:[(width |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
185 |
- vScrollBar width |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
186 |
- vScrollBar borderWidth |
814 | 187 |
"- scrolledView borderWidth") |
188 |
@ |
|
189 |
(height |
|
190 |
- hScrollBar height |
|
191 |
- hScrollBar borderWidth |
|
192 |
"- scrolledView borderWidth") |
|
193 |
] |
|
216 | 194 |
]. |
814 | 195 |
self setScrollActions. |
196 |
||
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
197 |
"Modified: 6.3.1997 / 17:04:47 / cg" |
216 | 198 |
! ! |
199 |
||
0 | 200 |
!HVScrollableView methodsFor:'initialization'! |
201 |
||
38 | 202 |
initializeFor:aViewClass miniScrollerH:miniH miniScrollerV:miniV |
130 | 203 |
|negativeOffset halfMargin orgX mrg halfSpacing |
204 |
is3D cls hBorderWidth isST80 isOpenWin extra| |
|
59 | 205 |
|
206 |
isST80 := StyleSheet name = #st80. "leftover - remove it" |
|
38 | 207 |
|
59 | 208 |
isST80 ifTrue:[ |
814 | 209 |
cls := HorizontalScrollBar |
59 | 210 |
] ifFalse:[ |
814 | 211 |
cls := miniH ifTrue:[HorizontalMiniScroller] ifFalse:[HorizontalScrollBar]. |
59 | 212 |
]. |
38 | 213 |
|
214 |
hScrollBar := cls in:self. |
|
0 | 215 |
|
38 | 216 |
super |
814 | 217 |
initializeFor:aViewClass |
218 |
miniScrollerH:miniH |
|
219 |
miniScrollerV:miniV. |
|
0 | 220 |
|
221 |
negativeOffset := borderWidth negated. |
|
222 |
halfMargin := innerMargin // 2. |
|
130 | 223 |
is3D := styleSheet is3D. |
224 |
isOpenWin := styleSheet name = #openwin. |
|
0 | 225 |
|
38 | 226 |
" |
227 |
change vertical scrollbars size |
|
228 |
" |
|
59 | 229 |
mrg := hScrollBar borderWidth. |
230 |
mrg isNil ifTrue:[mrg := 0]. |
|
231 |
hBorderWidth := mrg. |
|
232 |
||
38 | 233 |
is3D ifTrue:[ |
814 | 234 |
isST80 ifTrue:[ |
235 |
halfSpacing := 0 |
|
236 |
] ifFalse:[ |
|
237 |
mrg := mrg + innerMargin + innerMargin. |
|
238 |
halfSpacing := ViewSpacing // 2. |
|
239 |
]. |
|
0 | 240 |
]. |
130 | 241 |
|
242 |
extra := 0. |
|
243 |
isOpenWin ifTrue:[ |
|
814 | 244 |
extra := 2. |
130 | 245 |
]. |
246 |
||
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
247 |
vScrollBar extent:[vScrollBar width |
814 | 248 |
@ |
249 |
(height - hScrollBar height - mrg + extra)]. |
|
0 | 250 |
|
251 |
hScrollBar thumbOrigin:0 thumbHeight:100. |
|
38 | 252 |
|
253 |
scrollBarPosition == #left ifTrue:[ |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
254 |
orgX := vScrollBar origin x + vScrollBar width. |
814 | 255 |
is3D ifTrue:[ |
256 |
orgX := orgX + halfSpacing + 1. |
|
951 | 257 |
scrolledView notNil ifTrue:[ |
258 |
isST80 ifTrue:[ |
|
259 |
orgX := orgX - (scrolledView margin) |
|
260 |
] |
|
814 | 261 |
] |
262 |
] |
|
0 | 263 |
] ifFalse:[ |
814 | 264 |
orgX := 0 - hBorderWidth. |
130 | 265 |
"/ isST80 ifTrue:[ |
59 | 266 |
"/ orgX := orgX + 1 |
130 | 267 |
"/ ] |
268 |
]. |
|
269 |
isOpenWin ifTrue:[ |
|
814 | 270 |
orgX := orgX + 1 |
59 | 271 |
]. |
272 |
||
273 |
is3D ifTrue:[ |
|
814 | 274 |
hScrollBar origin:[(orgX + innerMargin - halfSpacing - hScrollBar margin) |
275 |
@ |
|
276 |
(height - hScrollBar height - halfMargin) |
|
277 |
] |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
278 |
extent:[(width - vScrollBar width - (innerMargin * 2) + extra) |
814 | 279 |
@ |
280 |
hScrollBar height |
|
281 |
] |
|
59 | 282 |
] ifFalse:[ |
814 | 283 |
scrollBarPosition == #left ifTrue:[ |
284 |
hScrollBar |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
285 |
origin:[(orgX + vScrollBar borderWidth) |
814 | 286 |
@ |
287 |
(height - hScrollBar height - hBorderWidth) |
|
288 |
] |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
289 |
extent:[(width - vScrollBar width) @ hScrollBar height] |
814 | 290 |
] ifFalse:[ |
291 |
hScrollBar |
|
292 |
origin:[orgX @ (height - hScrollBar height - hBorderWidth) ] |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
293 |
extent:[(width - vScrollBar width - hBorderWidth) @ hScrollBar height] |
814 | 294 |
] |
0 | 295 |
]. |
296 |
||
38 | 297 |
scrolledView notNil ifTrue:[ |
814 | 298 |
"redefine subviews size" |
299 |
is3D ifTrue:[ |
|
300 |
scrolledView |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
301 |
extent:[(width - vScrollBar width - (innerMargin * 2)) |
814 | 302 |
@ |
303 |
(height - hScrollBar height - (innerMargin * 2)) ] |
|
304 |
] ifFalse:[ |
|
305 |
scrolledView |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
306 |
extent:[(width - vScrollBar width - vScrollBar borderWidth) |
814 | 307 |
@ |
308 |
(height - hScrollBar height - hScrollBar borderWidth) |
|
309 |
] |
|
310 |
]. |
|
311 |
self setScrollActions. |
|
63 | 312 |
] |
814 | 313 |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
314 |
"Modified: 6.3.1997 / 17:06:14 / cg" |
7 | 315 |
! ! |
316 |
||
105 | 317 |
!HVScrollableView methodsFor:'queries'! |
318 |
||
1074 | 319 |
specClass |
320 |
self class == HVScrollableView ifTrue:[^ ScrollableViewSpec]. |
|
321 |
^ super specClass |
|
105 | 322 |
! ! |
323 |
||
845 | 324 |
!HVScrollableView class methodsFor:'documentation'! |
65 | 325 |
|
216 | 326 |
version |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
327 |
^ '$Header: /cvs/stx/stx/libwidg/HVScrollableView.st,v 1.25 1997-03-06 16:08:06 cg Exp $' |
65 | 328 |
! ! |