LayoutOrigin.st
author Claus Gittinger <cg@exept.de>
Thu, 08 May 2014 00:08:06 +0200
changeset 3330 f7b69891827b
parent 3016 e2374dddc45f
child 3331 443356a56b2f
permissions -rw-r--r--
class: LayoutOrigin added: #= #hash
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
"
1600
ac585461747e computed rectangle is truncated here.
Claus Gittinger <cg@exept.de>
parents: 1039
diff changeset
    12
"{ Package: 'stx:libview2' }"
ac585461747e computed rectangle is truncated here.
Claus Gittinger <cg@exept.de>
parents: 1039
diff changeset
    13
77
claus
parents:
diff changeset
    14
Layout subclass:#LayoutOrigin
191
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    15
	instanceVariableNames:'leftFraction topFraction leftOffset topOffset'
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    16
	classVariableNames:''
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    17
	poolDictionaries:''
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    18
	category:'Graphics-Geometry'
77
claus
parents:
diff changeset
    19
!
claus
parents:
diff changeset
    20
88
claus
parents: 83
diff changeset
    21
!LayoutOrigin class methodsFor:'documentation'!
claus
parents: 83
diff changeset
    22
claus
parents: 83
diff changeset
    23
copyright
claus
parents: 83
diff changeset
    24
"
claus
parents: 83
diff changeset
    25
 COPYRIGHT (c) 1995 by Claus Gittinger
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    26
	      All Rights Reserved
88
claus
parents: 83
diff changeset
    27
claus
parents: 83
diff changeset
    28
 This software is furnished under a license and may be used
claus
parents: 83
diff changeset
    29
 only in accordance with the terms of that license and with the
claus
parents: 83
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
claus
parents: 83
diff changeset
    31
 be provided or otherwise made available to, or used by, any
claus
parents: 83
diff changeset
    32
 other person.  No title to or ownership of the software is
claus
parents: 83
diff changeset
    33
 hereby transferred.
claus
parents: 83
diff changeset
    34
"
claus
parents: 83
diff changeset
    35
!
claus
parents: 83
diff changeset
    36
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    37
documentation
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    38
"
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    39
    This class is provided to make porting of existing ST-80 applications
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    40
    easier. Instances can be used to control the geometry of a subview, within
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    41
    its superview. It provides the same functionality as a relative origin
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    42
    combined with insets.
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    43
    A layoutOrigin controls the origin of a subcomponent, given a fractional
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    44
    component and an offset component.
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    45
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    46
    Notice: 
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    47
        this class was implemented using protocol information
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    48
        from alpha testers - it may not be complete or compatible to
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    49
        the corresponding ST-80 class. 
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    50
        If you encounter any incompatibilities, please forward a note 
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    51
        describing the incompatibility verbal (i.e. no code) 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
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    55
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    56
    [see also:]
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    57
        View
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    58
        LayoutFrame AlignmentOrigin Layout 
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    59
        Rectangle Point
94
8888ddd11323 *** empty log message ***
claus
parents: 93
diff changeset
    60
"
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    61
!
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    62
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    63
examples
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    64
"
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    65
    Although the examples below use a button as component,
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    66
    they work of course with any type of subview ....
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    67
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    68
    using a LayoutOrigin, to arrange for
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    69
    the TOPLEFT of a component be positions
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    70
    at the center (i.e. buttons origin at:0.5 @ 0.5):
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    71
                                                                        [exBegin]
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    72
        |top button|
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    73
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    74
        top := StandardSystemView new.
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    75
        top extent:300@300.
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    76
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    77
        button := Button label:'component'.
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    78
        top add:button in:(LayoutOrigin new
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    79
                                leftFraction:0.5;
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    80
                                topFraction:0.5).
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    81
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    82
        top open
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    83
                                                                        [exEnd]
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    84
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    85
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    86
    like above, but adds an additional offset:
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    87
    (i.e. center of button at:0.5 @ 0.5 OFFSET by 10 @ 20):
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    88
                                                                        [exBegin]
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    89
        |top button|
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    90
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    91
        top := StandardSystemView new.
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    92
        top extent:300@300.
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    93
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    94
        button := Button label:'component'.
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    95
        top add:button in:(LayoutOrigin new
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    96
                                leftFraction:0.5;
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    97
                                topFraction:0.5;
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    98
                                leftOffset:10;
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    99
                                topOffset:20).
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   100
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   101
        top open
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   102
                                                                        [exEnd]
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   103
"
88
claus
parents: 83
diff changeset
   104
! !
claus
parents: 83
diff changeset
   105
77
claus
parents:
diff changeset
   106
!LayoutOrigin class methodsFor:'instance creation'!
claus
parents:
diff changeset
   107
claus
parents:
diff changeset
   108
fractionalFromPoint:aPoint
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   109
    "given a point, create a layoutOrigin representing the same 
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   110
     relative origin."
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   111
83
claus
parents: 77
diff changeset
   112
    ^ (self new) leftFraction:aPoint x topFraction:aPoint y
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   113
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   114
    "
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   115
     LayoutOrigin fractionalFromPoint:0.5@0.5
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   116
    "
77
claus
parents:
diff changeset
   117
!
claus
parents:
diff changeset
   118
claus
parents:
diff changeset
   119
fromPoint:aPoint
1821
5539214ed293 comment
Claus Gittinger <cg@exept.de>
parents: 1601
diff changeset
   120
    "return a new LayoutOrigin from aPoint.
5539214ed293 comment
Claus Gittinger <cg@exept.de>
parents: 1601
diff changeset
   121
     If the coordinates are between 0 and 1, 
5539214ed293 comment
Claus Gittinger <cg@exept.de>
parents: 1601
diff changeset
   122
     take them as fractional parts (relative to superview).
77
claus
parents:
diff changeset
   123
     Otherwise, treat them as absolute offsets."
claus
parents:
diff changeset
   124
claus
parents:
diff changeset
   125
    |x y layout|
claus
parents:
diff changeset
   126
claus
parents:
diff changeset
   127
    x := aPoint x.
claus
parents:
diff changeset
   128
    y := aPoint y.
claus
parents:
diff changeset
   129
    layout := self new.
claus
parents:
diff changeset
   130
    ((x between:0 and:1)
claus
parents:
diff changeset
   131
    and:[y between:0 and:1]) ifTrue:[
1821
5539214ed293 comment
Claus Gittinger <cg@exept.de>
parents: 1601
diff changeset
   132
        layout leftFraction:x topFraction:y
77
claus
parents:
diff changeset
   133
    ] ifFalse:[
1821
5539214ed293 comment
Claus Gittinger <cg@exept.de>
parents: 1601
diff changeset
   134
        layout leftOffset:x topOffset:y
77
claus
parents:
diff changeset
   135
    ].
claus
parents:
diff changeset
   136
    ^ layout
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   137
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   138
    "
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   139
     LayoutOrigin fromPoint:100@100
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   140
     LayoutOrigin fromPoint:0.5@0.5
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   141
     LayoutOrigin fromPoint:0.5@100
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   142
    "
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   143
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   144
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   145
offsetFromPoint:aPoint
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   146
    "given a point, create a layoutOrigin representing the same 
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   147
     absolute (pixel) origin."
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   148
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   149
    ^ self new leftOffset:aPoint x topOffset:aPoint y
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   150
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   151
    "
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   152
     LayoutOrigin offsetFromPoint:100@100
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   153
    "
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   154
! !
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   155
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   156
!LayoutOrigin methodsFor:'accessing'!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   157
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   158
leftFraction
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   159
    "return leftFraction"
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   160
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   161
    ^ leftFraction
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   162
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   163
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   164
leftFraction:something
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   165
    "set leftFraction"
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   166
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   167
    leftFraction := something.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   168
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   169
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   170
leftFraction:something offset:o
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   171
    "set leftFraction and offset"
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   172
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   173
    leftFraction := something.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   174
    leftOffset := o
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   175
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   176
543
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   177
leftFraction:lF offset:lO topFraction:tF offset:tO 
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   178
    "set leftFraction, leftOffset, topFraction and topOffset"
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   179
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   180
    leftFraction := lF. leftOffset := lO.
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   181
    topFraction := tF. topOffset := tO.
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   182
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   183
    "Created: 18.4.1997 / 20:07:15 / cg"
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   184
!
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   185
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   186
leftFraction:newLeft topFraction:newTop 
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   187
    "set leftFraction and topFraction"
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   188
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   189
    leftFraction := newLeft.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   190
    topFraction := newTop.
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
275
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   193
leftInset:pixels
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   194
    "set leftOffset for an inset at the left"
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   195
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   196
    leftOffset := pixels.
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   197
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   198
    "Created: 26.5.1996 / 17:38:55 / cg"
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   199
    "Modified: 26.5.1996 / 17:42:16 / cg"
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   200
!
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   201
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   202
leftOffset
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   203
    "return leftOffset"
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   204
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   205
    ^ leftOffset
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   206
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   207
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   208
leftOffset:something
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   209
    "set leftOffset"
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   210
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   211
    leftOffset := something.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   212
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   213
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   214
leftOffset:newLeft topOffset:newTop 
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   215
    "set leftOffset and topOffset"
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
    leftOffset := newLeft.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   218
    topOffset := newTop.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   219
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   220
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   221
topFraction
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   222
    "return topFraction"
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   223
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   224
    ^ topFraction
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   225
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   226
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   227
topFraction:something
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   228
    "set topFraction"
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   229
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   230
    topFraction := something.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   231
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   232
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   233
topFraction:something offset:o
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   234
    "set topFraction and offset"
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   235
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   236
    topFraction := something.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   237
    topOffset := o
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   238
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   239
275
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   240
topInset:pixels
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   241
    "set topOffset for an inset at the top"
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   242
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   243
    topOffset := pixels.
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   244
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   245
    "Created: 26.5.1996 / 17:39:00 / cg"
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   246
    "Modified: 26.5.1996 / 17:42:12 / cg"
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   247
!
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   248
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   249
topOffset
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   250
    "return topOffset"
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   251
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   252
    ^ topOffset
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   253
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   254
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   255
topOffset:something
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   256
    "set topOffset"
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   257
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   258
    topOffset := something.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   259
! !
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   260
3330
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   261
!LayoutOrigin methodsFor:'comparing'!
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   262
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   263
= anObject
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   264
    ^ anObject class == self
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   265
        and:[ anObject leftFraction = leftFraction
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   266
        and:[ anObject topFraction = topFraction
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   267
        and:[ anObject leftOffset = leftOffset
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   268
        and:[ anObject topOffset = topOffset ]]]]
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   269
!
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   270
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   271
hash
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   272
    ^ leftFraction hash + topFraction hash + leftOffset hash + topOffset hash
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   273
! !
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   274
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   275
!LayoutOrigin methodsFor:'converting'!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   276
543
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   277
asAlignmentOrigin
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   278
    "return an equivalent alignmentOrigin"
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   279
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   280
    ^ AlignmentOrigin new
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   281
        leftFraction:leftFraction offset:leftOffset;
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   282
        topFraction:topFraction offset:topOffset;
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   283
        leftAlignmentFraction:0 topAlignmentFraction: 0;
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   284
        yourself
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   285
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   286
    "Created: 18.4.1997 / 20:08:14 / cg"
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   287
!
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   288
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   289
fromLiteralArrayEncoding:encoding
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   290
    "read my values from an encoding.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   291
     The encoding is supposed to be of the form: 
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   292
	(#LayoutOrigin orgOffsX relOrgX orgOffsY relOrgY)
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   293
     This is the reverse operation to #literalArrayEncoding."
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   294
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   295
    leftOffset := encoding at:2.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   296
    leftFraction := encoding at:3.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   297
    topOffset := encoding at:4.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   298
    topFraction := encoding at:5.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   299
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   300
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   301
    "
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   302
      LayoutOrigin new fromLiteralArrayEncoding:#(#LayoutOrigin 70 0 2 0)
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   303
    "
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   304
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   305
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   306
literalArrayEncoding
191
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   307
    "encode myself as an array, from which a copy of the receiver
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   308
     can be reconstructed with #decodeAsLiteralArray.
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   309
     The encoding is: 
191
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   310
        (#LayoutOrigin orgOffsX relOrgX orgOffsY relOrgY)
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   311
    "
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   312
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   313
    ^ Array
2134
0ef95141831c Fix comments.
Stefan Vogel <sv@exept.de>
parents: 1821
diff changeset
   314
        with:self class name
191
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   315
        with:leftOffset
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   316
        with:leftFraction
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   317
        with:topOffset
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   318
        with:topFraction
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   319
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   320
    "
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   321
      LayoutOrigin new fromLiteralArrayEncoding:#(#LayoutOrigin 70 0 2 0)
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   322
      (LayoutOrigin new leftOffset:10; leftFraction:0.2;
191
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   323
                       topOffset:20; topFraction:0.4) literalArrayEncoding 
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   324
    "
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   325
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   326
    "Modified: 1.9.1995 / 02:43:48 / claus"
191
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   327
    "Modified: 22.4.1996 / 13:00:21 / cg"
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   328
! !
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   329
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   330
!LayoutOrigin methodsFor:'initialization'!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   331
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   332
initialize
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   333
    leftOffset := topOffset := 0.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   334
    leftFraction := topFraction := 0.
77
claus
parents:
diff changeset
   335
! !
claus
parents:
diff changeset
   336
83
claus
parents: 77
diff changeset
   337
!LayoutOrigin methodsFor:'printing & storing'!
claus
parents: 77
diff changeset
   338
3016
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   339
displayOn:aGCOrStream
700
67f1dccb8333 comments
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
   340
    "return a printed representation of the receiver for displaying"
67f1dccb8333 comments
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
   341
3016
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   342
    "/ what a kludge - Dolphin and Squeak mean: printOn: a stream;
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   343
    "/ ST/X (and some old ST80's) mean: draw-yourself on a GC.
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   344
    (aGCOrStream isStream) ifFalse:[
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   345
        ^ super displayOn:aGCOrStream
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   346
    ].
700
67f1dccb8333 comments
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
   347
3016
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   348
    aGCOrStream 
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   349
        nextPutAll:self class name;
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   350
        nextPutAll:'(l: '.
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   351
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   352
    leftFraction displayOn:aGCOrStream.
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   353
    aGCOrStream nextPut:$+. 
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   354
    leftOffset displayOn:aGCOrStream.
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   355
    aGCOrStream nextPutAll:' t: '.
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   356
    topFraction displayOn:aGCOrStream.
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   357
    aGCOrStream nextPut:$+. 
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   358
    topOffset displayOn:aGCOrStream.
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   359
    aGCOrStream nextPut:$). 
83
claus
parents: 77
diff changeset
   360
! !
claus
parents: 77
diff changeset
   361
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   362
!LayoutOrigin methodsFor:'queries'!
77
claus
parents:
diff changeset
   363
415
5d1bf4dffbf5 *** empty log message ***
ca
parents: 275
diff changeset
   364
isLayoutOrigin
5d1bf4dffbf5 *** empty log message ***
ca
parents: 275
diff changeset
   365
    "return true, if this is a layoutOrigin"
5d1bf4dffbf5 *** empty log message ***
ca
parents: 275
diff changeset
   366
5d1bf4dffbf5 *** empty log message ***
ca
parents: 275
diff changeset
   367
    ^ true
5d1bf4dffbf5 *** empty log message ***
ca
parents: 275
diff changeset
   368
5d1bf4dffbf5 *** empty log message ***
ca
parents: 275
diff changeset
   369
!
5d1bf4dffbf5 *** empty log message ***
ca
parents: 275
diff changeset
   370
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   371
origin
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   372
    ^ leftFraction asFloat @ topFraction asFloat
77
claus
parents:
diff changeset
   373
!
claus
parents:
diff changeset
   374
949
0eb888b21192 prefRect may now be a valueHolder or block
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
   375
rectangleRelativeTo:superRectangle preferred:prefRectHolder
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   376
    "compute the rectangle represented by the receiver,
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   377
     given the superViews rectangle and the views preferredExtent."
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   378
949
0eb888b21192 prefRect may now be a valueHolder or block
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
   379
    |x y prefRect|
0eb888b21192 prefRect may now be a valueHolder or block
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
   380
0eb888b21192 prefRect may now be a valueHolder or block
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
   381
    prefRect := prefRectHolder value.
77
claus
parents:
diff changeset
   382
1039
4095e7721dad fixed framedBox computation.
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   383
    x := superRectangle left.
4095e7721dad fixed framedBox computation.
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   384
    y := superRectangle top.
4095e7721dad fixed framedBox computation.
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   385
4095e7721dad fixed framedBox computation.
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   386
    leftOffset notNil ifTrue:[
4095e7721dad fixed framedBox computation.
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   387
        x := x + leftOffset value
77
claus
parents:
diff changeset
   388
    ].
1039
4095e7721dad fixed framedBox computation.
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   389
    topOffset notNil ifTrue:[
4095e7721dad fixed framedBox computation.
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   390
        y := y + topOffset value
77
claus
parents:
diff changeset
   391
    ].
claus
parents:
diff changeset
   392
    leftFraction notNil ifTrue:[
1601
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
   393
        x := x + (superRectangle width * leftFraction value)
77
claus
parents:
diff changeset
   394
    ].
claus
parents:
diff changeset
   395
    topFraction notNil ifTrue:[
1601
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
   396
        y := y + (superRectangle height * topFraction value)
77
claus
parents:
diff changeset
   397
    ].
242
5b7f59450c65 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   398
    ^ Rectangle left:x top:y extent:prefRect extent
83
claus
parents: 77
diff changeset
   399
claus
parents: 77
diff changeset
   400
    "
claus
parents: 77
diff changeset
   401
     |superRect lO|
claus
parents: 77
diff changeset
   402
claus
parents: 77
diff changeset
   403
     superRect := 0@0 corner:100@100.
claus
parents: 77
diff changeset
   404
     lO := (LayoutOrigin new).
claus
parents: 77
diff changeset
   405
     lO leftFraction:0.5;
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   406
        topFraction:0.5.
83
claus
parents: 77
diff changeset
   407
     lO rectangleRelativeTo:superRect preferred:(0@0 corner:30@30)
claus
parents: 77
diff changeset
   408
    "
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   409
1039
4095e7721dad fixed framedBox computation.
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   410
    "Modified: / 13.8.1998 / 18:39:49 / cg"
77
claus
parents:
diff changeset
   411
! !
100
claus
parents: 96
diff changeset
   412
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   413
!LayoutOrigin class methodsFor:'documentation'!
100
claus
parents: 96
diff changeset
   414
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   415
version
3330
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   416
    ^ '$Header: /cvs/stx/stx/libview2/LayoutOrigin.st,v 1.26 2014-05-07 22:08:06 cg Exp $'
100
claus
parents: 96
diff changeset
   417
! !
3330
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   418