LayoutFrame.st
author Claus Gittinger <cg@exept.de>
Thu, 25 Apr 1996 18:21:10 +0200
changeset 219 106b86ca81da
parent 191 cb2815b77100
child 229 612861ef768a
permissions -rw-r--r--
documentation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
88
claus
parents: 83
diff changeset
     1
"
claus
parents: 83
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
     3
	      All Rights Reserved
88
claus
parents: 83
diff changeset
     4
claus
parents: 83
diff changeset
     5
 This software is furnished under a license and may be used
claus
parents: 83
diff changeset
     6
 only in accordance with the terms of that license and with the
claus
parents: 83
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
claus
parents: 83
diff changeset
     8
 be provided or otherwise made available to, or used by, any
claus
parents: 83
diff changeset
     9
 other person.  No title to or ownership of the software is
claus
parents: 83
diff changeset
    10
 hereby transferred.
claus
parents: 83
diff changeset
    11
"
claus
parents: 83
diff changeset
    12
77
claus
parents:
diff changeset
    13
LayoutOrigin subclass:#LayoutFrame
191
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    14
	instanceVariableNames:'rightFraction bottomFraction rightOffset bottomOffset'
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    15
	classVariableNames:''
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    16
	poolDictionaries:''
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    17
	category:'Graphics-Geometry'
77
claus
parents:
diff changeset
    18
!
claus
parents:
diff changeset
    19
88
claus
parents: 83
diff changeset
    20
!LayoutFrame class methodsFor:'documentation'!
claus
parents: 83
diff changeset
    21
claus
parents: 83
diff changeset
    22
copyright
claus
parents: 83
diff changeset
    23
"
claus
parents: 83
diff changeset
    24
 COPYRIGHT (c) 1995 by Claus Gittinger
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    25
	      All Rights Reserved
88
claus
parents: 83
diff changeset
    26
claus
parents: 83
diff changeset
    27
 This software is furnished under a license and may be used
claus
parents: 83
diff changeset
    28
 only in accordance with the terms of that license and with the
claus
parents: 83
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
claus
parents: 83
diff changeset
    30
 be provided or otherwise made available to, or used by, any
claus
parents: 83
diff changeset
    31
 other person.  No title to or ownership of the software is
claus
parents: 83
diff changeset
    32
 hereby transferred.
claus
parents: 83
diff changeset
    33
"
claus
parents: 83
diff changeset
    34
!
claus
parents: 83
diff changeset
    35
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    36
documentation
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    37
"
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    38
    This class is provided to make porting of existing ST-80 applications
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    39
    easier. Instances can be used to control the geometry of a subview, within
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    40
    its superview. Like a layoutOrigin, it controls the origin of a component
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    41
    by given fraction and offset dimensions; in addition, the bottom-right
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    42
    corner is also controlled by corresponding values. Therefore, the components
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    43
    preferredExtent is ignored.
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    44
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    45
    See also:
219
106b86ca81da documentation
Claus Gittinger <cg@exept.de>
parents: 191
diff changeset
    46
        LayoutOrigin AlignmentOrigin Layout
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    47
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    48
    Notice: this class was implemented using protocol information
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    49
    from alpha testers - it may not be complete or compatible to
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    50
    the corresponding ST-80 class. If you encounter any incompatibilities,
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    51
    please forward a note to the ST/X team.
219
106b86ca81da documentation
Claus Gittinger <cg@exept.de>
parents: 191
diff changeset
    52
106b86ca81da documentation
Claus Gittinger <cg@exept.de>
parents: 191
diff changeset
    53
    [author:]
106b86ca81da documentation
Claus Gittinger <cg@exept.de>
parents: 191
diff changeset
    54
        Claus Gittinger
94
8888ddd11323 *** empty log message ***
claus
parents: 93
diff changeset
    55
"
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    56
!
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    57
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    58
examples
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    59
"
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    60
	|top button|
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    61
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    62
	top := StandardSystemView new.
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    63
	top extent:300@300.
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    64
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    65
	button := Button label:'component'.
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    66
	top add:button in:(LayoutFrame new
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    67
				leftFraction:0.25;
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    68
				topFraction:0.25;
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    69
				rightFraction:0.75;
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    70
				bottomFraction:0.75).
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    71
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    72
	top open
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    73
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    74
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    75
    like above, but adds additional offset to the origin:
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    76
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    77
	|top button|
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    78
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    79
	top := StandardSystemView new.
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    80
	top extent:300@300.
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    81
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    82
	button := Button label:'component'.
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    83
	top add:button in:(LayoutFrame new
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    84
				leftFraction:0.25; leftOffset:10;
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    85
				topFraction:0.25;  topOffset:-20;
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    86
				rightFraction:0.75;
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    87
				bottomFraction:0.75).
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    88
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    89
	top open
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    90
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    91
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    92
    like above, with offsets on all edges, actually simulating
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    93
    a constant inset on all four edges:
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    94
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    95
	|top button|
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    96
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    97
	top := StandardSystemView new.
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    98
	top extent:300@300.
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    99
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   100
	button := Button label:'component'.
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   101
	top add:button in:(LayoutFrame new
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   102
				leftFraction:0.0; leftOffset:10;
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   103
				topFraction:0.0;  topOffset:10;
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   104
				rightFraction:1.0; rightOffset:-10;
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   105
				bottomFraction:1.0; bottomOffset:-10).
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   106
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   107
	top open
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   108
"
88
claus
parents: 83
diff changeset
   109
! !
claus
parents: 83
diff changeset
   110
77
claus
parents:
diff changeset
   111
!LayoutFrame methodsFor:'accessing'!
claus
parents:
diff changeset
   112
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   113
bottomFraction
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   114
    "return bottomFraction"
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   115
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   116
    ^ bottomFraction
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   117
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   118
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   119
bottomFraction:something
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   120
    "set bottomFraction"
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   121
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   122
    bottomFraction := something.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   123
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   124
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   125
bottomFraction:something offset:o
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   126
    "set bottomFraction and offset"
77
claus
parents:
diff changeset
   127
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   128
    bottomFraction := something.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   129
    bottomOffset := o
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   130
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   131
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   132
bottomOffset
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   133
    "return bottomOffset"
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   134
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   135
    ^ bottomOffset
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   136
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   137
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   138
bottomOffset:something
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   139
    "set bottomOffset"
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   140
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   141
    bottomOffset := something.
77
claus
parents:
diff changeset
   142
!
claus
parents:
diff changeset
   143
claus
parents:
diff changeset
   144
rightFraction
claus
parents:
diff changeset
   145
    "return rightFraction"
claus
parents:
diff changeset
   146
claus
parents:
diff changeset
   147
    ^ rightFraction
claus
parents:
diff changeset
   148
!
claus
parents:
diff changeset
   149
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   150
rightFraction:something
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   151
    "set rightFraction"
77
claus
parents:
diff changeset
   152
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   153
    rightFraction := something.
77
claus
parents:
diff changeset
   154
!
claus
parents:
diff changeset
   155
claus
parents:
diff changeset
   156
rightFraction:something offset:o
claus
parents:
diff changeset
   157
    "set rightFraction and offset"
claus
parents:
diff changeset
   158
claus
parents:
diff changeset
   159
    rightFraction := something.
claus
parents:
diff changeset
   160
    rightOffset := o
claus
parents:
diff changeset
   161
!
claus
parents:
diff changeset
   162
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   163
rightOffset
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   164
    "return rightOffset"
77
claus
parents:
diff changeset
   165
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   166
    ^ rightOffset
77
claus
parents:
diff changeset
   167
!
claus
parents:
diff changeset
   168
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   169
rightOffset:something
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   170
    "set rightOffset"
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   171
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   172
    rightOffset := something.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   173
! !
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   174
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   175
!LayoutFrame methodsFor:'converting'!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   176
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   177
fromLiteralArrayEncoding:encoding
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   178
    "read my values from an encoding.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   179
     The encoding is supposed to be of the form: 
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   180
	(LayoutFrame orgOffsX relOrgX orgOffsY relOrgY cornOffsX relCornX cornOffsY relCornY)
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   181
     This is the reverse to literalArrayEncoding."
77
claus
parents:
diff changeset
   182
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   183
    leftOffset := encoding at:2.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   184
    leftFraction := encoding at:3.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   185
    topOffset := encoding at:4.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   186
    topFraction := encoding at:5.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   187
    rightOffset := encoding at:6.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   188
    rightFraction := encoding at:7.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   189
    bottomOffset := encoding at:8.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   190
    bottomFraction := encoding at:9.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   191
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   192
    "
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   193
      LayoutFrame new fromLiteralArrayEncoding:#(#LayoutFrame 70 0 2 0 0 1 25 0 )
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   194
      #(#LayoutFrame 70 0 2 0 0 1 25 0 ) decodeAsLiteralArray 
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   195
    "
77
claus
parents:
diff changeset
   196
!
claus
parents:
diff changeset
   197
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   198
literalArrayEncoding
191
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   199
    "encode myself as an array, from which a copy of the receiver
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   200
     can be reconstructed with #decodeAsLiteralArray.
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   201
     The encoding is: 
191
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   202
        (#LayoutOrigin orgOffsX relOrgX orgOffsY relOrgY cornOffsX relCornX cornOffsY relCornY)"
77
claus
parents:
diff changeset
   203
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   204
    ^ super literalArrayEncoding
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   205
      , (Array
191
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   206
            with:rightOffset
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   207
            with:rightFraction
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   208
            with:bottomOffset
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   209
            with:bottomFraction)
77
claus
parents:
diff changeset
   210
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   211
    "Modified: 1.9.1995 / 02:43:35 / claus"
191
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   212
    "Modified: 22.4.1996 / 13:00:17 / cg"
77
claus
parents:
diff changeset
   213
! !
claus
parents:
diff changeset
   214
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   215
!LayoutFrame methodsFor:'initialization'!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   216
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   217
initialize
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   218
    leftOffset := rightOffset := bottomOffset := topOffset := 0.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   219
    leftFraction := topFraction := 0.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   220
    bottomFraction := rightFraction := 1.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   221
! !
77
claus
parents:
diff changeset
   222
83
claus
parents: 77
diff changeset
   223
!LayoutFrame methodsFor:'printing & storing'!
claus
parents: 77
diff changeset
   224
claus
parents: 77
diff changeset
   225
displayString
claus
parents: 77
diff changeset
   226
    ^ (self class name) , '(' 
claus
parents: 77
diff changeset
   227
	, 'l: ' , leftFraction displayString
claus
parents: 77
diff changeset
   228
	, '+' , leftOffset displayString
claus
parents: 77
diff changeset
   229
	, ' t: ' , topFraction displayString
claus
parents: 77
diff changeset
   230
	, '+' , topOffset displayString
claus
parents: 77
diff changeset
   231
	, ' r: ' , rightFraction displayString
claus
parents: 77
diff changeset
   232
	, '+' , rightOffset displayString
claus
parents: 77
diff changeset
   233
	, ' b: ' , bottomFraction displayString
claus
parents: 77
diff changeset
   234
	, '+' , bottomOffset displayString
claus
parents: 77
diff changeset
   235
	, ')'
claus
parents: 77
diff changeset
   236
! !
claus
parents: 77
diff changeset
   237
77
claus
parents:
diff changeset
   238
!LayoutFrame methodsFor:'queries'!
claus
parents:
diff changeset
   239
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   240
corner
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   241
    ^ rightFraction asFloat @ bottomFraction asFloat
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   242
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   243
77
claus
parents:
diff changeset
   244
rectangleRelativeTo:superRectangle preferred:prefRect
claus
parents:
diff changeset
   245
    |x1 y1 x2 y2|
claus
parents:
diff changeset
   246
claus
parents:
diff changeset
   247
    leftOffset isNil ifTrue:[
claus
parents:
diff changeset
   248
	x1 := 0
claus
parents:
diff changeset
   249
    ] ifFalse:[
claus
parents:
diff changeset
   250
	x1 := leftOffset
claus
parents:
diff changeset
   251
    ].
claus
parents:
diff changeset
   252
    topOffset isNil ifTrue:[
claus
parents:
diff changeset
   253
	y1 := 0
claus
parents:
diff changeset
   254
    ] ifFalse:[
claus
parents:
diff changeset
   255
	y1 := topOffset
claus
parents:
diff changeset
   256
    ].
claus
parents:
diff changeset
   257
    rightOffset isNil ifTrue:[
claus
parents:
diff changeset
   258
	x2 := 0
claus
parents:
diff changeset
   259
    ] ifFalse:[
claus
parents:
diff changeset
   260
	x2 := rightOffset
claus
parents:
diff changeset
   261
    ].
claus
parents:
diff changeset
   262
    bottomOffset isNil ifTrue:[
claus
parents:
diff changeset
   263
	y2 := 0
claus
parents:
diff changeset
   264
    ] ifFalse:[
claus
parents:
diff changeset
   265
	y2 := bottomOffset
claus
parents:
diff changeset
   266
    ].
claus
parents:
diff changeset
   267
    leftFraction notNil ifTrue:[
83
claus
parents: 77
diff changeset
   268
	x1 := x1 + (superRectangle width * leftFraction)
77
claus
parents:
diff changeset
   269
    ].
claus
parents:
diff changeset
   270
    topFraction notNil ifTrue:[
83
claus
parents: 77
diff changeset
   271
	y1 := y1 + (superRectangle height * topFraction)
77
claus
parents:
diff changeset
   272
    ].
claus
parents:
diff changeset
   273
    rightFraction notNil ifTrue:[
83
claus
parents: 77
diff changeset
   274
	x2 := x2 + (superRectangle width * rightFraction)
77
claus
parents:
diff changeset
   275
    ].
claus
parents:
diff changeset
   276
    bottomFraction notNil ifTrue:[
83
claus
parents: 77
diff changeset
   277
	y2 := y2 + (superRectangle height * bottomFraction)
77
claus
parents:
diff changeset
   278
    ].
claus
parents:
diff changeset
   279
    ^ Rectangle origin:x1@y1 corner:x2@y2 
83
claus
parents: 77
diff changeset
   280
claus
parents: 77
diff changeset
   281
    "
claus
parents: 77
diff changeset
   282
     |superRect lF|
claus
parents: 77
diff changeset
   283
claus
parents: 77
diff changeset
   284
     superRect := 0@0 corner:100@100.
claus
parents: 77
diff changeset
   285
     lF := (LayoutFrame new).
claus
parents: 77
diff changeset
   286
     lF leftFraction:0.25;
claus
parents: 77
diff changeset
   287
	topFraction:0.25;
claus
parents: 77
diff changeset
   288
	rightFraction:0.75;
claus
parents: 77
diff changeset
   289
	bottomFraction:0.75.
claus
parents: 77
diff changeset
   290
     lF rectangleRelativeTo:superRect preferred:(0@0 corner:30@30) 
claus
parents: 77
diff changeset
   291
    "
77
claus
parents:
diff changeset
   292
! !
100
claus
parents: 96
diff changeset
   293
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   294
!LayoutFrame class methodsFor:'documentation'!
100
claus
parents: 96
diff changeset
   295
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   296
version
219
106b86ca81da documentation
Claus Gittinger <cg@exept.de>
parents: 191
diff changeset
   297
    ^ '$Header: /cvs/stx/stx/libview2/LayoutFrame.st,v 1.12 1996-04-25 16:20:26 cg Exp $'
100
claus
parents: 96
diff changeset
   298
! !