author | Stefan Vogel <sv@exept.de> |
Tue, 10 Mar 2020 15:19:04 +0100 | |
changeset 6844 | 235a4c848100 |
parent 6762 | fe96efd9e402 |
permissions | -rw-r--r-- |
0 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
60 | 3 |
All Rights Reserved |
0 | 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 |
" |
|
2190 | 12 |
"{ Package: 'stx:libwidg' }" |
13 |
||
5516 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
119 | 16 |
SimpleView subclass:#PanelView |
585 | 17 |
instanceVariableNames:'hLayout vLayout verticalSpace horizontalSpace mustRearrange |
4415 | 18 |
elementsChangeSize ignoreInvisibleComponents backgroundChannel' |
585 | 19 |
classVariableNames:'' |
20 |
poolDictionaries:'' |
|
21 |
category:'Views-Layout' |
|
0 | 22 |
! |
23 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
788
diff
changeset
|
24 |
!PanelView class methodsFor:'documentation'! |
0 | 25 |
|
38 | 26 |
copyright |
27 |
" |
|
28 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
60 | 29 |
All Rights Reserved |
0 | 30 |
|
38 | 31 |
This software is furnished under a license and may be used |
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
38 |
! |
|
0 | 39 |
|
38 | 40 |
documentation |
41 |
" |
|
127 | 42 |
this is a view for holding subviews. (layout-widget ?) |
38 | 43 |
|
44 |
Instances of PanelView try to get all their subviews into them, |
|
45 |
arranging subviews left-to-right, top-to-bottom. |
|
46 |
||
5951 | 47 |
If you don't like its layout, define a new subclass or use one of |
38 | 48 |
the existing subclasses: HorizontalPanelView and VerticalPanelView. |
60 | 49 |
|
127 | 50 |
The panel assumes, that the elements do not resize themselfes, after it |
51 |
became visible. This is not true for all widgets (buttons or labels may |
|
52 |
like to change). If you have changing elements, tell this to the panel |
|
53 |
with 'aPanel elementsChangeSize:true'. In that case, the panel will react |
|
54 |
to size changes, and reorganize things. |
|
55 |
||
63 | 56 |
PanelViews normally delay the actual positioning/sizing of their elements, |
60 | 57 |
until actually displayed. This is useful, if more elements are to |
58 |
be added, to avoid repeated configuration of the elements. |
|
59 |
||
60 |
If you want to query for the relative position of an element BEFORE |
|
61 |
the view is visible, you have to send #setChildPositionsIfChanged before |
|
63 | 62 |
doing so (otherwise, you may get invalid origins from the subviews). As |
63 |
an example, the modalBoxes do so before showing themselfes to ask for the |
|
64 |
position of the ok-button relative to the top-left box-origin, in order to |
|
65 |
position the ok-button under the mouse-pointer. |
|
66 |
||
585 | 67 |
[Instance variables:] |
63 | 68 |
|
5951 | 69 |
hLayout <Symbol> controls horizontal layout; ignored in this |
70 |
class, but used in Horizontal- and |
|
71 |
VerticalPanelViews. See more info there. |
|
63 | 72 |
|
5951 | 73 |
vLayout <Symbol> controls vertical layout; ignored in this |
74 |
class, but used in Horizontal- and |
|
75 |
VerticalPanelViews. See more info there. |
|
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
76 |
|
5951 | 77 |
horizontalSpace <Integer> number of pixels to use as space between elements |
78 |
defaults to ViewSpacing, which is 1mm |
|
63 | 79 |
|
5951 | 80 |
verticalSpace <Integer> number of pixels to use as space between elements |
81 |
defaults to ViewSpacing, which is 1mm |
|
63 | 82 |
|
5951 | 83 |
mustRearrange <Boolean> internal flag, if rearrangement is needed |
63 | 84 |
|
5951 | 85 |
elementsChangeSize |
86 |
<Boolean> if true, the panel takes care of this situation. |
|
87 |
By default, this is false. |
|
125 | 88 |
|
5951 | 89 |
ignoreInvisibleComponents |
90 |
<Boolean> if true, invisible (i.e. hidden) views |
|
91 |
are not considered in the layout computation. |
|
92 |
If false, they will lead to additional space |
|
93 |
between visible components. |
|
94 |
The default is false. |
|
585 | 95 |
|
96 |
[author:] |
|
5951 | 97 |
Claus Gittinger |
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
98 |
" |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
99 |
! |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
100 |
|
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
101 |
examples |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
102 |
" |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
103 |
The generic panelView simply tries to get its |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
104 |
components arranged for fitting them all into |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
105 |
its area. No special layout is done, except for |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
106 |
horizontal/vertical spacings. |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
107 |
The view is filled top-left to bottom-right |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
108 |
with subcomponents. Subcomponents are not resized. |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
109 |
|
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
110 |
example: |
1604 | 111 |
[exBegin] |
112 |
|v p b1 b2 b3| |
|
113 |
||
114 |
v := StandardSystemView new. |
|
115 |
v label:'panel'. |
|
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
116 |
|
1604 | 117 |
p := PanelView in:v. |
118 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
119 |
b1 := Button label:'button1' in:p. |
|
120 |
b2 := Button label:'button2' in:p. |
|
121 |
b3 := Button label:'button3' in:p. |
|
122 |
v extent:300 @ 100. |
|
123 |
v open |
|
124 |
[exEnd] |
|
125 |
||
126 |
||
127 |
invisible component not considered in layout: |
|
128 |
[exBegin] |
|
129 |
|v p b1 b2 b3| |
|
130 |
||
131 |
v := StandardSystemView new. |
|
132 |
v label:'panel'. |
|
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
133 |
|
1604 | 134 |
p := PanelView in:v. |
135 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
136 |
b1 := Button label:'button1' in:p. |
|
137 |
b2 := Button label:'button2' in:p. |
|
138 |
b2 beInvisible. |
|
139 |
b3 := Button label:'button3' in:p. |
|
140 |
v extent:300 @ 100. |
|
141 |
v open |
|
142 |
[exEnd] |
|
143 |
||
144 |
invisible component considered in layout: |
|
145 |
[exBegin] |
|
146 |
|v p b1 b2 b3| |
|
147 |
||
148 |
v := StandardSystemView new. |
|
149 |
v label:'panel'. |
|
150 |
||
151 |
p := PanelView in:v. |
|
152 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
153 |
p ignoreInvisibleComponents:false. |
|
154 |
b1 := Button label:'button1' in:p. |
|
155 |
b2 := Button label:'button2' in:p. |
|
156 |
b2 beInvisible. |
|
157 |
b3 := Button label:'button3' in:p. |
|
158 |
v extent:300 @ 100. |
|
159 |
v open |
|
160 |
[exEnd] |
|
38 | 161 |
" |
787
c568dfd06f11
recompute & resize to the preferredExtent when views are added
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
162 |
! ! |
c568dfd06f11
recompute & resize to the preferredExtent when views are added
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
163 |
|
202 | 164 |
!PanelView methodsFor:'accessing'! |
165 |
||
1959 | 166 |
elementsChangeSize |
167 |
"tell the panel if elements are to change their size by themselfes |
|
168 |
(for example, Labels or Buttons may do so if their contents changes). |
|
169 |
Setting this flag will make the panel reorganize the elements whenever |
|
170 |
any element changes its size." |
|
171 |
||
172 |
^ elementsChangeSize |
|
173 |
! |
|
174 |
||
202 | 175 |
elementsChangeSize:aBoolean |
176 |
"tell the panel if elements are to change their size by themselfes |
|
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
177 |
(for example, Labels or Buttons may do so if their contents changes). |
202 | 178 |
Setting this flag will make the panel reorganize the elements whenever |
179 |
any element changes its size." |
|
180 |
||
3117
6d0c7aa281f2
#elementsChangeSize: do nothing, if instance var doesn't change
Stefan Vogel <sv@exept.de>
parents:
2753
diff
changeset
|
181 |
elementsChangeSize ~~ aBoolean ifTrue:[ |
6d0c7aa281f2
#elementsChangeSize: do nothing, if instance var doesn't change
Stefan Vogel <sv@exept.de>
parents:
2753
diff
changeset
|
182 |
elementsChangeSize := aBoolean. |
6d0c7aa281f2
#elementsChangeSize: do nothing, if instance var doesn't change
Stefan Vogel <sv@exept.de>
parents:
2753
diff
changeset
|
183 |
aBoolean ifTrue:[ |
6d0c7aa281f2
#elementsChangeSize: do nothing, if instance var doesn't change
Stefan Vogel <sv@exept.de>
parents:
2753
diff
changeset
|
184 |
self makeMyselfDependentOnSubviews. |
6d0c7aa281f2
#elementsChangeSize: do nothing, if instance var doesn't change
Stefan Vogel <sv@exept.de>
parents:
2753
diff
changeset
|
185 |
]. |
6d0c7aa281f2
#elementsChangeSize: do nothing, if instance var doesn't change
Stefan Vogel <sv@exept.de>
parents:
2753
diff
changeset
|
186 |
]. |
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
187 |
! |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
188 |
|
3843 | 189 |
hierarchicalIndexOfChild:aView |
190 |
^ aView hierarchicalIndexInList:subViews |
|
191 |
! |
|
192 |
||
1036 | 193 |
horizontalLayout |
194 |
"not supported by this view" |
|
195 |
||
196 |
^ nil |
|
197 |
! |
|
198 |
||
199 |
horizontalLayout:aLayoutSymbol |
|
200 |
"not supported by this view" |
|
201 |
||
202 |
! |
|
203 |
||
5905 | 204 |
horizontalLayout:layoutSymbolH verticalLayout:layoutSymbolV |
205 |
self horizontalLayout:layoutSymbolH. |
|
206 |
self verticalLayout:layoutSymbolV |
|
207 |
! |
|
208 |
||
1072 | 209 |
horizontalSpace |
210 |
"return the horizontal space between elements on pixels (default is 1mm)" |
|
211 |
||
212 |
^ horizontalSpace |
|
213 |
! |
|
214 |
||
202 | 215 |
horizontalSpace:numberOfPixels |
216 |
"set the horizontal space between elements on pixels (default is 1mm)" |
|
217 |
||
218 |
horizontalSpace ~= numberOfPixels ifTrue:[ |
|
219 |
horizontalSpace := numberOfPixels. |
|
220 |
self layoutChanged |
|
221 |
] |
|
222 |
! |
|
223 |
||
1423 | 224 |
ignoreInvisibleComponents |
225 |
"return the flag which controls if invisible (unrealized) |
|
226 |
components should be ignored in the layout computation. |
|
227 |
By default, it is false, which means that invisible components will |
|
228 |
lead to a visible space between visible components" |
|
229 |
||
230 |
^ ignoreInvisibleComponents |
|
231 |
! |
|
232 |
||
233 |
ignoreInvisibleComponents:aBoolean |
|
234 |
"set/clears the flag which controls if invisible (unrealized) |
|
235 |
components should be ignored in the layout computation. |
|
236 |
By default, it is false, which means that invisible components will |
|
2006 | 237 |
lead to a visible space between visible components." |
1423 | 238 |
|
1605
6ddd87c04fd5
recompute layout when ignoreInvisible* is changed.
Claus Gittinger <cg@exept.de>
parents:
1604
diff
changeset
|
239 |
(ignoreInvisibleComponents ~~ aBoolean) ifTrue:[ |
2006 | 240 |
aBoolean ifTrue:[ |
241 |
self makeMyselfDependentOnSubviews. |
|
242 |
]. |
|
1605
6ddd87c04fd5
recompute layout when ignoreInvisible* is changed.
Claus Gittinger <cg@exept.de>
parents:
1604
diff
changeset
|
243 |
ignoreInvisibleComponents := aBoolean. |
6ddd87c04fd5
recompute layout when ignoreInvisible* is changed.
Claus Gittinger <cg@exept.de>
parents:
1604
diff
changeset
|
244 |
self layoutChanged |
6ddd87c04fd5
recompute layout when ignoreInvisible* is changed.
Claus Gittinger <cg@exept.de>
parents:
1604
diff
changeset
|
245 |
] |
6ddd87c04fd5
recompute layout when ignoreInvisible* is changed.
Claus Gittinger <cg@exept.de>
parents:
1604
diff
changeset
|
246 |
|
6ddd87c04fd5
recompute layout when ignoreInvisible* is changed.
Claus Gittinger <cg@exept.de>
parents:
1604
diff
changeset
|
247 |
"Modified: / 20.7.1998 / 14:12:38 / cg" |
1423 | 248 |
! |
249 |
||
202 | 250 |
space:numberOfPixels |
251 |
"set the space between elements in pixels (default is 1mm) for both directions" |
|
252 |
||
253 |
(verticalSpace ~= numberOfPixels |
|
254 |
or:[horizontalSpace ~= numberOfPixels]) ifTrue:[ |
|
255 |
horizontalSpace := numberOfPixels. |
|
256 |
verticalSpace := numberOfPixels. |
|
257 |
self layoutChanged |
|
258 |
] |
|
259 |
! |
|
260 |
||
1036 | 261 |
verticalLayout |
262 |
"not supported by this view" |
|
263 |
||
264 |
^ nil |
|
265 |
! |
|
266 |
||
267 |
verticalLayout:aLayoutSymbol |
|
268 |
"not supported by this view" |
|
269 |
||
270 |
! |
|
271 |
||
1072 | 272 |
verticalSpace |
273 |
"return the vertical space between elements on pixels (default is 1mm)" |
|
274 |
||
275 |
^ verticalSpace |
|
276 |
! |
|
277 |
||
202 | 278 |
verticalSpace:numberOfPixels |
279 |
"set the vertical space between elements (in pixels). |
|
280 |
The default is computed for 1mm spacing." |
|
281 |
||
282 |
verticalSpace ~= numberOfPixels ifTrue:[ |
|
283 |
verticalSpace := numberOfPixels. |
|
284 |
self layoutChanged |
|
285 |
] |
|
286 |
! ! |
|
287 |
||
4415 | 288 |
!PanelView methodsFor:'accessing-channels'! |
289 |
||
290 |
backgroundChannel |
|
291 |
"return a valueHolder for background color" |
|
292 |
||
293 |
^ backgroundChannel |
|
294 |
||
295 |
"Modified: / 30.3.1999 / 13:49:28 / stefan" |
|
296 |
"Created: / 30.3.1999 / 13:50:55 / stefan" |
|
297 |
! |
|
298 |
||
299 |
backgroundChannel:aValueHolder |
|
300 |
"set the backgroundChannel - a valueHolder holding a color" |
|
301 |
||
302 |
|prev| |
|
303 |
||
304 |
prev := backgroundChannel. |
|
305 |
backgroundChannel := aValueHolder. |
|
306 |
self setupChannel:aValueHolder for:#backgroundColorChanged withOld:prev |
|
307 |
||
308 |
"Modified: / 31.10.1997 / 14:38:38 / cg" |
|
309 |
"Created: / 30.3.1999 / 13:48:42 / stefan" |
|
310 |
! ! |
|
311 |
||
6762 | 312 |
!PanelView methodsFor:'accessing-visibility'! |
313 |
||
314 |
beVisible |
|
315 |
"after making the views visible check the vertical layout" |
|
316 |
||
317 |
super beVisible. |
|
318 |
||
319 |
(realized and:[OperatingSystem isMSWINDOWSlike]) |
|
320 |
ifFalse:[ ^ self ]. |
|
321 |
||
322 |
(self class == HorizontalPanelView or:[self class == VerticalPanelView]) ifTrue:[ |
|
323 |
self sensor enqueueMessage:#beVisiblePostUpdate for:self. |
|
324 |
]. |
|
325 |
! |
|
326 |
||
327 |
beVisiblePostUpdate |
|
328 |
"after making the views visible check the vertical layout; called by #beVisible" |
|
329 |
| sviews | |
|
330 |
||
331 |
(subViews size > 0 and:[self isVisible]) ifFalse:[ ^ self ]. |
|
332 |
||
333 |
sviews := self subViewsToConsider. |
|
334 |
sviews notEmptyOrNil ifTrue:[ |
|
335 |
sviews detect:[: each | (each isView and:[(each getAttribute:#VerticalPanelPreferredWidthOrHeight) isNil]) ] |
|
336 |
ifNone:[ |
|
337 |
sviews do:[: eachChild | |
|
338 |
eachChild isView ifTrue:[ |wh| |
|
339 |
wh := eachChild getAttribute:#VerticalPanelPreferredWidthOrHeight. |
|
340 |
wh notNil ifTrue:[ |
|
341 |
self class == VerticalPanelView |
|
342 |
ifTrue: [ eachChild height: wh ] |
|
343 |
ifFalse:[ eachChild width: wh ]. |
|
344 |
]. |
|
345 |
]. |
|
346 |
]. |
|
347 |
self setChildPositions. |
|
348 |
mustRearrange := false. |
|
349 |
]. |
|
350 |
]. |
|
351 |
subViews do:[: eachChild | |
|
352 |
eachChild isView ifTrue:[ eachChild setAttribute: #VerticalPanelPreferredWidthOrHeight to: nil ] |
|
353 |
]. |
|
354 |
! |
|
355 |
||
356 |
storePreferredWidthOrHeight: aWidthOrHeight for: aView |
|
357 |
"called by UISpecification #buildViewWithLayoutFor to setup up a specific view" |
|
358 |
||
359 |
OperatingSystem isMSWINDOWSlike ifFalse:[ ^ self ]. "/ supported only for windows!!!! |
|
360 |
||
361 |
(aView isView and:[aWidthOrHeight isInteger and:[aWidthOrHeight > 0]]) |
|
362 |
ifTrue:[ aView setAttribute:#VerticalPanelPreferredWidthOrHeight to: aWidthOrHeight ]. "/ see: #beVisiblePostUpdate |
|
363 |
! ! |
|
364 |
||
202 | 365 |
!PanelView methodsFor:'adding & removing subviews'! |
366 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
788
diff
changeset
|
367 |
addComponent:aComponent |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
788
diff
changeset
|
368 |
"redefined to recompute layout when a component is added" |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
788
diff
changeset
|
369 |
|
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
788
diff
changeset
|
370 |
super addComponent:aComponent. |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
788
diff
changeset
|
371 |
self addedView:aComponent |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
788
diff
changeset
|
372 |
|
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
788
diff
changeset
|
373 |
"Created: 28.1.1997 / 17:44:18 / cg" |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
788
diff
changeset
|
374 |
! |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
788
diff
changeset
|
375 |
|
202 | 376 |
addSubView:aView |
377 |
"redefined to recompute layout when a subview is added" |
|
378 |
||
379 |
super addSubView:aView. |
|
380 |
self addedView:aView |
|
6719 | 381 |
|
382 |
"Modified: / 24-10-2019 / 15:50:12 / Stefan Vogel" |
|
383 |
"Modified (comment): / 24-10-2019 / 17:39:25 / Stefan Vogel" |
|
202 | 384 |
! |
385 |
||
4406 | 386 |
addSubView:newView after:aViewOrNil |
202 | 387 |
"redefined to recompute layout when a subview is added" |
388 |
||
4406 | 389 |
super addSubView:newView after:aViewOrNil. |
787
c568dfd06f11
recompute & resize to the preferredExtent when views are added
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
390 |
self addedView:newView |
c568dfd06f11
recompute & resize to the preferredExtent when views are added
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
391 |
|
4406 | 392 |
"Modified: / 15-07-1996 / 10:15:04 / cg" |
393 |
"Modified (format): / 22-03-2012 / 10:37:42 / cg" |
|
202 | 394 |
! |
395 |
||
4406 | 396 |
addSubView:newView before:aViewOrNil |
202 | 397 |
"redefined to recompute layout when a subview is added" |
398 |
||
4406 | 399 |
super addSubView:newView before:aViewOrNil. |
787
c568dfd06f11
recompute & resize to the preferredExtent when views are added
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
400 |
self addedView:newView |
c568dfd06f11
recompute & resize to the preferredExtent when views are added
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
401 |
|
4406 | 402 |
"Modified: / 15-07-1996 / 10:14:39 / cg" |
403 |
"Modified (format): / 22-03-2012 / 10:37:46 / cg" |
|
202 | 404 |
! |
405 |
||
406 |
removeSubView:aView |
|
407 |
"redefined to recompute layout when a subview is removed" |
|
408 |
||
409 |
super removeSubView:aView. |
|
410 |
aView removeDependent:self. |
|
5536 | 411 |
self isBeingDestroyed ifFalse:[ |
412 |
self layoutChanged |
|
413 |
]. |
|
38 | 414 |
! ! |
0 | 415 |
|
1159 | 416 |
!PanelView methodsFor:'enumerating subviews'! |
417 |
||
418 |
changeSequenceOrderFor:aSubView to:anIndex |
|
3885 | 419 |
"change a subview's position in the subviews collection. |
6346 | 420 |
This affects the arrangement of the views." |
3885 | 421 |
|
1159 | 422 |
|success| |
423 |
||
424 |
success := super changeSequenceOrderFor:aSubView to:anIndex. |
|
425 |
||
426 |
success ifTrue:[ |
|
3885 | 427 |
self layoutChanged. |
1159 | 428 |
]. |
429 |
^ success |
|
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
430 |
|
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
431 |
" |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
432 |
|panel comp1 comp2 comp3| |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
433 |
|
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
434 |
panel := HorizontalPanelView new. |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
435 |
comp1 := Label label:'one' in:panel. |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
436 |
comp2 := Label label:'two' in:panel. |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
437 |
comp3 := Label label:'three' in:panel. |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
438 |
panel open. |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
439 |
Delay waitForSeconds:3. |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
440 |
panel changeSequenceOrderFor:comp2 to:3. |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
441 |
Delay waitForSeconds:3. |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
442 |
panel changeSequenceOrderFor:comp2 to:1. |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
443 |
" |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
444 |
|
6346 | 445 |
"Modified: / 17-01-1998 / 00:13:43 / cg" |
446 |
"Modified (comment): / 14-06-2018 / 10:19:15 / Claus Gittinger" |
|
1159 | 447 |
! ! |
448 |
||
2753 | 449 |
!PanelView methodsFor:'event handling'! |
0 | 450 |
|
4415 | 451 |
backgroundColorChanged |
452 |
"called to update the background color" |
|
453 |
||
454 |
|color| |
|
455 |
||
456 |
color := backgroundChannel value. |
|
457 |
self backgroundColor:color. |
|
458 |
! |
|
459 |
||
0 | 460 |
sizeChanged:how |
119 | 461 |
"my size has changed - must rearrange elements" |
462 |
||
0 | 463 |
super sizeChanged:how. |
4945 | 464 |
"/ self layoutChanged - no; leads to recursion |
465 |
realized ifTrue:[ |
|
466 |
self setChildPositions |
|
467 |
] ifFalse:[ |
|
468 |
mustRearrange := true |
|
469 |
]. |
|
125 | 470 |
! |
471 |
||
472 |
update:something with:aParameter from:changedObject |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
788
diff
changeset
|
473 |
"an element changed its size" |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
788
diff
changeset
|
474 |
|
125 | 475 |
something == #sizeOfView ifTrue:[ |
3117
6d0c7aa281f2
#elementsChangeSize: do nothing, if instance var doesn't change
Stefan Vogel <sv@exept.de>
parents:
2753
diff
changeset
|
476 |
elementsChangeSize ifTrue:[ |
2034
2efa727de60f
avoid useless work (ignore updates from changed components sometimes)
Claus Gittinger <cg@exept.de>
parents:
2006
diff
changeset
|
477 |
self layoutChanged. |
2efa727de60f
avoid useless work (ignore updates from changed components sometimes)
Claus Gittinger <cg@exept.de>
parents:
2006
diff
changeset
|
478 |
]. |
2006 | 479 |
^ self |
480 |
]. |
|
2190 | 481 |
"/ something == #preferredExtent ifTrue:[ |
3117
6d0c7aa281f2
#elementsChangeSize: do nothing, if instance var doesn't change
Stefan Vogel <sv@exept.de>
parents:
2753
diff
changeset
|
482 |
"/ elementsChangeSize ifTrue:[ |
2190 | 483 |
"/ self layoutChanged. |
484 |
"/ ]. |
|
485 |
"/ ^ self |
|
486 |
"/ ]. |
|
2006 | 487 |
something == #visibility ifTrue:[ |
3117
6d0c7aa281f2
#elementsChangeSize: do nothing, if instance var doesn't change
Stefan Vogel <sv@exept.de>
parents:
2753
diff
changeset
|
488 |
ignoreInvisibleComponents ifTrue:[ |
2034
2efa727de60f
avoid useless work (ignore updates from changed components sometimes)
Claus Gittinger <cg@exept.de>
parents:
2006
diff
changeset
|
489 |
self layoutChanged. |
2efa727de60f
avoid useless work (ignore updates from changed components sometimes)
Claus Gittinger <cg@exept.de>
parents:
2006
diff
changeset
|
490 |
]. |
2006 | 491 |
^ self |
125 | 492 |
]. |
493 |
^ super update:something with:aParameter from:changedObject |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
788
diff
changeset
|
494 |
|
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
788
diff
changeset
|
495 |
"Modified: 28.1.1997 / 17:52:44 / cg" |
0 | 496 |
! ! |
497 |
||
1821
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1605
diff
changeset
|
498 |
!PanelView methodsFor:'focus handling'! |
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1605
diff
changeset
|
499 |
|
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1605
diff
changeset
|
500 |
wantsFocusWithButtonPress |
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1605
diff
changeset
|
501 |
"no, do not catch the keyboard focus on button click" |
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1605
diff
changeset
|
502 |
|
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1605
diff
changeset
|
503 |
^ false |
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1605
diff
changeset
|
504 |
|
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1605
diff
changeset
|
505 |
|
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1605
diff
changeset
|
506 |
! ! |
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1605
diff
changeset
|
507 |
|
6275 | 508 |
!PanelView methodsFor:'initialization & release'! |
202 | 509 |
|
510 |
initialize |
|
6076 | 511 |
<modifier: #super> "must be called if redefined" |
512 |
||
202 | 513 |
super initialize. |
514 |
||
515 |
hLayout := vLayout := #center. "/ notice, this is ignored in this class |
|
6076 | 516 |
"/ used by subclasses only |
202 | 517 |
verticalSpace := ViewSpacing. |
518 |
horizontalSpace := ViewSpacing. |
|
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
519 |
mustRearrange := elementsChangeSize := false. |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
520 |
ignoreInvisibleComponents := true. |
6076 | 521 |
|
522 |
"Modified: / 08-02-2017 / 00:35:19 / cg" |
|
202 | 523 |
! |
524 |
||
5516 | 525 |
mapped |
526 |
mustRearrange ifTrue:[ |
|
527 |
self setChildPositions |
|
528 |
]. |
|
529 |
super mapped |
|
530 |
! |
|
531 |
||
202 | 532 |
realize |
533 |
mustRearrange ifTrue:[ |
|
534 |
self setChildPositions |
|
535 |
]. |
|
536 |
super realize |
|
537 |
! |
|
538 |
||
6275 | 539 |
release |
540 |
backgroundChannel notNil ifTrue:[ |
|
6591 | 541 |
backgroundChannel removeDependentAndRetractInterestsFor:self. |
542 |
backgroundChannel := nil |
|
6275 | 543 |
]. |
544 |
super release |
|
6591 | 545 |
|
546 |
"Modified: / 30-05-2019 / 11:14:40 / Claus Gittinger" |
|
6275 | 547 |
! |
548 |
||
1216
3506a6474c42
setChildPos if extent is set in create->resize->prefExtent
ca
parents:
1159
diff
changeset
|
549 |
resize |
3506a6474c42
setChildPos if extent is set in create->resize->prefExtent
ca
parents:
1159
diff
changeset
|
550 |
super resize. |
3506a6474c42
setChildPos if extent is set in create->resize->prefExtent
ca
parents:
1159
diff
changeset
|
551 |
mustRearrange ifTrue:[ |
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
552 |
self setChildPositions |
1216
3506a6474c42
setChildPos if extent is set in create->resize->prefExtent
ca
parents:
1159
diff
changeset
|
553 |
]. |
3506a6474c42
setChildPos if extent is set in create->resize->prefExtent
ca
parents:
1159
diff
changeset
|
554 |
! |
3506a6474c42
setChildPos if extent is set in create->resize->prefExtent
ca
parents:
1159
diff
changeset
|
555 |
|
202 | 556 |
setChildPositionsIfChanged |
557 |
"set all of my child positions - this is usually delayed, |
|
6165 | 558 |
until the panel is actually shown (since we do not know, if more |
202 | 559 |
elements are to be added) thus avoiding repositioning the elements |
6165 | 560 |
over and over. However, sometimes it is necessary to force positioning |
202 | 561 |
the elements, for example, before querying the relative position of |
6165 | 562 |
an element (modalBoxes do so, to position the OK-button under the mouse |
202 | 563 |
pointer)." |
564 |
||
565 |
mustRearrange ifTrue:[ |
|
5951 | 566 |
self setChildPositions |
202 | 567 |
]. |
6165 | 568 |
|
569 |
"Modified (comment): / 30-05-2017 / 17:36:26 / mawalch" |
|
202 | 570 |
! ! |
571 |
||
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
572 |
!PanelView methodsFor:'layout'! |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
573 |
|
6486 | 574 |
computePreferredExtent |
3861 | 575 |
"return a good extent, one that makes subviews fit. |
576 |
Note that width is considered as given, and compute height here." |
|
577 |
||
578 |
|subViews xpos totalHeight maxHeightInRow first| |
|
579 |
||
580 |
subViews := self subViewsToConsider. |
|
581 |
subViews isEmptyOrNil ifTrue:[ |
|
6486 | 582 |
^ super computePreferredExtent. |
3861 | 583 |
]. |
584 |
||
585 |
xpos := horizontalSpace. |
|
586 |
||
587 |
totalHeight := 0. |
|
588 |
maxHeightInRow := 0. |
|
589 |
first := true. |
|
590 |
||
591 |
subViews do:[:eachChild | |childPreferredExtent| |
|
592 |
childPreferredExtent := eachChild preferredExtent. |
|
593 |
||
594 |
"go to next row, if this subview won't fit" |
|
595 |
first ifFalse: [ |
|
596 |
(xpos + childPreferredExtent x + horizontalSpace) > width |
|
597 |
ifTrue: [ |
|
598 |
xpos := horizontalSpace. |
|
599 |
totalHeight := totalHeight + maxHeightInRow + verticalSpace. |
|
600 |
maxHeightInRow := 0. |
|
601 |
] |
|
602 |
]. |
|
603 |
||
604 |
xpos := xpos + (childPreferredExtent x) + horizontalSpace. |
|
605 |
(maxHeightInRow < (childPreferredExtent y)) ifTrue:[ |
|
606 |
maxHeightInRow := childPreferredExtent y. |
|
607 |
]. |
|
608 |
first := false |
|
609 |
]. |
|
610 |
maxHeightInRow ~= 0 ifTrue:[ |
|
611 |
totalHeight := totalHeight + maxHeightInRow + verticalSpace. |
|
612 |
]. |
|
613 |
||
614 |
^ width @ totalHeight |
|
6486 | 615 |
|
616 |
"Created: / 09-11-2018 / 19:58:50 / Claus Gittinger" |
|
3861 | 617 |
! |
618 |
||
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
619 |
setChildPositions |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
620 |
"(re)compute position of every child. |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
621 |
This method is redefined for different layout characteristics - you may |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
622 |
even create subclasses with completely different geometry management." |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
623 |
|
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
624 |
|first xpos ypos maxHeightInRow thisRow subViews ext| |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
625 |
|
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
626 |
subViews := self subViewsToConsider. |
1423 | 627 |
subViews size == 0 ifTrue:[^ self]. |
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
628 |
|
3501 | 629 |
"/ self extentChangedFlag ifTrue:[ |
630 |
"/ ext := self computeExtent. |
|
631 |
"/ width := ext x. |
|
632 |
"/ height := ext y. |
|
633 |
"/ ]. |
|
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
634 |
|
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
635 |
xpos := horizontalSpace. |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
636 |
ypos := verticalSpace. |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
637 |
|
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
638 |
maxHeightInRow := 0. |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
639 |
first := true. |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
640 |
thisRow := OrderedCollection new. |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
641 |
subViews do:[:child | |
1423 | 642 |
"go to next row, if this subview won't fit" |
643 |
first ifFalse: [ |
|
644 |
(xpos + child widthIncludingBorder + horizontalSpace) > width |
|
645 |
ifTrue: [ |
|
646 |
thisRow notEmpty ifTrue:[ |
|
647 |
thisRow do:[:rowElement | |
|
648 |
rowElement heightIncludingBorder < maxHeightInRow ifTrue:[ |
|
649 |
rowElement top:(rowElement top + (maxHeightInRow - rowElement heightIncludingBorder)) |
|
650 |
] |
|
651 |
] |
|
652 |
]. |
|
653 |
ypos := ypos + verticalSpace + maxHeightInRow. |
|
654 |
xpos := horizontalSpace. |
|
655 |
maxHeightInRow := 0. |
|
656 |
thisRow := OrderedCollection new. |
|
657 |
] |
|
658 |
]. |
|
659 |
thisRow add:child. |
|
660 |
child origin:(xpos@ypos). |
|
661 |
xpos := xpos + (child widthIncludingBorder) + horizontalSpace. |
|
662 |
(maxHeightInRow < (child heightIncludingBorder)) ifTrue:[ |
|
663 |
maxHeightInRow := child heightIncludingBorder |
|
664 |
]. |
|
665 |
first := false |
|
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
666 |
]. |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
667 |
thisRow notEmpty ifTrue:[ |
1423 | 668 |
thisRow do:[:rowElement | |
669 |
rowElement heightIncludingBorder < maxHeightInRow ifTrue:[ |
|
670 |
rowElement top:(rowElement top + (maxHeightInRow - rowElement heightIncludingBorder)) |
|
671 |
] |
|
672 |
] |
|
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
673 |
]. |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
674 |
mustRearrange := false |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
675 |
|
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
676 |
"Modified: / 17.1.1998 / 00:17:19 / cg" |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
677 |
! ! |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
678 |
|
0 | 679 |
!PanelView methodsFor:'private'! |
680 |
||
202 | 681 |
addedView:aView |
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
788
diff
changeset
|
682 |
"added a new element - rearrange components" |
202 | 683 |
|
2006 | 684 |
(elementsChangeSize or:[ignoreInvisibleComponents]) ifTrue:[ |
685 |
aView addDependent:self |
|
787
c568dfd06f11
recompute & resize to the preferredExtent when views are added
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
686 |
]. |
c568dfd06f11
recompute & resize to the preferredExtent when views are added
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
687 |
aView resize. |
788
653fd742b5b0
extent handling when adding views
Claus Gittinger <cg@exept.de>
parents:
787
diff
changeset
|
688 |
"/ explicitExtent ~~ true ifTrue:[ |
653fd742b5b0
extent handling when adding views
Claus Gittinger <cg@exept.de>
parents:
787
diff
changeset
|
689 |
"/ self resize |
653fd742b5b0
extent handling when adding views
Claus Gittinger <cg@exept.de>
parents:
787
diff
changeset
|
690 |
"/ ]. |
202 | 691 |
self layoutChanged |
787
c568dfd06f11
recompute & resize to the preferredExtent when views are added
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
692 |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
788
diff
changeset
|
693 |
"Modified: 28.1.1997 / 17:45:10 / cg" |
202 | 694 |
! |
695 |
||
0 | 696 |
layoutChanged |
119 | 697 |
"called whenever repositioning is required. If the panel view is |
698 |
already visible, reposition elements right now. Otherwise, remember |
|
699 |
that a repositioning is needed to do so when the view eventually becomes |
|
700 |
visible." |
|
701 |
||
4945 | 702 |
super layoutChanged. |
6723 | 703 |
self shown "realized" ifTrue:[ |
2198 | 704 |
self setChildPositions |
0 | 705 |
] ifFalse:[ |
2198 | 706 |
mustRearrange := true |
4945 | 707 |
]. |
0 | 708 |
! |
709 |
||
2006 | 710 |
makeMyselfDependentOnSubviews |
2527 | 711 |
subViews notNil ifTrue:[ |
2006 | 712 |
subViews do:[:aView | |
713 |
aView addDependent:self |
|
714 |
] |
|
715 |
] |
|
716 |
! |
|
717 |
||
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
718 |
subViewsToConsider |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
719 |
"return a collection of subviews which are to be considered in |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
720 |
the layout. If ignoreInvisibleComponents is true, only visible |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
721 |
components are considered; otherwise, all are considered." |
0 | 722 |
|
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
723 |
|subViews| |
1042 | 724 |
|
725 |
subViews := self subViews. |
|
6719 | 726 |
(ignoreInvisibleComponents and:[subViews notEmptyOrNil]) ifTrue:[ |
727 |
subViews := subViews |
|
728 |
select:[:v | |
|
729 |
"/ if I am already realized, only consider realized subViews |
|
730 |
"/ otherwise, consider subViews which will be shown when I am. |
|
731 |
realized |
|
732 |
ifTrue:[v realized] |
|
733 |
ifFalse:[v isHiddenOnRealize not] |
|
734 |
]. |
|
1042 | 735 |
]. |
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1216
diff
changeset
|
736 |
^ subViews |
1042 | 737 |
|
6719 | 738 |
"Created: / 17-01-1998 / 00:17:05 / cg" |
739 |
"Modified: / 24-10-2019 / 15:57:35 / Stefan Vogel" |
|
0 | 740 |
! ! |
125 | 741 |
|
3863
eceb130bb92b
UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents:
3861
diff
changeset
|
742 |
!PanelView methodsFor:'queries'! |
eceb130bb92b
UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents:
3861
diff
changeset
|
743 |
|
eceb130bb92b
UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents:
3861
diff
changeset
|
744 |
isLayoutWrapper |
eceb130bb92b
UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents:
3861
diff
changeset
|
745 |
"answer true, if this view defines the layout of it's subviews" |
eceb130bb92b
UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents:
3861
diff
changeset
|
746 |
|
eceb130bb92b
UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents:
3861
diff
changeset
|
747 |
^ true |
eceb130bb92b
UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents:
3861
diff
changeset
|
748 |
! ! |
eceb130bb92b
UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents:
3861
diff
changeset
|
749 |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
788
diff
changeset
|
750 |
!PanelView class methodsFor:'documentation'! |
205 | 751 |
|
752 |
version |
|
5516 | 753 |
^ '$Header$' |
5907 | 754 |
! |
755 |
||
756 |
version_CVS |
|
757 |
^ '$Header$' |
|
205 | 758 |
! ! |
4945 | 759 |