1975
|
1 |
"{ Package: 'stx:libview2' }"
|
|
2 |
|
|
3 |
View subclass:#TransparentBox
|
2003
|
4 |
instanceVariableNames:'shapeForm'
|
1975
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'Views-Basic'
|
|
8 |
!
|
|
9 |
|
2003
|
10 |
!TransparentBox class methodsFor:'documentation'!
|
|
11 |
|
|
12 |
examples
|
|
13 |
"
|
|
14 |
| tv b1 b2 |
|
|
15 |
|
2004
|
16 |
b1 := Button label:'close'.
|
|
17 |
b1 action:[ tv close ].
|
2003
|
18 |
b1 origin:10@10.
|
|
19 |
|
|
20 |
b2 := Button label:'hello'.
|
|
21 |
b2 origin:100@100.
|
|
22 |
|
|
23 |
tv := self new.
|
|
24 |
tv extent:200@200.
|
|
25 |
|
|
26 |
tv addSubView:b1.
|
|
27 |
tv addSubView:b2.
|
|
28 |
tv open
|
|
29 |
"
|
|
30 |
! !
|
1975
|
31 |
|
|
32 |
!TransparentBox methodsFor:'events'!
|
|
33 |
|
|
34 |
sizeChanged:how
|
2003
|
35 |
shapeForm notNil ifTrue:[
|
|
36 |
self computeShape.
|
|
37 |
].
|
|
38 |
^ super sizeChanged: how.
|
1975
|
39 |
! !
|
|
40 |
|
|
41 |
!TransparentBox methodsFor:'initialization'!
|
|
42 |
|
2003
|
43 |
realize
|
1975
|
44 |
self computeShape.
|
2003
|
45 |
super realize.
|
1975
|
46 |
! !
|
|
47 |
|
|
48 |
!TransparentBox methodsFor:'queries'!
|
|
49 |
|
|
50 |
isTransparentBox
|
|
51 |
|
|
52 |
^true
|
|
53 |
!
|
|
54 |
|
|
55 |
specClass
|
|
56 |
^ TransparentBoxSpec
|
2003
|
57 |
!
|
|
58 |
|
|
59 |
windowStyle
|
|
60 |
^ #undecorated
|
1975
|
61 |
! !
|
|
62 |
|
|
63 |
!TransparentBox methodsFor:'shape computation'!
|
|
64 |
|
2003
|
65 |
addSubView:aView
|
|
66 |
super addSubView:aView.
|
|
67 |
shapeForm notNil ifTrue:[
|
|
68 |
self computeShape
|
|
69 |
].
|
|
70 |
!
|
|
71 |
|
1975
|
72 |
computeShape
|
2003
|
73 |
| subViews w h |
|
1975
|
74 |
|
|
75 |
device supportsArbitraryShapedViews ifFalse:[^self].
|
|
76 |
|
|
77 |
w := self extent x.
|
|
78 |
h := self extent y.
|
2003
|
79 |
shapeForm := Form width:w height:h.
|
|
80 |
shapeForm fill:(Color colorId:0).
|
1975
|
81 |
|
2003
|
82 |
shapeForm foreground:(Color colorId:1).
|
1975
|
83 |
|
|
84 |
subViews := self subViews.
|
|
85 |
subViews isEmptyOrNil ifTrue:[
|
2003
|
86 |
self fillFormWithBorderShape:shapeForm.
|
1975
|
87 |
] ifFalse:[
|
|
88 |
subViews do:[:aSubView|
|
2003
|
89 |
aSubView fillFormWithBorderShape:shapeForm.
|
1975
|
90 |
]
|
|
91 |
].
|
2003
|
92 |
"/ self viewShape:shapeForm.
|
|
93 |
self borderShape:shapeForm.
|
1975
|
94 |
! !
|
|
95 |
|
|
96 |
!TransparentBox class methodsFor:'documentation'!
|
|
97 |
|
|
98 |
version
|
2004
|
99 |
^ '$Header: /cvs/stx/stx/libview2/TransparentBox.st,v 1.3 2004-07-16 14:41:50 cg Exp $'
|
1975
|
100 |
! !
|