MultiColumnPanelView.st
author Claus Gittinger <cg@exept.de>
Fri, 06 Mar 2020 21:56:26 +0100
changeset 6843 6c5e543e903e
parent 6827 71d47cbb79ed
permissions -rw-r--r--
#OTHER by cg class: SimpleView added: #isWarningBox
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6827
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
     1
"{ Encoding: utf8 }"
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
     2
3518
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
"
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
 COPYRIGHT (c) 1989 by Claus Gittinger
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
	      All Rights Reserved
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 This software is furnished under a license and may be used
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
 hereby transferred.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
"
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
"{ Package: 'stx:libwidg' }"
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
6487
debe1f7cce35 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4564
diff changeset
    16
"{ NameSpace: Smalltalk }"
debe1f7cce35 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4564
diff changeset
    17
3518
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
PanelView subclass:#MultiColumnPanelView
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	instanceVariableNames:'columnWidths'
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	classVariableNames:''
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
	poolDictionaries:''
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
	category:'Views-Layout'
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
!MultiColumnPanelView class methodsFor:'documentation'!
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
copyright
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
"
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
 COPYRIGHT (c) 1989 by Claus Gittinger
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
	      All Rights Reserved
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 This software is furnished under a license and may be used
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 only in accordance with the terms of that license and with the
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 inclusion of the above copyright notice.   This software may not
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
 be provided or otherwise made available to, or used by, any
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
 other person.  No title to or ownership of the software is
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
 hereby transferred.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
"
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
!
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
documentation
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
"
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
    a View which arranges its child-views in a vertical column.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
    All real work is done in PanelView - except the layout computation is
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
    redefined here.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
    The layout is controlled by the instance variables: 
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
	horizontalLayout and verticalLayout
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    in addition to 
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
	horizontalSpace and verticalSpace.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
    The vertical layout can be any of:
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
	#top            arrange elements at the top
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
	#topSpace       arrange elements at the top, start with spacing
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
	#bottom         arrange elements at the bottom
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
	#bottomSpace    arrange elements at the bottom, start with spacing
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
	#center         arrange elements in the center; ignore verticalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
	#spread         spread elements evenly; ignore verticalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
	#spreadSpace    spread elements evenly with spacing at ends; ignore verticalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
	#fit            like #spread, but resize elements for tight packing; ignore verticalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
	#fitSpace       like #fit, with spacing; ignore verticalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
	#topFit         like #top, but resize the last element to fit
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
	#topSpaceFit    like #topSpace, but resize the last element to fit
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
	#bottomFit      like #bottom, but resize the first element to fit
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
	#bottomSpaceFit like #bottomSpace, but resize the first element to fit
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
    the horizontal layout can be:
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
	#left           place element at the left
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
	#leftSpace      place element at the left, offset by horizontalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
	#center         place elements horizontally centered; ignore horizontalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
	#right          place it at the right
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
	#rightSpace     place it at the right, offset by horizontalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
	#fit            resize elements horizontally to fit this panel; ignore horizontalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
	#fitSpace       like #fit, but add spacing; ignore horizontalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
	#leftMax        like #left, but resize elements to max of them
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
	#leftSpaceMax   like #leftSpace, but resize elements
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
	#centerMax      like #center, but resize elements
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
	#rightMax       like #right, but resize elements to max of them
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
	#rightSpaceMax  like #rightSpace, but resize elements
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
    The defaults is #center for both directions.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
    The layout is changed by the messages #verticalLayout: and #horizontalLayout:.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
    For backward compatibility (to times, where only vLayout existed), the simple
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
    #layout: does the same as #verticalLayout:. Do not use this old method.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
    The panel assumes, that the elements do not resize themselfes, after it
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
    became visible. This is not true for all widgets (buttons or labels may
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
    like to change). If you have changing elements, tell this to the panel
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
    with 'aPanel elementsChangeSize:true'. In that case, the panel will react
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
    to size changes, and reorganize things.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
    If none of these layout/space combinations is exactly what you need in
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
    your application, create a subclass, and redefine the setChildPositions method.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
    CAVEAT: this class started with #top and no horizontal alignments;
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
    as time went by, more layouts were added and the setup should be changed
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
    to use different selectors for space, max-resize and alignment
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
    (i.e. having more and more layout symbols makes things a bit confusing ...)
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
    [see also:]
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
	HorizontalPanelView
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
	VariableVerticalPanel VariableHorizontalPanel
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
	Label
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
    [author:]
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
	Claus Gittinger
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
"
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
!
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
examples
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
"
6827
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
   116
    These examples demonstrate the effect of different layout settings.
3518
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
    You should try more examples, combining spacing and different
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
    verticalLayout:/horizontalLayout: combinations.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
6827
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
   121
    example: default layout and columns made to fit
3518
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
                                                                        [exBegin]
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
        |v p b1 b2 b3 l1 l2 l3|
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
        v := StandardSystemView new.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
        v label:'center (default)'.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
        p := MultiColumnPanelView in:v.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
        p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
        p columnWidths:#(0.3 0.7).
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
        l1 := Label label:'label1' in:p.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
        b1 := Button label:'button1' in:p.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
        l2 := Label label:'l2' in:p.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
        b2 := Button label:'b2' in:p.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
        l3 := Label label:'lab3' in:p.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
        b3 := Button label:'butt3' in:p.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
        v extent:100 @ 300.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
        v open
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
                                                                        [exEnd]
6827
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
   139
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
   140
                                                                        [exBegin]
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
   141
        |v p b1 b2 b3 l1 l2 l3|
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
   142
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
   143
        v := StandardSystemView new.
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
   144
        v label:'center (default)'.
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
   145
        p := MultiColumnPanelView in:v.
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
   146
        p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
   147
        p horizontalLayout:#fitSpace.
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
   148
        l1 := Label label:'label1' in:p.
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
   149
        b1 := Button label:'button1' in:p.
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
   150
        l2 := Label label:'l2' in:p.
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
   151
        b2 := Button label:'b2' in:p.
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
   152
        l3 := Label label:'lab3' in:p.
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
   153
        b3 := Button label:'butt3' in:p.
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
   154
        v extent:100 @ 300.
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
   155
        v open
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
   156
                                                                        [exEnd]
3518
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
"
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
! !
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
!MultiColumnPanelView methodsFor:'accessing'!
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
columnWidths:something
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
    something ~= columnWidths ifTrue:[
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
        columnWidths := something.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
        self layoutChanged
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
    ].
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
!
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
horizontalLayout
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
    "return the horizontal layout as symbol.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
     the returned value is one of
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
	#left           place element at the left
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
	#leftSpace      place element at the left, offset by horizontalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
	#center         place elements horizontally centered; ignore horizontalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
	#right          place it at the right
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
	#rightSpace     place it at the right, offset by horizontalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
	#fit            resize elements horizontally to fit this panel; ignore horizontalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
	#fitSpace       like #fit, but add spacing; ignore horizontalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
	#leftMax        like #left, but resize elements to max of them
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
	#leftSpaceMax   like #leftSpace, but resize elements
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
	#centerMax      like #center, but resize elements
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
	#rightMax       like #right, but resize elements to max of them
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
	#rightSpaceMax  like #rightSpace, but resize elements
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
      the default is #centered
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
    "
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
    ^ hLayout
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
!
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
horizontalLayout:aSymbol
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
    "change the horizontal layout as symbol.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
     The argument, aSymbol must be one of:
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
	#left           place element at the left
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
	#leftSpace      place element at the left, offset by horizontalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
	#center         place elements horizontally centered; ignore horizontalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
	#right          place it at the right
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
	#rightSpace     place it at the right, offset by horizontalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
	#fit            resize elements horizontally to fit this panel; ignore horizontalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
	#fitSpace       like #fit, but add spacing; ignore horizontalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
	#leftMax        like #left, but resize elements to max of them
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
	#leftSpaceMax   like #leftSpace, but resize elements
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
	#centerMax      like #center, but resize elements
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
	#rightMax       like #right, but resize elements to max of them
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
	#rightSpaceMax  like #rightSpace, but resize elements
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
      the default (if never changed) is #centered
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
    "
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
    (hLayout ~~ aSymbol) ifTrue:[
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
	hLayout := aSymbol.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
	self layoutChanged
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
    ]
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
!
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
layout:something
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
    "OBSOLETE compatibility interface. Will vanish.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
     leftover for historic reasons - do not use any more.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
     In the meantime, try to figure out what is meant ... a kludge"
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
    <resource:#obsolete>
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
    something isLayout ifTrue:[^ super layout:something].
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
    self obsoleteMethodWarning:'use #verticalLayout:'.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
    ^ self verticalLayout:something
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
    "Modified: 31.8.1995 / 23:08:54 / claus"
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
!
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
verticalLayout
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
    "return the vertical layout as a symbol.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
     the returned value is one of
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
	#top            arrange elements at the top
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
	#topSpace       arrange elements at the top, start with spacing
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
	#bottom         arrange elements at the bottom
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
	#bottomSpace    arrange elements at the bottom, start with spacing
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
	#center         arrange elements in the center; ignore verticalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
	#spread         spread elements evenly; ignore verticalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
	#spreadSpace    spread elements evenly with spacing at ends; ignore verticalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
	#fit            like #spread, but resize elements for tight packing; ignore verticalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
	#fitSpace       like #fit, with spacing; ignore verticalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
	#topFit         like #top, but resize the last element to fit
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   244
	#topSpaceFit    like #topSpace, but resize the last element to fit
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
	#bottomFit      like #bottom, but resize the first element to fit
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
	#bottomSpaceFit like #bottomSpace, but extend the first element to fit
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
      the default is #centered
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
    "
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
    ^ vLayout
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
    "Modified: 17.8.1997 / 15:20:13 / cg"
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
!
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
verticalLayout:aSymbol
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
    "change the vertical layout as a symbol.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
     The argument, aSymbol must be one of:
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
	#top            arrange elements at the top
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
	#topSpace       arrange elements at the top, start with spacing
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
	#bottom         arrange elements at the bottom
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
	#bottomSpace    arrange elements at the bottom, start with spacing
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
	#center         arrange elements in the center; ignore verticalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
	#spread         spread elements evenly; ignore verticalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
	#spreadSpace    spread elements evenly with spacing at ends; ignore verticalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
	#fit            like #spread, but resize elements for tight packing; ignore verticalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
	#fitSpace       like #fit, with spacing; ignore verticalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
	#topFit         like #top, but resize the last element to fit
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
	#topSpaceFit    like #topSpace, but resize the last element to fit
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
	#bottomFit      like #bottom, but resize the first element to fit
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
	#bottomSpaceFit like #bottomSpace, but extend the first element to fit
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
      the default (if never changed) is #centered
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
    "
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
    (vLayout ~~ aSymbol) ifTrue:[
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
	vLayout := aSymbol.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
	self layoutChanged
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   277
    ]
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   278
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
    "Modified: 17.8.1997 / 15:19:58 / cg"
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   280
! !
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   282
!MultiColumnPanelView methodsFor:'initialization'!
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   283
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   284
initialize
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   285
    super initialize.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   286
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   287
    hLayout := #fit.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   288
    vLayout := #top.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   289
    columnWidths := #(0.5 0.5).
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   290
! !
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   291
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   292
!MultiColumnPanelView methodsFor:'layout'!
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   293
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   294
setChildPositions
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   295
    "(re)compute position of every child"
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
4564
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   297
    |xpos ypos space numChilds hInside hL vL maxHeight m2 subViews rowsPerCol maxWidthPerCol col numCols cX cY bw|
3518
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   298
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   299
    subViews := self subViewsToConsider.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   300
    subViews size == 0 ifTrue:[^ self].
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   301
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   302
"/    self extentChangedFlag ifTrue:[
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   303
"/        ext := self computeExtent.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   304
"/        width := ext x.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   305
"/        height := ext y.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   306
"/    ].
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   307
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
    space := verticalSpace.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
    numChilds := subViews size.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   310
    numCols := columnWidths size max:1.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   311
4019
bf57f58f13a8 no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents: 3760
diff changeset
   312
    bw := self borderWidth.
3518
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   313
    m2 := margin * 2.
4019
bf57f58f13a8 no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents: 3760
diff changeset
   314
    hInside := height - m2 + (bw*2) - subViews last borderWidth.
3518
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   315
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   316
    hL := hLayout.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
    vL := vLayout.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   318
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   319
    rowsPerCol := Array new:numCols withAll:0.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
    maxWidthPerCol := Array new:numCols withAll:0.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   322
    maxHeight := 0.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   323
    col := 1.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   324
    subViews do:[:child |
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   325
        |childsW childsH|
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   327
        childsW := child widthIncludingBorder.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
        childsH := child heightIncludingBorder.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   329
        maxHeight := maxHeight max:childsH.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   330
        maxWidthPerCol at:col put:((maxWidthPerCol at:col) max:childsW).
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   331
        rowsPerCol at:col put:(rowsPerCol at:col)+1.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   332
        col := col + 1.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   333
        col > numCols ifTrue:[ col := 1 ].
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   334
    ].
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   335
"/ new
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   336
    xpos := 0.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   337
    ypos := 0.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   338
    col := 1.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   339
    subViews do:[:child |
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   340
        col == numCols ifTrue:[
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   341
            cX := width.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   342
        ] ifFalse:[
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   343
            cX := xpos + (width // numCols).
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   344
        ].
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   345
        cY := ypos + maxHeight.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   346
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   347
        child origin:(xpos@ypos)"corner:(cX @ cY)".
6827
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
   348
        (hLayout == #fit) ifTrue:[
3518
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   349
            child width:(cX - xpos + 1).
6827
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
   350
        ] ifFalse:[
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
   351
            (hLayout == #fitSpace) ifTrue:[
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
   352
                child width:(cX - xpos + 1 - horizontalSpace).
71d47cbb79ed #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6487
diff changeset
   353
            ].
3518
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   354
        ].
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   355
        col := col + 1.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   356
        col > numCols ifTrue:[ 
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   357
            col := 1.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   358
            xpos := 0.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   359
            ypos := cY + verticalSpace.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
        ] ifFalse:[
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   361
            xpos := cX + horizontalSpace.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   362
        ].
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
    ].
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
    ^ self.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   365
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   366
"/ old
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   367
4564
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   368
"/    resizeToMaxV := false.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   369
"/    (vL endsWith:'Max') ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   370
"/        resizeToMaxV := true.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   371
"/        hEach := maxHeight := subViews inject:0 into:[:maxSoFar :child | maxSoFar max:child heightIncludingBorder].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   372
"/        vL := (vL copyButLast:3) asSymbol.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   373
"/    ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   374
"/
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   375
"/    numChilds == 1 ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   376
"/        (vL == #topFit or:[vL == #bottomFit]) ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   377
"/            vL := #fit
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   378
"/        ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   379
"/        (vL == #topSpaceFit or:[vL == #bottomSpaceFit]) ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   380
"/            vL := #fitSpace
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   381
"/        ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   382
"/    ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   383
"/
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   384
"/    vL == #fitSpace ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   385
"/        "
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   386
"/         adjust childs extents and set origins.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   387
"/         Be careful to avoid accumulation of rounding errors
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   388
"/        "
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   389
"/        hEach := (hInside - ((numChilds + 1) * space)) / numChilds.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   390
"/        ypos := space + margin - bw.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   391
"/    ] ifFalse:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   392
"/        vL == #fit ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   393
"/            "
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   394
"/             adjust childs extents and set origins.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   395
"/             Be careful to avoid accumulation of rounding errors
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   396
"/            "
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   397
"/            hEach := (hInside - ((numChilds - 1) * space)) / numChilds.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   398
"/            ypos := margin - bw.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   399
"/        ] ifFalse:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   400
"/            l := vL.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   401
"/
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   402
"/            "
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   403
"/             compute net height needed
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   404
"/            "
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   405
"/            resizeToMaxV ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   406
"/                sumOfHeights := subViews inject:0 into:[:sumSoFar :child | sumSoFar + maxHeight + (child borderWidth*2)].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   407
"/            ] ifFalse:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   408
"/                sumOfHeights := subViews inject:0 into:[:sumSoFar :child | sumSoFar + child heightIncludingBorder].
3518
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   409
"/
4564
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   410
"/                "/ adjust - do not include height of last(first) element if doing a fit
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   411
"/                (vL == #topFit or:[vL == #topSpaceFit]) ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   412
"/                    sumOfHeights := sumOfHeights - subViews last heightIncludingBorder.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   413
"/                ] ifFalse:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   414
"/                    (vL == #bottomFit or:[vL == #bottomSpaceFit]) ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   415
"/                        sumOfHeights := sumOfHeights - subViews first heightIncludingBorder.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   416
"/                    ]
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   417
"/                ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   418
"/            ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   419
"/
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   420
"/            restHeight := height - sumOfHeights - ((numChilds-1)*space).
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   421
"/
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   422
"/            ((l == #center) and:[numChilds == 1]) ifTrue:[l := #spread].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   423
"/            (l == #spread and:[numChilds == 1]) ifTrue:[l := #spreadSpace].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   424
"/
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   425
"/            "
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   426
"/             compute position of topmost subview and space between them;
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   427
"/             if they do hardly fit, leave no space between them 
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   428
"/            "
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   429
"/            ((sumOfHeights >= (height - m2))
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   430
"/            and:[l ~~ #fixTopSpace and:[l ~~ #fixTop]]) ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   431
"/                "
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   432
"/                 if we have not enough space for all the elements, 
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   433
"/                 fill them tight, and show what can be shown (at least)
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   434
"/                "
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   435
"/                ypos := margin.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   436
"/                space := 0
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   437
"/            ] ifFalse:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   438
"/                l == #fixTopSpace ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   439
"/                    l := #topSpace
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   440
"/                ] ifFalse:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   441
"/                    l == #fixTop ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   442
"/                        l := #top 
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   443
"/                    ]
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   444
"/                ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   445
"/                ((l == #bottom) or:[l == #bottomSpace
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   446
"/                or:[l == #bottomFit or:[l == #bottomSpaceFit]]]) ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   447
"/                    ypos := restHeight - (space * (numChilds - 1)).
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   448
"/"/
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   449
"/"/                    bw == 0 ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   450
"/"/                        ypos := ypos + space 
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   451
"/"/                    ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   452
"/"/           
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   453
"/                    (l == #bottomSpace
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   454
"/                    or:[l == #bottomSpaceFit]) ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   455
"/                        ypos >= space ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   456
"/                            ypos := ypos - space
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   457
"/                        ]
3518
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   458
"/                    ].
4564
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   459
"/                    ypos := ypos - margin.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   460
"/
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   461
"/                    ypos < 0 ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   462
"/                        space := space min:(restHeight // (numChilds + 1)).
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   463
"/                        ypos := restHeight - (space * numChilds).
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   464
"/                    ]
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   465
"/                ] ifFalse: [
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   466
"/                    (l == #spread) ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   467
"/                        space := (restHeight - m2) // (numChilds - 1).
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   468
"/                        ypos := margin.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   469
"/                        (space == 0) ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   470
"/                            ypos := restHeight // 2
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   471
"/                        ]
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   472
"/                    ] ifFalse: [
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   473
"/                      (l == #spreadSpace) ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   474
"/                        space := (restHeight - m2) // (numChilds + 1).
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   475
"/                        ypos := space + margin.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   476
"/                        (space == 0) ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   477
"/                            ypos := restHeight // 2
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   478
"/                        ]
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   479
"/                      ] ifFalse: [
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   480
"/                        ((l == #top) or:[l == #topSpace
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   481
"/                        or:[l == #topFit or:[l == #topSpaceFit]]]) ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   482
"/                            space := space min:(restHeight - m2) // (numChilds + 1).
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   483
"/                            (vL == #fixTop or:[vL == #fixTopSpace]) ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   484
"/                                space := space max:verticalSpace.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   485
"/                            ] ifFalse:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   486
"/                                space := space max:0.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   487
"/                            ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   488
"/                            (l == #topSpace or:[l == #topSpaceFit]) ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   489
"/                                ypos := space + margin.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   490
"/                            ] ifFalse:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   491
"/                                "/
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   492
"/                                "/ if the very first view has a 0-level AND
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   493
"/                                "/ my level is non-zero, begin with margin
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   494
"/                                "/
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   495
"/                                true "(margin ~~ 0 and:[subViews first level == 0])" ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   496
"/                                    ypos := margin
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   497
"/                                ] ifFalse:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   498
"/                                    ypos := 0
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   499
"/                                ]
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   500
"/                            ]
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   501
"/                        ] ifFalse:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   502
"/                            "center"
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   503
"/                            ypos := (restHeight - ((numChilds - 1) * space)) // 2.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   504
"/                            ypos < 0 ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   505
"/                                space := restHeight // (numChilds + 1).
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   506
"/                                ypos := (restHeight - ((numChilds - 1) * space)) // 2.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   507
"/                            ]
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   508
"/                        ]
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   509
"/                      ]
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   510
"/                    ]
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   511
"/                ]
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   512
"/            ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   513
"/        ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   514
"/    ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   515
"/
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   516
"/    resizeToMaxH := false.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   517
"/    (hL endsWith:'Max') ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   518
"/        resizeToMaxH := true.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   519
"/        maxWidth := subViews inject:0 into:[:maxSoFar :child | maxSoFar max:child widthIncludingBorder].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   520
"/        hL := (hL copyWithoutLast:3) asSymbol.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   521
"/    ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   522
"/
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   523
"/    "
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   524
"/     now set positions
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   525
"/    "
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   526
"/    subViews keysAndValuesDo:[:index :child |
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   527
"/        |xpos advance bwChild wChild newWChild x2|
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   528
"/
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   529
"/        wChild := child widthIncludingBorder.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   530
"/        bwChild := child borderWidth.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   531
"/
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   532
"/        elementsChangeSize ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   533
"/            "to avoid a recursion when we change the elements size"
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   534
"/            child removeDependent:self.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   535
"/        ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   536
"/        resizeToMaxH ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   537
"/            child width:(wChild := maxWidth - (bwChild  * 2)).
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   538
"/        ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   539
"/
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   540
"/        hL == #left ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   541
"/            xpos := 0 - bw + margin.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   542
"/        ] ifFalse:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   543
"/            hL == #leftSpace ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   544
"/                xpos := horizontalSpace + margin
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   545
"/            ] ifFalse:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   546
"/                hL == #right ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   547
"/                    xpos := width - wChild - margin
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   548
"/                ] ifFalse:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   549
"/                    hL == #rightSpace ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   550
"/                        xpos := width - horizontalSpace - wChild - margin.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   551
"/                    ] ifFalse:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   552
"/                        hL == #fitSpace ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   553
"/                            xpos := horizontalSpace + margin.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   554
"/                            newWChild := width - m2 - ((horizontalSpace + bwChild) * 2)
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   555
"/                        ] ifFalse:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   556
"/                            hL == #fit ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   557
"/                                newWChild := width "- (bwChild * 2)".
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   558
"/                                bw == 0 ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   559
"/                                    newWChild :=  newWChild - (bwChild * 2)
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   560
"/                                ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   561
"/                                true "child level == 0" ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   562
"/                                    xpos := margin - bw.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   563
"/                                    newWChild := newWChild - m2
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   564
"/                                ] ifFalse:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   565
"/                                    xpos := 0 - bw. 
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   566
"/                                ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   567
"/                            ] ifFalse:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   568
"/                                "centered"
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   569
"/                                 xpos := margin + ((width - m2 - wChild) // 2).
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   570
"/                            ]
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   571
"/                        ]
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   572
"/                    ]
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   573
"/                ]
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   574
"/            ]
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   575
"/        ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   576
"/        newWChild notNil ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   577
"/            child width:newWChild
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   578
"/        ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   579
"/
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   580
"/"/        (xpos < 0) ifTrue:[ xpos := 0 ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   581
"/
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   582
"/        x2 := xpos + child width - 1.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   583
"/
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   584
"/        (vL == #fit 
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   585
"/        or:[vL == #fitSpace
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   586
"/        or:[resizeToMaxV]]) ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   587
"/            child origin:(xpos @ (ypos rounded))
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   588
"/                  corner:(x2 @ (ypos + hEach - bwChild - 1) rounded).
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   589
"/            advance := hEach
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   590
"/        ] ifFalse:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   591
"/            child origin:(xpos@ypos).
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   592
"/            advance := child heightIncludingBorder
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   593
"/        ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   594
"/
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   595
"/        index == numChilds ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   596
"/            |y|
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   597
"/
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   598
"/            (vL == #topFit or:[vL == #topSpaceFit]) ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   599
"/                y := height - margin - 1.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   600
"/                vL == #topSpaceFit ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   601
"/                    y := y - space
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   602
"/                ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   603
"/                child corner:x2 @ y
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   604
"/            ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   605
"/        ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   606
"/        index == 1 ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   607
"/            (vL == #bottomFit or:[vL == #bottomSpaceFit]) ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   608
"/                ypos := margin + 0 + (child borderWidth * 2) - bw.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   609
"/                vL == #bottomSpaceFit ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   610
"/                    ypos := ypos + space
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   611
"/                ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   612
"/                advance := restHeight.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   613
"/                child origin:((child origin x) @ ypos)
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   614
"/                      corner:((child corner x) @ (ypos+advance))
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   615
"/            ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   616
"/        ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   617
"/
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   618
"/        ypos := ypos + advance + space.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   619
"/        elementsChangeSize ifTrue:[
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   620
"/            "reinstall dependency that we removed above"
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   621
"/            child addDependent:self.
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   622
"/        ].
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   623
"/    ]
3518
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   624
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   625
    "Modified: / 04-09-1995 / 18:43:29 / claus"
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   626
    "Modified: / 10-10-2007 / 13:47:56 / cg"
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   627
! !
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   628
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   629
!MultiColumnPanelView methodsFor:'queries'!
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   630
6487
debe1f7cce35 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4564
diff changeset
   631
computePreferredExtent
3518
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   632
    "return a good extent, one that makes subviews fit"
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   633
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   634
    |maxHeight maxWidth maxWidthPerCol w m2 subViews col numCols rowsPerCol|
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   635
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   636
    subViews := self subViewsToConsider.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   637
    (subViews size == 0) ifTrue:[
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   638
        ^ super preferredExtent.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   639
    ].
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   640
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   641
    "compute net height needed"
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   642
    numCols := columnWidths size.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   643
    rowsPerCol := Array new:numCols withAll:0.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   644
    maxWidthPerCol := Array new:numCols withAll:0.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   645
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   646
    maxHeight := 0.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   647
    col := 1.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   648
    subViews do:[:child |
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   649
        |childsPreference|
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   650
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   651
        childsPreference := child preferredExtent.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   652
        maxHeight := maxHeight max:childsPreference y.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   653
        maxWidthPerCol at:col put:((maxWidthPerCol at:col) max:childsPreference y).
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   654
        rowsPerCol at:col put:(rowsPerCol at:col)+1.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   655
        col := col + 1.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   656
        col > numCols ifTrue:[ col := 1 ].
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   657
    ].
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   658
4019
bf57f58f13a8 no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents: 3760
diff changeset
   659
    self borderWidth ~~ 0 ifTrue:[
3518
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   660
        maxWidth := maxWidth + (horizontalSpace * 2).
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   661
    ].
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   662
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   663
"/    sumOfHeights := sumOfHeights + ((subViews size - 1) * verticalSpace).
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   664
"/    ((vLayout == #topSpace) or:[vLayout == #bottomSpace]) ifTrue:[
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   665
"/        sumOfHeights := sumOfHeights + verticalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   666
"/    ] ifFalse:[
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   667
"/        ((vLayout == #center) or:[vLayout == #spread]) ifTrue:[
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   668
"/            sumOfHeights := sumOfHeights + (verticalSpace * 2)
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   669
"/        ]
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   670
"/    ].
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   671
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   672
"/    ((hLayout == #leftSpace) or:[hLayout == #rightSpace]) ifTrue:[
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   673
"/        maxWidth := maxWidth + horizontalSpace
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   674
"/    ] ifFalse:[
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   675
"/        ((hLayout == #fitSpace) or:[hLayout == #center]) ifTrue:[
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   676
"/            maxWidth := maxWidth + (horizontalSpace * 2)
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   677
"/        ]        
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   678
"/    ].
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   679
    m2 := margin * 2.
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   680
"/    ^ (maxWidth + m2) @ (sumOfHeights + m2)
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   681
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   682
    w := maxWidthPerCol inject:0 into:[:sumSoFar :thisWidth | sumSoFar + thisWidth].
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   683
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   684
    ^ (w+m2) @ (rowsPerCol max * maxHeight) + m2
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   685
6487
debe1f7cce35 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4564
diff changeset
   686
    "Created: / 09-11-2018 / 19:57:46 / Claus Gittinger"
3518
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   687
! !
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   688
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   689
!MultiColumnPanelView class methodsFor:'documentation'!
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   690
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   691
version
6487
debe1f7cce35 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4564
diff changeset
   692
    ^ '$Header$'
4019
bf57f58f13a8 no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents: 3760
diff changeset
   693
!
bf57f58f13a8 no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents: 3760
diff changeset
   694
bf57f58f13a8 no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents: 3760
diff changeset
   695
version_CVS
6487
debe1f7cce35 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4564
diff changeset
   696
    ^ '$Header$'
3518
61cde5384831 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   697
! !
4564
0a0d41148e11 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4019
diff changeset
   698