9 other person. No title to or ownership of the software is |
9 other person. No title to or ownership of the software is |
10 hereby transferred. |
10 hereby transferred. |
11 " |
11 " |
12 |
12 |
13 View subclass:#TopView |
13 View subclass:#TopView |
14 instanceVariableNames:'type' |
14 instanceVariableNames:'type' |
15 classVariableNames: '' |
15 classVariableNames:'' |
16 poolDictionaries:'' |
16 poolDictionaries:'' |
17 category:'Views-Basic' |
17 category:'Views-Basic' |
18 ! |
18 ! |
19 |
19 |
20 !TopView class methodsFor:'documentation'! |
20 !TopView class methodsFor:'documentation'! |
21 |
21 |
22 copyright |
22 copyright |
51 |
47 |
52 |display| |
48 |display| |
53 |
49 |
54 display := Screen current. |
50 display := Screen current. |
55 ^ (display width // 3 * 2) @ (display height // 3 * 2) |
51 ^ (display width // 3 * 2) @ (display height // 3 * 2) |
|
52 ! ! |
|
53 |
|
54 !TopView methodsFor:'accessing & queries'! |
|
55 |
|
56 beMaster |
|
57 "make this a master-view. All slave views within the same |
|
58 windowGroup will be closed if any master is closed." |
|
59 |
|
60 type := #master |
|
61 ! |
|
62 |
|
63 bePartner |
|
64 "make this a partner-view. Each partner-view will automatically |
|
65 close other partner views whenclosed." |
|
66 |
|
67 type := #partner |
|
68 ! |
|
69 |
|
70 beSlave |
|
71 "make this a slave-view. It will be closed automatically, |
|
72 whenever any master of the group is closed." |
|
73 |
|
74 type := #slave |
|
75 ! |
|
76 |
|
77 heightIncludingBorder |
|
78 "return the views overall-height" |
|
79 |
|
80 ^ height |
|
81 ! |
|
82 |
|
83 isCollapsed |
|
84 "ST80 compatibility: return true if the view is not shown (i.e. iconified)" |
|
85 |
|
86 ^ shown not |
|
87 ! |
|
88 |
|
89 preferredExtent |
|
90 "return my preferred extent - this is the minimum size I would like to have. |
|
91 The default here is the classes default extent, |
|
92 however many subclasses redefine this to compute the actual value |
|
93 depending on the sizes of the contents or subcomponents." |
|
94 |
|
95 ^ self class defaultExtent |
|
96 ! |
|
97 |
|
98 type |
|
99 "return the views type. This is one of #normal, |
|
100 #master, #slave or #partner." |
|
101 |
|
102 ^ type |
|
103 ! |
|
104 |
|
105 widthIncludingBorder |
|
106 "return the views overall-width" |
|
107 |
|
108 ^ width |
56 ! ! |
109 ! ! |
57 |
110 |
58 !TopView methodsFor:'initialization'! |
111 !TopView methodsFor:'initialization'! |
59 |
112 |
60 initialize |
113 initialize |
64 |
117 |
65 screenCenter := device center. |
118 screenCenter := device center. |
66 left := screenCenter x - (width // 2). |
119 left := screenCenter x - (width // 2). |
67 top := screenCenter y - (height // 2). |
120 top := screenCenter y - (height // 2). |
68 type := #normal |
121 type := #normal |
|
122 ! ! |
|
123 |
|
124 !TopView methodsFor:'misc'! |
|
125 |
|
126 raiseDeiconified |
|
127 "deiconify & bring to front" |
|
128 |
|
129 self isCollapsed ifTrue:[ |
|
130 self unrealize. |
|
131 self realize. |
|
132 ]. |
|
133 self raise |
|
134 |
|
135 " |
|
136 Transcript topView raiseDeiconified |
|
137 " |
|
138 ! |
|
139 |
|
140 withCursor:aCursor do:aBlock |
|
141 "evaluate aBlock while showing aCursor in all my views. |
|
142 Return the value as returned by aBlock." |
|
143 |
|
144 windowGroup notNil ifTrue:[ |
|
145 ^ windowGroup withCursor:aCursor do:aBlock |
|
146 ]. |
|
147 ^ super withCursor:aCursor do:aBlock |
|
148 ! |
|
149 |
|
150 withWaitCursorDo:aBlock |
|
151 "evaluate aBlock while showing a waitCursor in all my views. |
|
152 Return the value as returned by aBlock." |
|
153 |
|
154 ^ self withCursor:(Cursor wait) do:aBlock |
|
155 ! ! |
|
156 |
|
157 !TopView methodsFor:'startup'! |
|
158 |
|
159 openInGroup:aGroup |
|
160 "special open within another windowGroup. |
|
161 This allows a view to be realized in any windowgroup; |
|
162 for applications where multiple views act as a group |
|
163 (i.e. close and iconify together)." |
|
164 |
|
165 self windowGroup:aGroup. |
|
166 aGroup addTopView:self. |
|
167 self realizeLeavingGroup:true |
|
168 ! |
|
169 |
|
170 openWithExtent:anExtent |
|
171 "set extent and open. The given extent overrides the |
|
172 receivers preferredExtent. |
|
173 Added for ST-80 compatibility" |
|
174 |
|
175 self extent:anExtent; sizeFixed:true. |
|
176 self open |
69 ! ! |
177 ! ! |
70 |
178 |
71 !TopView methodsFor:'window events'! |
179 !TopView methodsFor:'window events'! |
72 |
180 |
73 destroy |
181 destroy |
123 ]. |
231 ]. |
124 ]. |
232 ]. |
125 |
233 |
126 ! ! |
234 ! ! |
127 |
235 |
128 !TopView methodsFor:'misc'! |
236 !TopView class methodsFor:'documentation'! |
129 |
237 |
130 withWaitCursorDo:aBlock |
238 version |
131 "evaluate aBlock while showing a waitCursor in all my views. |
239 ^ '$Header: /cvs/stx/stx/libview/TopView.st,v 1.8 1995-11-27 22:31:39 cg Exp $' |
132 Return the value as returned by aBlock." |
240 ! ! |
133 |
|
134 ^ self withCursor:(Cursor wait) do:aBlock |
|
135 ! |
|
136 |
|
137 withCursor:aCursor do:aBlock |
|
138 "evaluate aBlock while showing aCursor in all my views. |
|
139 Return the value as returned by aBlock." |
|
140 |
|
141 windowGroup notNil ifTrue:[ |
|
142 ^ windowGroup withCursor:aCursor do:aBlock |
|
143 ]. |
|
144 ^ super withCursor:aCursor do:aBlock |
|
145 ! |
|
146 |
|
147 raiseDeiconified |
|
148 "deiconify & bring to front" |
|
149 |
|
150 self isCollapsed ifTrue:[ |
|
151 self unrealize. |
|
152 self realize. |
|
153 ]. |
|
154 self raise |
|
155 |
|
156 " |
|
157 Transcript topView raiseDeiconified |
|
158 " |
|
159 ! ! |
|
160 |
|
161 !TopView methodsFor:'startup'! |
|
162 |
|
163 openWithExtent:anExtent |
|
164 "set extent and open. The given extent overrides the |
|
165 receivers preferredExtent. |
|
166 Added for ST-80 compatibility" |
|
167 |
|
168 self extent:anExtent; sizeFixed:true. |
|
169 self open |
|
170 ! |
|
171 |
|
172 openInGroup:aGroup |
|
173 "special open within another windowGroup. |
|
174 This allows a view to be realized in any windowgroup; |
|
175 for applications where multiple views act as a group |
|
176 (i.e. close and iconify together)." |
|
177 |
|
178 self windowGroup:aGroup. |
|
179 aGroup addTopView:self. |
|
180 self realizeLeavingGroup:true |
|
181 ! ! |
|
182 |
|
183 !TopView methodsFor:'accessing & queries'! |
|
184 |
|
185 type |
|
186 "return the views type. This is one of #normal, |
|
187 #master, #slave or #partner." |
|
188 |
|
189 ^ type |
|
190 ! |
|
191 |
|
192 beMaster |
|
193 "make this a master-view. All slave views within the same |
|
194 windowGroup will be closed if any master is closed." |
|
195 |
|
196 type := #master |
|
197 ! |
|
198 |
|
199 beSlave |
|
200 "make this a slave-view. It will be closed automatically, |
|
201 whenever any master of the group is closed." |
|
202 |
|
203 type := #slave |
|
204 ! |
|
205 |
|
206 bePartner |
|
207 "make this a partner-view. Each partner-view will automatically |
|
208 close other partner views whenclosed." |
|
209 |
|
210 type := #partner |
|
211 ! |
|
212 |
|
213 preferredExtent |
|
214 "return my preferred extent - this is the minimum size I would like to have. |
|
215 The default here is the classes default extent, |
|
216 however many subclasses redefine this to compute the actual value |
|
217 depending on the sizes of the contents or subcomponents." |
|
218 |
|
219 ^ self class defaultExtent |
|
220 ! |
|
221 |
|
222 isCollapsed |
|
223 "ST80 compatibility: return true if the view is not shown (i.e. iconified)" |
|
224 |
|
225 ^ shown not |
|
226 ! |
|
227 |
|
228 heightIncludingBorder |
|
229 "return the views overall-height" |
|
230 |
|
231 ^ height |
|
232 ! |
|
233 |
|
234 widthIncludingBorder |
|
235 "return the views overall-width" |
|
236 |
|
237 ^ width |
|
238 ! ! |
|
239 |
|