HorizontalPanelView.st
changeset 118 3ee5ea99d0e2
parent 77 565b052f5277
child 125 3ffa271732f7
equal deleted inserted replaced
117:53cbfeaa9c9a 118:3ee5ea99d0e2
    19 
    19 
    20 HorizontalPanelView comment:'
    20 HorizontalPanelView comment:'
    21 COPYRIGHT (c) 1989 by Claus Gittinger
    21 COPYRIGHT (c) 1989 by Claus Gittinger
    22 	      All Rights Reserved
    22 	      All Rights Reserved
    23 
    23 
    24 $Header: /cvs/stx/stx/libwidg/HorizontalPanelView.st,v 1.8 1995-02-06 00:52:25 claus Exp $
    24 $Header: /cvs/stx/stx/libwidg/HorizontalPanelView.st,v 1.9 1995-05-03 00:29:39 claus Exp $
    25 '!
    25 '!
    26 
    26 
    27 !HorizontalPanelView class methodsFor:'documentation'!
    27 !HorizontalPanelView class methodsFor:'documentation'!
    28 
    28 
    29 copyright
    29 copyright
    40 "
    40 "
    41 !
    41 !
    42 
    42 
    43 version
    43 version
    44 "
    44 "
    45 $Header: /cvs/stx/stx/libwidg/HorizontalPanelView.st,v 1.8 1995-02-06 00:52:25 claus Exp $
    45 $Header: /cvs/stx/stx/libwidg/HorizontalPanelView.st,v 1.9 1995-05-03 00:29:39 claus Exp $
    46 "
    46 "
    47 !
    47 !
    48 
    48 
    49 documentation
    49 documentation
    50 "
    50 "
    58 
    58 
    59     The horizontal layout can be any of:
    59     The horizontal layout can be any of:
    60 
    60 
    61 	#left           arrange elements at the left
    61 	#left           arrange elements at the left
    62 	#leftSpace      arrange elements at the left, start with spacing
    62 	#leftSpace      arrange elements at the left, start with spacing
       
    63 	#fixLeft        same as #left, but do not reduce spacing in case of no fit
       
    64 	#fixLeftSpace   same as #leftSpace, but do not reduce spacing in case of no fit
    63 	#right          arrange elements at the right
    65 	#right          arrange elements at the right
    64 	#rightSpace     arrange elements at the right, start with spacing
    66 	#rightSpace     arrange elements at the right, start with spacing
    65 	#center         arrange elements in the center
    67 	#center         arrange elements in the center
    66 	#spread         spread elements evenly
    68 	#spread         spread elements evenly
    67 	#spreadSpace    spread elements evenly with spacing at the ends
    69 	#spreadSpace    spread elements evenly with spacing at the ends
    83     The defaults is #center for both directions.
    85     The defaults is #center for both directions.
    84     The layout is changed by the messages #verticalLayout: and #horizontalLayout:.
    86     The layout is changed by the messages #verticalLayout: and #horizontalLayout:.
    85     For backward compatibility (to times, where only hLayout existed), the simple
    87     For backward compatibility (to times, where only hLayout existed), the simple
    86     #layout: does the same as #horizontalLayout:. Do not use this old method.
    88     #layout: does the same as #horizontalLayout:. Do not use this old method.
    87 
    89 
    88     If none of these layout/space combinations is exactly what you need in
    90     By combining Horizontal- and VerticalPanels (i.e. place a hPanel into a
    89     your application, create a subclass, and redefine the setChildPositions method.
    91     vPanel), most layouts should be implementable.
       
    92     However, ff none of these layout/space combinations is exactly what you need 
       
    93     in your application, create a subclass, and redefine the setChildPositions 
       
    94     method there.
    90 "
    95 "
    91 !
    96 !
    92 
    97 
    93 examples
    98 examples
    94 "
    99 "
    96     verticalLayout settings. Try them all. Especially, notice the
   101     verticalLayout settings. Try them all. Especially, notice the
    97     differences between the xxx and xxxSpace layouts and the effect of
   102     differences between the xxx and xxxSpace layouts and the effect of
    98     setting different values for the spacing.
   103     setting different values for the spacing.
    99     Try resizing the view and see how the elements get rearranged.
   104     Try resizing the view and see how the elements get rearranged.
   100 
   105 
   101     All of the below examples place 3 buttons onto a panel - of course,
   106     Most of the examples below place 3 buttons onto a panel; Of course,
   102     you can put any other view into a panel ... the last example shows this.
   107     you can put any other view into a panel ... the last examples show this.
   103 
   108 
   104 
   109 
   105     example: default layout (centered)
   110     example: default layout (centered)
   106 
   111 
   107 	|v p b1 b2 b3|
   112 	|v p b1 b2 b3|
   108 
   113 
   109 	v := StandardSystemView new.
   114 	v := StandardSystemView new.
   110 	v label:'default'.
   115 	v label:'default: center'.
   111 
   116 
   112 	p := HorizontalPanelView in:v.
   117 	p := HorizontalPanelView in:v.
   113 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   118 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   114 	b1 := Button label:'button1' in:p.
   119 	b1 := Button label:'button1' in:p.
   115 	b2 := Button label:'button2' in:p.
   120 	b2 := Button label:'button2' in:p.
   122 
   127 
   123 	|v p b1 b2 b3|
   128 	|v p b1 b2 b3|
   124 
   129 
   125 	v := StandardSystemView new.
   130 	v := StandardSystemView new.
   126 	p := HorizontalPanelView in:v.
   131 	p := HorizontalPanelView in:v.
   127 	v label:'hL=left'.
   132 	v label:'hL=left; vL=default (center)'.
   128 
   133 
   129 	p horizontalLayout:#left.
   134 	p horizontalLayout:#left.
   130 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   135 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   131 	b1 := Button label:'button1' in:p.
   136 	b1 := Button label:'button1' in:p.
   132 	b2 := Button label:'button2' in:p.
   137 	b2 := Button label:'button2' in:p.
   139 
   144 
   140 	|v p b1 b2 b3|
   145 	|v p b1 b2 b3|
   141 
   146 
   142 	v := StandardSystemView new.
   147 	v := StandardSystemView new.
   143 	p := HorizontalPanelView in:v.
   148 	p := HorizontalPanelView in:v.
   144 	v label:'hL=leftSpace'.
   149 	v label:'hL=leftSpace; vL=center'.
   145 
   150 
   146 	p horizontalLayout:#leftSpace.
   151 	p horizontalLayout:#leftSpace.
   147 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   152 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   148 	b1 := Button label:'button1' in:p.
   153 	b1 := Button label:'button1' in:p.
   149 	b2 := Button label:'button2' in:p.
   154 	b2 := Button label:'button2' in:p.
   156 
   161 
   157 	|v p b1 b2 b3|
   162 	|v p b1 b2 b3|
   158 
   163 
   159 	v := StandardSystemView new.
   164 	v := StandardSystemView new.
   160 	p := HorizontalPanelView in:v.
   165 	p := HorizontalPanelView in:v.
   161 	v label:'hL=leftFit'.
   166 	v label:'hL=leftFit; vL=center'.
   162 
   167 
   163 	p horizontalLayout:#leftFit.
   168 	p horizontalLayout:#leftFit.
   164 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   169 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   165 	b1 := Button label:'button1' in:p.
   170 	b1 := Button label:'button1' in:p.
   166 	b2 := Button label:'button2' in:p.
   171 	b2 := Button label:'button2' in:p.
   173 
   178 
   174 	|v p b1 b2 b3|
   179 	|v p b1 b2 b3|
   175 
   180 
   176 	v := StandardSystemView new.
   181 	v := StandardSystemView new.
   177 	p := HorizontalPanelView in:v.
   182 	p := HorizontalPanelView in:v.
   178 	v label:'hL=leftFit'.
   183 	v label:'hL=leftSpaceFit; vL=center'.
   179 
   184 
   180 	p horizontalLayout:#leftSpaceFit.
   185 	p horizontalLayout:#leftSpaceFit.
   181 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   186 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   182 	b1 := Button label:'button1' in:p.
   187 	b1 := Button label:'button1' in:p.
   183 	b2 := Button label:'button2' in:p.
   188 	b2 := Button label:'button2' in:p.
   190 
   195 
   191 	|v p b1 b2 b3|
   196 	|v p b1 b2 b3|
   192 
   197 
   193 	v := StandardSystemView new.
   198 	v := StandardSystemView new.
   194 	p := HorizontalPanelView in:v.
   199 	p := HorizontalPanelView in:v.
   195 	v label:'hL=right'.
   200 	v label:'hL=right; vL=center'.
   196 
   201 
   197 	p horizontalLayout:#right.
   202 	p horizontalLayout:#right.
   198 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   203 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   199 	b1 := Button label:'button1' in:p.
   204 	b1 := Button label:'button1' in:p.
   200 	b2 := Button label:'button2' in:p.
   205 	b2 := Button label:'button2' in:p.
   207 
   212 
   208 	|v p b1 b2 b3|
   213 	|v p b1 b2 b3|
   209 
   214 
   210 	v := StandardSystemView new.
   215 	v := StandardSystemView new.
   211 	p := HorizontalPanelView in:v.
   216 	p := HorizontalPanelView in:v.
   212 	v label:'hL=rightSpace'.
   217 	v label:'hL=rightSpace; vL=center'.
   213 
   218 
   214 	p horizontalLayout:#rightSpace.
   219 	p horizontalLayout:#rightSpace.
   215 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   220 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   216 	b1 := Button label:'button1' in:p.
   221 	b1 := Button label:'button1' in:p.
   217 	b2 := Button label:'button2' in:p.
   222 	b2 := Button label:'button2' in:p.
   225 	|v p b1 b2 b3|
   230 	|v p b1 b2 b3|
   226 
   231 
   227 	v := StandardSystemView new.
   232 	v := StandardSystemView new.
   228 	p := HorizontalPanelView in:v.
   233 	p := HorizontalPanelView in:v.
   229 	p horizontalLayout:#fit.
   234 	p horizontalLayout:#fit.
   230 	v label:'hL=fit'.
   235 	v label:'hL=fit; vL=center'.
   231 
   236 
   232 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   237 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   233 	b1 := Button label:'button1' in:p.
   238 	b1 := Button label:'button1' in:p.
   234 	b2 := Button label:'button2' in:p.
   239 	b2 := Button label:'button2' in:p.
   235 	b3 := Button label:'button3' in:p.
   240 	b3 := Button label:'button3' in:p.
   243 
   248 
   244 	v := StandardSystemView new.
   249 	v := StandardSystemView new.
   245 	p := HorizontalPanelView in:v.
   250 	p := HorizontalPanelView in:v.
   246 	p horizontalLayout:#fit.
   251 	p horizontalLayout:#fit.
   247 	p horizontalSpace:0.
   252 	p horizontalSpace:0.
   248 	v label:'hL=fit hS=0'.
   253 	v label:'hL=fit hS=0; vL=center'.
   249 
   254 
   250 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   255 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   251 	b1 := Button label:'button1' in:p.
   256 	b1 := Button label:'button1' in:p.
   252 	b2 := Button label:'button2' in:p.
   257 	b2 := Button label:'button2' in:p.
   253 	b3 := Button label:'button3' in:p.
   258 	b3 := Button label:'button3' in:p.
   259 
   264 
   260 	|v p b1 b2 b3|
   265 	|v p b1 b2 b3|
   261 
   266 
   262 	v := StandardSystemView new.
   267 	v := StandardSystemView new.
   263 	p := HorizontalPanelView in:v.
   268 	p := HorizontalPanelView in:v.
   264 	v label:'hL=fitSpace'.
   269 	v label:'hL=fitSpace; vL=center'.
   265 
   270 
   266 	p horizontalLayout:#fitSpace.
   271 	p horizontalLayout:#fitSpace.
   267 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   272 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   268 	b1 := Button label:'button1' in:p.
   273 	b1 := Button label:'button1' in:p.
   269 	b2 := Button label:'button2' in:p.
   274 	b2 := Button label:'button2' in:p.
   277 	|v p b1 b2 b3|
   282 	|v p b1 b2 b3|
   278 
   283 
   279 	v := StandardSystemView new.
   284 	v := StandardSystemView new.
   280 	p := HorizontalPanelView in:v.
   285 	p := HorizontalPanelView in:v.
   281 	p horizontalLayout:#spread.
   286 	p horizontalLayout:#spread.
   282 	v label:'hL=spread'.
   287 	v label:'hL=spread; vL=center'.
   283 
   288 
   284 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   289 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   285 	b1 := Button label:'button1' in:p.
   290 	b1 := Button label:'button1' in:p.
   286 	b2 := Button label:'button2' in:p.
   291 	b2 := Button label:'button2' in:p.
   287 	b3 := Button label:'button3' in:p.
   292 	b3 := Button label:'button3' in:p.
   293 
   298 
   294 	|v p b1 b2 b3|
   299 	|v p b1 b2 b3|
   295 
   300 
   296 	v := StandardSystemView new.
   301 	v := StandardSystemView new.
   297 	p := HorizontalPanelView in:v.
   302 	p := HorizontalPanelView in:v.
   298 	v label:'hL=spreadSpace'.
   303 	v label:'hL=spreadSpace; vL=center'.
   299 
   304 
   300 	p horizontalLayout:#spreadSpace.
   305 	p horizontalLayout:#spreadSpace.
   301 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   306 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   302 	b1 := Button label:'button1' in:p.
   307 	b1 := Button label:'button1' in:p.
   303 	b2 := Button label:'button2' in:p.
   308 	b2 := Button label:'button2' in:p.
   310 
   315 
   311 	|v p b1 b2 b3|
   316 	|v p b1 b2 b3|
   312 
   317 
   313 	v := StandardSystemView new.
   318 	v := StandardSystemView new.
   314 	p := HorizontalPanelView in:v.
   319 	p := HorizontalPanelView in:v.
   315 	v label:'hL=spreadSpace vL=fit'.
   320 	v label:'hL=spreadSpace; vL=fit'.
   316 
   321 
   317 	p horizontalLayout:#spreadSpace.
   322 	p horizontalLayout:#spreadSpace.
   318 	p verticalLayout:#fit.
   323 	p verticalLayout:#fit.
   319 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   324 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   320 	b1 := Button label:'button1' in:p.
   325 	b1 := Button label:'button1' in:p.
   328 
   333 
   329 	|v p b1 b2 b3|
   334 	|v p b1 b2 b3|
   330 
   335 
   331 	v := StandardSystemView new.
   336 	v := StandardSystemView new.
   332 	p := HorizontalPanelView in:v.
   337 	p := HorizontalPanelView in:v.
   333 	v label:'hL=spreadSpace vL=fitSpace'.
   338 	v label:'hL=spreadSpace; vL=fitSpace'.
   334 
   339 
   335 	p horizontalLayout:#spreadSpace.
   340 	p horizontalLayout:#spreadSpace.
   336 	p verticalLayout:#fitSpace.
   341 	p verticalLayout:#fitSpace.
   337 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   342 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   338 	b1 := Button label:'button1' in:p.
   343 	b1 := Button label:'button1' in:p.
   346 
   351 
   347 	|v p b1 b2 b3|
   352 	|v p b1 b2 b3|
   348 
   353 
   349 	v := StandardSystemView new.
   354 	v := StandardSystemView new.
   350 	p := HorizontalPanelView in:v.
   355 	p := HorizontalPanelView in:v.
   351 	v label:'hL=fit vL=top'.
   356 	v label:'hL=fit; vL=top'.
   352 
   357 
   353 	p horizontalLayout:#fit.
   358 	p horizontalLayout:#fit.
   354 	p verticalLayout:#top.
   359 	p verticalLayout:#top.
   355 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   360 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   356 	b1 := Button label:'button1' in:p.
   361 	b1 := Button label:'button1' in:p.
   364 
   369 
   365 	|v p b1 b2 b3|
   370 	|v p b1 b2 b3|
   366 
   371 
   367 	v := StandardSystemView new.
   372 	v := StandardSystemView new.
   368 	p := HorizontalPanelView in:v.
   373 	p := HorizontalPanelView in:v.
   369 	v label:'hL=fitSpace vL=top'.
   374 	v label:'hL=fitSpace; vL=top'.
   370 
   375 
   371 	p horizontalLayout:#fitSpace.
   376 	p horizontalLayout:#fitSpace.
   372 	p verticalLayout:#top.
   377 	p verticalLayout:#top.
   373 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   378 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   374 	b1 := Button label:'button1' in:p.
   379 	b1 := Button label:'button1' in:p.
   382 
   387 
   383 	|v p b1 b2 b3|
   388 	|v p b1 b2 b3|
   384 
   389 
   385 	v := StandardSystemView new.
   390 	v := StandardSystemView new.
   386 	p := HorizontalPanelView in:v.
   391 	p := HorizontalPanelView in:v.
   387 	v label:'hL=fitSpace vL=fitSpace'.
   392 	v label:'hL=fitSpace; vL=fitSpace'.
   388 
   393 
   389 	p horizontalLayout:#fitSpace.
   394 	p horizontalLayout:#fitSpace.
   390 	p verticalLayout:#fitSpace.
   395 	p verticalLayout:#fitSpace.
   391 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   396 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   392 	b1 := Button label:'button1' in:p.
   397 	b1 := Button label:'button1' in:p.
   400 
   405 
   401 	|v p b1 b2 b3|
   406 	|v p b1 b2 b3|
   402 
   407 
   403 	v := StandardSystemView new.
   408 	v := StandardSystemView new.
   404 	p := HorizontalPanelView in:v.
   409 	p := HorizontalPanelView in:v.
   405 	v label:'hL=fit vL=fit hS=0'.
   410 	v label:'hL=fit hS=0; vL=fit'.
   406 
   411 
   407 	p horizontalLayout:#fit.
   412 	p horizontalLayout:#fit.
   408 	p verticalLayout:#fit.
   413 	p verticalLayout:#fit.
   409 	p horizontalSpace:0.
   414 	p horizontalSpace:0.
   410 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   415 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   419 
   424 
   420 	|v p b1 b2 b3|
   425 	|v p b1 b2 b3|
   421 
   426 
   422 	v := StandardSystemView new.
   427 	v := StandardSystemView new.
   423 	p := HorizontalPanelView in:v.
   428 	p := HorizontalPanelView in:v.
   424 	v label:'hL=fitSpace vL=topSpace'.
   429 	v label:'hL=fitSpace; vL=topSpace'.
   425 
   430 
   426 	p horizontalLayout:#fitSpace.
   431 	p horizontalLayout:#fitSpace.
   427 	p verticalLayout:#topSpace.
   432 	p verticalLayout:#topSpace.
   428 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   433 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   429 	b1 := Button label:'button1' in:p.
   434 	b1 := Button label:'button1' in:p.
   437 
   442 
   438 	|v p b1 b2 b3|
   443 	|v p b1 b2 b3|
   439 
   444 
   440 	v := StandardSystemView new.
   445 	v := StandardSystemView new.
   441 	p := HorizontalPanelView in:v.
   446 	p := HorizontalPanelView in:v.
   442 	v label:'hL=fit vL=top'.
   447 	v label:'hL=fit; vL=top'.
   443 
   448 
   444 	p horizontalLayout:#fit.
   449 	p horizontalLayout:#fit.
   445 	p verticalLayout:#top.
   450 	p verticalLayout:#top.
   446 	p horizontalSpace:0.
   451 	p horizontalSpace:0.
   447 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   452 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   456 
   461 
   457 	|v p b1 b2 b3|
   462 	|v p b1 b2 b3|
   458 
   463 
   459 	v := StandardSystemView new.
   464 	v := StandardSystemView new.
   460 	p := HorizontalPanelView in:v.
   465 	p := HorizontalPanelView in:v.
   461 	v label:'hL=fitSpace vL=bottomSpace'.
   466 	v label:'hL=fitSpace; vL=bottomSpace'.
   462 
   467 
   463 	p horizontalLayout:#fitSpace.
   468 	p horizontalLayout:#fitSpace.
   464 	p verticalLayout:#bottomSpace.
   469 	p verticalLayout:#bottomSpace.
   465 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   470 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   466 	b1 := Button label:'button1' in:p.
   471 	b1 := Button label:'button1' in:p.
   474 
   479 
   475 	|v p b1 b2 b3|
   480 	|v p b1 b2 b3|
   476 
   481 
   477 	v := StandardSystemView new.
   482 	v := StandardSystemView new.
   478 	p := HorizontalPanelView in:v.
   483 	p := HorizontalPanelView in:v.
   479 	v label:'hL=fit vL=bottomSpace'.
   484 	v label:'hL=fit; vL=bottomSpace'.
   480 
   485 
   481 	p horizontalLayout:#fit.
   486 	p horizontalLayout:#fit.
   482 	p verticalLayout:#bottomSpace.
   487 	p verticalLayout:#bottomSpace.
   483 	p horizontalSpace:0.
   488 	p horizontalSpace:0.
   484 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   489 	p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
   485 	b1 := Button label:'button1' in:p.
   490 	b1 := Button label:'button1' in:p.
   486 	b2 := Button label:'button2' in:p.
   491 	b2 := Button label:'button2' in:p.
   487 	b3 := Button label:'button3' in:p.
   492 	b3 := Button label:'button3' in:p.
   488 	v extent:300 @ 100.
   493 	v extent:300 @ 100.
       
   494 	v open
       
   495 
       
   496     example: placing hPanels into a vPanel
       
   497 
       
   498 	|v vP hP1 hP2 hP3 b1 b2 b3 b4 b5 b6 b7 b8 b9|
       
   499 
       
   500 	v := StandardSystemView new.
       
   501 	vP := VerticalPanelView in:v.
       
   502 	vP origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
       
   503 	vP verticalLayout:#fit;
       
   504 	   verticalSpace:0;
       
   505 	   horizontalLayout:#fit.
       
   506 
       
   507 	hP1 := HorizontalPanelView in:vP.
       
   508 	hP1 horizontalLayout:#fitSpace;
       
   509 	    verticalLayout:#center.
       
   510 	b1 := Button label:'button1' in:hP1.
       
   511 	b2 := Button label:'button2' in:hP1.
       
   512 	b3 := Button label:'button3' in:hP1.
       
   513 
       
   514 	hP2 := HorizontalPanelView in:vP.
       
   515 	hP2 horizontalLayout:#fitSpace;
       
   516 	    verticalLayout:#center.
       
   517 	b4 := Button label:'button4' in:hP2.
       
   518 	b5 := Button label:'button5' in:hP2.
       
   519 	b6 := Button label:'button6' in:hP2.
       
   520 
       
   521 	hP3 := HorizontalPanelView in:vP.
       
   522 	hP3 horizontalLayout:#fitSpace;
       
   523 	    verticalLayout:#center.
       
   524 	b7 := Button label:'button7' in:hP3.
       
   525 	b8 := Button label:'button8' in:hP3.
       
   526 	b9 := Button label:'button9' in:hP3.
       
   527 
       
   528 	v extent:300 @ 300.
   489 	v open
   529 	v open
   490 
   530 
   491     example: a browser like table, where the rightmost list
   531     example: a browser like table, where the rightmost list
   492 	     extends to the far right.
   532 	     extends to the far right.
   493 
   533 
   513 	l2 ignoreParentDirectory:true.
   553 	l2 ignoreParentDirectory:true.
   514 	l2 action:[:selection | l3 directory:(l2 selectedPathname)].
   554 	l2 action:[:selection | l3 directory:(l2 selectedPathname)].
   515 
   555 
   516 	l3 := ScrollableView for:FileSelectionList in:p.
   556 	l3 := ScrollableView for:FileSelectionList in:p.
   517 	l3 directory:nil.
   557 	l3 directory:nil.
   518 	l3 ignoreParentDirectory:true.
   558 	l3 ignoreParentDirectory:false.
   519 	v extent:400 @ 300.
   559 	v extent:400 @ 300.
   520 	v open
   560 	v open
   521 "
   561 "
   522 ! !
   562 ! !
   523 
   563 
   526 horizontalLayout
   566 horizontalLayout
   527     "return the horizontal layout as symbol.
   567     "return the horizontal layout as symbol.
   528      the returned value is one of
   568      the returned value is one of
   529 	#left 
   569 	#left 
   530 	#leftSpace 
   570 	#leftSpace 
       
   571 	#leftFit 
       
   572 	#leftSpaceFit 
   531 	#center
   573 	#center
   532 	#spread
   574 	#spread
   533 	#fit
   575 	#fit
   534 	#right 
   576 	#right 
   535 	#rightSpace 
   577 	#rightSpace 
   536       the default is #center
   578       the default is #center
       
   579       See the class documentation for  the meanings.
   537     "
   580     "
   538 
   581 
   539     ^ hLayout
   582     ^ hLayout
   540 !
   583 !
   541 
   584 
   545 	#top / #topSpace
   588 	#top / #topSpace
   546 	#center
   589 	#center
   547 	#bottom / #bottomSpace
   590 	#bottom / #bottomSpace
   548 	#fit
   591 	#fit
   549       the default is #center
   592       the default is #center
       
   593       See the class documentation for  the meanings.
   550     "
   594     "
   551 
   595 
   552     ^ vLayout
   596     ^ vLayout
   553 !
   597 !
   554 
   598 
   555 horizontalLayout:aSymbol
   599 horizontalLayout:aSymbol
   556     "change the horizontal layout as symbol.
   600     "change the horizontal layout as symbol.
   557      The argument, aSymbol must be one of:
   601      The argument, aSymbol must be one of:
   558 	#left / #leftSpace 
   602 	#left / #leftSpace 
       
   603 	#leftFit / #leftSpaceFit 
   559 	#center
   604 	#center
   560 	#spread / spredSpace
   605 	#spread / spreadSpace
   561 	#fit / fitSpace
   606 	#fit / fitSpace
   562 	#right / #rightSpace 
   607 	#right / #rightSpace 
   563       the default (if never changed) is #center
   608       the default (if never changed) is #center.
       
   609       See the class documentation for  the meanings.
   564     "
   610     "
   565 
   611 
   566     (hLayout ~~ aSymbol) ifTrue:[
   612     (hLayout ~~ aSymbol) ifTrue:[
   567 	hLayout := aSymbol.
   613 	hLayout := aSymbol.
   568 	self layoutChanged
   614 	self layoutChanged
   575 	#top / #topSpace
   621 	#top / #topSpace
   576 	#center
   622 	#center
   577 	#bottom / #bottomSpace
   623 	#bottom / #bottomSpace
   578 	#fit 
   624 	#fit 
   579       the default (if never changed) is #center
   625       the default (if never changed) is #center
       
   626       See the class documentation for  the meanings.
   580     "
   627     "
   581 
   628 
   582     (vLayout ~~ aSymbol) ifTrue:[
   629     (vLayout ~~ aSymbol) ifTrue:[
   583 	vLayout := aSymbol.
   630 	vLayout := aSymbol.
   584 	self layoutChanged
   631 	self layoutChanged
   653 
   700 
   654 setChildPositions
   701 setChildPositions
   655     "(re)compute position of every child whenever childs are added or
   702     "(re)compute position of every child whenever childs are added or
   656      my size has changed"
   703      my size has changed"
   657 
   704 
   658     |xpos space sumOfWidths numChilds l wEach wInside|
   705     |xpos space sumOfWidths numChilds l wEach wInside hL vL|
   659 
   706 
   660     subViews isNil ifTrue:[^ self].
   707     subViews isNil ifTrue:[^ self].
   661 
   708 
   662     space := horizontalSpace.
   709     space := horizontalSpace.
   663     numChilds := subViews size.
   710     numChilds := subViews size.
   664     wInside := width - (margin * 2) + (borderWidth*2) - subViews last borderWidth.
   711     wInside := width - (margin * 2) + (borderWidth*2) - subViews last borderWidth.
   665 
   712 
   666     hLayout == #fitSpace ifTrue:[
   713     hL := hLayout.
       
   714     vL := vLayout.
       
   715 
       
   716     hL == #fitSpace ifTrue:[
   667 	"
   717 	"
   668 	 adjust childs extents and set origins.
   718 	 adjust childs extents and set origins.
   669 	 Be careful to avoid accumulation of rounding errors
   719 	 Be careful to avoid accumulation of rounding errors
   670 	"
   720 	"
   671 	wEach := (wInside - (numChilds + 1 * space)) / numChilds.
   721 	wEach := (wInside - (numChilds + 1 * space)) / numChilds.
   672 	xpos := space + margin - borderWidth.
   722 	xpos := space + margin - borderWidth.
   673     ] ifFalse:[
   723     ] ifFalse:[
   674 	hLayout == #fit ifTrue:[
   724 	hL == #fit ifTrue:[
   675 	    "
   725 	    "
   676 	     adjust childs extents and set origins.
   726 	     adjust childs extents and set origins.
   677 	     Be careful to avoid accumulation of rounding errors
   727 	     Be careful to avoid accumulation of rounding errors
   678 	    "
   728 	    "
   679 	    wEach := (wInside - (numChilds - 1 * space)) / numChilds.
   729 	    wEach := (wInside - (numChilds - 1 * space)) / numChilds.
   682 	    "
   732 	    "
   683 	     compute net width needed
   733 	     compute net width needed
   684 	    "
   734 	    "
   685 	    sumOfWidths := subViews inject:0 into:[:sumSoFar :child | sumSoFar + child widthIncludingBorder].
   735 	    sumOfWidths := subViews inject:0 into:[:sumSoFar :child | sumSoFar + child widthIncludingBorder].
   686 
   736 
   687 	    l := hLayout.
   737 	    l := hL.
   688 	    ((l == #center) and:[numChilds == 1]) ifTrue:[
   738 	    ((l == #center) and:[numChilds == 1]) ifTrue:[
   689 		l := #spread
   739 		l := #spread
   690 	    ].
   740 	    ].
   691 	    (l == #spread and:[numChilds == 1]) ifTrue:[
   741 	    (l == #spread and:[numChilds == 1]) ifTrue:[
   692 		l := #spreadSpace
   742 		l := #spreadSpace
   694 
   744 
   695 	    "
   745 	    "
   696 	     compute position of leftmost subview and space between them;
   746 	     compute position of leftmost subview and space between them;
   697 	     if they do hardly fit, leave no space between them 
   747 	     if they do hardly fit, leave no space between them 
   698 	    "
   748 	    "
   699 	    (sumOfWidths >= (width - (margin * 2))) ifTrue:[
   749 	    ((sumOfWidths >= (width - (margin * 2))) 
       
   750 	    and:[l ~~ #fixLeftSpace and:[l ~~ #fixLeft]]) ifTrue:[
   700 		xpos := 0.
   751 		xpos := 0.
   701 		space := 0
   752 		space := 0
   702 	    ] ifFalse: [
   753 	    ] ifFalse: [
       
   754 		l == #fixLeftSpace ifTrue:[
       
   755 		    l := #leftSpace
       
   756 		] ifFalse:[
       
   757 		    l == #fixLeft ifTrue:[
       
   758 			l := #left
       
   759 		    ]
       
   760 		].
   703 		((l == #right) or:[l == #rightSpace]) ifTrue:[
   761 		((l == #right) or:[l == #rightSpace]) ifTrue:[
   704 		    xpos := width - (space * (numChilds - 1)) - sumOfWidths.
   762 		    xpos := width - (space * (numChilds - 1)) - sumOfWidths.
   705 	"
   763 	"
   706 		    borderWidth == 0 ifTrue:[
   764 		    borderWidth == 0 ifTrue:[
   707 			xpos := xpos + space 
   765 			xpos := xpos + space 
   735 			((l == #left) 
   793 			((l == #left) 
   736 			or:[l == #leftSpace
   794 			or:[l == #leftSpace
   737 			or:[l == #leftFit
   795 			or:[l == #leftFit
   738 			or:[l == #leftSpaceFit]]]) ifTrue:[
   796 			or:[l == #leftSpaceFit]]]) ifTrue:[
   739 			    space := space min:(width - sumOfWidths) // (numChilds + 1).
   797 			    space := space min:(width - sumOfWidths) // (numChilds + 1).
       
   798 			    (hL == #fixLeft or:[hL == #fixLeftSpace]) ifTrue:[
       
   799 				space := space max:horizontalSpace.
       
   800 			    ] ifFalse:[
       
   801 				space := space max:0.
       
   802 			    ].
   740 			    (l == #leftSpace 
   803 			    (l == #leftSpace 
   741 			    or:[l == #leftSpaceFit]) ifTrue:[
   804 			    or:[l == #leftSpaceFit]) ifTrue:[
   742 				xpos := space.
   805 				xpos := space.
   743 			    ] ifFalse:[
   806 			    ] ifFalse:[
   744 				xpos := 0
   807 				xpos := 0
   768     "now set positions"
   831     "now set positions"
   769 
   832 
   770     subViews keysAndValuesDo:[:index :child |
   833     subViews keysAndValuesDo:[:index :child |
   771 	|ypos advance|
   834 	|ypos advance|
   772 
   835 
   773 	vLayout == #top ifTrue:[
   836 	vL == #top ifTrue:[
   774 	    ypos := 0
   837 	    ypos := 0
   775 	] ifFalse:[
   838 	] ifFalse:[
   776 	    vLayout == #topSpace ifTrue:[
   839 	    vL == #topSpace ifTrue:[
   777 		ypos := verticalSpace
   840 		ypos := verticalSpace
   778 	    ] ifFalse:[
   841 	    ] ifFalse:[
   779 		vLayout == #bottom ifTrue:[
   842 		vL == #bottom ifTrue:[
   780 		    ypos := height - child heightIncludingBorder
   843 		    ypos := height - child heightIncludingBorder
   781 		] ifFalse:[
   844 		] ifFalse:[
   782 		    vLayout == #bottomSpace ifTrue:[
   845 		    vL == #bottomSpace ifTrue:[
   783 			ypos := height - verticalSpace - child heightIncludingBorder.
   846 			ypos := height - verticalSpace - child heightIncludingBorder.
   784 		    ] ifFalse:[
   847 		    ] ifFalse:[
   785 			vLayout == #fitSpace ifTrue:[
   848 			vL == #fitSpace ifTrue:[
   786 			    ypos := verticalSpace.
   849 			    ypos := verticalSpace.
   787 			    child height:(height - (verticalSpace + child borderWidth * 2))
   850 			    child height:(height - (verticalSpace + child borderWidth * 2))
   788 			] ifFalse:[
   851 			] ifFalse:[
   789 			    vLayout == #fit ifTrue:[
   852 			    vL == #fit ifTrue:[
   790 				ypos := 0.
   853 				ypos := 0.
   791 				child height:(height - (child borderWidth * 2))
   854 				child height:(height - (child borderWidth * 2))
   792 			    ] ifFalse:[
   855 			    ] ifFalse:[
   793 				"centered"
   856 				"centered"
   794 				ypos := (height - child heightIncludingBorder) // 2.
   857 				ypos := (height - child heightIncludingBorder) // 2.
   798 		]
   861 		]
   799 	    ]
   862 	    ]
   800 	].
   863 	].
   801 	(ypos < 0) ifTrue:[ypos := 0].
   864 	(ypos < 0) ifTrue:[ypos := 0].
   802 
   865 
   803 	(hLayout == #fit or:[hLayout == #fitSpace]) ifTrue:[
   866 	(hL == #fit or:[hL == #fitSpace]) ifTrue:[
   804 	    child origin:(xpos truncated @ ypos)
   867 	    child origin:(xpos truncated @ ypos)
   805 		  corner:(xpos + wEach - (child borderWidth)) truncated
   868 		  corner:(xpos + wEach - (child borderWidth)) truncated
   806 			 @ (ypos + child height).
   869 			 @ (ypos + child height).
   807 	    advance := wEach.
   870 	    advance := wEach.
   808 	] ifFalse:[
   871 	] ifFalse:[
   812 	xpos := xpos + advance + space.
   875 	xpos := xpos + advance + space.
   813 
   876 
   814 	index == numChilds ifTrue:[
   877 	index == numChilds ifTrue:[
   815 	    |x|
   878 	    |x|
   816 
   879 
   817 	    hLayout == #leftFit ifTrue:[
   880 	    hL == #leftFit ifTrue:[
   818 		x := width - margin.
   881 		x := width - margin.
   819 	    ].
   882 	    ].
   820 	    hLayout == #leftSpaceFit ifTrue:[
   883 	    hL == #leftSpaceFit ifTrue:[
   821 		x := width - margin - space
   884 		x := width - margin - space
   822 	    ].
   885 	    ].
   823 	    x notNil ifTrue:[
   886 	    x notNil ifTrue:[
   824 		subViews last corner:(x @ (ypos + child height))
   887 		subViews last corner:(x @ (ypos + child height))
   825 	    ]
   888 	    ]