56
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
62
|
3 |
All Rights Reserved
|
56
|
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 |
|
|
13 |
|
|
14 |
SimpleView subclass:#Separator
|
157
|
15 |
instanceVariableNames:'orientation'
|
|
16 |
classVariableNames:''
|
|
17 |
poolDictionaries:''
|
|
18 |
category:'Views-Layout'
|
56
|
19 |
!
|
|
20 |
|
|
21 |
!Separator class methodsFor:'documentation'!
|
|
22 |
|
71
|
23 |
copyright
|
|
24 |
"
|
|
25 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
26 |
All Rights Reserved
|
|
27 |
|
|
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 |
|
95
|
38 |
documentation
|
|
39 |
"
|
|
40 |
a simple widget for a separating line.
|
|
41 |
To be placed between groups of other widgets.
|
|
42 |
|
|
43 |
See examples.
|
|
44 |
|
157
|
45 |
[See also:]
|
|
46 |
FramedBox VariableVerticalPanel VariableHorizontalPanel
|
|
47 |
|
|
48 |
[author:]
|
|
49 |
Claus Gittinger
|
95
|
50 |
"
|
|
51 |
!
|
|
52 |
|
56
|
53 |
examples
|
|
54 |
"
|
|
55 |
a separator between two button-panels:
|
160
|
56 |
[exBegin]
|
56
|
57 |
|top p1 p2 sep|
|
|
58 |
|
|
59 |
top := StandardSystemView new.
|
|
60 |
top extent:300@300.
|
|
61 |
|
|
62 |
p1 := VerticalPanelView origin:0.0@0.0 corner:1.0@0.5 in:top.
|
|
63 |
p1 bottomInset:5; borderWidth:0.
|
|
64 |
p2 := VerticalPanelView origin:0.0@0.5 corner:1.0@1.0 in:top.
|
|
65 |
p2 topInset:5; borderWidth:0.
|
|
66 |
|
|
67 |
(Button label:'one' in:p1) width:0.2.
|
|
68 |
(Button label:'two' in:p1) width:0.2.
|
|
69 |
(Button label:'three' in:p1) width:0.2.
|
|
70 |
|
|
71 |
sep := Separator in:top.
|
|
72 |
sep orientation:#horizontal.
|
|
73 |
sep origin:0.0@0.5 extent:1.0@10.
|
|
74 |
sep topInset:-5; bottomInset:-5.
|
|
75 |
|
|
76 |
(Button label:'four' in:p2) width:0.2.
|
|
77 |
(Button label:'five' in:p2) width:0.2.
|
|
78 |
(Button label:'six' in:p2) width:0.2.
|
|
79 |
|
|
80 |
top open
|
160
|
81 |
[exEnd]
|
56
|
82 |
|
|
83 |
|
|
84 |
vertical:
|
160
|
85 |
[exBegin]
|
56
|
86 |
|top p1 p2 sep|
|
|
87 |
|
|
88 |
top := StandardSystemView new.
|
|
89 |
top extent:300@300.
|
|
90 |
|
|
91 |
p1 := VerticalPanelView origin:0.0@0.0 corner:0.5@1.0 in:top.
|
|
92 |
p1 rightInset:5; borderWidth:0.
|
|
93 |
p2 := VerticalPanelView origin:0.5@0.0 corner:1.0@1.0 in:top.
|
|
94 |
p2 leftInset:5; borderWidth:0.
|
|
95 |
|
|
96 |
(Button label:'one' in:p1) width:0.4.
|
|
97 |
(Button label:'two' in:p1) width:0.4.
|
|
98 |
(Button label:'three' in:p1) width:0.4.
|
|
99 |
|
|
100 |
sep := Separator in:top.
|
|
101 |
sep orientation:#vertical.
|
|
102 |
sep origin:0.5@0.0 extent:10@1.0.
|
|
103 |
sep leftInset:-5; rightInset:-5.
|
|
104 |
|
|
105 |
(Button label:'four' in:p2) width:0.4.
|
|
106 |
(Button label:'five' in:p2) width:0.4.
|
|
107 |
(Button label:'six' in:p2) width:0.4.
|
|
108 |
|
|
109 |
top open
|
160
|
110 |
[exEnd]
|
56
|
111 |
|
|
112 |
|
|
113 |
with multiple horizontal seps in a panel:
|
160
|
114 |
[exBegin]
|
56
|
115 |
|top p sep|
|
|
116 |
|
|
117 |
top := StandardSystemView new.
|
|
118 |
top extent:300@300.
|
|
119 |
|
|
120 |
p := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
|
|
121 |
p verticalLayout:#spreadSpace.
|
|
122 |
p horizontalLayout:#center.
|
|
123 |
|
|
124 |
(Button label:'one' in:p).
|
|
125 |
(Button label:'two' in:p).
|
|
126 |
(Button label:'three' in:p).
|
|
127 |
|
|
128 |
sep := Separator in:p.
|
|
129 |
sep orientation:#horizontal.
|
|
130 |
sep extent:0.9@10.
|
|
131 |
|
|
132 |
(Button label:'four' in:p).
|
|
133 |
(Button label:'five' in:p).
|
|
134 |
|
|
135 |
sep := Separator in:p.
|
|
136 |
sep orientation:#horizontal.
|
|
137 |
sep extent:0.9@10.
|
|
138 |
|
|
139 |
(Button label:'six' in:p).
|
|
140 |
|
|
141 |
top open
|
160
|
142 |
[exEnd]
|
56
|
143 |
"
|
95
|
144 |
! !
|
|
145 |
|
|
146 |
!Separator methodsFor:'accessing'!
|
|
147 |
|
|
148 |
orientation
|
|
149 |
"return the orientation (one of #horizontal or #vertical)"
|
|
150 |
|
|
151 |
^ orientation
|
56
|
152 |
!
|
|
153 |
|
95
|
154 |
orientation:aSymbol
|
|
155 |
"set the orientation to one of #horizontal or #vertical"
|
62
|
156 |
|
95
|
157 |
orientation := aSymbol
|
56
|
158 |
! !
|
|
159 |
|
|
160 |
!Separator methodsFor:'drawing'!
|
|
161 |
|
|
162 |
redraw
|
|
163 |
|vCenter hCenter is3D|
|
|
164 |
|
|
165 |
self clear.
|
62
|
166 |
is3D := styleSheet is3D.
|
56
|
167 |
|
|
168 |
self paint:shadowColor.
|
|
169 |
orientation == #vertical ifTrue:[
|
68
|
170 |
hCenter := self width // 2.
|
62
|
171 |
self displayLineFromX:hCenter y:0 toX:hCenter y:height-1.
|
|
172 |
is3D ifTrue:[
|
|
173 |
self paint:lightColor.
|
|
174 |
self displayLineFromX:hCenter+1 y:0 toX:hCenter+1 y:height-1.
|
|
175 |
]
|
56
|
176 |
] ifFalse:[
|
68
|
177 |
vCenter := self height // 2.
|
62
|
178 |
self displayLineFromX:0 y:vCenter toX:width-1 y:vCenter.
|
|
179 |
is3D ifTrue:[
|
|
180 |
self paint:lightColor.
|
|
181 |
self displayLineFromX:0 y:vCenter+1 toX:width-1 y:vCenter+1.
|
|
182 |
]
|
56
|
183 |
]
|
|
184 |
! !
|
|
185 |
|
|
186 |
!Separator methodsFor:'initialization'!
|
|
187 |
|
|
188 |
initialize
|
|
189 |
super initialize.
|
|
190 |
borderWidth := 0
|
|
191 |
! !
|
95
|
192 |
|
292
|
193 |
!Separator methodsFor:'queries'!
|
|
194 |
|
|
195 |
specClass
|
|
196 |
self class == Separator ifTrue:[^ DividerSpec].
|
|
197 |
^ nil
|
|
198 |
|
|
199 |
|
|
200 |
! !
|
|
201 |
|
100
|
202 |
!Separator class methodsFor:'documentation'!
|
|
203 |
|
|
204 |
version
|
292
|
205 |
^ '$Header: /cvs/stx/stx/libwidg2/Separator.st,v 1.11 1997-02-14 01:54:27 ca Exp $'
|
100
|
206 |
! !
|