10 hereby transferred. |
10 hereby transferred. |
11 " |
11 " |
12 |
12 |
13 View subclass:#ScrollBar |
13 View subclass:#ScrollBar |
14 instanceVariableNames:'thumb button1 button2 layout' |
14 instanceVariableNames:'thumb button1 button2 layout' |
15 classVariableNames:'defaultScrollUpForm |
15 classVariableNames:'DefaultScrollUpForm |
16 defaultScrollDownForm' |
16 DefaultScrollDownForm' |
17 poolDictionaries:'' |
17 poolDictionaries:'' |
18 category:'Views-Interactors' |
18 category:'Views-Interactors' |
19 ! |
19 ! |
20 |
20 |
21 ScrollBar comment:' |
21 ScrollBar comment:' |
25 |
25 |
26 this class implements vertical scrollbars with scroller and |
26 this class implements vertical scrollbars with scroller and |
27 2 step-scroll buttons. when moved or stepped, it performs a |
27 2 step-scroll buttons. when moved or stepped, it performs a |
28 predefined action. |
28 predefined action. |
29 |
29 |
30 $Header: /cvs/stx/stx/libwidg/ScrollBar.st,v 1.4 1993-12-11 01:49:06 claus Exp $ |
30 $Header: /cvs/stx/stx/libwidg/ScrollBar.st,v 1.5 1994-01-08 17:27:56 claus Exp $ |
31 |
31 |
32 written spring/summer 89 by claus |
32 written spring/summer 89 by claus |
33 '! |
33 '! |
34 |
34 |
35 !ScrollBar class methodsFor:'defaults'! |
35 !ScrollBar class methodsFor:'defaults'! |
36 |
36 |
37 scrollUpButtonForm:style |
37 scrollUpButtonForm:style |
38 "return the form used for the scrollUp Button" |
38 "return the form used for the scrollUp Button" |
39 |
39 |
40 defaultScrollUpForm isNil ifTrue:[ |
40 DefaultScrollUpForm isNil ifTrue:[ |
41 defaultScrollUpForm := Form fromFile:(self classResources at:'SCROLL_UP_BUTTON_FORM_FILE' |
41 DefaultScrollUpForm := Form fromFile:(self classResources at:'SCROLL_UP_BUTTON_FORM_FILE' |
42 default:(style == #mswindows |
42 default:(style == #mswindows |
43 ifTrue:['ScrollUp_win.xbm'] |
43 ifTrue:['ScrollUp_win.xbm'] |
44 ifFalse:['ScrollUp.xbm']) |
44 ifFalse:['ScrollUp.xbm']) |
45 ) |
45 ) |
46 resolution:100 |
46 resolution:100 |
47 ]. |
47 ]. |
48 defaultScrollUpForm isNil ifTrue:[ |
48 DefaultScrollUpForm isNil ifTrue:[ |
49 defaultScrollUpForm := Form width:16 height:16 |
49 DefaultScrollUpForm := Form width:16 height:16 |
50 fromArray:#(2r00000000 2r00000000 |
50 fromArray:#(2r00000000 2r00000000 |
51 2r00000001 2r10000000 |
51 2r00000001 2r10000000 |
52 2r00000010 2r01000000 |
52 2r00000010 2r01000000 |
53 2r00000100 2r00100000 |
53 2r00000100 2r00100000 |
54 2r00001000 2r00010000 |
54 2r00001000 2r00010000 |
62 2r00001000 2r00010000 |
62 2r00001000 2r00010000 |
63 2r00001000 2r00010000 |
63 2r00001000 2r00010000 |
64 2r00001111 2r11110000 |
64 2r00001111 2r11110000 |
65 2r00000000 2r00000000) |
65 2r00000000 2r00000000) |
66 ]. |
66 ]. |
67 ^ defaultScrollUpForm |
67 ^ DefaultScrollUpForm |
68 ! |
68 ! |
69 |
69 |
70 scrollDownButtonForm:style |
70 scrollDownButtonForm:style |
71 "retun the form used for the scrollDown Button" |
71 "retun the form used for the scrollDown Button" |
72 |
72 |
73 defaultScrollDownForm isNil ifTrue:[ |
73 DefaultScrollDownForm isNil ifTrue:[ |
74 defaultScrollDownForm := Form fromFile:(self classResources at:'SCROLL_DOWN_BUTTON_FORM_FILE' |
74 DefaultScrollDownForm := Form fromFile:(self classResources at:'SCROLL_DOWN_BUTTON_FORM_FILE' |
75 default:(style == #mswindows |
75 default:(style == #mswindows |
76 ifTrue:['ScrollDn_win.xbm'] |
76 ifTrue:['ScrollDn_win.xbm'] |
77 ifFalse:['ScrollDn.xbm']) |
77 ifFalse:['ScrollDn.xbm']) |
78 ) |
78 ) |
79 resolution:100 |
79 resolution:100 |
80 ]. |
80 ]. |
81 defaultScrollDownForm isNil ifTrue:[ |
81 DefaultScrollDownForm isNil ifTrue:[ |
82 defaultScrollDownForm := Form width:16 height:16 |
82 DefaultScrollDownForm := Form width:16 height:16 |
83 fromArray:#(2r00000000 2r00000000 |
83 fromArray:#(2r00000000 2r00000000 |
84 2r00001111 2r11110000 |
84 2r00001111 2r11110000 |
85 2r00001000 2r00010000 |
85 2r00001000 2r00010000 |
86 2r00001000 2r00010000 |
86 2r00001000 2r00010000 |
87 2r00001000 2r00010000 |
87 2r00001000 2r00010000 |
95 2r00000100 2r00100000 |
95 2r00000100 2r00100000 |
96 2r00000010 2r01000000 |
96 2r00000010 2r01000000 |
97 2r00000001 2r10000000 |
97 2r00000001 2r10000000 |
98 2r00000000 2r00000000) |
98 2r00000000 2r00000000) |
99 ]. |
99 ]. |
100 ^ defaultScrollDownForm |
100 ^ DefaultScrollDownForm |
101 ! ! |
101 ! ! |
102 |
102 |
103 !ScrollBar class methodsFor:'style changes'! |
103 !ScrollBar class methodsFor:'style changes'! |
104 |
104 |
105 styleChange |
105 styleChange |
106 defaultScrollUpForm := nil. |
106 DefaultScrollUpForm := nil. |
107 defaultScrollDownForm := nil |
107 DefaultScrollDownForm := nil |
108 |
108 |
109 "ScrollBar styleChange" |
109 "ScrollBar styleChange" |
110 ! ! |
110 ! ! |
111 |
111 |
112 !ScrollBar methodsFor:'initialization'! |
112 !ScrollBar methodsFor:'initialization'! |
115 "setup; create the 2 buttons and a scroller" |
115 "setup; create the 2 buttons and a scroller" |
116 |
116 |
117 |bwn sep w h upForm downForm clr| |
117 |bwn sep w h upForm downForm clr| |
118 |
118 |
119 super initialize. |
119 super initialize. |
|
120 button1 := ArrowButton upIn:self. |
|
121 button1 name:'UpButton'. |
|
122 button1 autoRepeat. |
|
123 |
|
124 button2 := ArrowButton downIn:self. |
|
125 button2 name:'DownButton'. |
|
126 button2 autoRepeat. |
|
127 |
|
128 thumb := Scroller in:self. |
120 |
129 |
121 "compute my extent from sub-components" |
130 "compute my extent from sub-components" |
122 |
131 |
123 upForm := self class scrollUpButtonForm:style. |
132 upForm := self class scrollUpButtonForm:style. |
124 downForm := self class scrollDownButtonForm:style. |
133 downForm := self class scrollDownButtonForm:style. |
137 sep := 1 |
146 sep := 1 |
138 ] ifFalse:[ |
147 ] ifFalse:[ |
139 sep := 0 |
148 sep := 0 |
140 ]. |
149 ]. |
141 |
150 |
142 button1 := "Button form:(self class scrollUpButtonForm:style) in:self." |
|
143 ArrowButton upIn:self. |
|
144 button1 name:'UpButton'. |
|
145 button1 borderWidth:borderWidth. |
151 button1 borderWidth:borderWidth. |
146 button1 autoRepeat. |
152 |
147 |
|
148 thumb := Scroller in:self. |
|
149 style ~~ #next ifTrue:[ |
153 style ~~ #next ifTrue:[ |
150 thumb borderWidth:borderWidth. |
154 thumb borderWidth:borderWidth. |
151 ]. |
155 ]. |
152 |
156 |
153 button2 := "Button form:(self class scrollDownButtonForm:style) in:self." |
|
154 ArrowButton downIn:self. |
|
155 button2 name:'DownButton'. |
|
156 button2 borderWidth:borderWidth. |
157 button2 borderWidth:borderWidth. |
157 button2 autoRepeat. |
|
158 |
158 |
159 ((style == #iris) and:[Display hasGreyscales])ifTrue:[ |
159 ((style == #iris) and:[Display hasGreyscales])ifTrue:[ |
160 "have to change some of Buttons defaults" |
160 "have to change some of Buttons defaults" |
161 clr := (Color grey:25) on:device. |
161 clr := (Color grey:25) on:device. |
162 button1 offLevel:2. |
162 button1 offLevel:2. |