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