author | ca |
Wed, 28 Nov 2007 15:07:15 +0100 | |
changeset 3286 | 91e2e2399b81 |
parent 2659 | 3af857eb52fb |
child 3574 | b841099afab3 |
permissions | -rw-r--r-- |
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 |
" |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
1280
diff
changeset
|
12 |
"{ Package: 'stx:libwidg2' }" |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
1280
diff
changeset
|
13 |
|
56 | 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 |
|
316
f6214d6f484d
redraw if orientation changes
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
157 |
orientation := aSymbol. |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
1280
diff
changeset
|
158 |
self invalidate |
316
f6214d6f484d
redraw if orientation changes
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
159 |
|
f6214d6f484d
redraw if orientation changes
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
160 |
"Modified: 28.2.1997 / 21:24:38 / cg" |
56 | 161 |
! ! |
162 |
||
163 |
!Separator methodsFor:'drawing'! |
|
164 |
||
3286 | 165 |
redrawX:x y:y width:w height:h |
166 |
|vCenter hCenter is3D bgColor| |
|
167 |
||
168 |
(shown and:[superView notNil]) ifFalse:[^ self]. |
|
169 |
||
170 |
bgColor := superView viewBackground. |
|
56 | 171 |
|
3286 | 172 |
bgColor isColor ifTrue:[ |
173 |
self paint:(superView viewBackground). |
|
174 |
self fillRectangleX:x y:y width:w height:h. |
|
175 |
] ifFalse:[ |
|
176 |
self clearRectangleX:x y:y width:w height:h. |
|
177 |
]. |
|
62 | 178 |
is3D := styleSheet is3D. |
56 | 179 |
|
180 |
self paint:shadowColor. |
|
181 |
orientation == #vertical ifTrue:[ |
|
3286 | 182 |
hCenter := self width // 2. |
183 |
self displayLineFromX:hCenter y:0 toX:hCenter y:height-1. |
|
184 |
is3D ifTrue:[ |
|
185 |
self paint:lightColor. |
|
186 |
self displayLineFromX:hCenter+1 y:0 toX:hCenter+1 y:height-1. |
|
187 |
] |
|
56 | 188 |
] ifFalse:[ |
3286 | 189 |
vCenter := self height // 2. |
190 |
self displayLineFromX:0 y:vCenter toX:width-1 y:vCenter. |
|
191 |
is3D ifTrue:[ |
|
192 |
self paint:lightColor. |
|
193 |
self displayLineFromX:0 y:vCenter+1 toX:width-1 y:vCenter+1. |
|
194 |
] |
|
56 | 195 |
] |
864
d84a7a02f037
sizeChange must clear (try to resize ...)
Claus Gittinger <cg@exept.de>
parents:
602
diff
changeset
|
196 |
! |
d84a7a02f037
sizeChange must clear (try to resize ...)
Claus Gittinger <cg@exept.de>
parents:
602
diff
changeset
|
197 |
|
d84a7a02f037
sizeChange must clear (try to resize ...)
Claus Gittinger <cg@exept.de>
parents:
602
diff
changeset
|
198 |
sizeChanged:how |
d84a7a02f037
sizeChange must clear (try to resize ...)
Claus Gittinger <cg@exept.de>
parents:
602
diff
changeset
|
199 |
super sizeChanged:how. |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
1280
diff
changeset
|
200 |
self invalidate |
864
d84a7a02f037
sizeChange must clear (try to resize ...)
Claus Gittinger <cg@exept.de>
parents:
602
diff
changeset
|
201 |
|
d84a7a02f037
sizeChange must clear (try to resize ...)
Claus Gittinger <cg@exept.de>
parents:
602
diff
changeset
|
202 |
"Created: / 18.4.1998 / 02:36:42 / cg" |
865 | 203 |
"Modified: / 18.4.1998 / 14:10:05 / cg" |
56 | 204 |
! ! |
205 |
||
1280
8836fc202970
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
865
diff
changeset
|
206 |
!Separator methodsFor:'focus handling'! |
8836fc202970
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
865
diff
changeset
|
207 |
|
8836fc202970
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
865
diff
changeset
|
208 |
wantsFocusWithButtonPress |
8836fc202970
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
865
diff
changeset
|
209 |
"no, do not catch the keyboard focus on button click" |
8836fc202970
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
865
diff
changeset
|
210 |
|
8836fc202970
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
865
diff
changeset
|
211 |
^ false |
8836fc202970
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
865
diff
changeset
|
212 |
|
8836fc202970
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
865
diff
changeset
|
213 |
|
8836fc202970
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
865
diff
changeset
|
214 |
! ! |
8836fc202970
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
865
diff
changeset
|
215 |
|
56 | 216 |
!Separator methodsFor:'initialization'! |
217 |
||
218 |
initialize |
|
219 |
super initialize. |
|
315
eab866497e0e
orientation instVar was undefined.
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
220 |
borderWidth := 0. |
eab866497e0e
orientation instVar was undefined.
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
221 |
orientation := #horizontal. |
eab866497e0e
orientation instVar was undefined.
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
222 |
|
eab866497e0e
orientation instVar was undefined.
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
223 |
"Modified: 28.2.1997 / 21:23:02 / cg" |
56 | 224 |
! ! |
95 | 225 |
|
292 | 226 |
!Separator methodsFor:'queries'! |
227 |
||
323 | 228 |
preferredExtent |
229 |
|e| |
|
230 |
||
231 |
preferredExtent notNil ifTrue:[^ preferredExtent]. |
|
232 |
||
233 |
e := super preferredExtent. |
|
234 |
orientation == #horizontal ifTrue:[ |
|
235 |
^ e x @ 5 |
|
236 |
]. |
|
237 |
^ 5 @ e y |
|
238 |
||
239 |
"Created: 17.3.1997 / 10:37:42 / cg" |
|
240 |
! |
|
241 |
||
292 | 242 |
specClass |
602 | 243 |
"redefined, since the name of my specClass is nonStandard (i.e. not SeparatorSpec)" |
244 |
||
292 | 245 |
self class == Separator ifTrue:[^ DividerSpec]. |
300 | 246 |
^ super specClass |
292 | 247 |
|
602 | 248 |
"Modified: / 31.10.1997 / 19:48:40 / cg" |
292 | 249 |
! ! |
250 |
||
100 | 251 |
!Separator class methodsFor:'documentation'! |
252 |
||
316
f6214d6f484d
redraw if orientation changes
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
253 |
version |
3286 | 254 |
^ '$Header: /cvs/stx/stx/libwidg2/Separator.st,v 1.21 2007-11-28 14:07:15 ca Exp $' |
100 | 255 |
! ! |