author | Claus Gittinger <cg@exept.de> |
Thu, 09 Dec 1999 23:50:49 +0100 | |
changeset 2080 | 620d5ac7dee5 |
parent 1992 | 6d6b16f9d55e |
child 2203 | 1550851c94f6 |
permissions | -rw-r--r-- |
0 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1991 by Claus Gittinger |
59 | 3 |
All Rights Reserved |
0 | 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 |
||
118 | 13 |
SimpleView subclass:#FramedBox |
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
14 |
instanceVariableNames:'label labelPosition fgColor showFrame frame3D horizontalSpace |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
15 |
verticalSpace innerHorizontalSpace innerVerticalSpace' |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
16 |
classVariableNames:'' |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
17 |
poolDictionaries:'' |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
18 |
category:'Views-Layout' |
0 | 19 |
! |
20 |
||
914
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
21 |
!FramedBox class methodsFor:'documentation'! |
38 | 22 |
|
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 1991 by Claus Gittinger |
|
59 | 26 |
All Rights Reserved |
0 | 27 |
|
38 | 28 |
This software is furnished under a license and may be used |
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! |
|
36 |
||
37 |
documentation |
|
38 |
" |
|
39 |
a frame around something. The frame may have a label, whose position |
|
133 | 40 |
is controlled by the labelPosition variable, a symbol which may be one of: |
38 | 41 |
[#topCenter #topLeft #topRight #bottomLeft #bottomCenter #bottomRight] |
42 |
||
133 | 43 |
The default labelPosition is controlled by the styleSheet variable: |
44 |
'framedBoxLabelPosition' (usually, #topCenter). |
|
45 |
||
38 | 46 |
Its also possible, to not show the frame but only the label, by setting |
47 |
showFrame to false. |
|
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
48 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
49 |
The distance from the outer viewBorder to the frame is controlled by |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
50 |
horizontalSpace / verticalSpace. The default is the fonts height. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
51 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
52 |
The distance from the frame to the interior area is controlled by |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
53 |
innerHorizontalSpace / innerVerticalSpace. The default is 0. |
585 | 54 |
|
55 |
[author:] |
|
56 |
Claus Gittinger |
|
685 | 57 |
|
58 |
[see also:] |
|
59 |
PanelView Separator |
|
38 | 60 |
" |
0 | 61 |
! |
62 |
||
125 | 63 |
examples |
64 |
" |
|
65 |
simple: |
|
593 | 66 |
[exBegin] |
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
67 |
|top frame1 frame2 frame3| |
125 | 68 |
|
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
69 |
top := StandardSystemView new. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
70 |
top extent:300@200. |
125 | 71 |
|
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
72 |
frame1 := FramedBox origin:0.0@0.0 corner:0.5@0.5 in:top. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
73 |
frame1 label:'frame1'. |
3 | 74 |
|
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
75 |
frame2 := FramedBox origin:0.5@0.0 corner:1.0@0.5 in:top. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
76 |
frame2 label:'frame2'. |
125 | 77 |
|
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
78 |
frame3 := FramedBox origin:0.0@0.5 corner:1.0@1.0 in:top. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
79 |
frame3 label:'frame3'. |
0 | 80 |
|
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
81 |
top open |
593 | 82 |
[exEnd] |
125 | 83 |
|
84 |
||
1019
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
85 |
non-string label: |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
86 |
[exBegin] |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
87 |
|top frame| |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
88 |
|
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
89 |
top := StandardSystemView new. |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
90 |
top extent:300@200. |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
91 |
|
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
92 |
frame := FramedBox origin:0.0@0.0 corner:1.0@1.0 in:top. |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
93 |
frame label:(Image fromFile:'bitmaps/SBrowser.xbm'). |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
94 |
|
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
95 |
top open |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
96 |
[exEnd] |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
97 |
|
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
98 |
|
125 | 99 |
placing something inside: |
593 | 100 |
[exBegin] |
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
101 |
|top frame1 frame2 frame3 v1 v2 v3| |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
102 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
103 |
top := StandardSystemView new. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
104 |
top extent:300@200. |
3 | 105 |
|
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
106 |
frame1 := FramedBox origin:0.0@0.0 corner:0.5@0.5 in:top. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
107 |
frame1 label:'frame1'. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
108 |
v1 := View origin:0.0@0.0 corner:1.0@1.0 in:frame1. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
109 |
v1 viewBackground:(Color yellow); |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
110 |
level:1. |
125 | 111 |
|
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
112 |
frame2 := FramedBox origin:0.5@0.0 corner:1.0@0.5 in:top. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
113 |
frame2 label:'frame2'. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
114 |
v2 := View origin:0.0@0.0 corner:1.0@1.0 in:frame2. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
115 |
v2 viewBackground:(Color red); |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
116 |
level:1. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
117 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
118 |
frame3 := FramedBox origin:0.0@0.5 corner:1.0@1.0 in:top. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
119 |
frame3 label:'frame3'. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
120 |
v3 := View origin:0.0@0.0 corner:1.0@1.0 in:frame3. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
121 |
v3 viewBackground:(Color green); |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
122 |
level:1. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
123 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
124 |
top open |
593 | 125 |
[exEnd] |
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
126 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
127 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
128 |
placing something inside a frame in a dialog: |
593 | 129 |
[exBegin] |
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
130 |
|box panel frame1 frame2 frame3 v1 v1b v2 v3| |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
131 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
132 |
box := Dialog new. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
133 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
134 |
frame1 := FramedBox label:'frame1'. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
135 |
panel := HorizontalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame1. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
136 |
v1 := View extent:100@100 in:panel. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
137 |
v1 viewBackground:(Color red); |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
138 |
level:1. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
139 |
v1b := View extent:100@100 in:panel. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
140 |
v1b viewBackground:(Color yellow); |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
141 |
level:1. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
142 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
143 |
box addComponent:frame1. |
0 | 144 |
|
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
145 |
frame2 := FramedBox label:'frame2'. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
146 |
v2 := View origin:0.0@0.0 corner:1.0@1.0 in:frame2. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
147 |
v2 viewBackground:(Color green); |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
148 |
level:1. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
149 |
box addComponent:frame2. |
0 | 150 |
|
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
151 |
frame3 := FramedBox label:'frame3'. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
152 |
v3 := View origin:0.0@0.0 corner:1.0@1.0 in:frame3. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
153 |
v3 viewBackground:(Color blue); |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
154 |
level:1. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
155 |
box addComponent:frame3. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
156 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
157 |
box addOkButton. |
593 | 158 |
box stickAtBottomWithVariableHeight:frame3. |
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
159 |
box open |
593 | 160 |
[exEnd] |
125 | 161 |
|
0 | 162 |
|
125 | 163 |
placing something inside a frame in a dialog: |
593 | 164 |
[exBegin] |
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
165 |
|box panel frame1 frame2 frame3 v1 v1b v2 v3| |
125 | 166 |
|
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
167 |
box := Dialog new. |
0 | 168 |
|
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
169 |
frame1 := FramedBox label:'frame1'. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
170 |
panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame1. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
171 |
v1 := View extent:100@100 in:panel. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
172 |
v1 viewBackground:(Color red); |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
173 |
level:1. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
174 |
v1b := View extent:100@100 in:panel. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
175 |
v1b viewBackground:(Color yellow); |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
176 |
level:1. |
125 | 177 |
|
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
178 |
box addComponent:frame1. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
179 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
180 |
frame2 := FramedBox label:'frame2'. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
181 |
v2 := View origin:0.0@0.0 corner:1.0@1.0 in:frame2. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
182 |
v2 viewBackground:(Color green); |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
183 |
level:1. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
184 |
box addComponent:frame2. |
0 | 185 |
|
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
186 |
frame3 := FramedBox label:'frame3'. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
187 |
v3 := View origin:0.0@0.0 corner:1.0@1.0 in:frame3. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
188 |
v3 viewBackground:(Color blue); |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
189 |
level:1. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
190 |
box addComponent:frame3. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
191 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
192 |
box addOkButton. |
593 | 193 |
box stickAtBottomWithVariableHeight:frame3. |
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
194 |
box open |
593 | 195 |
[exEnd] |
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
196 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
197 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
198 |
simple again, default spacings: |
593 | 199 |
[exBegin] |
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
200 |
|top frame v| |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
201 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
202 |
top := StandardSystemView new. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
203 |
top extent:300@200. |
125 | 204 |
|
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
205 |
frame := FramedBox origin:0.0@0.0 corner:0.5@0.5 in:top. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
206 |
frame label:'frame'. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
207 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
208 |
v := View origin:0.0@0.0 corner:1.0@1.0 in:frame. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
209 |
v viewBackground:(Color yellow); level:1. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
210 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
211 |
top open |
593 | 212 |
[exEnd] |
125 | 213 |
|
214 |
||
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
215 |
changing spacings: |
593 | 216 |
[exBegin] |
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
217 |
|top frame v| |
0 | 218 |
|
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
219 |
top := StandardSystemView new. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
220 |
top extent:300@200. |
125 | 221 |
|
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
222 |
frame := FramedBox origin:0.0@0.0 corner:0.5@0.5 in:top. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
223 |
frame label:'frame'. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
224 |
frame horizontalSpace:30. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
225 |
frame verticalSpace:20. |
125 | 226 |
|
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
227 |
v := View origin:0.0@0.0 corner:1.0@1.0 in:frame. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
228 |
v viewBackground:(Color yellow); level:1. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
229 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
230 |
top open |
593 | 231 |
[exEnd] |
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
232 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
233 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
234 |
changing inner spacings: |
593 | 235 |
[exBegin] |
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
236 |
|top frame v| |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
237 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
238 |
top := StandardSystemView new. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
239 |
top extent:300@200. |
125 | 240 |
|
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
241 |
frame := FramedBox origin:0.0@0.0 corner:0.5@0.5 in:top. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
242 |
frame label:'frame'. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
243 |
frame innerHorizontalSpace:30. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
244 |
frame innerVerticalSpace:20. |
0 | 245 |
|
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
246 |
v := View origin:0.0@0.0 corner:1.0@1.0 in:frame. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
247 |
v viewBackground:(Color yellow); level:1. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
248 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
249 |
top open |
593 | 250 |
[exEnd] |
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
251 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
252 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
253 |
label only (no frame around): |
593 | 254 |
[exBegin] |
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
255 |
|top frame v| |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
256 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
257 |
top := StandardSystemView new. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
258 |
top extent:300@200. |
0 | 259 |
|
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
260 |
frame := FramedBox origin:0.0@0.0 corner:0.5@0.5 in:top. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
261 |
frame label:'frame'. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
262 |
frame showFrame:false. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
263 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
264 |
v := View origin:0.0@0.0 corner:1.0@1.0 in:frame. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
265 |
v viewBackground:(Color yellow); level:1. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
266 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
267 |
top open |
593 | 268 |
[exEnd] |
125 | 269 |
" |
195 | 270 |
! ! |
271 |
||
272 |
!FramedBox methodsFor:'accessing'! |
|
273 |
||
274 |
font:aFont |
|
664 | 275 |
"set the frame labelstrings font. |
276 |
CAVEAT: with the addition of Text objects, |
|
277 |
this method is going to be obsoleted by a textStyle |
|
278 |
method, which allows specific control over |
|
279 |
normalFont/boldFont/italicFont parameters." |
|
195 | 280 |
|
281 |
(font ~= aFont) ifTrue:[ |
|
664 | 282 |
super font:aFont. |
993 | 283 |
shown ifTrue:[ |
284 |
self invalidate |
|
285 |
] |
|
195 | 286 |
] |
664 | 287 |
|
1555
49aee7cb2f36
label changes are redrawn immediately
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
288 |
"Modified: / 6.6.1998 / 20:05:05 / cg" |
195 | 289 |
! |
290 |
||
291 |
foregroundColor |
|
292 |
"return the frame labels foreground color" |
|
293 |
||
294 |
^ fgColor |
|
295 |
! |
|
296 |
||
297 |
foregroundColor:aColor |
|
298 |
"set the frame labels foreground color" |
|
299 |
||
300 |
aColor ~= fgColor ifTrue:[ |
|
721
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
301 |
fgColor := aColor. |
993 | 302 |
shown ifTrue:[ |
1555
49aee7cb2f36
label changes are redrawn immediately
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
303 |
self invalidateRepairNow:true |
993 | 304 |
] |
195 | 305 |
] |
721
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
306 |
|
1555
49aee7cb2f36
label changes are redrawn immediately
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
307 |
"Modified: / 6.6.1998 / 19:23:14 / cg" |
195 | 308 |
! |
309 |
||
310 |
frameShown |
|
311 |
"return true, if frame is shown; |
|
312 |
if false, oly the label is shown. |
|
313 |
OBSOLETE; use #showFrame." |
|
314 |
||
315 |
^ showFrame |
|
316 |
! |
|
317 |
||
318 |
horizontalSpace |
|
319 |
"return the number of pixels by which the frame is inset horizontally. |
|
320 |
The default, nil, lets the box compute the horizontal inset from the |
|
321 |
labels font height." |
|
322 |
||
323 |
^ horizontalSpace |
|
324 |
||
325 |
"Modified: 5.9.1995 / 17:24:21 / claus" |
|
326 |
! |
|
327 |
||
328 |
horizontalSpace:aNumber |
|
329 |
"set the number of pixels by which the frame is inset horizontally. |
|
330 |
The default, nil, lets the box compute the horizontal inset from the |
|
331 |
labels font height." |
|
332 |
||
333 |
horizontalSpace := aNumber |
|
334 |
! |
|
335 |
||
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
336 |
innerHorizontalSpace:aNumber |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
337 |
"set the number of pixels by which the interior is inset horizontally from the frame. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
338 |
The default is 0" |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
339 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
340 |
innerHorizontalSpace := aNumber |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
341 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
342 |
"Created: 10.1.1996 / 14:39:20 / cg" |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
343 |
! |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
344 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
345 |
innerVerticalSpace:aNumber |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
346 |
"set the number of pixels by which the interior is inset vertically from the frame. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
347 |
The default is 0" |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
348 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
349 |
innerVerticalSpace := aNumber |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
350 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
351 |
"Created: 10.1.1996 / 14:39:35 / cg" |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
352 |
! |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
353 |
|
195 | 354 |
label |
355 |
"return the frames labelstring" |
|
356 |
||
357 |
^ label |
|
358 |
! |
|
359 |
||
1019
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
360 |
label:aStringOrImage |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
361 |
"set the frames labelstring or labelImage" |
195 | 362 |
|
1019
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
363 |
(label ~= aStringOrImage) ifTrue:[ |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
364 |
(aStringOrImage isString |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
365 |
and:[aStringOrImage isEmpty]) ifTrue:[ |
721
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
366 |
label := nil |
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
367 |
] ifFalse:[ |
1019
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
368 |
label := aStringOrImage. |
721
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
369 |
]. |
993 | 370 |
shown ifTrue:[ |
1555
49aee7cb2f36
label changes are redrawn immediately
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
371 |
self invalidateRepairNow:true |
993 | 372 |
] |
195 | 373 |
] |
374 |
||
1555
49aee7cb2f36
label changes are redrawn immediately
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
375 |
"Modified: / 5.9.1995 / 17:20:05 / claus" |
49aee7cb2f36
label changes are redrawn immediately
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
376 |
"Modified: / 6.6.1998 / 19:23:17 / cg" |
195 | 377 |
! |
378 |
||
379 |
labelPosition |
|
380 |
"return the labelPosition, which is a symbol describing |
|
381 |
the labels position." |
|
382 |
||
383 |
^ labelPosition |
|
384 |
! |
|
385 |
||
386 |
labelPosition:aSymbol |
|
387 |
"define the position of the label; |
|
388 |
aSymbol may be one of: |
|
721
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
389 |
#topLeft, #topCenter, #topRight; |
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
390 |
#bottomLeft, #bottomCenter or #bottomRight" |
195 | 391 |
|
392 |
labelPosition ~~ aSymbol ifTrue:[ |
|
721
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
393 |
labelPosition := aSymbol. |
993 | 394 |
shown ifTrue:[ |
395 |
self invalidate |
|
396 |
] |
|
195 | 397 |
] |
721
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
398 |
|
1555
49aee7cb2f36
label changes are redrawn immediately
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
399 |
"Modified: / 6.6.1998 / 20:04:22 / cg" |
195 | 400 |
! |
401 |
||
402 |
layout:something |
|
403 |
"OBSOLETE compatibility interface. Will vanish. |
|
404 |
In the meantime, try to figure out what is meant ... a kludge" |
|
405 |
||
406 |
something isLayout ifTrue:[^ super layout:something]. |
|
407 |
||
408 |
self obsoleteMethodWarning:'use #labelPosition:'. |
|
409 |
^ self labelPosition:something |
|
410 |
||
411 |
"Modified: 31.8.1995 / 23:07:00 / claus" |
|
412 |
! |
|
413 |
||
1019
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
414 |
setLabel:anImage |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
415 |
"set the frames label. |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
416 |
same as #label: for ST-80 GroupBox compatibility" |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
417 |
|
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
418 |
^ self label:anImage |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
419 |
|
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
420 |
"Created: 17.2.1997 / 11:03:04 / cg" |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
421 |
"Modified: 17.2.1997 / 11:03:24 / cg" |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
422 |
! |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
423 |
|
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
424 |
setLabelString:anImage |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
425 |
"set the frames label. |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
426 |
same as #label: for ST-80 GroupBox compatibility" |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
427 |
|
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
428 |
^ self label:anImage |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
429 |
|
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
430 |
"Modified: 17.2.1997 / 11:03:19 / cg" |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
431 |
! |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
432 |
|
195 | 433 |
showFrame |
434 |
"return if the view shows its frame. |
|
435 |
If false, only the label is drawn" |
|
436 |
||
437 |
^ showFrame |
|
438 |
||
439 |
"Modified: 5.9.1995 / 17:21:37 / claus" |
|
440 |
! |
|
441 |
||
442 |
showFrame:aBoolean |
|
443 |
"turn on/off showing of the frame - |
|
444 |
without a frame, only the label is shown at its position" |
|
445 |
||
446 |
aBoolean ~~ showFrame ifTrue:[ |
|
721
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
447 |
showFrame := aBoolean. |
993 | 448 |
shown ifTrue:[ |
449 |
self invalidate |
|
450 |
] |
|
195 | 451 |
] |
721
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
452 |
|
1555
49aee7cb2f36
label changes are redrawn immediately
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
453 |
"Modified: / 6.6.1998 / 20:03:50 / cg" |
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
454 |
! |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
455 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
456 |
verticalSpace |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
457 |
"return the number of pixels by which the frame is inset vertically. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
458 |
The default, nil, lets the box compute the vertical inset from the |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
459 |
labels font height." |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
460 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
461 |
^ verticalSpace |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
462 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
463 |
"Modified: 5.9.1995 / 17:24:21 / claus" |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
464 |
"Created: 10.1.1996 / 14:38:21 / cg" |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
465 |
! |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
466 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
467 |
verticalSpace:aNumber |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
468 |
"set the number of pixels by which the frame is inset vertically. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
469 |
The default, nil, lets the box compute the vertical inset from the |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
470 |
labels font height." |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
471 |
|
1555
49aee7cb2f36
label changes are redrawn immediately
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
472 |
verticalSpace := aNumber. |
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
473 |
|
1555
49aee7cb2f36
label changes are redrawn immediately
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
474 |
"Created: / 10.1.1996 / 14:38:31 / cg" |
49aee7cb2f36
label changes are redrawn immediately
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
475 |
"Modified: / 6.6.1998 / 20:04:39 / cg" |
0 | 476 |
! ! |
477 |
||
478 |
!FramedBox methodsFor:'drawing'! |
|
479 |
||
480 |
drawFrame |
|
481 |
"redraw the frame" |
|
482 |
||
133 | 483 |
|halfSepX halfSepY w h| |
0 | 484 |
|
38 | 485 |
" |
486 |
if there is no label, give more real estate to the inside |
|
487 |
" |
|
488 |
label isNil ifTrue:[ |
|
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
489 |
halfSepX := halfSepY := 2 |
38 | 490 |
] ifFalse:[ |
1019
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
491 |
halfSepX := halfSepY := (label heightOn:self) // 2. |
38 | 492 |
]. |
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
493 |
|
133 | 494 |
horizontalSpace notNil ifTrue:[ |
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
495 |
halfSepX := horizontalSpace. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
496 |
]. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
497 |
verticalSpace notNil ifTrue:[ |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
498 |
halfSepY := verticalSpace. |
133 | 499 |
]. |
38 | 500 |
|
1635
095c31e9c914
fixed drawingPosition, with big margin (i.e. 3D level)
Claus Gittinger <cg@exept.de>
parents:
1555
diff
changeset
|
501 |
halfSepX := halfSepX + margin. |
095c31e9c914
fixed drawingPosition, with big margin (i.e. 3D level)
Claus Gittinger <cg@exept.de>
parents:
1555
diff
changeset
|
502 |
halfSepY := halfSepY + margin. |
095c31e9c914
fixed drawingPosition, with big margin (i.e. 3D level)
Claus Gittinger <cg@exept.de>
parents:
1555
diff
changeset
|
503 |
|
133 | 504 |
w := width - halfSepX - halfSepX. |
505 |
h := height - halfSepY - halfSepY. |
|
38 | 506 |
|
59 | 507 |
frame3D ifFalse:[ |
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
508 |
self displayRectangleX:halfSepX |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
509 |
y:halfSepY |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
510 |
width:w |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
511 |
height:h. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
512 |
^ self |
0 | 513 |
]. |
38 | 514 |
|
515 |
w := w + 1. |
|
516 |
h := h + 1. |
|
7 | 517 |
|
685 | 518 |
self paint:lightColor. |
519 |
self displayRectangleX:halfSepX |
|
520 |
y:halfSepY |
|
521 |
width:w |
|
522 |
height:h. |
|
523 |
||
0 | 524 |
self paint:shadowColor. |
133 | 525 |
self displayRectangleX:halfSepX-1 |
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
526 |
y:halfSepY-1 |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
527 |
width:w |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
528 |
height:h. |
0 | 529 |
|
1019
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
530 |
"Modified: 17.2.1997 / 11:04:34 / cg" |
0 | 531 |
! |
532 |
||
533 |
redraw |
|
534 |
"redraw the frame and name if present" |
|
535 |
||
536 |
|labelLen l x y| |
|
537 |
||
1084 | 538 |
self clear. |
539 |
||
0 | 540 |
label isNil ifTrue:[ |
914
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
541 |
labelLen := 0 |
0 | 542 |
] ifFalse:[ |
1019
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
543 |
label isString ifTrue:[ |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
544 |
l := ' ' , label , ' '. |
1992 | 545 |
font := font onDevice:device. |
1019
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
546 |
] ifFalse:[ |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
547 |
l := label |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
548 |
]. |
1084 | 549 |
labelLen := l widthOn:self |
0 | 550 |
]. |
551 |
||
38 | 552 |
showFrame ifTrue:[ |
914
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
553 |
self drawFrame. |
38 | 554 |
]. |
555 |
||
0 | 556 |
labelLen > 0 ifTrue:[ |
914
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
557 |
labelLen < width ifTrue:[ |
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
558 |
(labelPosition == #topLeft |
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
559 |
or:[labelPosition == #topCenter |
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
560 |
or:[labelPosition == #topRight]]) ifTrue:[ |
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
561 |
" |
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
562 |
label at top |
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
563 |
" |
1635
095c31e9c914
fixed drawingPosition, with big margin (i.e. 3D level)
Claus Gittinger <cg@exept.de>
parents:
1555
diff
changeset
|
564 |
y := font ascent + margin. |
914
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
565 |
] ifFalse:[ |
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
566 |
" |
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
567 |
label at bottom |
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
568 |
" |
1635
095c31e9c914
fixed drawingPosition, with big margin (i.e. 3D level)
Claus Gittinger <cg@exept.de>
parents:
1555
diff
changeset
|
569 |
y := height - margin - font descent. |
914
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
570 |
]. |
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
571 |
(labelPosition == #topLeft |
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
572 |
or:[labelPosition == #bottomLeft]) ifTrue:[ |
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
573 |
" |
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
574 |
label at left |
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
575 |
" |
1635
095c31e9c914
fixed drawingPosition, with big margin (i.e. 3D level)
Claus Gittinger <cg@exept.de>
parents:
1555
diff
changeset
|
576 |
x := font height + margin |
914
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
577 |
] ifFalse:[ |
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
578 |
(labelPosition == #topRight |
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
579 |
or:[labelPosition == #bottomRight]) ifTrue:[ |
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
580 |
" |
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
581 |
label at right |
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
582 |
" |
1635
095c31e9c914
fixed drawingPosition, with big margin (i.e. 3D level)
Claus Gittinger <cg@exept.de>
parents:
1555
diff
changeset
|
583 |
x := width - margin - labelLen - font height |
914
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
584 |
] ifFalse:[ |
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
585 |
" |
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
586 |
label at center |
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
587 |
" |
1635
095c31e9c914
fixed drawingPosition, with big margin (i.e. 3D level)
Claus Gittinger <cg@exept.de>
parents:
1555
diff
changeset
|
588 |
x := (width - margin - labelLen) // 2 |
914
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
589 |
] |
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
590 |
]. |
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
591 |
self paint:fgColor on:viewBackground. |
1019
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
592 |
label isString ifTrue:[ |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
593 |
self displayOpaqueString:l x:x y:y |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
594 |
] ifFalse:[ |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
595 |
l displayOpaqueOn:self x:x y:y - font ascent |
0d027812861e
allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
596 |
] |
914
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
597 |
] |
0 | 598 |
] |
914
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
599 |
|
1084 | 600 |
"Modified: 28.2.1997 / 21:28:09 / cg" |
0 | 601 |
! ! |
602 |
||
195 | 603 |
!FramedBox methodsFor:'event handling'! |
604 |
||
605 |
sizeChanged:how |
|
993 | 606 |
shown ifTrue:[ |
607 |
self invalidate. |
|
608 |
]. |
|
195 | 609 |
super sizeChanged:how |
721
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
610 |
|
993 | 611 |
"Modified: 8.2.1997 / 15:19:52 / cg" |
195 | 612 |
! ! |
613 |
||
614 |
!FramedBox methodsFor:'initialization'! |
|
615 |
||
944 | 616 |
fetchDeviceResources |
617 |
"fetch device colors, to avoid reallocation at redraw time" |
|
618 |
||
619 |
super fetchDeviceResources. |
|
620 |
||
1992 | 621 |
fgColor := fgColor onDevice:device. |
944 | 622 |
|
623 |
"Created: 15.2.1997 / 16:57:56 / cg" |
|
624 |
! |
|
625 |
||
195 | 626 |
initStyle |
959 | 627 |
"setup style specifics. |
628 |
The default position is top-center, except for ms-windows, where |
|
195 | 629 |
the text is positioned at top-left" |
630 |
||
1364 | 631 |
<resource: #style (#'framedBox.foregroundColor' |
632 |
#'framedBox.labelPosition' |
|
1845
84f68da8e19b
added framedBox.font attribute in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1635
diff
changeset
|
633 |
#'framedBox.font' |
1364 | 634 |
#'framedBox.3DFrame')> |
608 | 635 |
|
195 | 636 |
super initStyle. |
637 |
||
1364 | 638 |
fgColor := StyleSheet at:'framedBox.foregroundColor' default:Black. |
639 |
labelPosition := StyleSheet at:'framedBox.labelPosition' default:#topCenter. |
|
640 |
frame3D := StyleSheet at:'framedBox.3DFrame' default:true. |
|
1845
84f68da8e19b
added framedBox.font attribute in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1635
diff
changeset
|
641 |
font := StyleSheet at:'framedBox.font' default:font. |
195 | 642 |
borderWidth := 0. |
608 | 643 |
|
1364 | 644 |
"Modified: / 26.10.1997 / 17:00:57 / cg" |
195 | 645 |
! |
646 |
||
647 |
initialize |
|
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
648 |
innerHorizontalSpace := innerVerticalSpace := 0. |
195 | 649 |
super initialize. |
650 |
showFrame := true |
|
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
651 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
652 |
"Modified: 10.1.1996 / 14:38:40 / cg" |
195 | 653 |
! ! |
654 |
||
125 | 655 |
!FramedBox methodsFor:'queries'! |
656 |
||
195 | 657 |
preferredExtent |
572 | 658 |
"compute the boxes preferredExtent from the components' sizes. |
659 |
Redefined to add space for the frame to the default extent" |
|
195 | 660 |
|
661 |
|m2 sep| |
|
662 |
||
797 | 663 |
"/ If I have an explicit preferredExtent .. |
664 |
||
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
685
diff
changeset
|
665 |
preferredExtent notNil ifTrue:[ |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
685
diff
changeset
|
666 |
^ preferredExtent |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
685
diff
changeset
|
667 |
]. |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
685
diff
changeset
|
668 |
|
914
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
669 |
sep := font heightOn:device. |
195 | 670 |
m2 := sep + sep. |
671 |
||
672 |
showFrame ifFalse:[ |
|
572 | 673 |
^ super preferredExtent + (0 @ m2) |
195 | 674 |
]. |
675 |
^ super preferredExtent+(m2 @ m2) |
|
572 | 676 |
|
914
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
677 |
"Modified: 3.1.1997 / 22:02:56 / cg" |
195 | 678 |
! |
679 |
||
125 | 680 |
viewRectangle |
681 |
"return the inside area |
|
682 |
- redefined to save frame from relative computations." |
|
683 |
||
685 | 684 |
|mH mV sepH sepV imH imV lw| |
125 | 685 |
|
914
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
686 |
sepH := sepV := font heightOn:device. |
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
687 |
horizontalSpace notNil ifTrue:[ |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
688 |
sepH := horizontalSpace |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
689 |
]. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
690 |
verticalSpace notNil ifTrue:[ |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
691 |
sepV := verticalSpace |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
692 |
]. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
693 |
|
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
694 |
mH := sepH * 2. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
695 |
mV := sepV * 2. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
696 |
imH := innerHorizontalSpace * 2. |
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
697 |
imV := innerVerticalSpace * 2. |
125 | 698 |
|
699 |
showFrame ifFalse:[ |
|
685 | 700 |
sepH := mH := lw := 0. |
701 |
] ifTrue:[ |
|
702 |
lw := 2. |
|
125 | 703 |
]. |
685 | 704 |
|
705 |
^ ((sepH + innerHorizontalSpace + lw) @ (innerVerticalSpace + sepV + lw)) |
|
706 |
extent:((width - imH - mH - lw - lw) @ (height - imV - mV - lw - lw)) |
|
125 | 707 |
|
708 |
"/ |m2 sepH sepV| |
|
709 |
"/ |
|
710 |
"/ sepV := font height. |
|
711 |
"/ |
|
712 |
"/ showFrame ifFalse:[ |
|
713 |
"/ ^ (0 @ sepV) extent:(width @ (height - sepV - sepV)) |
|
714 |
"/ ]. |
|
715 |
"/ sepH := sepV // 2. |
|
716 |
"/ ^ (sepH @ sepH) extent:((width - sepH - sepH) @ (height - sepV - sepV)) |
|
277
243d138cf316
more frame layout control added
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
717 |
|
914
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
718 |
"Modified: 3.1.1997 / 22:03:08 / cg" |
125 | 719 |
! ! |
720 |
||
914
c2435be998ba
care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
721 |
!FramedBox class methodsFor:'documentation'! |
205 | 722 |
|
723 |
version |
|
1992 | 724 |
^ '$Header: /cvs/stx/stx/libwidg/FramedBox.st,v 1.40 1999-08-18 14:48:53 cg Exp $' |
205 | 725 |
! ! |