88
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
77
|
13 |
'From Smalltalk/X, Version:2.10.5 on 15-apr-1995 at 12:14:46 pm'!
|
|
14 |
|
|
15 |
LayoutOrigin subclass:#LayoutFrame
|
|
16 |
instanceVariableNames:'rightFraction bottomFraction
|
|
17 |
rightOffset bottomOffset'
|
|
18 |
classVariableNames:''
|
|
19 |
poolDictionaries:''
|
83
|
20 |
category:'Graphics-Geometry'
|
77
|
21 |
!
|
|
22 |
|
88
|
23 |
!LayoutFrame class methodsFor:'documentation'!
|
|
24 |
|
|
25 |
copyright
|
|
26 |
"
|
|
27 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
28 |
All Rights Reserved
|
|
29 |
|
|
30 |
This software is furnished under a license and may be used
|
|
31 |
only in accordance with the terms of that license and with the
|
|
32 |
inclusion of the above copyright notice. This software may not
|
|
33 |
be provided or otherwise made available to, or used by, any
|
|
34 |
other person. No title to or ownership of the software is
|
|
35 |
hereby transferred.
|
|
36 |
"
|
|
37 |
!
|
|
38 |
|
|
39 |
version
|
|
40 |
"
|
|
41 |
$Header: /cvs/stx/stx/libview2/Attic/LayoutFrm.st,v 1.3 1995-08-10 18:43:57 claus Exp $
|
|
42 |
"
|
|
43 |
! !
|
|
44 |
|
77
|
45 |
!LayoutFrame methodsFor:'accessing'!
|
|
46 |
|
|
47 |
rightFraction:something
|
|
48 |
"set rightFraction"
|
|
49 |
|
|
50 |
rightFraction := something.
|
|
51 |
!
|
|
52 |
|
|
53 |
rightFraction
|
|
54 |
"return rightFraction"
|
|
55 |
|
|
56 |
^ rightFraction
|
|
57 |
!
|
|
58 |
|
|
59 |
rightOffset:something
|
|
60 |
"set rightOffset"
|
|
61 |
|
|
62 |
rightOffset := something.
|
|
63 |
!
|
|
64 |
|
|
65 |
rightOffset
|
|
66 |
"return rightOffset"
|
|
67 |
|
|
68 |
^ rightOffset
|
|
69 |
!
|
|
70 |
|
|
71 |
rightFraction:something offset:o
|
|
72 |
"set rightFraction and offset"
|
|
73 |
|
|
74 |
rightFraction := something.
|
|
75 |
rightOffset := o
|
|
76 |
!
|
|
77 |
|
|
78 |
bottomFraction:something
|
|
79 |
"set bottomFraction"
|
|
80 |
|
|
81 |
bottomFraction := something.
|
|
82 |
!
|
|
83 |
|
|
84 |
bottomFraction
|
|
85 |
"return bottomFraction"
|
|
86 |
|
|
87 |
^ bottomFraction
|
|
88 |
!
|
|
89 |
|
|
90 |
bottomOffset:something
|
|
91 |
"set bottomOffset"
|
|
92 |
|
|
93 |
bottomOffset := something.
|
|
94 |
!
|
|
95 |
|
|
96 |
bottomOffset
|
|
97 |
"return bottomOffset"
|
|
98 |
|
|
99 |
^ bottomOffset
|
|
100 |
!
|
|
101 |
|
|
102 |
bottomFraction:something offset:o
|
|
103 |
"set bottomFraction and offset"
|
|
104 |
|
|
105 |
bottomFraction := something.
|
|
106 |
bottomOffset := o
|
|
107 |
! !
|
|
108 |
|
|
109 |
|
83
|
110 |
!LayoutFrame methodsFor:'printing & storing'!
|
|
111 |
|
|
112 |
displayString
|
|
113 |
^ (self class name) , '('
|
|
114 |
, 'l: ' , leftFraction displayString
|
|
115 |
, '+' , leftOffset displayString
|
|
116 |
, ' t: ' , topFraction displayString
|
|
117 |
, '+' , topOffset displayString
|
|
118 |
, ' r: ' , rightFraction displayString
|
|
119 |
, '+' , rightOffset displayString
|
|
120 |
, ' b: ' , bottomFraction displayString
|
|
121 |
, '+' , bottomOffset displayString
|
|
122 |
, ')'
|
|
123 |
! !
|
|
124 |
|
77
|
125 |
!LayoutFrame methodsFor:'queries'!
|
|
126 |
|
|
127 |
rectangleRelativeTo:superRectangle preferred:prefRect
|
|
128 |
|x1 y1 x2 y2|
|
|
129 |
|
|
130 |
leftOffset isNil ifTrue:[
|
|
131 |
x1 := 0
|
|
132 |
] ifFalse:[
|
|
133 |
x1 := leftOffset
|
|
134 |
].
|
|
135 |
topOffset isNil ifTrue:[
|
|
136 |
y1 := 0
|
|
137 |
] ifFalse:[
|
|
138 |
y1 := topOffset
|
|
139 |
].
|
|
140 |
rightOffset isNil ifTrue:[
|
|
141 |
x2 := 0
|
|
142 |
] ifFalse:[
|
|
143 |
x2 := rightOffset
|
|
144 |
].
|
|
145 |
bottomOffset isNil ifTrue:[
|
|
146 |
y2 := 0
|
|
147 |
] ifFalse:[
|
|
148 |
y2 := bottomOffset
|
|
149 |
].
|
|
150 |
leftFraction notNil ifTrue:[
|
83
|
151 |
x1 := x1 + (superRectangle width * leftFraction)
|
77
|
152 |
].
|
|
153 |
topFraction notNil ifTrue:[
|
83
|
154 |
y1 := y1 + (superRectangle height * topFraction)
|
77
|
155 |
].
|
|
156 |
rightFraction notNil ifTrue:[
|
83
|
157 |
x2 := x2 + (superRectangle width * rightFraction)
|
77
|
158 |
].
|
|
159 |
bottomFraction notNil ifTrue:[
|
83
|
160 |
y2 := y2 + (superRectangle height * bottomFraction)
|
77
|
161 |
].
|
|
162 |
^ Rectangle origin:x1@y1 corner:x2@y2
|
83
|
163 |
|
|
164 |
"
|
|
165 |
|superRect lF|
|
|
166 |
|
|
167 |
superRect := 0@0 corner:100@100.
|
|
168 |
lF := (LayoutFrame new).
|
|
169 |
lF leftFraction:0.25;
|
|
170 |
topFraction:0.25;
|
|
171 |
rightFraction:0.75;
|
|
172 |
bottomFraction:0.75.
|
|
173 |
lF rectangleRelativeTo:superRect preferred:(0@0 corner:30@30)
|
|
174 |
"
|
77
|
175 |
!
|
|
176 |
|
|
177 |
corner
|
|
178 |
^ rightFraction asFloat @ bottomFraction asFloat
|
|
179 |
! !
|
|
180 |
|
|
181 |
!LayoutFrame methodsFor:'initialization'!
|
|
182 |
|
|
183 |
initialize
|
|
184 |
leftOffset := rightOffset := bottomOffset := topOffset := 0.
|
|
185 |
leftFraction := topFraction := 0.
|
|
186 |
bottomFraction := rightFraction := 1.
|
|
187 |
! !
|