author | Claus Gittinger <cg@exept.de> |
Wed, 18 Dec 2019 19:08:06 +0100 | |
changeset 6768 | c9329ef316b5 |
parent 6493 | 8707ca079e1f |
permissions | -rw-r--r-- |
6493 | 1 |
"{ Encoding: utf8 }" |
2 |
||
37 | 3 |
" |
4 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
64 | 5 |
All Rights Reserved |
37 | 6 |
|
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
3165 | 14 |
"{ Package: 'stx:libwidg' }" |
15 |
||
5628 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
37 | 18 |
Scroller subclass:#MiniScroller |
539
c7c5585e77f6
use common code for H/V miniScrollers
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
19 |
instanceVariableNames:'' |
1305
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
20 |
classVariableNames:'MiniScrollerSize' |
539
c7c5585e77f6
use common code for H/V miniScrollers
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
21 |
poolDictionaries:'' |
c7c5585e77f6
use common code for H/V miniScrollers
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
22 |
category:'Views-Interactors' |
37 | 23 |
! |
24 |
||
968 | 25 |
!MiniScroller class methodsFor:'documentation'! |
37 | 26 |
|
27 |
copyright |
|
28 |
" |
|
29 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
64 | 30 |
All Rights Reserved |
37 | 31 |
|
32 |
This software is furnished under a license and may be used |
|
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
39 |
! |
|
40 |
||
41 |
documentation |
|
42 |
" |
|
43 |
like a scroller, but taking less screen space |
|
585 | 44 |
|
45 |
[author:] |
|
1427
f73bcbd3b994
dont let miniscroller become too small (motif style)
Claus Gittinger <cg@exept.de>
parents:
1386
diff
changeset
|
46 |
Claus Gittinger |
37 | 47 |
" |
48 |
! ! |
|
49 |
||
1305
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
50 |
!MiniScroller class methodsFor:'defaults'! |
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
51 |
|
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
52 |
updateStyleCache |
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
53 |
"extract values from the styleSheet and cache them in class variables" |
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
54 |
|
1354 | 55 |
<resource: #style (#'miniScroller.size')> |
1305
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
56 |
|
1354 | 57 |
MiniScrollerSize := StyleSheet at:'miniScroller.size'. |
1305
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
58 |
|
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
59 |
" |
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
60 |
self updateStyleCache |
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
61 |
" |
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
62 |
|
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
63 |
"Created: 15.8.1997 / 01:51:38 / cg" |
1354 | 64 |
"Modified: 20.10.1997 / 15:06:36 / cg" |
1305
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
65 |
! ! |
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
66 |
|
130 | 67 |
!MiniScroller methodsFor:'initialization'! |
37 | 68 |
|
69 |
initStyle |
|
968 | 70 |
"setup viewStyle specifics" |
71 |
||
119 | 72 |
|style lvl| |
73 |
||
37 | 74 |
super initStyle. |
119 | 75 |
style := StyleSheet name. |
37 | 76 |
style == #iris ifTrue:[ |
1519 | 77 |
tallyLevel := tallyMarks := 0. |
78 |
thumbEdgeStyle := nil. |
|
79 |
thumbLevel := thumbActiveLevel := 2. |
|
37 | 80 |
]. |
81 |
((style ~~ #normal) and:[style ~~ #mswindows]) ifTrue:[ |
|
1519 | 82 |
style == #st80 ifTrue:[ |
83 |
lvl := 1. |
|
84 |
"/ lvl := 0. |
|
85 |
] ifFalse:[ |
|
86 |
lvl := -1. |
|
87 |
]. |
|
88 |
self level:lvl. |
|
89 |
self borderWidth:0 |
|
37 | 90 |
]. |
91 |
shadowForm := lightForm := nil. |
|
1519 | 92 |
fixThumbHeight := false. |
539
c7c5585e77f6
use common code for H/V miniScrollers
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
93 |
|
1519 | 94 |
thumbImage := nil. |
95 |
||
96 |
"Modified: / 12.5.1998 / 20:41:52 / cg" |
|
37 | 97 |
! ! |
205 | 98 |
|
99 |
!MiniScroller methodsFor:'queries'! |
|
100 |
||
6493 | 101 |
computePreferredExtent |
572 | 102 |
"return my preferredExtent - make my width very small" |
205 | 103 |
|
539
c7c5585e77f6
use common code for H/V miniScrollers
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
104 |
|defExt w h mm| |
205 | 105 |
|
539
c7c5585e77f6
use common code for H/V miniScrollers
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
106 |
defExt := self class defaultExtent. |
1114 | 107 |
|
1305
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
108 |
(mm := MiniScrollerSize) isNil ifTrue:[ |
3498
1170b64bde6e
default thicknes changed a bit
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
109 |
mm := (thumbLevel ~~ 0) ifTrue:[1.8] ifFalse:[1.5]. |
1170b64bde6e
default thicknes changed a bit
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
110 |
mm := (thumbLevel ~~ 0) ifTrue:[2.5] ifFalse:[2]. |
1170b64bde6e
default thicknes changed a bit
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
111 |
styleSheet name == #st80 ifTrue:[ |
1170b64bde6e
default thicknes changed a bit
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
112 |
mm := 2 |
1170b64bde6e
default thicknes changed a bit
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
113 |
]. |
1305
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
114 |
]. |
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
115 |
|
1114 | 116 |
w := defExt x. |
117 |
h := defExt y. |
|
118 |
||
539
c7c5585e77f6
use common code for H/V miniScrollers
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
119 |
orientation == #vertical ifTrue:[ |
5628 | 120 |
w := (device horizontalPixelPerMillimeter asFloat * mm) rounded. |
5948 | 121 |
"/ don't let it become too small for thumb ... |
3498
1170b64bde6e
default thicknes changed a bit
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
122 |
w := w max:((level abs + thumbLevel) * 2 + 1). |
539
c7c5585e77f6
use common code for H/V miniScrollers
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
123 |
] ifFalse:[ |
5628 | 124 |
h := (device verticalPixelPerMillimeter asFloat * mm) rounded. |
5948 | 125 |
"/ don't let it become too small for thumb ... |
3498
1170b64bde6e
default thicknes changed a bit
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
126 |
h := h max:((level abs + thumbLevel) * 2 + 1). |
539
c7c5585e77f6
use common code for H/V miniScrollers
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
127 |
]. |
797 | 128 |
preferredExtent := w @ h. |
129 |
^ preferredExtent. |
|
539
c7c5585e77f6
use common code for H/V miniScrollers
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
130 |
|
6493 | 131 |
"Created: / 09-11-2018 / 19:57:23 / Claus Gittinger" |
132 |
! |
|
133 |
||
134 |
isMiniScroller |
|
135 |
^ true |
|
136 |
||
137 |
"Created: 7.3.1997 / 16:20:22 / cg" |
|
205 | 138 |
! ! |
139 |
||
968 | 140 |
!MiniScroller class methodsFor:'documentation'! |
205 | 141 |
|
142 |
version |
|
5628 | 143 |
^ '$Header$' |
205 | 144 |
! ! |
4901 | 145 |