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