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