author | Claus Gittinger <cg@exept.de> |
Sat, 16 Oct 2004 14:29:55 +0200 | |
changeset 3070 | 438887ca611a |
parent 1519 | 7be06f0bb911 |
child 3165 | 58b08c376a6e |
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 |
" |
|
12 |
||
13 |
Scroller subclass:#MiniScroller |
|
539
c7c5585e77f6
use common code for H/V miniScrollers
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
14 |
instanceVariableNames:'' |
1305
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
15 |
classVariableNames:'MiniScrollerSize' |
539
c7c5585e77f6
use common code for H/V miniScrollers
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
16 |
poolDictionaries:'' |
c7c5585e77f6
use common code for H/V miniScrollers
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
17 |
category:'Views-Interactors' |
37 | 18 |
! |
19 |
||
968 | 20 |
!MiniScroller class methodsFor:'documentation'! |
37 | 21 |
|
22 |
copyright |
|
23 |
" |
|
24 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
64 | 25 |
All Rights Reserved |
37 | 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 |
||
36 |
documentation |
|
37 |
" |
|
38 |
like a scroller, but taking less screen space |
|
585 | 39 |
|
40 |
[author:] |
|
1427
f73bcbd3b994
dont let miniscroller become too small (motif style)
Claus Gittinger <cg@exept.de>
parents:
1386
diff
changeset
|
41 |
Claus Gittinger |
37 | 42 |
" |
43 |
! ! |
|
44 |
||
1305
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
45 |
!MiniScroller class methodsFor:'defaults'! |
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
46 |
|
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
47 |
updateStyleCache |
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
48 |
"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
|
49 |
|
1354 | 50 |
<resource: #style (#'miniScroller.size')> |
1305
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
51 |
|
1354 | 52 |
MiniScrollerSize := StyleSheet at:'miniScroller.size'. |
1305
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
53 |
|
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 |
self updateStyleCache |
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 |
"Created: 15.8.1997 / 01:51:38 / cg" |
1354 | 59 |
"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
|
60 |
! ! |
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
61 |
|
130 | 62 |
!MiniScroller methodsFor:'initialization'! |
37 | 63 |
|
64 |
initStyle |
|
968 | 65 |
"setup viewStyle specifics" |
66 |
||
119 | 67 |
|style lvl| |
68 |
||
37 | 69 |
super initStyle. |
119 | 70 |
style := StyleSheet name. |
37 | 71 |
style == #iris ifTrue:[ |
1519 | 72 |
tallyLevel := tallyMarks := 0. |
73 |
thumbEdgeStyle := nil. |
|
74 |
thumbLevel := thumbActiveLevel := 2. |
|
37 | 75 |
]. |
76 |
((style ~~ #normal) and:[style ~~ #mswindows]) ifTrue:[ |
|
1519 | 77 |
style == #st80 ifTrue:[ |
78 |
lvl := 1. |
|
79 |
"/ lvl := 0. |
|
80 |
] ifFalse:[ |
|
81 |
lvl := -1. |
|
82 |
]. |
|
83 |
self level:lvl. |
|
84 |
self borderWidth:0 |
|
37 | 85 |
]. |
86 |
shadowForm := lightForm := nil. |
|
1519 | 87 |
fixThumbHeight := false. |
539
c7c5585e77f6
use common code for H/V miniScrollers
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
88 |
|
1519 | 89 |
thumbImage := nil. |
90 |
||
91 |
"Modified: / 12.5.1998 / 20:41:52 / cg" |
|
555 | 92 |
! |
93 |
||
94 |
initialize |
|
95 |
"initialize - setup instvars from defaults" |
|
96 |
||
556 | 97 |
orientation isNil ifTrue:[orientation := #vertical]. |
555 | 98 |
super initialize. |
37 | 99 |
! ! |
205 | 100 |
|
101 |
!MiniScroller methodsFor:'queries'! |
|
102 |
||
1116 | 103 |
isMiniScroller |
104 |
^ true |
|
105 |
||
106 |
"Created: 7.3.1997 / 16:20:22 / cg" |
|
107 |
! |
|
108 |
||
205 | 109 |
preferredExtent |
572 | 110 |
"return my preferredExtent - make my width very small" |
205 | 111 |
|
539
c7c5585e77f6
use common code for H/V miniScrollers
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
112 |
|defExt w h mm| |
205 | 113 |
|
797 | 114 |
"/ If I have an explicit preferredExtent .. |
115 |
||
714
5ff02d2d9fa7
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
116 |
preferredExtent notNil ifTrue:[ |
1427
f73bcbd3b994
dont let miniscroller become too small (motif style)
Claus Gittinger <cg@exept.de>
parents:
1386
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:[ |
1427
f73bcbd3b994
dont let miniscroller become too small (motif style)
Claus Gittinger <cg@exept.de>
parents:
1386
diff
changeset
|
123 |
mm := (thumbLevel ~~ 0) ifTrue:[1.8] ifFalse:[1.5]. |
f73bcbd3b994
dont let miniscroller become too small (motif style)
Claus Gittinger <cg@exept.de>
parents:
1386
diff
changeset
|
124 |
styleSheet name == #st80 ifTrue:[ |
f73bcbd3b994
dont let miniscroller become too small (motif style)
Claus Gittinger <cg@exept.de>
parents:
1386
diff
changeset
|
125 |
mm := 2 |
f73bcbd3b994
dont let miniscroller become too small (motif style)
Claus Gittinger <cg@exept.de>
parents:
1386
diff
changeset
|
126 |
]. |
1305
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
127 |
]. |
02af46047b4a
allow miniscrollers thickness to be defined in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
128 |
|
1114 | 129 |
w := defExt x. |
130 |
h := defExt y. |
|
131 |
||
539
c7c5585e77f6
use common code for H/V miniScrollers
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
132 |
orientation == #vertical ifTrue:[ |
1427
f73bcbd3b994
dont let miniscroller become too small (motif style)
Claus Gittinger <cg@exept.de>
parents:
1386
diff
changeset
|
133 |
w := (device horizontalPixelPerMillimeter asFloat * mm) rounded. |
f73bcbd3b994
dont let miniscroller become too small (motif style)
Claus Gittinger <cg@exept.de>
parents:
1386
diff
changeset
|
134 |
"/ dont let it become too small for thumb ... |
f73bcbd3b994
dont let miniscroller become too small (motif style)
Claus Gittinger <cg@exept.de>
parents:
1386
diff
changeset
|
135 |
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
|
136 |
] ifFalse:[ |
1427
f73bcbd3b994
dont let miniscroller become too small (motif style)
Claus Gittinger <cg@exept.de>
parents:
1386
diff
changeset
|
137 |
h := (device verticalPixelPerMillimeter asFloat * mm) rounded. |
f73bcbd3b994
dont let miniscroller become too small (motif style)
Claus Gittinger <cg@exept.de>
parents:
1386
diff
changeset
|
138 |
"/ dont let it become too small for thumb ... |
f73bcbd3b994
dont let miniscroller become too small (motif style)
Claus Gittinger <cg@exept.de>
parents:
1386
diff
changeset
|
139 |
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
|
140 |
]. |
797 | 141 |
preferredExtent := w @ h. |
142 |
^ preferredExtent. |
|
539
c7c5585e77f6
use common code for H/V miniScrollers
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
143 |
|
1427
f73bcbd3b994
dont let miniscroller become too small (motif style)
Claus Gittinger <cg@exept.de>
parents:
1386
diff
changeset
|
144 |
"Modified: / 25.1.1998 / 00:57:07 / cg" |
205 | 145 |
! ! |
146 |
||
968 | 147 |
!MiniScroller class methodsFor:'documentation'! |
205 | 148 |
|
149 |
version |
|
1519 | 150 |
^ '$Header: /cvs/stx/stx/libwidg/MiniScroller.st,v 1.21 1998-05-12 19:00:42 cg Exp $' |
205 | 151 |
! ! |