TransparentBox.st
changeset 1975 3901166c295e
child 2003 196bdcaf1859
equal deleted inserted replaced
1974:025c3119062b 1975:3901166c295e
       
     1 'From Smalltalk/X, Version:5.2.2 on 07-04-2004 at 04:07:23 PM'                  !
       
     2 
       
     3 "{ Package: 'stx:libview2' }"
       
     4 
       
     5 View subclass:#TransparentBox
       
     6 	instanceVariableNames:''
       
     7 	classVariableNames:''
       
     8 	poolDictionaries:''
       
     9 	category:'Views-Basic'
       
    10 !
       
    11 
       
    12 
       
    13 !TransparentBox methodsFor:'events'!
       
    14 
       
    15 sizeChanged:how
       
    16 
       
    17     self computeShape.
       
    18 "/    self clear;redraw.
       
    19 
       
    20     ^super sizeChanged: how.
       
    21 
       
    22 
       
    23 
       
    24 ! !
       
    25 
       
    26 !TransparentBox methodsFor:'initialization'!
       
    27 
       
    28 initialize
       
    29 
       
    30     super initialize.
       
    31     self computeShape.
       
    32     self viewBackground: Color green.
       
    33 
       
    34 
       
    35 "
       
    36 | tv |
       
    37 
       
    38 tv := TopView new.
       
    39 
       
    40 gbox := GBOX origin:0.0@0.0 corner: 1.0@1.0 in: tv.
       
    41 gbox viewBackground: Color green.
       
    42 
       
    43 tv open
       
    44 
       
    45 "
       
    46 
       
    47 
       
    48 
       
    49 
       
    50 
       
    51 ! !
       
    52 
       
    53 !TransparentBox methodsFor:'queries'!
       
    54 
       
    55 isTransparentBox
       
    56 
       
    57     ^true
       
    58 !
       
    59 
       
    60 specClass
       
    61     ^ TransparentBoxSpec
       
    62 ! !
       
    63 
       
    64 !TransparentBox methodsFor:'shape computation'!
       
    65 
       
    66 computeShape
       
    67     | borderForm subViews w h |
       
    68 
       
    69     device supportsArbitraryShapedViews ifFalse:[^self].
       
    70 
       
    71     w := self extent x.
       
    72     h := self extent y.
       
    73     borderForm := Form width:w height:h.
       
    74     borderForm fill:(Color colorId:0).
       
    75 
       
    76     borderForm foreground:(Color colorId:1).
       
    77 
       
    78     subViews := self subViews.
       
    79     subViews isEmptyOrNil ifTrue:[
       
    80        self fillFormWithBorderShape:borderForm.
       
    81     ] ifFalse:[
       
    82         subViews do:[:aSubView|
       
    83             aSubView fillFormWithBorderShape:borderForm.
       
    84         ]
       
    85     ].
       
    86     self borderShape:borderForm.
       
    87 ! !
       
    88 
       
    89 !TransparentBox class methodsFor:'documentation'!
       
    90 
       
    91 version
       
    92     ^ '$Header: /cvs/stx/stx/libview2/TransparentBox.st,v 1.1 2004-04-07 14:07:50 cg Exp $'
       
    93 ! !