135
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
3 |
All Rights Reserved
|
|
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 |
View subclass:#TopView
|
269
|
14 |
instanceVariableNames:'type'
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Views-Basic'
|
135
|
18 |
!
|
|
19 |
|
|
20 |
!TopView class methodsFor:'documentation'!
|
|
21 |
|
|
22 |
copyright
|
|
23 |
"
|
|
24 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
25 |
All Rights Reserved
|
|
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 |
I am an abstract superclass of StandardSystemView and PopUpView;
|
|
39 |
i.e. views which have no superview.
|
|
40 |
"
|
|
41 |
! !
|
|
42 |
|
|
43 |
!TopView class methodsFor:'defaults'!
|
|
44 |
|
|
45 |
defaultExtent
|
|
46 |
"topviews extent is (0.6 @ 0.6) of screen by default"
|
|
47 |
|
153
|
48 |
|display|
|
|
49 |
|
|
50 |
display := Screen current.
|
|
51 |
^ (display width // 3 * 2) @ (display height // 3 * 2)
|
135
|
52 |
! !
|
|
53 |
|
269
|
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
|
|
109 |
! !
|
|
110 |
|
135
|
111 |
!TopView methodsFor:'initialization'!
|
|
112 |
|
|
113 |
initialize
|
|
114 |
|screenCenter|
|
|
115 |
|
|
116 |
super initialize.
|
|
117 |
|
|
118 |
screenCenter := device center.
|
|
119 |
left := screenCenter x - (width // 2).
|
|
120 |
top := screenCenter y - (height // 2).
|
141
|
121 |
type := #normal
|
135
|
122 |
! !
|
|
123 |
|
269
|
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
|
|
177 |
! !
|
|
178 |
|
157
|
179 |
!TopView methodsFor:'window events'!
|
|
180 |
|
|
181 |
destroy
|
|
182 |
"the receiver is to be destroyed - look for partners and slaves"
|
|
183 |
|
|
184 |
|wg|
|
|
185 |
|
|
186 |
wg := windowGroup. "/ have to fetch windowGroup before;
|
|
187 |
super destroy. "/ since destroy nils it
|
|
188 |
wg notNil ifTrue:[
|
|
189 |
"/
|
|
190 |
"/ if I am a master or partner, close all slaves
|
|
191 |
"/
|
|
192 |
(type == #master or:[type == #partner]) ifTrue:[
|
|
193 |
wg slavesDo:[:v | v destroy].
|
|
194 |
].
|
|
195 |
"/
|
|
196 |
"/ if I am a partner, close all partners
|
|
197 |
"/
|
|
198 |
type == #partner ifTrue:[
|
|
199 |
wg partnersDo:[:v | v ~~ self ifTrue:[v destroy]].
|
|
200 |
].
|
|
201 |
].
|
|
202 |
!
|
|
203 |
|
|
204 |
mapped
|
|
205 |
"the recevier was mapped (i.e. deiconified or just created);
|
|
206 |
look for partners and slaves."
|
|
207 |
|
|
208 |
realized := true.
|
|
209 |
super mapped.
|
|
210 |
windowGroup notNil ifTrue:[
|
|
211 |
(type == #master or:[type == #partner]) ifTrue:[
|
|
212 |
windowGroup slavesDo:[:v | v rerealize].
|
|
213 |
].
|
|
214 |
type == #partner ifTrue:[
|
|
215 |
windowGroup partnersDo:[:v | v ~~ self ifTrue:[v rerealize]].
|
|
216 |
]
|
|
217 |
].
|
|
218 |
!
|
|
219 |
|
|
220 |
unmapped
|
|
221 |
"the recevier was unmapped (i.e. iconified);
|
|
222 |
look for partners and slaves."
|
|
223 |
|
|
224 |
super unmapped.
|
|
225 |
windowGroup notNil ifTrue:[
|
|
226 |
(type == #master or:[type == #partner]) ifTrue:[
|
|
227 |
windowGroup slavesDo:[:v | v unrealize].
|
|
228 |
].
|
|
229 |
type == #partner ifTrue:[
|
|
230 |
windowGroup partnersDo:[:v | v ~~ self ifTrue:[v unrealize]].
|
|
231 |
].
|
|
232 |
].
|
|
233 |
|
|
234 |
! !
|
|
235 |
|
269
|
236 |
!TopView class methodsFor:'documentation'!
|
135
|
237 |
|
269
|
238 |
version
|
|
239 |
^ '$Header: /cvs/stx/stx/libview/TopView.st,v 1.8 1995-11-27 22:31:39 cg Exp $'
|
135
|
240 |
! !
|