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